Wave 350/509: Surface Extrude: a symmetric distance is the total, as for a solid extrude (and 3 more)
4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - 9008d13f3 jyviko: Surface Extrude: a symmetric distance is the total, as for a solid extrude - de5c338e7 jyviko: Preferences: keep the older per-side reading of a symmetric surface extrude - ac70662d6 jyviko: Sweeps: a path through a drawn 3D arc follows the arc, not a spline through its three points - 7664925fb jyviko: Sketch: Project onto Surface keeps the side the projection meets first, in one curve Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -1047,12 +1047,16 @@ fn edit_feature(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
resolve_feature_names(&mut v, &s.doc, cmd)?;
|
||||
let mut nf: Feature = serde_json::from_value(v.clone()).map_err(|e| bad(cmd, format!("invalid feature: {e}")))?;
|
||||
nf.id = f.id;
|
||||
if let (FeatureKind::Extrude { extent: old, .. }, FeatureKind::Extrude { extent: new, .. }) = (&f.kind, &mut nf.kind)
|
||||
// A one-sided extrude made symmetric takes the convention a new one would: its old marker
|
||||
// never read a symmetric distance.
|
||||
let maker = if matches!(f.kind, FeatureKind::SurfaceExtrude { .. }) { "surface.extrude" } else { "solid.extrude" };
|
||||
if let (FeatureKind::Extrude { extent: old, .. }, FeatureKind::Extrude { extent: new, .. })
|
||||
| (FeatureKind::SurfaceExtrude { extent: old, .. }, FeatureKind::SurfaceExtrude { extent: new, .. }) = (&f.kind, &mut nf.kind)
|
||||
&& old.direction != solidcraft_doc::Direction::Symmetric
|
||||
&& new.direction == solidcraft_doc::Direction::Symmetric
|
||||
&& set.get("extent").and_then(|e| e.get("convention")).is_none()
|
||||
{
|
||||
new.convention = solidcraft_doc::ExtrudeConvention::TotalDistance;
|
||||
new.convention = super::features::default_extrude_convention(s, maker);
|
||||
}
|
||||
if std::mem::discriminant(&nf.kind) != std::mem::discriminant(&f.kind) {
|
||||
return Err(bad(cmd, "the feature type cannot change"));
|
||||
@@ -1410,10 +1414,10 @@ fn redefine(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
&& matches!(cid, "solid.extrude" | "surface.extrude")
|
||||
&& let Some(parameters) = params.as_object_mut()
|
||||
{
|
||||
let convention = if cid == "surface.extrude" || extent.direction == solidcraft_doc::Direction::Symmetric {
|
||||
let convention = if extent.direction == solidcraft_doc::Direction::Symmetric {
|
||||
extent.convention
|
||||
} else {
|
||||
solidcraft_doc::ExtrudeConvention::TotalDistance
|
||||
super::features::default_extrude_convention(s, cid)
|
||||
};
|
||||
parameters.entry("convention").or_insert_with(|| json!(convention));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user