Reconstruct constant-section meshes as parametric solids
This commit is contained in:
1 parent
417511367c
commit
df4c8a2994
19 files changed
+717
-12
No files matched your search
@@ -3299,6 +3299,20 @@ fn eval_feature(doc: &Document, vals: &BTreeMap<String, Value>, f: &Feature, st:
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
FeatureKind::MeshConvert { body, tolerance } => {
|
||||
let tolerance = val(vals, tolerance, Kind::Length)?;
|
||||
let index = st.bodies.iter().position(|b| &b.name == body).ok_or_else(|| DocError::Unknown(format!("body `{body}`")))?;
|
||||
let source = st.bodies.get(index).ok_or_else(|| DocError::Unknown(format!("body `{body}`")))?;
|
||||
if doc.model_body_component(source) != f.component {
|
||||
return Err(DocError::Invalid("activate the mesh body's component before converting it".into()));
|
||||
}
|
||||
let converted = kernel::convert_prismatic_mesh(&source.body, tolerance)?;
|
||||
let converted = converted.with_color(source.body.color());
|
||||
let result = ModelBody::new(source.name.clone(), converted, f.id);
|
||||
let target = st.bodies.get_mut(index).ok_or_else(|| DocError::Unknown(format!("body `{body}`")))?;
|
||||
*target = result;
|
||||
Ok(())
|
||||
}
|
||||
FeatureKind::MeshImport { meshes, .. } => {
|
||||
for (k, (name, b)) in mesh_bodies(meshes)?.into_iter().enumerate() {
|
||||
let name = copy_body_name(st, f, k, &name);
|
||||
|
||||
Reference in new issue
Block a user