diff --git a/src/pcb/pcb_copper_pour.ts b/src/pcb/pcb_copper_pour.ts index 88762f67..54829c44 100644 --- a/src/pcb/pcb_copper_pour.ts +++ b/src/pcb/pcb_copper_pour.ts @@ -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), }) @@ -37,6 +38,7 @@ export interface PcbCopperPourRect { subcircuit_id?: string layer: LayerRef source_net_id?: string + clearance?: Length shape: "rect" center: Point width: Length @@ -63,6 +65,7 @@ export interface PcbCopperPourBRep { subcircuit_id?: string layer: LayerRef source_net_id?: string + clearance?: Length shape: "brep" brep_shape: BRepShape } @@ -87,6 +90,7 @@ export interface PcbCopperPourPolygon { subcircuit_id?: string layer: LayerRef source_net_id?: string + clearance?: Length shape: "polygon" points: Point[] } diff --git a/tests/pcb_copper_pour.test.ts b/tests/pcb_copper_pour.test.ts index 5c0911e8..5f4bf7ef 100644 --- a/tests/pcb_copper_pour.test.ts +++ b/tests/pcb_copper_pour.test.ts @@ -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() @@ -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) +})