Extrude: a side drawn in collinear pieces is one face (#1788) (#1949)

Thanks @DuBearte.
This commit is contained in:
DuBearte authored and GitHub committed 2026-10-18 05:43:23 -04:00
1 parent 132b63d24d
commit e70bd52409
6 files changed
+137 -8

No files matched your search

+14 -3
View File
@@ -253,9 +253,20 @@ impl Document {
return self.certified_pieces(body, indices, target.origin_feature);
}
if let Some(super::FaceCertificate::ExtrudeSide { sketch, curve }) = &target.certificate {
let indices: Vec<_> = body.body.face_sources().into_iter().flatten().enumerate().filter_map(|(index, source)| {
matches!(source, Some(solidcraft_kernel::FaceSource::CertifiedExtrudeSide { producer, sketch: current_sketch, curve: current_curve, .. }) if *producer == target.origin_feature && current_sketch == sketch && current_curve == curve).then_some(index)
}).collect();
let side = |index: usize, exact: bool| matches!(body.body.face_sources().and_then(|sources| sources.get(index)), Some(Some(solidcraft_kernel::FaceSource::CertifiedExtrudeSide { producer, sketch: current_sketch, curve: current_curve, .. })) if *producer == target.origin_feature && current_sketch == sketch && (!exact || current_curve == curve));
let count = body.body.face_sources().map_or(0, |sources| sources.len());
let mut indices: Vec<_> = (0..count).filter(|index| side(*index, true)).collect();
// A side drawn in collinear pieces is one face over all of them (#1788): a certificate
// made when the pieces were faces of their own finds it by the piece's name, which
// the joined face answers to.
if indices.is_empty() {
let names = crate::naming::names(body);
indices = (0..count)
.filter(|index| {
side(*index, false) && crate::history_names::matches(&names, *index, &target.name) == Some(crate::history_names::Match::Alias)
})
.collect();
}
if indices.is_empty() {
return Err(DocError::Unknown("constructed side certificate no longer exists".into()));
}
+2 -1
View File
@@ -3079,7 +3079,8 @@ fn centered_extrude(plane: &Plane, region: &Region2, start: f64, end: f64, sketc
};
// Fit cap surfaces in their own coordinates. Fitting a distant world-space
// wire can tilt an otherwise exact planar cap through numeric cancellation.
let bodies = kernel::extrude(&Plane::XY, std::slice::from_ref(region), start, end)?;
// A side drawn in collinear pieces is one face (#1788).
let bodies = kernel::extrude_whole_sides(&Plane::XY, std::slice::from_ref(region), start, end)?;
if *plane == Plane::XY {
return Ok(bodies.into_iter().map(|body| roles.tool(body, None)).collect());
}