STEP export no longer hangs on a box with a screw hole (#1985) (#2243)

* claim: #1985

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L15TLCjpXsQdp8ovC4ZacH

* STEP export no longer hangs on a box with a screw hole (#1985)

The export reads its own STEP text back, and meshing the read-back screw
hole never finished. On a seam cylinder the boundary walk projected points
to angles up to 5e7 rad apart and moved each by two turns at most, so the
11-point loop spanned millions of turns and the polyline closing it across
the seam had 4.3 million points. Each projected parameter is now brought to
within half a period of the point before it, whatever the gap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L15TLCjpXsQdp8ovC4ZacH

* Second #1985 regression: the reporter's flanged enclosure

The issue's reporter delta-debugged a second design whose STEP export hung
on main: a flanged enclosure with two standoffs and no screw hole. It hangs
without the get_mindiff change and reads back with 29 faces and the same
volume with it. Both tests share the read-back checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L15TLCjpXsQdp8ovC4ZacH

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
This commit is contained in:
rlartot
2026-10-20 01:14:01 +02:00
committed by GitHub
parent 504d7c9488
commit ee67ed53af
5 changed files with 126 additions and 6 deletions
@@ -45,6 +45,49 @@ fn volume(s: &Session, body: &str) -> f64 {
s.model.state().body(body).map(|b| solidcraft_kernel::measure(&b.body).unwrap().volume).unwrap_or(0.0)
}
/// #1985: the STEP export of a small enclosure never finished. The export reads its own file
/// back, and meshing the screw hole's seam cylinder never ended: the boundary walk took
/// projected angles millions of turns apart. The file is written, reads back cleanly, and holds
/// the same solid.
#[test]
fn step_export_of_an_enclosure_with_a_screw_hole_finishes_and_reads_back() {
let s = replay(include_str!("../../../examples/regressions/step_export_screw_hole_enclosure.json"));
let state = s.model.state();
let body = &state.body("Unterteil").unwrap().body;
// 27 faces; the kernel splits each of the three whole turns (the hole, two standoffs) in two.
assert_eq!(body.face_count(), 30);
let (text, file_faces) = read_back(&s, body);
assert_eq!(text.matches("CYLINDRICAL_SURFACE(").count(), 7, "the seven round faces stay cylinders");
assert_eq!(file_faces, 27);
}
/// #1985, the reporter's second reproduction: the same walk on a standoff of a flanged
/// enclosure without a screw hole.
#[test]
fn step_export_of_a_flanged_enclosure_finishes_and_reads_back() {
let s = replay(include_str!("../../../examples/regressions/step_export_flanged_enclosure.json"));
let state = s.model.state();
let (_, file_faces) = read_back(&s, &state.body("Unterteil").unwrap().body);
assert_eq!(file_faces, 29);
}
/// The body's STEP text, which reads back without warnings as one closed solid of the same
/// volume and area, and the number of faces the file holds.
fn read_back(s: &Session, body: &solidcraft_kernel::Body) -> (String, usize) {
assert!(s.model.results.iter().all(|r| r.error.is_none()), "{:?}", s.model.results);
let text = solidcraft_kernel::step_export(&[body], "SolidCraft").unwrap();
let imp = solidcraft_kernel::step_import(&text).unwrap();
assert!(imp.warnings.is_empty(), "{:?}", imp.warnings);
assert_eq!(imp.bodies.len(), 1);
let back = &imp.bodies[0];
assert!(back.closed);
let (a, b) = (solidcraft_kernel::measure(body).unwrap(), solidcraft_kernel::measure(&back.body).unwrap());
assert!((a.volume - b.volume).abs() < 1e-3 * a.volume, "volume {} read back as {}", a.volume, b.volume);
assert!((a.area - b.area).abs() < 1e-3 * a.area, "area {} read back as {}", a.area, b.area);
println!("#1985 volume {:.3} / {:.3} mm³; area {:.3} / {:.3} mm²", a.volume, b.volume, a.area, b.area);
(text, back.file_faces)
}
/// #2059: tabs exactly as wide as their supporting ribs share the ribs' side
/// planes. The base's remote conical chamfer must not prevent their join.
#[test]
@@ -0,0 +1,29 @@
{
"description": "Second reproduction for #1985, delta-debugged by the issue's reporter from the same enclosure with wall_thickness 3: a rounded box with a flange, an inner cut, a corner gusset and two standoffs, no screw hole. Its STEP export hung on main 675c8654 (but not on 0.14.0): the same boundary walk took a standoff's projected angles millions of turns apart.",
"commands": [
{"command": "parameters.add", "params": {"expression": "74", "name": "interior_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "73", "name": "interior_depth", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "30", "name": "interior_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "3", "name": "wall_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2.5", "name": "bottom_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "3", "name": "corner_radius", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "8", "name": "gusset_size", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "10", "name": "flange_extend", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "5", "name": "pin_base_d", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "3", "name": "standoff_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_width + 2 * wall_thickness", "name": "outer_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_depth + 2 * wall_thickness", "name": "outer_depth", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_height + bottom_thickness", "name": "outer_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "outer_width + 2 * flange_extend", "name": "flange_total_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "(interior_width - 53.34) / 2", "name": "board_offset_x", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "1", "name": "board_offset_y", "unit": "mm"}},
{"command": "timeline.add", "params": {"feature": {"id": 1, "name": "Koerper_Skizze", "plane": {"name": "XY", "type": "origin"}, "sketch": {"constraints": [{"id": "k1", "l": 0, "type": "horizontal"}, {"id": "k2", "l": 2, "type": "horizontal"}, {"id": "k3", "l": 1, "type": "vertical"}, {"id": "k4", "l": 3, "type": "vertical"}, {"id": "k5", "p": 0, "q": 1, "type": "coincident"}, {"c": 0, "id": "k6", "p": 1, "type": "point_on_curve"}, {"c": 3, "id": "k7", "p": 1, "type": "point_on_curve"}, {"a": 0, "b": 4, "id": "k8", "type": "tangent"}, {"a": 3, "b": 4, "id": "k9", "type": "tangent"}, {"c": 4, "id": "k10", "param": "d1", "type": "radius", "value": 3.0}, {"a": 0, "b": 5, "id": "k11", "type": "tangent"}, {"a": 1, "b": 5, "id": "k12", "type": "tangent"}, {"a": 4, "b": 5, "id": "k13", "type": "equal"}, {"a": 1, "b": 6, "id": "k14", "type": "tangent"}, {"a": 2, "b": 6, "id": "k15", "type": "tangent"}, {"a": 4, "b": 6, "id": "k16", "type": "equal"}, {"a": 2, "b": 7, "id": "k17", "type": "tangent"}, {"a": 3, "b": 7, "id": "k18", "type": "tangent"}, {"a": 4, "b": 7, "id": "k19", "type": "equal"}, {"id": "k20", "l": 0, "param": "d2", "type": "length", "value": 74.0}, {"id": "k21", "l": 3, "param": "d3", "type": "length", "value": 73.0}, {"a": 3, "b": 8, "id": "k22", "type": "collinear"}, {"a": 0, "b": 9, "id": "k23", "type": "collinear"}], "counters": {"a": 4, "corner": 1, "j": 2, "k": 23, "l": 6, "p": 16}, "curves": [{"a": 2, "b": 5, "construction": false, "id": "l1", "type": "line"}, {"a": 6, "b": 8, "construction": false, "id": "l2", "type": "line"}, {"a": 9, "b": 11, "construction": false, "id": "l3", "type": "line"}, {"a": 12, "b": 3, "construction": false, "id": "l4", "type": "line"}, {"a": 3, "b": 2, "c": 4, "construction": false, "id": "a1", "type": "arc"}, {"a": 5, "b": 6, "c": 7, "construction": false, "id": "a2", "type": "arc"}, {"a": 8, "b": 9, "c": 10, "construction": false, "id": "a3", "type": "arc"}, {"a": 11, "b": 12, "c": 13, "construction": false, "id": "a4", "type": "arc"}, {"a": 14, "b": 15, "construction": true, "id": "l5", "link": "j1", "type": "line"}, {"a": 16, "b": 17, "construction": true, "id": "l6", "link": "j2", "type": "line"}], "links": [{"id": "j1", "kind": "project", "source": {"name": "y", "type": "sketch_axis"}}, {"id": "j2", "kind": "project", "source": {"name": "x", "type": "sketch_axis"}}], "points": [{"fixed": true, "id": "origin", "pos": [0.0, 0.0]}, {"fixed": false, "id": "corner1", "pos": [0.0, 0.0]}, {"fixed": false, "id": "p5", "pos": [3.0, 0.0]}, {"fixed": false, "id": "p6", "pos": [0.0, 3.0]}, {"fixed": false, "id": "a1.center", "pos": [3.0, 3.0]}, {"fixed": false, "id": "p7", "pos": [77.0, 0.0]}, {"fixed": false, "id": "p8", "pos": [80.0, 3.0]}, {"fixed": false, "id": "a2.center", "pos": [77.0, 3.0]}, {"fixed": false, "id": "p9", "pos": [80.0, 76.0]}, {"fixed": false, "id": "p10", "pos": [77.0, 79.0]}, {"fixed": false, "id": "a3.center", "pos": [77.0, 76.0]}, {"fixed": false, "id": "p11", "pos": [3.0, 79.0]}, {"fixed": false, "id": "p12", "pos": [0.0, 76.0]}, {"fixed": false, "id": "a4.center", "pos": [3.0, 76.0]}, {"fixed": true, "id": "p13", "link": "j1", "pos": [0.0, -100.0]}, {"fixed": true, "id": "p14", "link": "j1", "pos": [0.0, 100.0]}, {"fixed": true, "id": "p15", "link": "j2", "pos": [-100.0, 0.0]}, {"fixed": true, "id": "p16", "link": "j2", "pos": [100.0, 0.0]}]}, "suppressed": false, "type": "sketch"}, "params": [{"expression": "corner_radius", "name": "d1", "unit": "mm"}, {"expression": "outer_width - 2*corner_radius", "name": "d2", "unit": "mm"}, {"expression": "outer_depth - 2*corner_radius", "name": "d3", "unit": "mm"}]}},
{"command": "timeline.add", "params": {"feature": {"body_names": ["Unterteil"], "extent": {"convention": "total_distance", "direction": "positive", "distance": "outer_height"}, "id": 2, "name": "Koerper", "operation": "new_body", "param_names": ["d4"], "profiles": {"type": "all"}, "sketch": 1, "suppressed": false, "type": "extrude"}}},
{"command": "timeline.add", "params": {"feature": {"id": 3, "name": "Flansch_Skizze", "plane": {"name": "XY", "type": "origin"}, "sketch": {"constraints": [{"id": "k1", "l": 0, "type": "horizontal"}, {"id": "k2", "l": 2, "type": "horizontal"}, {"id": "k3", "l": 1, "type": "vertical"}, {"id": "k4", "l": 3, "type": "vertical"}, {"a": 0, "b": 4, "id": "k5", "type": "tangent"}, {"a": 3, "b": 4, "id": "k6", "type": "tangent"}, {"c": 4, "id": "k7", "param": "d5", "type": "radius", "value": 3.0}, {"a": 0, "b": 5, "id": "k8", "type": "tangent"}, {"a": 1, "b": 5, "id": "k9", "type": "tangent"}, {"a": 4, "b": 5, "id": "k10", "type": "equal"}, {"a": 1, "b": 6, "id": "k11", "type": "tangent"}, {"a": 2, "b": 6, "id": "k12", "type": "tangent"}, {"a": 4, "b": 6, "id": "k13", "type": "equal"}, {"a": 2, "b": 7, "id": "k14", "type": "tangent"}, {"a": 3, "b": 7, "id": "k15", "type": "tangent"}, {"a": 4, "b": 7, "id": "k16", "type": "equal"}, {"id": "k17", "l": 0, "param": "d6", "type": "length", "value": 94.0}, {"id": "k18", "l": 3, "param": "d7", "type": "length", "value": 73.0}, {"c": 8, "id": "k19", "p": 1, "type": "point_on_curve"}, {"id": "k20", "p": 0, "param": "d8", "q": 2, "type": "distance_x", "value": 10.0}], "counters": {"a": 4, "j": 1, "k": 20, "l": 5, "p": 14}, "curves": [{"a": 1, "b": 4, "construction": false, "id": "l1", "type": "line"}, {"a": 5, "b": 7, "construction": false, "id": "l2", "type": "line"}, {"a": 8, "b": 10, "construction": false, "id": "l3", "type": "line"}, {"a": 11, "b": 2, "construction": false, "id": "l4", "type": "line"}, {"a": 2, "b": 1, "c": 3, "construction": false, "id": "a1", "type": "arc"}, {"a": 4, "b": 5, "c": 6, "construction": false, "id": "a2", "type": "arc"}, {"a": 7, "b": 8, "c": 9, "construction": false, "id": "a3", "type": "arc"}, {"a": 10, "b": 11, "c": 12, "construction": false, "id": "a4", "type": "arc"}, {"a": 13, "b": 14, "construction": true, "id": "l5", "link": "j1", "type": "line"}], "links": [{"id": "j1", "kind": "project", "source": {"name": "x", "type": "sketch_axis"}}], "points": [{"fixed": true, "id": "origin", "pos": [0.0, 0.0]}, {"fixed": false, "id": "p5", "pos": [-7.000000000421964, -9.639689500501904e-11]}, {"fixed": false, "id": "p6", "pos": [-10.000000000100329, 2.999999999497484]}, {"fixed": false, "id": "a1.center", "pos": [-7.000000000350304, 2.999999999572889]}, {"fixed": false, "id": "p7", "pos": [86.99999999951254, -1.1049218029226348e-10]}, {"fixed": false, "id": "p8", "pos": [89.99999999908958, 2.99999999957527]}, {"fixed": false, "id": "a2.center", "pos": [86.99999999945408, 2.9999999995765445]}, {"fixed": false, "id": "p9", "pos": [89.99999999905073, 75.99999999922994]}, {"fixed": false, "id": "p10", "pos": [86.99999999926114, 78.99999999903463]}, {"fixed": false, "id": "a3.center", "pos": [86.99999999926523, 75.99999999923355]}, {"fixed": false, "id": "p11", "pos": [-7.0000000004280105, 78.99999999906302]}, {"fixed": false, "id": "p12", "pos": [-10.000000000111083, 75.99999999942932]}, {"fixed": false, "id": "a4.center", "pos": [-7.000000000426023, 75.99999999936931]}, {"fixed": true, "id": "p13", "link": "j1", "pos": [-100.0, 0.0]}, {"fixed": true, "id": "p14", "link": "j1", "pos": [100.0, 0.0]}]}, "suppressed": false, "type": "sketch"}, "params": [{"expression": "corner_radius", "name": "d5", "unit": "mm"}, {"expression": "flange_total_width - 2*corner_radius", "name": "d6", "unit": "mm"}, {"expression": "outer_depth - 2*corner_radius", "name": "d7", "unit": "mm"}, {"expression": "flange_extend", "name": "d8", "unit": "mm"}]}},
{"command": "timeline.add", "params": {"feature": {"extent": {"convention": "total_distance", "direction": "positive", "distance": "bottom_thickness"}, "id": 4, "name": "Flansch", "operation": "join", "param_names": ["d9"], "profiles": {"type": "all"}, "sketch": 3, "suppressed": false, "targets": ["Unterteil"], "type": "extrude"}}},
{"command": "timeline.add", "params": {"feature": {"corner": ["wall_thickness", "wall_thickness", "bottom_thickness"], "height": "interior_height + 1", "id": 5, "length": "interior_width", "name": "Innenraum", "operation": "cut", "param_names": ["d10", "d11", "d12"], "participants": ["Unterteil"], "suppressed": false, "type": "box", "width": "interior_depth"}}},
{"command": "timeline.add", "params": {"feature": {"corner": ["wall_thickness + interior_width - gusset_size", "wall_thickness + interior_depth - gusset_size", "bottom_thickness"], "height": "interior_height", "id": 9, "length": "gusset_size", "name": "Gusset_11", "operation": "join", "param_names": ["d22", "d23", "d24"], "participants": ["Unterteil"], "suppressed": false, "type": "box", "width": "gusset_size"}}},
{"command": "timeline.add", "params": {"feature": {"axis": [0.0, 0.0, 1.0], "base": ["wall_thickness + board_offset_x + 17.78", "wall_thickness + board_offset_y + 66.04", "bottom_thickness"], "height": "standoff_height", "id": 18, "name": "PinSockel_2", "operation": "join", "param_names": ["d41", "d42"], "participants": ["Unterteil"], "radius": "(pin_base_d) / 2", "suppressed": false, "type": "cylinder"}}},
{"command": "timeline.add", "params": {"feature": {"axis": [0.0, 0.0, 1.0], "base": ["wall_thickness + board_offset_x + 45.72", "wall_thickness + board_offset_y + 66.04", "bottom_thickness"], "height": "standoff_height", "id": 20, "name": "PinSockel_3", "operation": "join", "param_names": ["d45", "d46"], "participants": ["Unterteil"], "radius": "(pin_base_d) / 2", "suppressed": false, "type": "cylinder"}}}
]
}
@@ -0,0 +1,38 @@
{
"description": "Reproduction for #1985, from the script in the public issue (a small enclosure: rounded box, inner cut, a corner gusset with a screw hole, two standoffs and a USB cut-out), with interior_height 35 instead of 30. Exporting it as STEP never finished: the export reads its own file back, and meshing the screw hole's seam cylinder never ended, because the boundary walk let projected angles millions of turns apart through.",
"commands": [
{"command": "parameters.add", "params": {"expression": "74", "name": "interior_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "73", "name": "interior_depth", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "35", "name": "interior_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2", "name": "wall_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2.5", "name": "bottom_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "3", "name": "corner_radius", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2", "name": "lid_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "1", "name": "lid_pad_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "0.3", "name": "lid_pad_gap", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "8", "name": "gusset_size", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2.5", "name": "gusset_screw_d", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "8", "name": "gusset_screw_depth", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "10", "name": "flange_extend", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "4.5", "name": "flange_hole_d", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "5", "name": "pin_base_d", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "3", "name": "standoff_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2", "name": "pin_d", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "1.6", "name": "pcb_thickness", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "2", "name": "pin_above", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_width + 2 * wall_thickness", "name": "outer_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_depth + 2 * wall_thickness", "name": "outer_depth", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "interior_height + bottom_thickness", "name": "outer_height", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "outer_width + 2 * flange_extend", "name": "flange_total_width", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "(interior_width - 53.34) / 2", "name": "board_offset_x", "unit": "mm"}},
{"command": "parameters.add", "params": {"expression": "1", "name": "board_offset_y", "unit": "mm"}},
{"command": "timeline.add", "params": {"feature": {"id": 1, "name": "Koerper_Skizze", "plane": {"name": "XY", "type": "origin"}, "sketch": {"constraints": [{"id": "k1", "l": 0, "type": "horizontal"}, {"id": "k2", "l": 2, "type": "horizontal"}, {"id": "k3", "l": 1, "type": "vertical"}, {"id": "k4", "l": 3, "type": "vertical"}, {"id": "k5", "p": 0, "q": 1, "type": "coincident"}, {"c": 0, "id": "k6", "p": 1, "type": "point_on_curve"}, {"c": 3, "id": "k7", "p": 1, "type": "point_on_curve"}, {"a": 0, "b": 4, "id": "k8", "type": "tangent"}, {"a": 3, "b": 4, "id": "k9", "type": "tangent"}, {"c": 4, "id": "k10", "param": "d1", "type": "radius", "value": 3.0}, {"a": 0, "b": 5, "id": "k11", "type": "tangent"}, {"a": 1, "b": 5, "id": "k12", "type": "tangent"}, {"a": 4, "b": 5, "id": "k13", "type": "equal"}, {"a": 1, "b": 6, "id": "k14", "type": "tangent"}, {"a": 2, "b": 6, "id": "k15", "type": "tangent"}, {"a": 4, "b": 6, "id": "k16", "type": "equal"}, {"a": 2, "b": 7, "id": "k17", "type": "tangent"}, {"a": 3, "b": 7, "id": "k18", "type": "tangent"}, {"a": 4, "b": 7, "id": "k19", "type": "equal"}, {"id": "k20", "l": 0, "param": "d2", "type": "length", "value": 74.0}, {"id": "k21", "l": 3, "param": "d3", "type": "length", "value": 73.0}, {"a": 3, "b": 8, "id": "k22", "type": "collinear"}, {"a": 0, "b": 9, "id": "k23", "type": "collinear"}], "counters": {"a": 4, "corner": 1, "j": 2, "k": 23, "l": 6, "p": 16}, "curves": [{"a": 2, "b": 5, "construction": false, "id": "l1", "type": "line"}, {"a": 6, "b": 8, "construction": false, "id": "l2", "type": "line"}, {"a": 9, "b": 11, "construction": false, "id": "l3", "type": "line"}, {"a": 12, "b": 3, "construction": false, "id": "l4", "type": "line"}, {"a": 3, "b": 2, "c": 4, "construction": false, "id": "a1", "type": "arc"}, {"a": 5, "b": 6, "c": 7, "construction": false, "id": "a2", "type": "arc"}, {"a": 8, "b": 9, "c": 10, "construction": false, "id": "a3", "type": "arc"}, {"a": 11, "b": 12, "c": 13, "construction": false, "id": "a4", "type": "arc"}, {"a": 14, "b": 15, "construction": true, "id": "l5", "link": "j1", "type": "line"}, {"a": 16, "b": 17, "construction": true, "id": "l6", "link": "j2", "type": "line"}], "links": [{"id": "j1", "kind": "project", "source": {"name": "y", "type": "sketch_axis"}}, {"id": "j2", "kind": "project", "source": {"name": "x", "type": "sketch_axis"}}], "points": [{"fixed": true, "id": "origin", "pos": [0.0, 0.0]}, {"fixed": false, "id": "corner1", "pos": [0.0, 0.0]}, {"fixed": false, "id": "p5", "pos": [3.0, 0.0]}, {"fixed": false, "id": "p6", "pos": [0.0, 3.0]}, {"fixed": false, "id": "a1.center", "pos": [3.0, 3.0]}, {"fixed": false, "id": "p7", "pos": [77.0, 0.0]}, {"fixed": false, "id": "p8", "pos": [80.0, 3.0]}, {"fixed": false, "id": "a2.center", "pos": [77.0, 3.0]}, {"fixed": false, "id": "p9", "pos": [80.0, 76.0]}, {"fixed": false, "id": "p10", "pos": [77.0, 79.0]}, {"fixed": false, "id": "a3.center", "pos": [77.0, 76.0]}, {"fixed": false, "id": "p11", "pos": [3.0, 79.0]}, {"fixed": false, "id": "p12", "pos": [0.0, 76.0]}, {"fixed": false, "id": "a4.center", "pos": [3.0, 76.0]}, {"fixed": true, "id": "p13", "link": "j1", "pos": [0.0, -100.0]}, {"fixed": true, "id": "p14", "link": "j1", "pos": [0.0, 100.0]}, {"fixed": true, "id": "p15", "link": "j2", "pos": [-100.0, 0.0]}, {"fixed": true, "id": "p16", "link": "j2", "pos": [100.0, 0.0]}]}, "suppressed": false, "type": "sketch"}, "params": [{"expression": "corner_radius", "name": "d1", "unit": "mm"}, {"expression": "outer_width - 2*corner_radius", "name": "d2", "unit": "mm"}, {"expression": "outer_depth - 2*corner_radius", "name": "d3", "unit": "mm"}]}},
{"command": "timeline.add", "params": {"feature": {"body_names": ["Unterteil"], "extent": {"convention": "total_distance", "direction": "positive", "distance": "outer_height"}, "id": 2, "name": "Koerper", "operation": "new_body", "param_names": ["d4"], "profiles": {"type": "all"}, "sketch": 1, "suppressed": false, "type": "extrude"}}},
{"command": "timeline.add", "params": {"feature": {"corner": ["wall_thickness", "wall_thickness", "bottom_thickness"], "height": "interior_height + 1", "id": 5, "length": "interior_width", "name": "Innenraum", "operation": "cut", "param_names": ["d10", "d11", "d12"], "participants": ["Unterteil"], "suppressed": false, "type": "box", "width": "interior_depth"}}},
{"command": "timeline.add", "params": {"feature": {"corner": ["wall_thickness + interior_width - gusset_size", "wall_thickness + interior_depth - gusset_size", "bottom_thickness"], "height": "interior_height", "id": 9, "length": "gusset_size", "name": "Gusset_11", "operation": "join", "param_names": ["d22", "d23", "d24"], "participants": ["Unterteil"], "suppressed": false, "type": "box", "width": "gusset_size"}}},
{"command": "timeline.add", "params": {"feature": {"axis": [0.0, 0.0, 1.0], "base": ["wall_thickness + interior_width - gusset_size/2", "wall_thickness + interior_depth - gusset_size/2", "outer_height - gusset_screw_depth"], "height": "gusset_screw_depth + 1", "id": 13, "name": "Kernloch_11", "operation": "cut", "param_names": ["d31", "d32"], "participants": ["Unterteil"], "radius": "(gusset_screw_d) / 2", "suppressed": false, "type": "cylinder"}}},
{"command": "timeline.add", "params": {"feature": {"axis": [0.0, 0.0, 1.0], "base": ["wall_thickness + board_offset_x + 17.78", "wall_thickness + board_offset_y + 66.04", "bottom_thickness"], "height": "standoff_height", "id": 18, "name": "PinSockel_2", "operation": "join", "param_names": ["d41", "d42"], "participants": ["Unterteil"], "radius": "(pin_base_d) / 2", "suppressed": false, "type": "cylinder"}}},
{"command": "timeline.add", "params": {"feature": {"axis": [0.0, 0.0, 1.0], "base": ["wall_thickness + board_offset_x + 45.72", "wall_thickness + board_offset_y + 66.04", "bottom_thickness"], "height": "standoff_height", "id": 20, "name": "PinSockel_3", "operation": "join", "param_names": ["d45", "d46"], "participants": ["Unterteil"], "radius": "(pin_base_d) / 2", "suppressed": false, "type": "cylinder"}}},
{"command": "timeline.add", "params": {"feature": {"corner": ["wall_thickness + board_offset_x + 9", -1.0, "bottom_thickness + 2.5"], "height": "6", "id": 22, "length": "10", "name": "Ausschnitt_MicroUSB", "operation": "cut", "param_names": ["d49", "d50", "d51"], "participants": ["Unterteil"], "suppressed": false, "type": "box", "width": "wall_thickness + 2"}}}
]
}
+6
View File
@@ -131,6 +131,12 @@ Changes:
- `tessellation/triangulation.rs`: meshed faces and edges are built unchecked: faces whose loop
runs along a seam edge both ways and closed edges (a full circle on one vertex) are valid,
but the debug-build checks rejected them (debug builds could not mesh them).
- `tessellation/triangulation.rs`: on a periodic surface, a boundary point's projected parameter
is moved by whole periods to within half a period of the point before it, however many periods
away the search put it (it was moved by two periods at most). A hinted search on a revolved
surface can return an angle millions of turns from its hint; the loop then spanned those turns,
the polyline closing it across the seam had millions of points, and meshing never finished,
which hung the STEP export that reads its own file back (#1985).
- `tessellation/triangulation.rs`: parameter searches that land outside a surface's bounded,
non-periodic domain are rejected (a hinted B-spline search can run off and extrapolate to
thousands of parameter units, and meshing that grid never finishes); the last-resort nearest
+10 -6
View File
@@ -621,13 +621,17 @@ impl PolyBoundaryPiece {
}
}
fn abs_diff(previous: f64) -> impl Fn(&f64, &f64) -> std::cmp::Ordering {
let f = move |x: &f64| f64::abs(x - previous);
move |x: &f64, y: &f64| f(x).partial_cmp(&f(y)).unwrap()
}
/// SolidCraft: `u` moved by whole periods `up` to within half a period of `u0`, however many
/// periods away it is (on a tie, the lower one, as before). A hinted search on a revolved
/// surface can return an angle millions of turns from its hint, the same point; moving it by two
/// periods at most left a face's boundary loop spanning those turns, and the polyline that closes
/// it across the seam then had millions of points: meshing it never finished (#1985).
fn get_mindiff(u: f64, u0: f64, up: f64) -> f64 {
let closure = |i| u + i as f64 * up;
(-2..=2).map(closure).min_by(abs_diff(u0)).unwrap()
let d = (u - u0).rem_euclid(up);
if !d.is_finite() {
return u;
}
u0 + if d >= 0.5 * up { d - up } else { d }
}
/// SolidCraft: the second field holds each loop's parameter box, so `include` skips loops that