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
26 changes: 25 additions & 1 deletion src/fn/smb.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,30 @@ export const smb = (
pcb_silkscreen_path_id: "",
}

const w = length.parse(parameters.w)
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: smbWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
courtyard as AnySoupElement,
),
parameters,
}
Expand Down
25 changes: 24 additions & 1 deletion src/fn/smbf.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 smbf = (
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: smbfWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
courtyard as AnySoupElement,
),
parameters,
}
Expand Down
25 changes: 24 additions & 1 deletion src/fn/smc.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 @@ -49,10 +53,29 @@ export const smc = (
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: smcWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
courtyard as AnySoupElement,
),
parameters,
}
Expand Down
25 changes: 24 additions & 1 deletion src/fn/smf.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 smf = (
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: smfWithoutParsing(parameters).concat(
silkscreenLine as AnySoupElement,
silkscreenRefText as AnySoupElement,
courtyard as AnySoupElement,
),
parameters,
}
Expand Down
Loading