Skip to content

Add cad model board direction and pcbRotationOffset props#617

Merged
seveibar merged 1 commit intomainfrom
codex/add-modelboardnormaldirection-and-pcbrotationoffset
Mar 12, 2026
Merged

Add cad model board direction and pcbRotationOffset props#617
seveibar merged 1 commit intomainfrom
codex/add-modelboardnormaldirection-and-pcbrotationoffset

Conversation

@seveibar
Copy link
Contributor

Motivation

  • Expose CAD model axis orientation and an optional PCB rotation offset so CAD model placement can specify which model axis is the board-normal and apply an additional rotation on the PCB.

Description

  • Added cadModelAxisDirections, CadModelAxisDirection, and cadModelAxisDirection to represent model axis directions ("x+","x-","y+","y-","z+","z-").
  • Extended CadModelBase with modelBoardNormalDirection?: CadModelAxisDirection and pcbRotationOffset?: number and added these to the Zod cadModelBase schema.
  • Added a unit test to tests/cadmodel.test.ts verifying parsing of modelBoardNormalDirection and pcbRotationOffset.
  • Regenerated docs so generated/COMPONENT_TYPES.md and generated/PROPS_OVERVIEW.md reflect the new fields and ran project formatting.

Testing

  • Ran bun test tests/cadmodel.test.ts which passed (8 tests, 0 failures).
  • Ran bunx tsc --noEmit which completed successfully with no type errors.
  • Ran generation scripts bun scripts/generate-component-types.ts, bun scripts/generate-manual-edits-docs.ts, bun scripts/generate-readme-docs.ts, and bun scripts/generate-props-overview.ts which succeeded and updated generated docs.
  • Ran bun run format which formatted files successfully.

Codex Task

Comment on lines +117 to +131
test("cadmodel accepts modelBoardNormalDirection and pcbRotationOffset", () => {
const raw: CadModelPropsInput = {
modelUrl: "https://example.com/model.stl",
modelBoardNormalDirection: "z+",
pcbRotationOffset: 90,
}

const parsed = cadmodelProps.parse(raw) as Exclude<
CadModelPropsInput,
null | string
>

expect(parsed.modelBoardNormalDirection).toBe("z+")
expect(parsed.pcbRotationOffset).toBe(90)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This test file violates the rule that a *.test.ts file may have AT MOST one test(...) function. The file already contains at least one test() function (as evidenced by the existing test ending at line 115), and this diff adds a second test() function starting at line 117. To fix this violation, the new test should be moved to a separate numbered test file, such as 'cadmodel2.test.ts' or similar.

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar merged commit a4c7b9e into main Mar 12, 2026
5 checks passed
@seveibar seveibar deleted the codex/add-modelboardnormaldirection-and-pcbrotationoffset branch March 12, 2026 20:40
@tscircuitbot
Copy link
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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