Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/pcb/pcb_copper_pour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const pcb_copper_pour_base = z.object({
subcircuit_id: z.string().optional(),
layer: layer_ref,
source_net_id: z.string().optional(),
clearance: length.optional(),
covered_with_solder_mask: z.boolean().optional().default(true),
})

Expand All @@ -37,6 +38,7 @@ export interface PcbCopperPourRect {
subcircuit_id?: string
layer: LayerRef
source_net_id?: string
clearance?: Length
shape: "rect"
center: Point
width: Length
Expand All @@ -63,6 +65,7 @@ export interface PcbCopperPourBRep {
subcircuit_id?: string
layer: LayerRef
source_net_id?: string
clearance?: Length
shape: "brep"
brep_shape: BRepShape
}
Expand All @@ -87,6 +90,7 @@ export interface PcbCopperPourPolygon {
subcircuit_id?: string
layer: LayerRef
source_net_id?: string
clearance?: Length
shape: "polygon"
points: Point[]
}
Expand Down
18 changes: 18 additions & 0 deletions tests/pcb_copper_pour.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ test("pcb_copper_pour rect parses", () => {
height: 10,
layer: "top",
source_net_id: "net1",
clearance: 0.2,
})
expect(pour.shape).toBe("rect")
if (pour.shape === "rect") {
expect(pour.width).toBe(10)
expect(pour.clearance).toBe(0.2)
}
expect((pour as any).pcb_copper_pour_id).toBeDefined()
expect(any_circuit_element.parse(pour)).toBeDefined()
Expand Down Expand Up @@ -76,3 +78,19 @@ test("coveredWithSolderMask defaults to true", () => {
})
expect(pour.covered_with_solder_mask).toBe(true)
})

test("pcb_copper_pour clearance is optional", () => {
const pour = pcb_copper_pour.parse({
type: "pcb_copper_pour",
shape: "polygon",
points: [
{ x: 0, y: 0 },
{ x: 10, y: 0 },
{ x: 5, y: 10 },
],
layer: "top",
clearance: "0.33mm",
})

expect(pour.clearance).toBe(0.33)
})
Loading