face.delete heal: false leaves an open surface body (#861)
Delete Face takes heal (default true, as before). With heal: false the picked faces are removed and the gap stays open, leaving the remaining faces as a surface body (kernel remove_faces); deleting every face is refused. Saved only when false, noted under format 18.
This commit is contained in:
1 parent
c616f50bd0
commit
b52d4390a0
7 files changed
+80
-5
No files matched your search
@@ -607,6 +607,10 @@ pub enum FeatureKind {
|
||||
faces: Vec<Vec3>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
body: Option<String>,
|
||||
/// Close the gap by extending the neighbouring faces (the default); `false` leaves it
|
||||
/// open, the faces left a surface body.
|
||||
#[serde(default = "yes", skip_serializing_if = "is_yes")]
|
||||
heal: bool,
|
||||
},
|
||||
/// A box around bodies, grown by a margin.
|
||||
BoundingSolid {
|
||||
@@ -1745,6 +1749,14 @@ fn all_profiles() -> ProfileSel {
|
||||
ProfileSel::All
|
||||
}
|
||||
|
||||
fn yes() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn is_yes(b: &bool) -> bool {
|
||||
*b
|
||||
}
|
||||
|
||||
fn zero_expr() -> String {
|
||||
"0".into()
|
||||
}
|
||||
|
||||
@@ -4134,7 +4134,7 @@ fn eval_feature(doc: &Document, vals: &BTreeMap<String, Value>, f: &Feature, st:
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
FeatureKind::DeleteFace { faces, body } => {
|
||||
FeatureKind::DeleteFace { faces, body, heal } => {
|
||||
let i = body_at(st, body, faces)?;
|
||||
let Some(mb) = st.bodies.get(i).cloned() else { return Err(DocError::Invalid("body".into())) };
|
||||
let mut picked: Vec<usize> = Vec::new();
|
||||
@@ -4146,7 +4146,8 @@ fn eval_feature(doc: &Document, vals: &BTreeMap<String, Value>, f: &Feature, st:
|
||||
}
|
||||
}
|
||||
let all = kernel::with_same_surface(&mb.body, &picked);
|
||||
let nb = Traced::step(kernel::delete_faces(&mb.body, &all)?, &[&mb.traced()]);
|
||||
let left = if *heal { kernel::delete_faces(&mb.body, &all)? } else { kernel::remove_faces(&mb.body, &all)? };
|
||||
let nb = Traced::step(left, &[&mb.traced()]);
|
||||
if let Some(slot) = st.bodies.get_mut(i) {
|
||||
*slot = ModelBody::traced_new(mb.name, nb, mb.feature);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,9 @@
|
||||
//! `letter_spacing` (mm), `line_spacing` (times the font's line distance), `path` (the id of a
|
||||
//! curve of the same sketch the baseline follows) and `reverse`. A text without `style` is set
|
||||
//! as it always was; 0.9.0 would drop the style and set the text plain, off its curve.
|
||||
//! Under the same version, Delete Face can leave the gap open (`heal: false` on the feature:
|
||||
//! the faces left are a surface body); a Delete Face without it heals, as it always did, and
|
||||
//! saves as before. 0.9.0 would heal a gap the design leaves open.
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
|
||||
Reference in new issue
Block a user