Stand up Y-up STEP and IGES files from SolidWorks automatically (#5191)

* claim: #5150

* Stand it up: don't offer it for SolidCraft's own STEP files (#5150)

STEP replies from file.insert_step and doc.open now carry the file's
originating system, and the window skips the stand-up offer when it is
exactly SolidCraft, as SolidCraft's STEP export writes it.

* Stand up Y-up STEP and IGES files from SolidWorks automatically

The STEP header (originating system, preprocessor version, FILE_DESCRIPTION) and the IGES
global section's native system ID say which program wrote a file. A SolidWorks header means
Y up: the import's component is stood up as it opens, as one undo step, and the message offers
Undo. SolidCraft's own files are left alone; an unknown exporter keeps the offer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Ray <raykholo@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruck
2026-10-23 02:53:20 +00:00
committed by GitHub
parent 0c72ad56d2
commit edf57cec29
15 changed files with 238 additions and 16 deletions
+13 -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,
}
/// A solid the walk found, converted later.
@@ -1318,7 +1322,15 @@ 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, schema: ex.schemas.join(", "), system: ex.originating_system.clone() })
Ok(StepImport {
bodies,
tree,
warnings,
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>,
@@ -452,7 +456,13 @@ pub fn parse(text: &str) -> Result<Exchange, String> {
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();
}
_ => {}