Fix Export to CAM's default filename appending .stl instead of replacing the extension
tab_display_name() is the drawing's real filename including its own extension (e.g. "Drawing1.dwg") - the CamExportDialogOpen handler appended ".stl" directly onto that, producing "Drawing1.dwg.stl" instead of "Drawing1.stl". Strips the existing extension via file_stem() first.
This commit is contained in:
parent
4a61c54826
commit
768b3ee97b
1 changed files with 9 additions and 1 deletions
|
|
@ -1182,7 +1182,15 @@ impl OpenCADStudio {
|
|||
.push_error(crate::t!("STLOUT: no 3D mesh data in this drawing.").as_ref());
|
||||
return Task::none();
|
||||
}
|
||||
self.cam_export_filename = format!("{}.stl", self.tabs[i].tab_display_name());
|
||||
// tab_display_name() is the drawing's real filename including
|
||||
// its own extension (e.g. "Drawing1.dwg") - appending ".stl"
|
||||
// directly produced "Drawing1.dwg.stl" instead of replacing
|
||||
// it (CMMS bug report, 2026-08-27).
|
||||
let base = std::path::Path::new(&self.tabs[i].tab_display_name())
|
||||
.file_stem()
|
||||
.map(|s| s.to_string_lossy().into_owned())
|
||||
.unwrap_or_else(|| self.tabs[i].tab_display_name());
|
||||
self.cam_export_filename = format!("{base}.stl");
|
||||
self.active_modal = Some(crate::app::ModalKind::CamExportDialog);
|
||||
Task::none()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue