Skip to content

Commit

Permalink
Add subcircuit_id and pcb_group_id to pcb elements
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Jan 20, 2025
1 parent f7d307d commit 9730615
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 0 deletions.
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
3 changes: 3 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,7 @@ export const pcb_fabrication_note_text = z
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
"pcb_fabrication_note_text",
),
subcircuit_id: z.string().optional(),
font: z.literal("tscircuit2024").default("tscircuit2024"),
font_size: distance.default("1mm"),
pcb_component_id: z.string(),
Expand All @@ -41,6 +42,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
2 changes: 2 additions & 0 deletions src/pcb/pcb_plated_hole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const pcb_plated_hole_circle = z.object({
pcb_component_id: z.string().optional(),
pcb_port_id: z.string().optional(),
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
})

/**
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
2 changes: 2 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 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
12 changes: 12 additions & 0 deletions src/pcb/pcb_smtpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const pcb_smtpad_circle = z.object({
type: z.literal("pcb_smtpad"),
shape: z.literal("circle"),
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
x: distance,
y: distance,
radius: z.number(),
Expand All @@ -21,6 +23,8 @@ const pcb_smtpad_rect = z.object({
type: z.literal("pcb_smtpad"),
shape: z.literal("rect"),
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
x: distance,
y: distance,
width: z.number(),
Expand All @@ -35,6 +39,8 @@ const pcb_smtpad_rotated_rect = z.object({
type: z.literal("pcb_smtpad"),
shape: z.literal("rotated_rect"),
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
pcb_group_id: z.string().optional(),
subcircuit_id: z.string().optional(),
x: distance,
y: distance,
width: z.number(),
Expand Down Expand Up @@ -62,6 +68,8 @@ export interface PcbSmtPadCircle {
type: "pcb_smtpad"
shape: "circle"
pcb_smtpad_id: string
pcb_group_id?: string
subcircuit_id?: string
x: Distance
y: Distance
radius: number
Expand All @@ -78,6 +86,8 @@ export interface PcbSmtPadRect {
type: "pcb_smtpad"
shape: "rect"
pcb_smtpad_id: string
pcb_group_id?: string
subcircuit_id?: string
x: Distance
y: Distance
width: number
Expand All @@ -95,6 +105,8 @@ export interface PcbSmtPadRotatedRect {
type: "pcb_smtpad"
shape: "rotated_rect"
pcb_smtpad_id: string
pcb_group_id?: string
subcircuit_id?: string
x: Distance
y: Distance
width: number
Expand Down
Loading

0 comments on commit 9730615

Please sign in to comment.