diff --git a/src/fn/mountedpcbmodule.ts b/src/fn/mountedpcbmodule.ts index 3b62362c..b1c47459 100644 --- a/src/fn/mountedpcbmodule.ts +++ b/src/fn/mountedpcbmodule.ts @@ -108,6 +108,11 @@ export const mountedpcbmodule_def = base_def usbtype: z.enum(["micro", "c"]).optional(), usbmicro: z.boolean().optional().default(false), usbc: z.boolean().optional().default(false), + screen: z + .boolean() + .optional() + .default(false) + .describe("add silkscreen outline for screen/display area"), }) .transform((data) => { const pinlabelAnchorSide = determinePinlabelAnchorSide(data) @@ -255,6 +260,7 @@ export const mountedpcbmodule = ( pinrowbottompins, usbposition, usbtype, + screen, } = parameters let pinlabelTextAlign: "center" | "left" | "right" = "center" if (pinlabeltextalignleft) pinlabelTextAlign = "left" @@ -593,6 +599,19 @@ export const mountedpcbmodule = ( elements.push(silkscreenpath(usbRect, { stroke_width: 0.1, layer: "top" })) } + if (screen) { + const screenOutline = [ + { x: -width * 0.475, y: -height * 0.475 }, + { x: width * 0.475, y: -height * 0.475 }, + { x: width * 0.475, y: height * 0.475 }, + { x: -width * 0.475, y: height * 0.475 }, + { x: -width * 0.475, y: -height * 0.475 }, + ] + elements.push( + silkscreenpath(screenOutline, { stroke_width: 0.05, layer: "top" }), + ) + } + return { circuitJson: elements, parameters, diff --git a/tests/__snapshots__/mountedpcbmodule_screen_1.snap.svg b/tests/__snapshots__/mountedpcbmodule_screen_1.snap.svg new file mode 100644 index 00000000..dd8f6923 --- /dev/null +++ b/tests/__snapshots__/mountedpcbmodule_screen_1.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/mountedpcbmodule_screen.test.ts b/tests/mountedpcbmodule_screen.test.ts new file mode 100644 index 00000000..af7c9364 --- /dev/null +++ b/tests/mountedpcbmodule_screen.test.ts @@ -0,0 +1,12 @@ +import { expect, test } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +test("mountedpcbmodule with screen", () => { + const circuitJson = fp.string("mountedpcbmodule_screen").circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "mountedpcbmodule_screen_1", + ) +})