feat: sketches on a sheet metal face attach to its panel (#474)
A sketch on a flat face of a sheet metal body was refused ("this face has no exact planar
source"), so the only way was a plane frozen in space. When the sheet changes (a flange's
angle, the thickness), the frozen sketch stays behind: a cut from it fails on the slanted
flange or leaves a blind pocket in the thicker sheet.
`sketch.create` with a face of a sheet metal body now attaches the sketch to the panel the
face belongs to. It keeps the face's name, `sheet:<body>:<panel>:<top|bottom>` (the panel is
the base or a flange's feature tag), and takes the panel's exact plane from its flat region
and fold each time the model is evaluated, so the sketch follows the sheet through parameter
changes, unfold and refold. Its coordinates are the flat pattern's (the bottom face's y
mirrored). A face that is gone is reported as a lost attachment, never replaced by the
nearest face. The attachment follows a renamed or copied body, shows as `sheet_face` in the
command result and as its own status in Redefine Sketch Plane. `fixed: true` still freezes.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
49956c2797
commit
af0440aaab
13 files changed
+515
-13
No files matched your search
@@ -117,11 +117,13 @@ impl Document {
|
||||
}
|
||||
}
|
||||
|
||||
/// All status planes are world-space. A lost plane is a repair guide only.
|
||||
/// All status planes are world-space. A lost plane is a repair guide only. `Sheet` is a sketch on
|
||||
/// a flat face of a sheet metal body, attached by the name of its panel (`sheet::sheet_face_name`).
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum FaceAttachmentStatus {
|
||||
Fixed { plane: Option<Plane> },
|
||||
Legacy { plane: Option<Plane> },
|
||||
Sheet { plane: Option<Plane> },
|
||||
Healthy { plane: Plane, target: ConfigFaceTarget, path: Vec<u64> },
|
||||
Lost { message: String, repair_plane: Option<Plane> },
|
||||
}
|
||||
@@ -210,6 +212,13 @@ impl Document {
|
||||
self.resolve_plane(&vals, plane, 0).ok()
|
||||
});
|
||||
let current = world.and_then(|world| current.and_then(|plane| map_plane(&world, &plane).ok()));
|
||||
if crate::sheet::plane_sheet_face(plane).is_some() {
|
||||
let state = model.state_before(feature.id);
|
||||
return match crate::eval::sheet_face_plane_in_frame(self, &state, feature.component, plane) {
|
||||
Ok(_) => FaceAttachmentStatus::Sheet { plane: current },
|
||||
Err(error) => FaceAttachmentStatus::Lost { message: error.to_string(), repair_plane: current },
|
||||
};
|
||||
}
|
||||
return if has_face_reference(plane) {
|
||||
FaceAttachmentStatus::Legacy { plane: current }
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user