feat: Add dot width correction for raster engraving#316
Merged
Conversation
Adds EngraveStep.dot_width_correction_mm, wiring the new raygeo dot_width_correction_mm parameter through get_assembler_kwargs/ assemble_on_surface and a matching Raster settings UI row. Follows the same convention as line_interval_mm/sample_interval_mm: None means "auto" (half the selected laser's spot_size_mm[0]), an explicit float overrides it. Requires the corresponding raygeo change (branch feature/dot-width-correction), which does the actual power-array trimming. Also adds a mocked test asserting assemble_on_surface resolves the auto-default correctly (half the laser's spot size when unset, the explicit override when set) -- the same "resolves to the right value at generation time" bug class the settings-widget-auto-value-bugs PR fixed for the UI side, previously untested for any of the three raster fields.
Contributor
|
Raygeo 1.24.0 is now pushed! |
Dot width correction landed in raygeo 1.24.0 (PyPI); this pulls it in so the feature added in the previous commit actually takes effect.
Contributor
Author
vyvcodd
marked this pull request as ready for review
July 21, 2026 20:23
Contributor
|
Sweet, looking good! Thanks for the PR! I will push a small change thereafter to also support this in the existing Lightburn import. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds LightBurn-style "Dot Correction" support to raster engraving: shortens the marked area of every continuous engraved run by compensating for the physical width of the laser spot, so engraved images come out at their intended size instead of slightly larger/darker along the scan-line direction. This especially matters for fine detail — thin dark features and the gaps between them are closest in size to the spot diameter, so without correction they're the first to over-thicken and wash out.
Depends on the raygeo change in branch
feature/dot-width-correction(https://github.com/vyvcodd/raygeo/tree/feature/dot-width-correction), which does the actual work: it delays laser-on and advances laser-off by half the spot diameter at each end of every engraved run, without changing any toolpath geometry. See that branch's PR description for the full rationale — in short, this is a firing-timing correction, not a geometric one, so it's implemented separately from (and cannot reuse) the existing kerf/tool-radius offset machinery. It also documents a known, deliberate limitation: engraved detail smaller than roughly the spot diameter is dropped entirely rather than shrunk to a point, since this feature is inherently a lossy scale-down of the burn and a hard threshold is the easiest version of that tradeoff to reason about.Changes
EngraveStep.dot_width_correction_mm(raster_step.py):Optional[float], defaulting toNone(auto = half the selected laser'sspot_size_mm[0]), same convention as the existingline_interval_mm/sample_interval_mm— auto value shown as the default, explicit override once the user edits it, no separate toggle. Wired throughget_assembler_kwargs/assemble_on_surfaceinto the newdot_width_correction_mmkwarg on the raygeoraster()assembler.raster_widget.py: new "Dot Width Correction"Adw.SpinRowinRasterSettingsWidget, next to Line Spacing / Sample Interval.test_raster_step.py: updatedtest_get_assembler_kwargs's expected key set, added a roundtrip-serialization assertion for the new field, and a mockedassemble_on_surfacetest (TestAssembleOnSurfaceAutoDefaults) asserting the auto-default actually resolves to half the laser's spot size at generation time, and that an explicit override is respected — this exact "resolves to the right value when generating, not just a hardcoded placeholder" class of bug is what the settings-widget-auto-value-bugs PR fixed for the other raster fields, so it's worth locking down here too.Checks
rayforge/builtin_addons/rayforge-addon-laser/tests/steps/test_raster_step.py: 8 passed.tests/+rayforge/builtin_addons/), rebased onto currentmain: 5277 passed, 300 deselected.scripts/screenshot/cli.py step-settings:engrave:general:variable) hung in this environment and was killed rather than left running; worth a quick manual look at the new spin row before merging.Sequencing note — do not merge before the raygeo pin bump
This is not a dormant feature waiting on a later release — it's a breaking change against the currently-pinned raygeo.
dot_width_correction_mmis passed unconditionally on every raster generation, and the pinned release (1.23.0) doesn't accept that kwarg at all:Verified directly against the actual cached 1.23.0 wheel. Every Engrave step would fail to generate. This must land in the same PR (or immediately after, with no gap) as the
raygeopin bump to the release that includesfeature/dot-width-correction, matching the existing "bump pin + migrate code" convention already used for every other raygeo version bump in this repo's history. Until then, test locally withscripts/run_with_local_raygeo.sh ../raygeopointed at that branch.