Fix packed-component CAD rotation in core so 3D models match post-pack footprint orientation#2064
Conversation
…k footprint orientation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| const totalRotation = | ||
| pcbComponent?.position_mode === "packed" | ||
| ? (pcbComponent.rotation ?? preLayoutRotation) | ||
| : preLayoutRotation |
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
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
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
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) ✅