snapmaker-studio icon indicating copy to clipboard operation
snapmaker-studio copied to clipboard

Placement check reports 'inside' for repeated instances that are off the plate

Open DVOpenLabs opened this issue 1 month ago • 1 comments

Problem

The placement check reports the wrong result when one object is used by more than one build item (a repeated instance).

backend/snapstudio_core/placement.py builds its table of placements with dict(_BUILD_ITEM.findall(root)), which keeps only the last transform for each object id. plate_placement._printable_only then gives every instance of that object the footprint of the last one.

Reproduction (on main b01f7d0)

A project with one cube object and two build items that use the same object id, one at X=500 and one at X=100 (the first is far outside the U1 bed). With a model_settings.config part record present, plate_placement.assess() returns:

  • off_plate count 0
  • both items at position (105, 105)
  • the summary "Every object sits inside the Snapmaker U1's printable area."

The instance at X=500 is not inside the printable area.

Impact

A false "inside" result for repeated instances. It is a claim that a printable area check passed when it did not.

Notes

  • Found during plan review for the read-only 3D project inspection. That work does not fix this; it disables engine-derived out-of-bounds highlighting for objects with more than one build item and says so.
  • Fix direction: key placement by build item (ordinal and component path), not by object id; add a repeated-instance fixture and compare per-instance results with the scene's world bounds.
  • Orca's own "add instance" output was not checked, so how common this layout is in real projects is not known.

DVOpenLabs avatar Oct 08 '26 23:10 DVOpenLabs

Verified after the merge of #102 (849e156). On merged main (tree identical to the verified #102 head) test_repeated_instance_placement.py and test_repeated_component.py pass, including the issue's reproduction in both orders (X=500 and X=100: the X=500 instance is reported off the plate, the other inside), both-off, all-inside, per-component, nested-transform, per-plate and scene-world-bounds cases (50 tests across the placement files). Full backend suite on the merged tree: 3649 passed, 49 skipped; all 8 CI checks green. Coverage limit by design: projects whose physical size the file does not establish (non-millimetre unit, rotated or scaled item) report the placement check as not checked instead of a per-instance verdict. Orca's own 'add instance' output was still not checked.

DVOpenLabs avatar Oct 22 '26 10:10 DVOpenLabs