* fix(doc): extrude and revolve in a moved component from another component's sketch A feature built from a sketch of another component read the sketch's plane as if it were in the feature's own component. When the two components are placed differently (a moved or jointed part), the tool landed transformed along with the feature's component: a join on a part turned half a turn about Z, from a root sketch, came out on the far side of the origin. Extrude and Revolve now see the sketch through both placements, as sweeps along 3D paths and sketches on another component's face already do (sketch_in_feature_frame, using profile_in_frame). The sheet-metal rotated-frames test built its cap witness from a sketch of the moved component while the root was active, relying on the old reading; it now builds the witness in the sketch's own component, which is what it measures against. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: To Object extrude in a moved component from a root sketch Co-Authored-By: Claude Opus 5.5 <[email protected]> * style: rustfmt Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0154572580
commit
968a22897c
3 files changed
+84
-2
No files matched your search
+21
-2
@@ -1986,7 +1986,11 @@ fn feature_tools_with_constructor(
|
||||
let unnamed = |bodies: Vec<Body>| -> Vec<Traced> { bodies.into_iter().map(Traced::unnamed).collect() };
|
||||
match &f.kind {
|
||||
FeatureKind::Extrude { sketch, profiles, extent, operation, targets } => {
|
||||
let ss = st.sketch(*sketch).ok_or_else(|| DocError::Unknown(format!("sketch {sketch} (it must come earlier in the timeline)")))?.clone();
|
||||
let ss = sketch_in_feature_frame(
|
||||
doc,
|
||||
st.sketch(*sketch).ok_or_else(|| DocError::Unknown(format!("sketch {sketch} (it must come earlier in the timeline)")))?,
|
||||
f.component,
|
||||
)?;
|
||||
let regions = solidcraft_sketch::merge_regions(&select_profiles(&ss, profiles)?);
|
||||
// From / To Object: where the face or point lies along the normal, measured over the
|
||||
// middle of the profiles.
|
||||
@@ -2129,7 +2133,11 @@ fn feature_tools_with_constructor(
|
||||
Ok(tools)
|
||||
}
|
||||
FeatureKind::Revolve { sketch, profiles, axis, angle, angle2, symmetric, convention, to, .. } => {
|
||||
let ss = st.sketch(*sketch).ok_or_else(|| DocError::Unknown(format!("sketch {sketch} (it must come earlier in the timeline)")))?.clone();
|
||||
let ss = sketch_in_feature_frame(
|
||||
doc,
|
||||
st.sketch(*sketch).ok_or_else(|| DocError::Unknown(format!("sketch {sketch} (it must come earlier in the timeline)")))?,
|
||||
f.component,
|
||||
)?;
|
||||
let regions = solidcraft_sketch::merge_regions(&select_profiles(&ss, profiles)?);
|
||||
let (o, d) = revolve_axis(&ss, axis)?;
|
||||
let angles = if to.is_some() {
|
||||
@@ -2420,6 +2428,17 @@ fn map_wire(wire: &mut solidcraft_sketch::Wire, matrix: &Mat) {
|
||||
}
|
||||
}
|
||||
|
||||
/// A feature's sketch as its component sees it: a sketch of another component that is placed
|
||||
/// differently is moved through both placements (as `state_in_frame` does for sketches on faces),
|
||||
/// so the tool is built where the sketch is shown. The sketch itself when they share a frame.
|
||||
fn sketch_in_feature_frame(doc: &Document, sketch: &SolvedSketch, consumer: u64) -> Result<SolvedSketch> {
|
||||
let owner = doc.feature(sketch.feature).map(|feature| feature.component).unwrap_or(0);
|
||||
if owner == consumer || doc.occurrences.is_empty() {
|
||||
return Ok(sketch.clone());
|
||||
}
|
||||
profile_in_frame(doc, sketch, consumer)
|
||||
}
|
||||
|
||||
fn profile_in_frame(doc: &Document, sketch: &SolvedSketch, consumer: u64) -> Result<SolvedSketch> {
|
||||
let owner = doc.feature(sketch.feature).map(|feature| feature.component).unwrap_or(0);
|
||||
let inverse =
|
||||
|
||||
Reference in new issue
Block a user