diff --git a/generated/COMPONENT_TYPES.md b/generated/COMPONENT_TYPES.md index 0b9f15d3..4f26a8f9 100644 --- a/generated/COMPONENT_TYPES.md +++ b/generated/COMPONENT_TYPES.md @@ -2329,6 +2329,7 @@ export interface AutorouterConfig { cache?: PcbRouteCache traceClearance?: Distance availableJumperTypes?: Array<"1206x4" | "0603"> + allowViaInPad?: boolean groupMode?: | "sequential_trace" | "subcircuit" @@ -2371,6 +2372,12 @@ export const autorouterConfig = z.object({ cache: z.custom((v) => true).optional(), traceClearance: length.optional(), availableJumperTypes: z.array(z.enum(["1206x4", "0603"])).optional(), + allowViaInPad: z + .boolean() + .optional() + .describe( + "Allows the autorouter to place vias inside connected pads. Omitted or false keeps via-in-pad routing disabled.", + ), groupMode: z .enum(["sequential_trace", "subcircuit", "sequential-trace"]) .optional(), diff --git a/generated/PROPS_OVERVIEW.md b/generated/PROPS_OVERVIEW.md index a1a77650..14f9ddf4 100644 --- a/generated/PROPS_OVERVIEW.md +++ b/generated/PROPS_OVERVIEW.md @@ -148,6 +148,7 @@ export interface AutorouterConfig { cache?: PcbRouteCache traceClearance?: Distance availableJumperTypes?: Array<"1206x4" | "0603"> + allowViaInPad?: boolean groupMode?: | "sequential_trace" | "subcircuit" diff --git a/lib/components/group.ts b/lib/components/group.ts index e08d4b17..bcd26477 100644 --- a/lib/components/group.ts +++ b/lib/components/group.ts @@ -335,6 +335,7 @@ export interface AutorouterConfig { cache?: PcbRouteCache traceClearance?: Distance availableJumperTypes?: Array<"1206x4" | "0603"> + allowViaInPad?: boolean groupMode?: | "sequential_trace" | "subcircuit" @@ -404,6 +405,12 @@ export const autorouterConfig = z.object({ cache: z.custom((v) => true).optional(), traceClearance: length.optional(), availableJumperTypes: z.array(z.enum(["1206x4", "0603"])).optional(), + allowViaInPad: z + .boolean() + .optional() + .describe( + "Allows the autorouter to place vias inside connected pads. Omitted or false keeps via-in-pad routing disabled.", + ), groupMode: z .enum(["sequential_trace", "subcircuit", "sequential-trace"]) .optional(), diff --git a/tests/autorouter.test.ts b/tests/autorouter.test.ts index a8792994..f2b1d98e 100644 --- a/tests/autorouter.test.ts +++ b/tests/autorouter.test.ts @@ -1,8 +1,10 @@ import { expect, test } from "bun:test" import { + autorouterConfig, autorouterProp, routingTolerances, subcircuitGroupPropsWithBool, + type AutorouterConfig, type RoutingTolerances, } from "../lib/components/group" @@ -29,6 +31,15 @@ test("supports auto jumper preset", () => { expect(result).toBe("auto_jumper") }) +test("supports opting in to via-in-pad routing", () => { + const enabled: AutorouterConfig = { allowViaInPad: true } + const disabled: AutorouterConfig = { allowViaInPad: false } + + expect(autorouterConfig.parse(enabled).allowViaInPad).toBe(true) + expect(autorouterConfig.parse(disabled).allowViaInPad).toBe(false) + expect(autorouterConfig.parse({}).allowViaInPad).toBeUndefined() +}) + test("supports laser prefab preset", () => { const result = autorouterProp.parse("laser_prefab") expect(result).toBe("laser_prefab")