8000 Fix sizing errors in scans and STL exports by jasonmadigan · Pull Request #234 · tracefinity/tracefinity · GitHub
[go: up one dir, main page]

Skip to content

Fix sizing errors in scans and STL exports - #234

Merged
jasonmadigan merged 8 commits into
mainfrom
test/physical-size-accuracy
Oct 7, 2026
Merged

jasonmadigan merged 8 commits into
mainfrom
test/physical-size-accuracy

Conversation

@jasonmadigan
@jasonmadigan jasonmadigan commented Oct 6, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

This fixes five bugs found while investigating wrong-sized cutouts:

Problem Fix
Shadows make the detected paper smaller than the actual sheet, enlarging the trace. Prefer the visible sheet edges, with brightness detection as a fallback.
Generation starts before the latest clearance or layout edit has saved. Wait for saves to finish and hide outdated downloads.
An older generation finishes last and replaces the newer STL. Run exports for the same bin or session in order.
Auto-size ignores the stacking lip and chooses a bin that clips the tool ends. Include the lip when calculating usable space.
Changing Detail restores the outline from before a manual resize. Preserve the edited outline through Detail changes, rotation and undo.

The Detail bug, for example, turned a saved 72 mm correction back into an 80 mm outline. Its regression test now checks the actual downloaded cavity is 72.2 mm with 0.1 mm clearance.

The original scan-size report remains unresolved. This PR does not correct perspective enlargement of raised objects. Fixtures are synthetic or maintainer-provided. Edits made in another tool editor still require reloading the bin.

The contribution guide now requires repository writing to describe core behavior directly.

Tests

  • Backend venv/bin/python -m pytest: 848 passed.
  • Frontend pnpm test: 275 passed.
  • make lint: passed, with nine existing warnings.
  • make test-e2e-accuracy: five browser-to-STL tests passed.

The browser suite runs in CI and measures exported geometry within 1 mm. Smooth output must also fit the whole known tool. Segmentation is substituted with a mask derived from the uploaded pixels, so these tests cover calibration and export handling rather than hosted model quality.

Relates to #233

@jasonmadigan jasonmadigan changed the title Fix calibration and export races with physical accuracy regressions Preserve physical dimensions through calibration, editing and export Oct 6, 2026
@jasonmadigan
jasonmadigan force-pushed the test/physical-size-accuracy branch from 601a8ce to 04a0cf2 Compare October 7, 2026 10:50
@jasonmadigan jasonmadigan changed the title Preserve physical dimensions through calibration, editing and export Fix sizing errors in scans and STL exports Oct 7, 2026
@jasonmadigan
jasonmadigan force-pushed the test/physical-size-accuracy branch from 04a0cf2 to de1be25 Compare October 7, 2026 10:58
Generate photos of a flat 80 x 30 mm rectangle on A4, Letter and A3 paper.
Check upload resizing, EXIF rotation, tracing and clearance against the
actual downloaded cavity. A separate check rejects pockets with the right
overall dimensions but corners that prevent the tool from fitting.

Segmentation uses the submitted pixels instead of a hosted model. These
tests do not establish model accuracy or account for raised objects.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
The brightness detector could put corners inside a shaded sheet or include
an adjacent bright tabletop. Either mistake changes the physical scale.

Try closed edges with bright paper inside before the existing fallbacks.
Four maintainer photos cover the failure cases; synthetic tests protect
dim-paper detection and prevent selecting a dark rectangular tool. The
photo fixtures have EXIF metadata removed.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
A slow autosave could leave the export using old clearance even after the
page showed Saved. Run saves in order and wait for them before generation.
Hide the previous export while edits or generation are pending.

A failed save now rejects flush(), so generation stops and drawer
navigation keeps the unsaved plan open. An idle flush still does nothing.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
Canceling a browser request does not stop its backend worker. If that
worker finishes last, it can replace a newer STL with old dimensions.

Lock each bin or session from reading its settings through publishing its
files. Other bins can still generate concurrently. Tests hold
one job, verify that the next waits, then measure the final STL. Locks
remain local to the single backend process that owns the JSON stores.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
An 80 mm tool with 0.1 mm clearance could be assigned a two-unit bin whose
stacking lip leaves only 78.3 mm inside, cutting off the cavity ends.

Use the larger wall or lip inset when creating a bin, automatically sizing
it, or adding a tool. Measure exported cavities across both axes, half-grid
sizes, disabled lips and thicker walls.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
After shortening an outline from 80 to 72 mm, moving Detail could restore
the original 80 mm shape. Use the edited outline as the basis for later
Detail changes. Rotate and reflect that basis with the displayed outline,
and restore it together with the slider level during undo and redo.

Also record the first edit after undo so it replaces the redo branch.
Tests cover corrected dimensions, full-detail restoration and transforms.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
Upload a known photo, accept the detected paper corners, save the tool and
measure the STL downloaded through the UI. Cover Accurate and Smooth
output, a slow clearance save, automatic bin sizing and a manual correction
followed by a Detail change.

Run the suite in CI with isolated storage and pixel-based segmentation.
Document the 1 mm limit, the physical-fit check for rounded corners, and
what these tests cannot tell us about real model or raised-object errors.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
Require repository text to describe core behavior, changes and verification.
Link these writing conventions from the shared agent instructions and align
the existing documentation and test description.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
@jasonmadigan
jasonmadigan force-pushed the test/physical-size-accuracy branch from de1be25 to 6701fa6 Compare October 7, 2026 11:07
@jasonmadigan
jasonmadigan marked this pull request as ready for review October 7, 2026 11:12
@jasonmadigan
jasonmadigan merged commit 03badee into main Oct 7, 2026
6 checks passed
@jasonmadigan
jasonmadigan deleted the test/physical-size-accuracy branch October 7, 2026 11:14
jasonmadigan added a commit that referenced this pull request Oct 7, 2026
An older split job could leave 17.45 mm ZIP pockets beside a full STL
that already contained the new 12 mm pockets. The export lock in #234
prevents that mismatch.

Measure both downloads after overlapping bin and session exports, saved
depth changes, per-tool overrides and cached generation.

Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
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.

1 participant

0