Fix packed-component CAD rotation in core so 3D models match post-pack footprint orientation#2064
Merged
rushabhcodes merged 3 commits intotscircuit:mainfrom Mar 20, 2026
Conversation
…k footprint orientation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
seveibar
approved these changes
Mar 20, 2026
imrishabh18
reviewed
Mar 20, 2026
Comment on lines
+1456
to
+1459
| const totalRotation = | ||
| pcbComponent?.position_mode === "packed" | ||
| ? (pcbComponent.rotation ?? preLayoutRotation) | ||
| : preLayoutRotation |
Member
There was a problem hiding this comment.
Why do you have explicitly check for the packed position mode? If rotation is present just use that
Contributor
Author
There was a problem hiding this comment.
cant do that, pcb_component.rotation is often populated as 0 even when rotation is inherited from a parent group transform.
There was a problem hiding this comment.
Pull request overview
Fixes a rotation mismatch in tscircuit/core where PCB-packed components could end up with correctly rotated footprints/pads but incorrectly oriented 3D CAD models.
Changes:
- Adjusts CAD Z-rotation derivation in
NormalComponent.doInitialCadModelRenderto preferpcb_component.rotationover a pre-layout transform-derived rotation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/components/base-components/NormalComponent/NormalComponent.ts
Outdated
Show resolved
Hide resolved
lib/components/base-components/NormalComponent/NormalComponent.ts
Outdated
Show resolved
Hide resolved
imrishabh18
approved these changes
Mar 20, 2026
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
This PR fixes a subtle rotation mismatch in
tscircuit/corewhere packed components could have correctly rotated PCB pads/footprints but incorrectly oriented CAD models in 3D output.Problem
During CAD model insertion,
zrotation was derived from pre-layout transforms.For components moved/rotated by PCB packing (
position_mode: "packed"), this could diverge from the actual post-packpcb_component.rotation, causing CAD model misalignment relative to footprint pads.Fix
lib/components/base-components/NormalComponent/NormalComponent.tsposition_mode === "packed", CAD model rotation uses post-packpcb_component.rotation.Why this is high impact
tscircuit/core) ✅