Repository navigation
feat(optimize): cut planner switches (best start point, prefer corners) - #541
Conversation
|
The raygeo side has now shipped, so this PR is unblocked on that half.
What is left is the dependency bump itself:
I have not touched |
Two new options on the Optimize transformer and its settings group: Choose Best Start Point (rotate closed paths to the vertex nearest the head) and Prefer Corners (only start at sharp corners when the path has any). Both default off, so existing jobs are unchanged. The backend fields are provided by the raygeo cut-planner change. Refs barebaric#523
8daa270 to
215e760
Compare
|
Correction to my comment above: the pin was already bumped — |
The new strings stay wrapped in _(); the .po/.pot files are updated once before each release.
Choosing the nearest vertex shortens travel; it does not hide the seam. Hiding the seam is what Prefer Corners is for. Refs barebaric#523
|
Went over this one again against the architecture notes and pushed three small commits on top, no force-push:
The .po/.pot changes were already dropped in ef47cbc. The PR now only touches the Optimize transformer, its settings group, its tests and the docs. |
The website figure generators were standalone scripts under scripts/media/ with duplicated palette, font and output code. They now live in a scripts/figures package with shared style and canvas modules and a pixi figures task (python -m scripts.figures). Regenerating the moved figures produces byte-identical images.
Add a scripts/figures/path_optimization generator that runs a sample toolpath through the real raygeo optimizer and renders travel moves before and after optimization, plus where the closed test path is entered as drawn, at the nearest vertex (Choose Best Start Point) and at the nearest corner (Prefer Corners). Add the step-settings:contour:post:optimize screenshot target, which opens the post-processing page with the Optimize group expanded and both cut-planner switches on. Embed the figures and screenshot in the path optimization docs for all languages.
The step-settings screenshot scripts duck-typed their way to the post-processing page via hasattr(widget, "_group_dicts") and searched expander rows by title, then swallowed failures behind a generic logged message. The page now exposes get_transformer_group() and get_expander_row(), which raise KeyError when the transformer is absent, and the scripts preset the Optimize switches on the step model, fail with a specific RuntimeError on every miss, and check the screenshot result. Regenerating both targets reproduces the committed images.
|
Extended this PR with documentation visuals and some cleanups (df9dc92, 433356f, 1de965a, 97c9747, plus a merge of main): Merged main — the branch had drifted 75 commits behind; clean merge (only Generated figures for path-optimization.md — new
Because the figures run the actual optimizer, they cannot drift from real behavior. Refactored the figure generators — the two one-off scripts under New screenshot target Docs — Public API instead of widget-tree hacks — the screenshot scripts reached the post-processing page via Verification: lint clean; targeted optimize transformer tests 30 passed; |
Summary
Expose the cut planner in Rayforge's Optimize settings group: Choose Best
Start Point and Prefer Corners (rayforge half of #523).
What's in this PR
Optimizetransformer gainsbest_start_pointandprefer_corners(both default off, so existing jobs are unchanged) and passes them through
to
raygeo.ops.transform.optimize.OptimizeSpec.current position, hiding the seam of every loop;
vertices of a closed path to its sharp corners; paths without corners
(circles) fall back to any vertex.
to_dict/from_dictroundtrip the new fields; the addon catalogs areupdated for all languages.
Dependency
This PR needs the matching raygeo change
(barebaric/raygeo#54) to be released: the
OptimizeSpec(...)kwargs come from that version of raygeo. Until theraygeo==1.61.xdependency is bumped, CI against the released wheel fails onthe new kwargs — the PR is meant to land together with (or right after) the
raygeo release.
Tests
rayforge/builtin_addons/rayforge-addon-post/tests/transformers/test_optimize_transformer.py— new
TestCutPlannerOptionscovers serialization defaults and roundtrip,to_specpass-through, and the behavioural rotation of a closed path(30 passed in the targeted file).