The guard that refuses machining through bends sewed every bend zone and nonparallel panel into one solid. Two bends meeting at an open corner relief share only an edge, so that sew failed with "nonmanifold edge contact" and any cut on the base was refused. Sew and test each piece on its own instead. Reference case 75-sm-bracket-holes now passes; its known_failure mark is removed. Fixes #296 Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7db66bb824
commit
2ebceb6918
6 files changed
+42
-13
No files matched your search
@@ -687,7 +687,7 @@ pub(super) fn sheet_cut(
|
||||
plans.push((sh.body.clone(), Some((sh, mb.body.clone()))));
|
||||
continue;
|
||||
}
|
||||
if let Some(bends) = sh.unmodeled_solid(&ss.plane)? {
|
||||
for bends in sh.unmodeled_solids(&ss.plane)? {
|
||||
for tool in tools {
|
||||
if kernel::boolean(&bends, tool, kernel::BoolOp::Intersect)?.is_some() {
|
||||
return Err(DocError::Invalid(
|
||||
|
||||
@@ -879,10 +879,13 @@ impl SheetBody {
|
||||
Ok(body)
|
||||
}
|
||||
|
||||
/// Actual curved material, used to certify unsupported folded machining before mutation.
|
||||
pub(crate) fn unmodeled_solid(&self, plane: &Plane) -> Result<Option<Body>> {
|
||||
/// Actual curved material, used to certify unsupported folded machining before mutation:
|
||||
/// one solid per bend zone or nonparallel panel. Each is sewn on its own, because the
|
||||
/// selected pieces need not form a manifold solid together (two bends meeting at an open
|
||||
/// corner relief touch only along an edge).
|
||||
pub(crate) fn unmodeled_solids(&self, plane: &Plane) -> Result<Vec<Body>> {
|
||||
if self.flat || self.flanges.is_empty() {
|
||||
return Ok(None);
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let mut work = FlatWork::new();
|
||||
let cells: Vec<_> = self
|
||||
@@ -893,10 +896,7 @@ impl SheetBody {
|
||||
Piece::Panel(pi) => apply_vector(&self.world(pi), Vec3::Z).cross(plane.normal()).len() > 1e-6,
|
||||
})
|
||||
.collect();
|
||||
if cells.is_empty() {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some(kernel::sew(&self.faces(&cells, 0.0, self.t, &mut work)?)?))
|
||||
cells.iter().map(|c| Ok(kernel::sew(&self.faces(std::slice::from_ref(c), 0.0, self.t, &mut work)?)?)).collect()
|
||||
}
|
||||
|
||||
fn through_pocket_regions(&self, work: &mut FlatWork) -> Result<Vec<Region2>> {
|
||||
|
||||
@@ -1685,3 +1685,33 @@ fn fold_at_a_tab_root_names_the_real_cause() {
|
||||
outline_blank(&mut ok, json!([[0, 0], [100, 0], [100, 50], [60, 50], [60, 70], [40, 70], [40, 50], [0, 50]]));
|
||||
run(&mut ok, "sheet.fold", json!({"points": [[40, 51, 0.8], [60, 51, 0.8]], "fixed": [50, 25, 0.8]}));
|
||||
}
|
||||
|
||||
/// #296: two bends meeting at an open corner relief touch only along an edge, so the folded
|
||||
/// material the machining guard checks must not be sewn into one solid.
|
||||
#[test]
|
||||
fn hole_beside_two_adjacent_edge_flanges_cuts_and_bends_stay_guarded() {
|
||||
let build = |s: &mut Session| {
|
||||
base(s, 80.0, 40.0);
|
||||
run(s, "sheet.flange", json!({"edges":[[40.0, 0.0, 2.5]],"height":30,"angle":90}));
|
||||
run(s, "sheet.flange", json!({"edges":[[80.0, 22.5, 2.5]],"height":15,"angle":90}));
|
||||
};
|
||||
let hole = |s: &mut Session, name: &str, centre: [f64; 2]| {
|
||||
run(s, "sketch.create", json!({"plane":"XY","name":name}));
|
||||
run(s, "sketch.circle.center", json!({"center":centre,"radius":3}));
|
||||
run(s, "sketch.finish", json!({}));
|
||||
s.execute("solid.extrude", &json!({"sketch":name,"through_all":true,"operation":"cut"}))
|
||||
};
|
||||
let mut s = Session::default();
|
||||
build(&mut s);
|
||||
let before = volume(&mut s);
|
||||
assert!((before - 14057.2).abs() < 0.1, "{before}");
|
||||
if let Err(e) = hole(&mut s, "Hole", [25.0, 20.0]) {
|
||||
panic!("hole beside two flanges: {e}");
|
||||
}
|
||||
let after = volume(&mut s);
|
||||
assert!((before - after - 9.0 * PI * 2.5).abs() < 0.05, "{before} -> {after}");
|
||||
let mut bend = Session::default();
|
||||
build(&mut bend);
|
||||
let error = hole(&mut bend, "Bend", [78.5, 20.0]).unwrap_err().to_string();
|
||||
assert!(error.contains("bend"), "{error}");
|
||||
}
|
||||
Reference in new issue
Block a user