Skip to content

Conversation

@techmannih
Copy link
Owner

Summary

  • update pack output application to propagate rotation changes to CAD components
  • add regression test ensuring CAD models receive rotation updates from pack results

Testing

  • bun test tests/features/pcb-pack-layout/pack-rotates-cad-models.test.tsx (fails: missing bun-match-svg dependency in preload)

https://chatgpt.com/codex/tasks/task_e_68f120703ec08328b74f59a1a395774e

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +20 to +30
const cadComponents = db.cad_component
.list()
.filter((cad) => cad.pcb_component_id && ids.has(cad.pcb_component_id))

for (const cad of cadComponents) {
const existingRotation = cad.rotation ?? {}
db.cad_component.update(cad.cad_component_id, {
rotation: {
...existingRotation,
z: (existingRotation.z ?? 0) + rotationDegrees,
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Adjust cad rotation sign for bottom-layer components

The new updateCadComponentRotations helper always adds rotationDegrees to the CAD model’s rotation.z. For components on the bottom layer the CAD model rotation is defined as -(accumulatedRotation + offset) + 180 (see CadModel initialization), so applying a positive delta here actually reverses the intended rotation when a pack result rotates the component. After this change, any bottom-layer part that is rotated during packing will have its 3D model spun in the opposite direction. Consider looking up each component’s layer and subtracting the delta for bottom-layer parts (or otherwise mirroring the sign) before updating rotation.z.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants