Skip to content

fix: drop imported models onto the workplane centre - #91

Open
FutuRiata wants to merge 1 commit into
Formsmith746:mainfrom
FutuRiata:upstream-fix/import-centering
Open

fix: drop imported models onto the workplane centre#91
FutuRiata wants to merge 1 commit into
Formsmith746:mainfrom
FutuRiata:upstream-fix/import-centering

Conversation

@FutuRiata

Copy link
Copy Markdown

Every importer places the imported shape at a fixed offset:

x: 10,
z: -10,

The same pair is repeated in stlImport.ts, objImport.ts and svgImport.ts.

By the time this object is built the geometry has already been centred on its own bounding box in X and Z and seated on the plane in Y — the work of bringing the model to the origin is done, and the last step deliberately undoes part of it.

Two reasons this is worth changing:

It does not scale with anything. On a 35 mm part the offset is visible; on a 190 mm model it reads as a rounding error rather than a decision.

It is awkward to undo. The shape panel has no X or Y field, so the only numeric way to move a shape is the arrow keys, one snap step per press — and the direction depends on the current camera angle. Returning an import to the centre is ten presses per axis.

Users arriving from other browser CAD tools expect the import to land where they are already looking.

If the offset exists so that an imported model does not land on top of a primitive created at the origin, the offset still seems like the wrong lever: it is in the way every time and helps in one narrow case. Offsetting the new primitive when the spot is taken would fit better — happy to look at that instead if you prefer.

Six lines changed across three files. All 264 tests pass unchanged; tsc --noEmit is clean.

Every importer places the imported shape at a fixed offset:

  x: 10,
  z: -10,

The same pair is repeated in stlImport, objImport and svgImport.

By the time this object is built, the geometry has already been centred
on its own bounding box in X and Z and seated on the plane in Y — so the
work of bringing the model to the origin is done, and the last step
deliberately undoes part of it.

The offset does not scale with anything. On a 35 mm part it is visible;
on a 190 mm model it reads as a rounding error rather than a decision.

It is also awkward to undo: the shape panel has no X or Y field, so the
only numeric way to move a shape is the arrow keys, one snap step per
press — and the direction depends on the current camera angle.

Zeroing the pair puts the model where the user is already looking. Users
arriving from other browser CAD tools expect exactly that.

If the offset exists so that an imported model does not land on top of a
primitive created at the origin, the offset is still the wrong lever: it
is in the way every time and helps in one narrow case. Offsetting the
*new primitive* when the spot is taken would fit better.

264 tests pass unchanged.
mhaeu pushed a commit to mhaeu/SketchForge-3D that referenced this pull request Sep 9, 2026
Every importer places the imported shape at a fixed offset:

  x: 10,
  z: -10,

The same pair is repeated in stlImport, objImport and svgImport.

By the time this object is built, the geometry has already been centred
on its own bounding box in X and Z and seated on the plane in Y — so the
work of bringing the model to the origin is done, and the last step
deliberately undoes part of it.

The offset does not scale with anything. On a 35 mm part it is visible;
on a 190 mm model it reads as a rounding error rather than a decision.

It is also awkward to undo: the shape panel has no X or Y field, so the
only numeric way to move a shape is the arrow keys, one snap step per
press — and the direction depends on the current camera angle.

Zeroing the pair puts the model where the user is already looking. Users
arriving from other browser CAD tools expect exactly that.

If the offset exists so that an imported model does not land on top of a
primitive created at the origin, the offset is still the wrong lever: it
is in the way every time and helps in one narrow case. Offsetting the
*new primitive* when the spot is taken would fit better.

264 tests pass unchanged.

Applied-from: Formsmith746#91 (upstream nicht gemergt)
Applied-by: Claude Opus 5 <noreply@anthropic.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