@tscircuit/props 0.0.665 → 0.0.667

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -321,6 +321,12 @@ export interface RoutingTolerances {
321
321
  minViaHoleEdgeToViaHoleEdgeClearance?: Distance
322
322
  minPlatedHoleDrillEdgeToDrillEdgeClearance?: Distance
323
323
  minTraceToPadEdgeClearance?: Distance
324
+ /**
325
+ * Minimum trace copper edge to non-plated hole edge clearance. Numbers are mm;
326
+ * unit strings are normalized to mm. Must be finite and non-negative. Omitted
327
+ * leaves the router default unchanged. Independent of pad clearance, with no aliases.
328
+ */
329
+ minTraceToHoleEdgeClearance?: Distance
324
330
  minPadEdgeToPadEdgeClearance?: Distance
325
331
  minBoardEdgeClearance?: Distance
326
332
  minViaEdgeToPadEdgeClearance?: Distance
@@ -402,6 +408,11 @@ export const routingTolerances = z.object({
402
408
  minViaEdgeToPadEdgeClearance: length.optional(),
403
409
  minPlatedHoleDrillEdgeToDrillEdgeClearance: length.optional(),
404
410
  minTraceToPadEdgeClearance: length.optional(),
411
+ minTraceToHoleEdgeClearance: length
412
+ .refine((value) => Number.isFinite(value) && value >= 0, {
413
+ message: "minTraceToHoleEdgeClearance must be finite and non-negative",
414
+ })
415
+ .optional(),
405
416
  minPadEdgeToPadEdgeClearance: length.optional(),
406
417
  minBoardEdgeClearance: length.optional(),
407
418
  minViaHoleDiameter: length.optional(),
@@ -0,0 +1,42 @@
1
+ import { rotation } from "circuit-json"
2
+ import { distance, type Distance } from "lib/common/distance"
3
+ import { expectTypesMatch } from "lib/typecheck"
4
+ import { z } from "zod"
5
+
6
+ /** A bend on a flat flex PCB. Does not change fabrication coordinates. */
7
+ export interface PcbBendProps {
8
+ name?: string
9
+ /** Start/end of the bend-zone centerline in the parent PCB coordinate system. */
10
+ x1: Distance
11
+ y1: Distance
12
+ x2: Distance
13
+ y2: Distance
14
+ /** Signed degrees (or an angle string). Positive folds toward the local top face. */
15
+ bendAngle: number | string
16
+ /** Positive neutral-surface radius, in mm or a distance string. */
17
+ bendRadius: Distance
18
+ /** Moving side, looking from (x1, y1) toward (x2, y2) in the flat layout. */
19
+ bendSide: "left" | "right"
20
+ }
21
+
22
+ const finiteDistance = distance.pipe(z.number().finite())
23
+
24
+ export const pcbBendProps = z
25
+ .object({
26
+ name: z.string().optional(),
27
+ x1: finiteDistance,
28
+ y1: finiteDistance,
29
+ x2: finiteDistance,
30
+ y2: finiteDistance,
31
+ bendAngle: rotation.pipe(z.number().finite()),
32
+ bendRadius: distance.pipe(z.number().finite().positive()),
33
+ bendSide: z.enum(["left", "right"]),
34
+ })
35
+ .refine(({ x1, y1, x2, y2 }) => x1 !== x2 || y1 !== y2, {
36
+ message: "Bend centerline endpoints must be distinct",
37
+ path: ["x2"],
38
+ })
39
+
40
+ expectTypesMatch<PcbBendProps, z.input<typeof pcbBendProps>>(true)
41
+
42
+ export type PcbBendPropsInput = z.input<typeof pcbBendProps>
@@ -0,0 +1,48 @@
1
+ import { distance } from "lib/common/distance"
2
+ import { pcbLayoutProps } from "lib/common/layout"
3
+ import { z } from "zod"
4
+
5
+ const positiveDistance = distance.pipe(z.number().finite().positive())
6
+ const finiteDistance = distance.pipe(z.number().finite())
7
+ const stiffenerBaseProps = pcbLayoutProps.omit({ layer: true }).extend({
8
+ name: z.string().optional(),
9
+ /** Board attachment face, not a copper-layer assignment. Required. */
10
+ layer: z.enum(["top", "bottom"]),
11
+ material: z.enum(["fr4", "polyimide", "stainless_steel", "aluminum"]),
12
+ /** Stiffener material thickness only, excluding PCB and adhesive. */
13
+ thickness: positiveDistance,
14
+ /** Nonnegative adhesive thickness; omission means unspecified, not zero. */
15
+ adhesiveThickness: distance
16
+ .pipe(z.number().finite().nonnegative())
17
+ .optional(),
18
+ })
19
+
20
+ export const pcbStiffenerProps = z.discriminatedUnion("shape", [
21
+ stiffenerBaseProps.extend({
22
+ shape: z.literal("rect"),
23
+ width: positiveDistance,
24
+ height: positiveDistance,
25
+ outline: z.never().optional(),
26
+ }),
27
+ stiffenerBaseProps.extend({
28
+ shape: z.literal("polygon"),
29
+ /** Local vertices transformed by pcbX/pcbY/pcbRotation; implicitly closed. */
30
+ outline: z
31
+ .array(z.object({ x: finiteDistance, y: finiteDistance }))
32
+ .min(3)
33
+ .refine((points) => {
34
+ const twiceArea = points.reduce((sum, p, i) => {
35
+ const next = points[(i + 1) % points.length]!
36
+ return sum + p.x * next.y - next.x * p.y
37
+ }, 0)
38
+ return Number.isFinite(twiceArea) && twiceArea !== 0
39
+ }, "Stiffener outline must enclose a nonzero area"),
40
+ width: z.never().optional(),
41
+ height: z.never().optional(),
42
+ }),
43
+ ])
44
+
45
+ /** Bonded mechanical reinforcement; does not add copper layers or a rigid stackup. */
46
+ export type PcbStiffenerProps = z.input<typeof pcbStiffenerProps>
47
+
48
+ export type PcbStiffenerPropsInput = z.input<typeof pcbStiffenerProps>
package/lib/index.ts CHANGED
@@ -27,6 +27,8 @@ export * from "./common/kicadPinMetadata"
27
27
  export * from "./customDrc"
28
28
 
29
29
  export * from "./components/board"
30
+ export * from "./components/pcb-bend"
31
+ export * from "./components/pcb-stiffener"
30
32
  export * from "./components/panel"
31
33
  export * from "./components/subpanel"
32
34
  export * from "./components/breakout"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.665",
3
+ "version": "0.0.667",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",