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
25 changes: 24 additions & 1 deletion src/fn/melf.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
}
Expand Down
25 changes: 24 additions & 1 deletion src/fn/micromelf.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
}
Expand Down
25 changes: 24 additions & 1 deletion src/fn/minimelf.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion tests/kicad-parity/__snapshots__/melf.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/kicad-parity/__snapshots__/micromelf.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading