Prepare to re-use fj-export

This commit is contained in:
Hanno Braun 2025-03-21 23:14:43 +01:00
parent 7e7828d79a
commit e722e83432
2 changed files with 7 additions and 4 deletions

View File

@ -1,8 +1,11 @@
use std::{collections::BTreeMap, fs::File};
use std::{collections::BTreeMap, fs::File, path::Path};
use fj_interop::TriMesh;
pub fn export(tri_mesh: &TriMesh) -> anyhow::Result<()> {
pub fn export(
tri_mesh: &TriMesh,
path: impl AsRef<Path>,
) -> anyhow::Result<()> {
let mut indices_by_vertex = BTreeMap::new();
let mut points = Vec::new();
@ -38,7 +41,7 @@ pub fn export(tri_mesh: &TriMesh) -> anyhow::Result<()> {
},
};
let output = File::create("output.3mf")?;
let output = File::create(path)?;
threemf::write(output, mesh)?;
Ok(())

View File

@ -14,7 +14,7 @@ mod topology;
fn main() -> anyhow::Result<()> {
let tri_mesh = model::model();
export::export(&tri_mesh)?;
export::export(&tri_mesh, "output.3mf")?;
app::run(tri_mesh)?;
Ok(())