-
Notifications
You must be signed in to change notification settings - Fork 33
Add pad stackup support for plated holes #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| test("parse hole with pad stackup defaults hole offset to 0", () => { | ||
| const hole = pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "circle", | ||
| hole_diameter: 0.3, | ||
| x: 1, | ||
| y: 2, | ||
| layers: ["top", "bottom"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "rect", | ||
| width: 0.9, | ||
| height: 0.7, | ||
| ccw_rotation: 15, | ||
| }, | ||
| }, | ||
| { | ||
| layer: "bottom", | ||
| shape: { | ||
| type: "polygon", | ||
| pad_outline: [ | ||
| { x: -0.4, y: -0.3 }, | ||
| { x: 0.4, y: -0.3 }, | ||
| { x: 0, y: 0.5 }, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| }) as PcbHoleWithPadStackup | ||
|
|
||
| expect(hole.hole_offset_x).toBe(0) | ||
| expect(hole.hole_offset_y).toBe(0) | ||
| expect(hole.pad_stackup[0]?.shape).toEqual({ | ||
| type: "rect", | ||
| width: 0.9, | ||
| height: 0.7, | ||
| ccw_rotation: 15, | ||
| }) | ||
| expect(hole.pad_stackup[1]?.shape.type).toBe("polygon") | ||
| }) | ||
|
|
||
| test("hole with pad stackup requires hole dimensions for non-circular holes", () => { | ||
| expect(() => | ||
| pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "oval", | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "circle", | ||
| outer_diameter: 0.6, | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ).toThrow() | ||
| }) | ||
|
|
||
| test("hole with pad stackup requires rotation for rotated pill holes", () => { | ||
| expect(() => | ||
| pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "rotated_pill", | ||
| hole_width: 0.4, | ||
| hole_height: 0.9, | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "pill", | ||
| width: 0.6, | ||
| height: 0.9, | ||
| }, | ||
| }, | ||
| ], | ||
| }), | ||
| ).toThrow() | ||
|
|
||
| const rotatedPillHole = pcb_plated_hole.parse({ | ||
| type: "pcb_plated_hole", | ||
| shape: "hole_with_pad_stackup", | ||
| hole_shape: "rotated_pill", | ||
| hole_width: 0.4, | ||
| hole_height: 0.9, | ||
| hole_ccw_rotation: 45, | ||
| x: 0, | ||
| y: 0, | ||
| layers: ["top"], | ||
| pad_stackup: [ | ||
| { | ||
| layer: "top", | ||
| shape: { | ||
| type: "rotated_pill", | ||
| width: 0.6, | ||
| height: 0.9, | ||
| ccw_rotation: 90, | ||
| }, | ||
| }, | ||
| ], | ||
| }) as PcbHoleWithPadStackup | ||
|
|
||
| expect(rotatedPillHole.hole_ccw_rotation).toBe(45) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file contains 3 test() calls (lines 7, 51, and 73), but according to the style guide rule about test file organization, a *.test.ts file may have AT MOST one test(...) function. After that, the user should split into multiple, numbered files. To fix this, split the tests into separate files like: pcb_hole_with_pad_stackup1.test.ts, pcb_hole_with_pad_stackup2.test.ts, and pcb_hole_with_pad_stackup3.test.ts, with each file containing only one test() call.
Spotted by Graphite Agent (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
|
CC @Abse2001 |
Summary
Testing
Codex Task