diff --git a/src/fn/melf.ts b/src/fn/melf.ts
index 036905c3..23fc0f6f 100644
--- a/src/fn/melf.ts
+++ b/src/fn/melf.ts
@@ -1,4 +1,8 @@
-import type { AnySoupElement, PcbSilkscreenPath } from "circuit-json"
+import type {
+ AnySoupElement,
+ PcbCourtyardRect,
+ PcbSilkscreenPath,
+} from "circuit-json"
import { z } from "zod"
import { rectpad } from "../helpers/rectpad"
import { silkscreenRef, type SilkscreenRef } from "src/helpers/silkscreenRef"
@@ -53,10 +57,29 @@ export const melf = (
pcb_silkscreen_path_id: "",
}
+ const h = length.parse(parameters.h)
+ const pl = length.parse(parameters.pl)
+ const p = length.parse(parameters.p)
+ const courtyardPadding = 0.25
+ const crtMinX = -(p / 2 + pl / 2) - courtyardPadding
+ const crtMaxX = p / 2 + pl / 2 + courtyardPadding
+ const crtMinY = -h / 2 - courtyardPadding
+ const crtMaxY = h / 2 + courtyardPadding
+ const courtyard: PcbCourtyardRect = {
+ type: "pcb_courtyard_rect",
+ pcb_courtyard_rect_id: "",
+ pcb_component_id: "",
+ center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
+ width: crtMaxX - crtMinX,
+ height: crtMaxY - crtMinY,
+ layer: "top",
+ }
+
return {
circuitJson: melfWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
+ courtyard as AnySoupElement,
),
parameters,
}
diff --git a/src/fn/micromelf.ts b/src/fn/micromelf.ts
index 183d00aa..d1ce725b 100644
--- a/src/fn/micromelf.ts
+++ b/src/fn/micromelf.ts
@@ -1,4 +1,8 @@
-import type { AnySoupElement, PcbSilkscreenPath } from "circuit-json"
+import type {
+ AnySoupElement,
+ PcbCourtyardRect,
+ PcbSilkscreenPath,
+} from "circuit-json"
import { z } from "zod"
import { rectpad } from "../helpers/rectpad"
import { silkscreenRef, type SilkscreenRef } from "src/helpers/silkscreenRef"
@@ -53,10 +57,29 @@ export const micromelf = (
pcb_silkscreen_path_id: "",
}
+ const h = length.parse(parameters.h)
+ const pl = length.parse(parameters.pl)
+ const p = length.parse(parameters.p)
+ const courtyardPadding = 0.25
+ const crtMinX = -(p / 2 + pl / 2) - courtyardPadding
+ const crtMaxX = p / 2 + pl / 2 + courtyardPadding
+ const crtMinY = -h / 2 - courtyardPadding
+ const crtMaxY = h / 2 + courtyardPadding
+ const courtyard: PcbCourtyardRect = {
+ type: "pcb_courtyard_rect",
+ pcb_courtyard_rect_id: "",
+ pcb_component_id: "",
+ center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
+ width: crtMaxX - crtMinX,
+ height: crtMaxY - crtMinY,
+ layer: "top",
+ }
+
return {
circuitJson: microMelfWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
+ courtyard as AnySoupElement,
),
parameters,
}
diff --git a/src/fn/minimelf.ts b/src/fn/minimelf.ts
index f4130954..659bb05d 100644
--- a/src/fn/minimelf.ts
+++ b/src/fn/minimelf.ts
@@ -1,4 +1,8 @@
-import type { AnySoupElement, PcbSilkscreenPath } from "circuit-json"
+import type {
+ AnySoupElement,
+ PcbCourtyardRect,
+ PcbSilkscreenPath,
+} from "circuit-json"
import { z } from "zod"
import { rectpad } from "../helpers/rectpad"
import { silkscreenRef, type SilkscreenRef } from "src/helpers/silkscreenRef"
@@ -53,10 +57,29 @@ export const minimelf = (
pcb_silkscreen_path_id: "",
}
+ const h = length.parse(parameters.h)
+ const pl = length.parse(parameters.pl)
+ const p = length.parse(parameters.p)
+ const courtyardPadding = 0.25
+ const crtMinX = -(p / 2 + pl / 2) - courtyardPadding
+ const crtMaxX = p / 2 + pl / 2 + courtyardPadding
+ const crtMinY = -h / 2 - courtyardPadding
+ const crtMaxY = h / 2 + courtyardPadding
+ const courtyard: PcbCourtyardRect = {
+ type: "pcb_courtyard_rect",
+ pcb_courtyard_rect_id: "",
+ pcb_component_id: "",
+ center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
+ width: crtMaxX - crtMinX,
+ height: crtMaxY - crtMinY,
+ layer: "top",
+ }
+
return {
circuitJson: miniMelfWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
+ courtyard as AnySoupElement,
),
parameters,
}
diff --git a/tests/kicad-parity/__snapshots__/melf.snap.svg b/tests/kicad-parity/__snapshots__/melf.snap.svg
index 027f8de5..de44ff78 100644
--- a/tests/kicad-parity/__snapshots__/melf.snap.svg
+++ b/tests/kicad-parity/__snapshots__/melf.snap.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/kicad-parity/__snapshots__/micromelf.snap.svg b/tests/kicad-parity/__snapshots__/micromelf.snap.svg
index 3e8f0640..6acbcd5a 100644
--- a/tests/kicad-parity/__snapshots__/micromelf.snap.svg
+++ b/tests/kicad-parity/__snapshots__/micromelf.snap.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/kicad-parity/__snapshots__/minimelf.snap.svg b/tests/kicad-parity/__snapshots__/minimelf.snap.svg
index 2f912989..b188ca79 100644
--- a/tests/kicad-parity/__snapshots__/minimelf.snap.svg
+++ b/tests/kicad-parity/__snapshots__/minimelf.snap.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file