diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 1b7de0a78..6bdaf6e5b 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -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")) } diff --git a/crates/kernel/src/step_in/mod.rs b/crates/kernel/src/step_in/mod.rs index ba1d39545..8b03229ed 100644 --- a/crates/kernel/src/step_in/mod.rs +++ b/crates/kernel/src/step_in/mod.rs @@ -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. diff --git a/crates/step/src/p21.rs b/crates/step/src/p21.rs index add33a46c..fec135fec 100644 --- a/crates/step/src/p21.rs +++ b/crates/step/src/p21.rs @@ -122,6 +122,10 @@ pub struct Exchange { pub schemas: Vec, /// 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, /// Ids defined more than once (the first definition is kept). pub duplicates: Vec, @@ -441,7 +445,13 @@ pub fn parse_with(text: &str, watch: Option<&dyn Progress>) -> Result { + if let Some(Param::List(v)) = params.first() { + ex.description = v.iter().filter_map(|p| p.as_str()).collect::>().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(); } _ => {}