Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subcircuit_id and pcb_group_id to pcb elements #121

Merged
merged 2 commits into from
Jan 20, 2025
Merged
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
4 changes: 4 additions & 0 deletions src/pcb/pcb_board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const pcb_board = z
.object({
type: z.literal("pcb_board"),
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
is_subcircuit: z.boolean().optional(),
subcircuit_id: z.string().optional(),
width: length,
height: length,
center: point,
Expand All @@ -22,6 +24,8 @@ export const pcb_board = z
export interface PcbBoard {
type: "pcb_board"
pcb_board_id: string
is_subcircuit?: boolean
subcircuit_id?: string
width: Length
height: Length
thickness: Length
Expand Down
2 changes: 2 additions & 0 deletions src/pcb/pcb_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const pcb_component = z
rotation: rotation,
width: length,
height: length,
subcircuit_id: z.string().optional(),
})
.describe("Defines a component on the PCB")

Expand All @@ -27,6 +28,7 @@ export interface PcbComponent {
type: "pcb_component"
pcb_component_id: string
source_component_id: string
subcircuit_id?: string
center: Point
layer: LayerRef
rotation: Rotation
Expand Down
2 changes: 2 additions & 0 deletions src/pcb/pcb_fabrication_note_path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const pcb_fabrication_note_path = z
"pcb_fabrication_note_path",
),
pcb_component_id: z.string(),
subcircuit_id: z.string().optional(),
layer: layer_ref,
route: z.array(point),
stroke_width: length,
Expand All @@ -37,6 +38,7 @@ export interface PcbFabricationNotePath {
type: "pcb_fabrication_note_path"
pcb_fabrication_note_path_id: string
pcb_component_id: string
subcircuit_id?: string
layer: LayerRef
route: Point[]
stroke_width: Length
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_fabrication_note_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const pcb_fabrication_note_text = z
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
"pcb_fabrication_note_text",
),
subcircuit_id: z.string().optional(),
pcb_group_id: z.string().optional(),
font: z.literal("tscircuit2024").default("tscircuit2024"),
font_size: distance.default("1mm"),
pcb_component_id: z.string(),
Expand All @@ -41,6 +43,8 @@ type InferredPcbFabricationNoteText = z.infer<typeof pcb_fabrication_note_text>
export interface PcbFabricationNoteText {
type: "pcb_fabrication_note_text"
pcb_fabrication_note_text_id: string
subcircuit_id?: string
pcb_group_id?: string
font: "tscircuit2024"
font_size: Length
pcb_component_id: string
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const pcb_group = z
.object({
type: z.literal("pcb_group"),
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
is_subcircuit: z.boolean().optional(),
subcircuit_id: z.string().optional(),
width: length,
height: length,
center: point,
Expand All @@ -25,6 +27,8 @@ type InferredPcbGroup = z.infer<typeof pcb_group>
export interface PcbGroup {
type: "pcb_group"
pcb_group_id: string
is_subcircuit?: boolean
subcircuit_id?: string
width: Length
height: Length
center: Point
Expand Down
8 changes: 8 additions & 0 deletions src/pcb/pcb_hole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { expectTypesMatch } from "src/utils/expect-types-match"
const pcb_hole_circle_or_square = z.object({
type: z.literal("pcb_hole"),
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
hole_shape: z.enum(["circle", "square"]),
hole_diameter: z.number(),
x: distance,
Expand All @@ -28,6 +30,8 @@ type InferredPcbHoleCircleOrSquare = z.infer<typeof pcb_hole_circle_or_square>
export interface PcbHoleCircleOrSquare {
type: "pcb_hole"
pcb_hole_id: string
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "circle" | "square"
hole_diameter: number
x: Distance
Expand All @@ -39,6 +43,8 @@ expectTypesMatch<PcbHoleCircleOrSquare, InferredPcbHoleCircleOrSquare>(true)
const pcb_hole_oval = z.object({
type: z.literal("pcb_hole"),
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
hole_shape: z.literal("oval"),
hole_width: z.number(),
hole_height: z.number(),
Expand All @@ -59,6 +65,8 @@ type InferredPcbHoleOval = z.infer<typeof pcb_hole_oval>
export interface PcbHoleOval {
type: "pcb_hole"
pcb_hole_id: string
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "oval"
hole_width: number
hole_height: number
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_keepout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const pcb_keepout = z
.object({
type: z.literal("pcb_keepout"),
shape: z.literal("rect"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
width: distance,
height: distance,
Expand All @@ -17,6 +19,8 @@ export const pcb_keepout = z
z.object({
type: z.literal("pcb_keepout"),
shape: z.literal("circle"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
radius: distance,
pcb_keepout_id: z.string(),
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_manual_edit_conflict_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const pcb_manual_edit_conflict_error = z
pcb_error_id: getZodPrefixedIdWithDefault("pcb_manual_edit_conflict_error"),
message: z.string(),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
source_component_id: z.string(),
})
.describe(
Expand All @@ -29,6 +31,8 @@ export interface PcbManualEditConflictError {
pcb_error_id: string
message: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
source_component_id: string
}

Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_missing_footprint_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const pcb_missing_footprint_error = z
pcb_missing_footprint_error_id: getZodPrefixedIdWithDefault(
"pcb_missing_footprint_error",
),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
error_type: z.literal("pcb_missing_footprint_error"),
source_component_id: z.string(),
message: z.string(),
Expand All @@ -27,6 +29,8 @@ type InferredPcbMissingFootprintError = z.infer<
export interface PcbMissingFootprintError {
type: "pcb_missing_footprint_error"
pcb_missing_footprint_error_id: string
pcb_group_id?: string
subcircuit_id?: string
error_type: "pcb_missing_footprint_error"
source_component_id: string
message: string
Expand Down
12 changes: 12 additions & 0 deletions src/pcb/pcb_plated_hole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { expectTypesMatch } from "src/utils/expect-types-match"
const pcb_plated_hole_circle = z.object({
type: z.literal("pcb_plated_hole"),
shape: z.literal("circle"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
outer_diameter: z.number(),
hole_diameter: z.number(),
x: distance,
Expand All @@ -24,6 +26,8 @@ const pcb_plated_hole_circle = z.object({
export interface PcbPlatedHoleCircle {
type: "pcb_plated_hole"
shape: "circle"
pcb_group_id?: string
subcircuit_id?: string
outer_diameter: number
hole_diameter: number
x: Distance
Expand All @@ -38,6 +42,8 @@ export interface PcbPlatedHoleCircle {
const pcb_plated_hole_oval = z.object({
type: z.literal("pcb_plated_hole"),
shape: z.enum(["oval", "pill"]),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
outer_width: z.number(),
outer_height: z.number(),
hole_width: z.number(),
Expand All @@ -57,6 +63,8 @@ const pcb_plated_hole_oval = z.object({
export interface PcbPlatedHoleOval {
type: "pcb_plated_hole"
shape: "oval" | "pill"
pcb_group_id?: string
subcircuit_id?: string
outer_width: number
outer_height: number
hole_width: number
Expand All @@ -73,6 +81,8 @@ export interface PcbPlatedHoleOval {
const pcb_circular_hole_with_rect_pad = z.object({
type: z.literal("pcb_plated_hole"),
shape: z.literal("circular_hole_with_rect_pad"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
hole_shape: z.literal("circle"),
pad_shape: z.literal("rect"),
hole_diameter: z.number(),
Expand All @@ -90,6 +100,8 @@ const pcb_circular_hole_with_rect_pad = z.object({
export interface PcbHoleCircularWithRectPad {
type: "pcb_plated_hole"
shape: "circular_hole_with_rect_pad"
pcb_group_id?: string
subcircuit_id?: string
hole_shape: "circle"
pad_shape: "rect"
hole_diameter: number
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_port.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const pcb_port = z
.object({
type: z.literal("pcb_port"),
pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
source_port_id: z.string(),
pcb_component_id: z.string(),
x: distance,
Expand All @@ -25,6 +27,8 @@ type InferredPcbPort = z.infer<typeof pcb_port>
export interface PcbPort {
type: "pcb_port"
pcb_port_id: string
pcb_group_id?: string
subcircuit_id?: string
source_port_id: string
pcb_component_id: string
x: Distance
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const pcb_silkscreen_circle = z
"pcb_silkscreen_circle",
),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
radius: length,
layer: visible_layer,
Expand All @@ -32,6 +34,8 @@ export interface PcbSilkscreenCircle {
type: "pcb_silkscreen_circle"
pcb_silkscreen_circle_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
radius: Length
layer: VisibleLayer
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const pcb_silkscreen_line = z
type: z.literal("pcb_silkscreen_line"),
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
stroke_width: distance.default("0.1mm"),
x1: distance,
y1: distance,
Expand All @@ -33,6 +35,8 @@ export interface PcbSilkscreenLine {
type: "pcb_silkscreen_line"
pcb_silkscreen_line_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
stroke_width: Distance
x1: Distance
y1: Distance
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_oval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const pcb_silkscreen_oval = z
type: z.literal("pcb_silkscreen_oval"),
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
radius_x: distance,
radius_y: distance,
Expand All @@ -31,6 +33,8 @@ export interface PcbSilkscreenOval {
type: "pcb_silkscreen_oval"
pcb_silkscreen_oval_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
radius_x: Distance
radius_y: Distance
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const pcb_silkscreen_path = z
type: z.literal("pcb_silkscreen_path"),
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
layer: visible_layer,
route: z.array(point),
stroke_width: length,
Expand All @@ -28,6 +30,8 @@ export interface PcbSilkscreenPath {
type: "pcb_silkscreen_path"
pcb_silkscreen_path_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
layer: VisibleLayerRef
route: Point[]
stroke_width: Length
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_pill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const pcb_silkscreen_pill = z
type: z.literal("pcb_silkscreen_pill"),
pcb_silkscreen_pill_id: getZodPrefixedIdWithDefault("pcb_silkscreen_pill"),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
width: length,
height: length,
Expand All @@ -26,6 +28,8 @@ export interface PcbSilkscreenPill {
type: "pcb_silkscreen_pill"
pcb_silkscreen_pill_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
width: Length
height: Length
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const pcb_silkscreen_rect = z
type: z.literal("pcb_silkscreen_rect"),
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
pcb_component_id: z.string(),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
center: point,
width: length,
height: length,
Expand All @@ -26,6 +28,8 @@ export interface PcbSilkscreenRect {
type: "pcb_silkscreen_rect"
pcb_silkscreen_rect_id: string
pcb_component_id: string
pcb_group_id?: string
subcircuit_id?: string
center: Point
width: Length
height: Length
Expand Down
4 changes: 4 additions & 0 deletions src/pcb/pcb_silkscreen_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const pcb_silkscreen_text = z
.object({
type: z.literal("pcb_silkscreen_text"),
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
font: z.literal("tscircuit2024").default("tscircuit2024"),
font_size: distance.default("0.2mm"),
pcb_component_id: z.string(),
Expand All @@ -31,6 +33,8 @@ type InferredPcbSilkscreenText = z.infer<typeof pcb_silkscreen_text>
export interface PcbSilkscreenText {
type: "pcb_silkscreen_text"
pcb_silkscreen_text_id: string
pcb_group_id?: string
subcircuit_id?: string
font: "tscircuit2024"
font_size: Length
pcb_component_id: string
Expand Down
Loading
Loading