Skip to content

Preserve imported rectangular pad and silkscreen orientation - #4950

Open
sakunotec wants to merge 6 commits into
tscircuit:mainfrom
sakunotec:fix/imported-rectangle-rotation
Open

sakunotec wants to merge 6 commits into
tscircuit:mainfrom
sakunotec:fix/imported-rectangle-rotation

Conversation

@sakunotec

@sakunotec sakunotec commented Oct 27, 2026 •

Copy link
Copy Markdown

Importing a footprint with a rotated rectangular plated pad or silkscreen rectangle drops its angle. Forward rect_ccw_rotation to the plated hole and restore silkscreen rectangle orientation through fromCircuitJson, following the existing SolderPaste import pattern. The imported angle stays separate from immutable authored props, without expanding the public props API.

Geometry checks also exposed a bottom-layer issue: decomposing a reflected placement matrix picks a different reflection axis, reversing arbitrary pad angles. Derive plated-hole orientation from the transformed local +X direction, matching SilkscreenRect and the same placement matrix used for the center.

Reproduction context: #4945 by anil08607. The two new visual regressions compare emitted rectangle corners with independently imported corner paths, including 35° local rotation, parent rotations 0/90/180/270/25°, omitted and quarter-turn local angles, nonzero local centers, both layers, and unchanged input records. Both tests fail on unchanged main; after the import-only change, the plated-pad test still fails on the bottom layer, and the placement correction resolves it.

Validation:

  • Related suite: 50 passed, 2 failed across 46 files. Both failures are pre-existing SVG mismatches: subcircuit-inflate-primitives (0.01%) and plated-hole-paste-rotation (0.12%). Running untouched main with the same dependencies reproduces both; their diff PNG SHA-256 hashes are identical before and after. The existing oval-pad snapshot is updated for the corrected bottom-layer orientation and an independent corner-path check; unrelated snapshots are unchanged.
  • Final focused coverage: the two new import regressions and the strengthened native oval-pad regression pass (3 tests, 262 assertions). The new native geometry assertion fails on unchanged source with a 1.4855 mm corner mismatch. All three SVGs were rendered and visually inspected.
  • Full TypeScript check, ESM/declaration build, all three distribution smoke checks, repository-wide formatting, and diff check pass.
  • The complete repository test suite was not run locally.

Developed with AI assistance; reproduction, implementation and validation were run locally.

@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Oct 27, 2026 8:34am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 126cbe29 Deployed Oct 27, 2026 by vercel[bot]
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