Extend any surface: natural, tangent and curvature, up to a target (#760) (#1166)

Extend works on any surface: natural (continuing the face's own surface), tangent (G1 run-off) or curvature (G2 run-off), by a distance, up to a plane or face, or back to the surface's bounds, with neighbouring edges lengthened to meet. Untrim and Extend share face parameter-loop helpers. The new SurfaceExtend fields are noted under format 21. Closes #760.
This commit is contained in:
Irakli Kourtis authored and GitHub committed 2026-10-14 22:46:29 -04:00
1 parent 41f0c3d0c6
commit b4edf05373
18 files changed
+2271 -263

No files matched your search

+27 -2
View File
@@ -661,8 +661,33 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K
Surf::Thicken { thickness: thickness.clone(), symmetric: *symmetric, operation: op_index(operation) },
vec![bodies.iter().map(|n| Sel::Body { name: n.clone() }).collect()],
),
FeatureKind::SurfaceExtend { edges, distance, .. } => {
(Surf::Extend { distance: distance.clone() }, vec![edges.iter().filter_map(edge).collect()])
FeatureKind::SurfaceExtend { edges, distance, mode, up_to, neighbours, .. } => {
// The dialog edits the edges and the distance; the rest is kept as it was.
let mut extra = Map::new();
if !mode.is_natural() {
extra.insert("mode".into(), json!(mode));
}
if !*neighbours {
extra.insert("neighbours".into(), json!(false));
}
match up_to {
Some(solidcraft_engine::doc::ExtendTo::Bounds) => {
extra.insert("up_to".into(), json!("bounds"));
}
Some(solidcraft_engine::doc::ExtendTo::Face(t)) => {
extra.insert("up_to".into(), json!({"body": t.body, "point": pt(t.point)}));
}
Some(solidcraft_engine::doc::ExtendTo::Plane(PlaneRef::Origin { name } | PlaneRef::Construction { name })) => {
extra.insert("up_to".into(), json!(name));
}
_ => {}
}
let k = Surf::Extend { distance: distance.clone() };
let mut ins = inputs(&k);
if let Some(inp) = ins.first_mut() {
inp.items = edges.iter().filter_map(edge).collect();
}
return Some((Kind::Surface(k), ins, extra));
}
FeatureKind::SurfaceTrim { body, plane, tool, keep } => (
Surf::Trim,