Repository navigation
Waterline: scallop-bounded in-between levels, ramped entries and island-by-island linking for ball end mills (#46) - #379
Conversation
…, skipping levels that gain less than the contour error (stevecad#46)
…plunge into stock (stevecad#46)
…els where the lap cuts as much (stevecad#46)
… prints (stevecad#46) Waterline no longer sets ProfileMotion.helix_entries (its entries ramp along the loop in its own emitter), so the field, its Phase::Cut branch and loop_closes go; waterline uses its own loop_is_closed.
…roughed stock (stevecad#46) Without a declared RampEntry each level is reached by a 3 degree ramp at the cutting feed instead of one lap at the plunge feed. Entry ramps and level links that meet stock more than one stepdown deep (for a link, beyond the level gap) are counted in the report (deep_stock_entries) and the simulation warns to rough or rest-rough first.
…r scallop levels, linking and the 3 degree ramp (stevecad#46)
… for each (stevecad#46) The runs slope or region limits cut a contour into are linked like closed loops: to the next run's start at the upper level (back along the run just cut where a straight link would cross the part), down along the run at the ramp angle and back, then cut. Pieces of a stack more than two cutter radii from the pieces they skip are taken nearest first, so separate walls are cut one after the other, each top to bottom. On in-between levels under limits, scallop fragments within one allowed run bridge across gaps under 4 R. steep-and-shallow finish-steep: 48 -> 13 retracts, 271.8 -> 197.7 s.
…vecad#46) A rough in steps up to three times the finishing stepdown, plus its allowance, no longer warns; a raw blank or a gap the rough tool could not reach still does. The raw-blank tests use a 1 mm stepdown so their blanks stand more than three stepdowns above the levels.
…limits (stevecad#46) Every link segment, the glide-back route, every ramp and a cut whose start a sub-0.005 mm link snapped is checked against the part and the limits (leads and ramps are not checked by LinkGuard); without an allowed route the piece is entered after a retract. Bridged fragments are placed in order along their run, so a run closing at its seam is not bridged by a chord. A reorder the reach check refuses is undone before the stack is deferred.
…mitted (stevecad#46) A ramp too long for one lap (or one out-and-back on a run) takes as many laps or passes as the angle needs, refused by name past 1000; a split onto a vertex only lengthens a ramp, so a tiny descent no longer collapses to a zero-length ramp with a NaN coordinate. A moved side entry snaps its candidate onto the vertex before it is checked, and the final check covers side leads too.
10-X-eng
left a comment
There was a problem hiding this comment.
The side-entry air check can accept a lead that cuts stock. In stock_met, a cell is skipped when its centre is outside the swept ball radius, even if its near edge is inside. For a 1 mm radius and a cell spanning perpendicular distances 0.9–1.3 mm from the interior of a straight lead, the centre distance is 1.1 mm. With the tip at Z0 the ball reaches Z0.564 at the near edge. Stock up to Z1 there gives 0.436 mm of interference and the current check counts zero. Part clearance cannot establish air clearance on uncut stock. The same estimate controls link acceptance. Please use a conservative whole-cell or committed-sweep proof for the emitted lead and link. Add a regression with the cell centre outside the sweep, and check the comparison against the finishing lap independently.
The measured planning times also go from 0.026 to 0.049 s and 0.197 to 0.640 s. The dense cycle improvement is real, but #46 explicitly requires lower planning time. Please keep #46 open if that acceptance criterion is deferred.
|
Reproduced the missed stock in a native regression. A 2 mm ball passes 1.9 mm from the near edge of an elevated cell. It intersects more than 1 mm of solid stock, and the current check returns 0 mm. I’m fixing this on the PR branch and checking the resulting entry, link and posted paths. |
10-X-eng
left a comment
There was a problem hiding this comment.
The cell-edge regression now catches the original missed contact. The whole-cell proof and finishing-lap comparison pass the independent geometry checks. The three release workloads post with unchanged material bounds. The planning-time work remains open in #46.
Part of #46. Planning time remains an open acceptance criterion.
Final behavior at
6c06b47Ball waterlines add scallop-bounded intermediate levels, group contours by island, and link levels only when the emitted route passes the part, machining-limit and live-stock checks. The ramp uses the operation's plunge feed unless the caller explicitly supplies a ramp feed. Open ramps honor a declared minimum reversal span.
A stock cell can intersect the swept ball even when its centre is outside the tool radius. The added Rust regression puts over 1 mm of stock into that overlap. The previous check returned zero. The link proof now covers the full cell. It bounds penetration by the level gap or by what the lower lap is guaranteed to meet. Where the finishing ball reaches at least as deep at the same XY, the comparison holds for every possible stock height there. Cells that cannot establish the bound are refused. Side entries also use the whole-cell check.
The sloped-wall fixture previously required at most one entry per four runs. That quota depended on centre sampling. The fixture now checks 18 proven links, 12 entries and at least six stock refusals across its 30 runs. The independent test comparing links to the lower lap still passes, as do the active cutting limits, ramp-angle, scallop and material checks.
All three programs posted. Each retained its previous material bounds, with zero certain overcut. The dense baseline on main was 476.247 s and 56 retracts. The smaller waterline takes longer than main's 34.047 s. The expected paths and modeled times were regenerated from three sequential release runs per workload.
On Linux, 10 Rust unit tests and 45 waterline-related integration tests passed, along with seven Python waterline/ramp tests, nine package tests, formatting and workspace Clippy. All 64 release workloads matched their toolpath expectations. The PR checks cover the pushed commit and the merge queue tests the integration with main.
Original implementation and measurements at d0c30e2, before the whole-cell proof and entry-feed fix
Waterline: scallop-bounded in-between levels, ramped entries and island-by-island linking for ball end mills (#46)
What changes
1. In-between levels keep the scallop of a vertical wall (ball end mills).
On a slope at contact angle t, levels
stepdown_mmapart arestepdown_mm / sin(t)apart along the surface, so shallow areas get a much taller scallop than a wall. A ball waterline now adds sub-levels between two main levels wherever the spacing along the surface exceeds what the vertical-wall scallop allows.scallop_mm = R - sqrt(R^2 - stepdown_mm^2/4) + contour_error_mm.D = 2 sqrt(R^2 - (R - scallop_mm)^2).sin(t) < P / D - 1e-9, with P the parent level spacing.contour_error_mm, so a short last gap, or a stepdown already fine enough, adds none.scallop_levelsandscallop_from_deg, the contact angle below which the bound is not claimed. Flat and bull-nose cutters are unchanged and report neither.2. Entries never plunge into stock.
moved_entries).helical_entries).3. Island by island, levels linked by ramps.
stacks_level_ordered).ramp_links).links_refused_stock,links_refused_link_clearance,links_refused_ramp_clearance.3b. Slope- and region-limited runs are linked too.
gap / (2 tan angle), at most the run) instead of running the whole run twice.4. Default ramp: 3 degrees at the cutting feed.
entry, every ramp (entry or level link) descends at no more than 3 degrees, atfeed_mm_min. A declared or default angle is a maximum: where one lap of a loop (or one out-and-back on a run) is too short, the ramp takes as many laps or passes as the angle needs, each descending an equal share; past 1000 it is refused by name. A split onto a loop vertex only ever lengthens a ramp, so a tiny descent never collapses to zero length.entry=RampEntry(angle_deg, feed_mm_min=...)still sets both. Its feed defaults to the plunge feed, as in every other operation.RampEntryis accepted on a ball waterline.5. Unroughed-stock warning.
stepdown_mmdeep is counted indeep_stock_entries, and the simulation warns: "... Rough or rest-rough first".stepdown_mmbeyond the level gap it descends.stepdown_mm; no new switches.wall_entriesreport field and its warning are gone, since a loop is no longer entered on the wall.6. Removed dead code.
ProfileMotion.helix_entries, itsPhase::Cutbranch andloop_closesinsrc/profiles.rs;src/profiles.rsis back to its state before this branch. Waterline uses its ownloop_is_closed.7. Links and snapped moves are proven against the machining limits.
allows_curve(..., cutting=true). Leads and ramps are not checked by the run'sLinkGuard(rapids and links only), so the emitter checks them; where no allowed route exists the piece is entered after a retract.Known limit of the link stock measure. The link stock measure uses stock-cell centres, so a cell's material can be under-counted by about 0.009 mm. This affects tool load only, never the part: every move carries the part-clearance proof.
Cycle-time cost (bench,
waterlineandwaterline-dense)Simulated cycle time (exact stop), moves and retracts. All runs are on the benchmark's roughed blanks.
steep-and-shallow(the Waterline half,finish-steep, with slope limits from 25 degrees) also changes. Its 25 degree limit cuts every contour into runs on the two gable ends, and the in-between levels add 9 sub-levels on the roof edges:waterlinerises from main's 91.427 to 95.052 mm³ (certain over-cut stays 0.0).waterlineand from 0.197 s to 0.640 s onwaterline-dense(main measured at 4ddb3c4 on the same machine).waterline, the remaining +11 s over main is the in-between levels on its tapered island. That is the price of the bounded scallop.waterline-dense, linking removes 55 of 56 retracts and the run is 34 % faster than main.Benchmark expectations
Updated in this PR, as AGENTS.md asks ("Update only intentionally changed workload expectations from measurements and explain the differences in the PR"):
bench/expectations/waterline.json,waterline-dense.jsonandsteep-and-shallow.json. Each was written bybench/expectations.pyfrom a release run ofbench/run.py --only <workload>. Every other workload matches its expectation in a full release run. The figures above are those runs.Changed existing test asserts
Rust,
tests/waterline.rs:cad_frustum_levels_stream_actual_stock_and_preserve_every_target_cell: levels[7, 5, 3, 2.5]→[8, 7, 6, 5, 4, 3, 2.5]. The 70 degree flanks get depth-1 in-between levels; the short last gap gets none.waterline_heights_keep_rapids_above_feed_height_and_end_at_clearance: "every plunge starts at the feed height" now applies to vertical plunges only. A ramp is a travelling plunge along the contour.every_entry_plunge_ends_at_or_above_the_stock_under_the_ball:plunges > 0 && beside > 0→plunges > 0.wall_entries == 0→moved_entries == 0andhelical_entries >= 1.a_loop_with_no_stock_free_entry_is_reported_not_hidden:wall_entries > 0→moved_entries == 0,helical_entries >= 1,deep_stock_entries >= 1.wall_entries == 0→moved_entries == 0,helical_entries >= 1,deep_stock_entries == 0.deep_stock_entries1, expected 0).Python:
test_waterline.py, frustum levels:{8, 6, 4, 2.5}→{8, 7, 6, 5, 4, 2.5}(in-between levels, as above).test_waterline.py:test_a_loop_entered_on_the_wall_is_warned_about_and_a_roughed_blank_is_not→test_a_raw_blank_enters_on_a_ramp_and_warns_to_rough_first_a_roughed_blank_does_not.wall_entries > 0and one "on the wall" warning.moved_entriesorwall_entries;helical_entries > 0;deep_stock_entries > 0; exactly one warning containing "more than three stepdowns deep" and "Rough or rest-rough first".moved_entries,helical_entries == 1,ramp_links > 0, nodeep_stock_entries, and no warning.test_ramp.py,test_ramp_descends_along_the_contours_without_gouging: the "some cut descends" check now also counts travelling plunge moves. A ball's ramps link its levels as plunge moves at the ramp feed, so for the ball subtest nocutmove descends any more. The flat-cutter subtest is unchanged.New tests cover:
ramps_on_short_runs_keep_the_ramp_angle), and a 0.0002 mm ramp descent that streams finite moves (a_tiny_ramp_descent_streams_finite_moves);a_moved_side_entry_proves_the_lead_it_emits);links_stay_out_of_avoid_areas_between_runs) and bridged fragments that follow a run closing at its seam (bridged_fragments_follow_a_run_that_closes_at_its_seam);slope_limited_walls_are_cut_wall_by_wall_and_linked: 30 runs, 24 linked, 6 entries; without the fix all 36 runs are entries);Tested
macOS arm64 only, release builds, at d0c30e2 (this branch rebased onto main b636cc4). Linux and Windows are left to CI.
cargo test --release --workspace --all-features --lib --tests: 1147 passed, 5 ignored.cargo test --release --doc: 1 passed.PYTHONPATH=python python -m unittest discover -s python/tests: 1087 tests, OK, 19 skipped. This includestest_package.py, which runs both examples with and without--accept-unchecked-machine.bench/test_*.py): OK. A fullbench/run.pyrun compared withbench/expectations: every toolpath matches. The figures above come from that run.cargo fmt --check,ruff checkandruff format --check: clean.cargo clippy --workspace --all-targets --all-features -- -D warnings: clean except twoneedless_range_looperrors insrc/surface/spline_bounds.rs. This PR does not touch that file, and main gives the same errors under the local rustc 1.99.1.A real-part check (dome and filleted boss, a 3/16 in ball after a 3 mm-step rough, a declared 3 degree ramp):