mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-09 11:36:06 +00:00
Prepare to re-use fj-export
This commit is contained in:
parent
7e7828d79a
commit
e722e83432
@ -1,8 +1,11 @@
|
|||||||
use std::{collections::BTreeMap, fs::File};
|
use std::{collections::BTreeMap, fs::File, path::Path};
|
||||||
|
|
||||||
use fj_interop::TriMesh;
|
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 indices_by_vertex = BTreeMap::new();
|
||||||
|
|
||||||
let mut points = Vec::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)?;
|
threemf::write(output, mesh)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -14,7 +14,7 @@ mod topology;
|
|||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let tri_mesh = model::model();
|
let tri_mesh = model::model();
|
||||||
|
|
||||||
export::export(&tri_mesh)?;
|
export::export(&tri_mesh, "output.3mf")?;
|
||||||
app::run(tri_mesh)?;
|
app::run(tri_mesh)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user