Export 3MF with B-rep face tags (#834)

3MF export carries each triangle's B-rep face tag.
This commit is contained in:
Irakli Kourtis authored and GitHub committed 2026-10-13 16:29:09 -04:00
1 parent ff7a347013
commit 5d661fa2af
10 files changed
+286 -47

No files matched your search

+15 -3
View File
@@ -428,6 +428,10 @@ fn file_menu(app: &mut SolveApp, ctx: &egui::Context) {
export(app, "3mf");
close = true;
}
if item_if(ui, "Export 3MF with Face Tags…", "", shown) {
export_as(app, "3mf", Some("3mf-tagged"));
close = true;
}
if item_if(ui, "Export OBJ…", "", shown) {
export(app, "obj");
close = true;
@@ -488,10 +492,18 @@ fn save_as_with_extension(app: &mut SolveApp, extension: &str) {
}
fn export(app: &mut SolveApp, ext: &str) {
export_as(app, ext, None);
}
/// Export to a file with extension `ext`, in `format` when the extension alone doesn't name it.
fn export_as(app: &mut SolveApp, ext: &str, format: Option<&str>) {
let name = format!("{}.{ext}", app.session.doc.name);
if let Some(p) = app.services.pick_save.as_ref().and_then(|f| f(&name, &[ext]))
&& app.run("file.export", json!({"path": p})).is_ok()
{
let Some(p) = app.services.pick_save.as_ref().and_then(|f| f(&name, &[ext])) else { return };
let params = match format {
Some(f) => json!({"path": p, "format": f}),
None => json!({"path": p}),
};
if app.run("file.export", params).is_ok() {
app.set_status(format!("Exported {p}"), false);
}
}