STEP import: FILE_DESCRIPTION and the preprocessor name a Y-up exporter again

#5191 read the header's preprocessor version and FILE_DESCRIPTION, so a SolidWorks file named
only there was stood up. The reader had moved to crates/step (p21.rs) before #5191 merged,
and the merge kept only the originating system: a file naming SolidWorks in its description
got no exporter_up (step_replies_name_a_y_up_exporter). The parser reads both fields again,
StepImport carries them, and exporter_up looks at all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-28 22:10:51 -04:00
committed by Irakli Kourtis
parent ea65005597
commit f8c2fba077
3 changed files with 25 additions and 2 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ fn exporter_up(import: &solidcraft_kernel::StepImport) -> Option<(&'static str,
if import.system.trim().starts_with("SolidCraft") {
return Some(("z", "SolidCraft"));
}
let named = import.system.to_ascii_lowercase().contains("solidworks");
let named = [&import.system, &import.preprocessor, &import.description].iter().any(|h| h.to_ascii_lowercase().contains("solidworks"));
named.then_some(("y", "SolidWorks"))
}
+14 -1
View File
@@ -88,6 +88,10 @@ pub struct StepImport {
pub schema: String,
/// FILE_NAME originating system.
pub system: String,
/// FILE_NAME preprocessor version.
pub preprocessor: String,
/// FILE_DESCRIPTION text.
pub description: String,
}
/// What an import warning is about, so a window can word a summary of them (the warning's
@@ -1330,7 +1334,16 @@ impl StepReading {
return Err(KernelError::Failed(format!("STEP import: no bodies ({why})")));
}
let bodies = std::mem::take(&mut rd.bodies);
Ok(StepImport { bodies, tree, warnings, report, schema: ex.schemas.join(", "), system: ex.originating_system.clone() })
Ok(StepImport {
bodies,
tree,
warnings,
report,
schema: ex.schemas.join(", "),
system: ex.originating_system.clone(),
preprocessor: ex.preprocessor.clone(),
description: ex.description.clone(),
})
}
/// [`Self::finish`], and the import is cached for the next read of the same text.
+10
View File
@@ -122,6 +122,10 @@ pub struct Exchange {
pub schemas: Vec<String>,
/// FILE_NAME originating system.
pub originating_system: String,
/// FILE_NAME preprocessor version.
pub preprocessor: String,
/// FILE_DESCRIPTION text, its lines joined by a space.
pub description: String,
pub entities: HashMap<u64, Entity>,
/// Ids defined more than once (the first definition is kept).
pub duplicates: Vec<u64>,
@@ -441,7 +445,13 @@ pub fn parse_with(text: &str, watch: Option<&dyn Progress>) -> Result<Exchange,
ex.schemas = v.iter().filter_map(|p| p.as_str().map(str::to_string)).collect();
}
}
"FILE_DESCRIPTION" => {
if let Some(Param::List(v)) = params.first() {
ex.description = v.iter().filter_map(|p| p.as_str()).collect::<Vec<_>>().join(" ");
}
}
"FILE_NAME" => {
ex.preprocessor = params.get(4).and_then(Param::as_str).unwrap_or("").to_string();
ex.originating_system = params.get(5).and_then(Param::as_str).unwrap_or("").to_string();
}
_ => {}