Skip to content

feat(frame): let the user choose whether the frame includes overscan - #566

Merged
knipknap merged 3 commits into
mainfrom
fix/frame-overscan-choice
Oct 14, 2026
Merged

knipknap merged 3 commits into
mainfrom
fix/frame-overscan-choice

Conversation

@knipknap

Copy link
Copy Markdown
Contributor

Fixes #563

What

The frame button no longer starts the frame-up immediately. It opens a
popover (same look as the one for "Add Equidistant Tabs") with an
Include Overscan Margin switch and a Frame button:

  • switch off (default): the frame traces the area the laser actually
    burns — the job boundary — so it no longer overshoots the artwork by
    the engraving overscan on the left/right sides;
  • switch on: the frame traces the full machine path, including the
    overscan acceleration margin, as before.

How the tight frame is found

The overscan only exists in the final ops as zero-power cutting moves
and zero-value scanline padding, so the boundary is computed by the new
Ops.burning_rect() in raygeo (submitted as a separate raygeo PR),
in one O(n) Rust pass. _run_frame_action builds the frame from that
envelope; on raygeo releases without burning_rect (currently pinned
1.64.0) the code falls back to the plain ops rect, i.e. the previous
frame behavior. The rayforge test that exercises the tight frame is
therefore skipped until the raygeo pin moves to a release containing
raygeo#60 — after that release, bump raygeo = "==1.65.0" (or newer)
in pixi.toml and the behavior activates without any further change.

The travel warning (_warn_if_frame_exceeds_travel) is unaffected: it
keeps checking the frame that is actually traced.

Tests

  • tests/machine/test_machine_cmd.py::TestFrameOverscan: framing an
    artifact with overscan-style zero-power lead-out corners at the
    burned area (10..30) by default and at the full path (10..35) with
    the switch on; plus _job_frame_rect fallback behavior.
  • New strings are added to rayforge.pot and all shipped catalogs.

The machine frame traces the whole job artifact rect, which includes
the engraving overscan margin: the overscan transformer extends raster
lines with zero-power lead-in/lead-out moves for acceleration room, so
the framed outline overshoots the artwork, mainly in X (issue #563).

The frame button now opens a popover (like the one for equidistant
tabs) with an 'Include Overscan Margin' switch. When the switch is
off, the frame is built from the envelope the laser actually burns —
Ops.burning_rect(), added to raygeo — instead of the full machine
path. On raygeo releases without burning_rect the frame keeps the
previous behavior.

The travel warning keeps using the traced frame; catalogs gained the
two new strings.
@knipknap

knipknap commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated: the PR now requires raygeo 1.65.0 directly — the pin is bumped and the fallback for older raygeo releases is removed. Depends on raygeo#61 / raygeo 1.65.0 only.

Rebase the frame-overscan change onto the released raygeo:
Ops.powered_rect() (raygeo#61, released as 1.65.0) is now a hard
requirement and the only envelope source — the getattr fallback for
older raygeo releases and the skip-guarded test are gone. Bumps the
pin to ==1.65.0 in pixi.toml, requirements.txt and
debian/requirements-bundle.txt, and re-locks pixi.lock (raygeo-only
change).
..doceditor from mainwindow resolves to the controller package
rayforge.doceditor, where DocEditor lives; the popover widget is a
Gtk class in rayforge.ui_gtk.doceditor, so the relative import needs
a single dot (as the toolbar's AddTabsPopover import does).
@knipknap
knipknap merged commit c5fbdae into main Oct 14, 2026
34 checks passed
@github-actions

Copy link
Copy Markdown

🤖 Estimated LLM implementation cost

Replayed each of the 3 commits in this pull request and counted the code lines each commit added or rewrote:

Commit Message Lines (add/rewrite) Est. output tokens Est. output cost
87fe0b1d feat(frame): let the user choose whether the frame includes overscan 169 / 5 1,740 $0.0261
4144ebc1 feat(frame): use raygeo 1.65.0 powered_rect, drop the fallback 7 / 33 400 $0.0060
4d82acfa fix(ui): import the frame popover from the ui doceditor package 1 / 1 20 $0.0003
Total 216 2,160 $0.0324

Added lines by language: Python 174, Plain Text 2, TOML 1

Full estimate

Component Est. tokens Est. cost
Code emission (216 add/rewrite lines) 2,160 $0.0324
Context input (reading touched files) 82,273 $0.2468
Conversation replay (≈15× output) 32,400 $0.0972
Prompting (pull request description) 338 $0.0010
Debug cycles (20 failed checks) 420,000 $1.5000
Lower bound (output only) 2,160 $0.0324
Best estimate 537,171 $1.8774

Cost model: ≈10 tokens per code line at $15/Mtok output and $3/Mtok input (assuming heavy prompt caching); input ≈ 15× output for conversation replay; a review round ≈ 42,000 tokens; a failed CI run ≈ 21,000 tokens; file reads capped at 20 kB each.

Active window from first commit to merge: <1 day.

⚠️ Caveat: the lower bound covers only the tokens for emitting the code. The best estimate adds modeled overhead for exploration, conversation replay, review and debug turns, but real sessions vary by tool and task — treat it as an order-of-magnitude figure. Human engineering time is not included.

@knipknap
knipknap deleted the fix/frame-overscan-choice branch October 15, 2026 12:25

This branch was previously deployed

1 inactive deployment
pypi — 4d82acfa Deployed Oct 14, 2026 by knipknap via Build and Publish Wheel #2301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Framing extends beyond the bounds of the job

1 participant