component.insert_design (a saved part as a linked component) had no button, so an assembly of separately saved parts looked impossible. It is now on the ASSEMBLE panel of every tab and in the File menu; it asks for the file, and a STEP or mesh file picked there is inserted as Insert STEP or Insert Mesh would. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4823c293dd
commit
b156b5e09c
5 files changed
+64
-3
No files matched your search
@@ -679,6 +679,21 @@ impl SolveApp {
|
||||
self.pick_open_command(id, json!({}));
|
||||
return;
|
||||
}
|
||||
if id == "component.insert_design" {
|
||||
// Another design becomes a linked component; a STEP or mesh file picked here is
|
||||
// inserted the way Insert STEP or Insert Mesh would (#1240).
|
||||
self.pick_open(|app, path| {
|
||||
let Some(path) = path else { return };
|
||||
if is_design_path(&path) {
|
||||
if app.run("component.insert_design", json!({ "path": path })).is_ok() {
|
||||
app.fit_view();
|
||||
}
|
||||
} else {
|
||||
app.insert_path_async(&path);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if matches!(id, "file.insert_step" | "file.insert_mesh") {
|
||||
self.pick_open(|app, path| {
|
||||
if let Some(path) = path {
|
||||
@@ -1419,3 +1434,10 @@ pub fn now_ms() -> f64 {
|
||||
|
||||
#[cfg(test)]
|
||||
mod picker_test_support;
|
||||
|
||||
/// A SolidCraft design file (`.solidcraft`, or a design saved as JSON), as opposed to a STEP or
|
||||
/// mesh file.
|
||||
fn is_design_path(path: &str) -> bool {
|
||||
let ext = std::path::Path::new(path).extension().and_then(|e| e.to_str()).unwrap_or("").to_ascii_lowercase();
|
||||
matches!(ext.as_str(), "solidcraft" | "solvecraft" | "json")
|
||||
}
|
||||
Reference in new issue
Block a user