@tscircuit/3d-viewer 0.0.549 → 0.0.551

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.
Files changed (2) hide show
  1. package/dist/index.js +1813 -153
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -14658,10 +14658,14 @@ import { z as z20 } from "zod";
14658
14658
  import "zod";
14659
14659
  import "zod";
14660
14660
  import { z as z23 } from "zod";
14661
- import { length as length15 } from "circuit-json";
14661
+ import {
14662
+ length as length15
14663
+ } from "circuit-json";
14662
14664
  import { z as z24 } from "zod";
14663
14665
  import { length as length16 } from "circuit-json";
14664
- import { length as length17 } from "circuit-json";
14666
+ import {
14667
+ length as length17
14668
+ } from "circuit-json";
14665
14669
  import { z as z25 } from "zod";
14666
14670
  import { z as z26 } from "zod";
14667
14671
  import { length as length18 } from "circuit-json";
@@ -14673,7 +14677,9 @@ import {
14673
14677
  length as length20
14674
14678
  } from "circuit-json";
14675
14679
  import { z as z28 } from "zod";
14676
- import { length as length21 } from "circuit-json";
14680
+ import {
14681
+ length as length21
14682
+ } from "circuit-json";
14677
14683
  import { z as z29 } from "zod";
14678
14684
  import {
14679
14685
  length as length22
@@ -14946,6 +14952,99 @@ var u_curve = Array.from(
14946
14952
  x,
14947
14953
  y: -Math.sqrt(1 - x ** 2)
14948
14954
  }));
14955
+ var createRectUnionOutline = (rectBoundsFromOuterToInner) => {
14956
+ if (rectBoundsFromOuterToInner.length < 2) {
14957
+ throw new Error("Rect union outline requires at least two bounds");
14958
+ }
14959
+ for (const bounds of rectBoundsFromOuterToInner) {
14960
+ if (bounds.minX >= bounds.maxX || bounds.minY >= bounds.maxY) {
14961
+ throw new Error("Each rectangle bound must have min < max on both axes");
14962
+ }
14963
+ }
14964
+ for (let i = 1; i < rectBoundsFromOuterToInner.length; i++) {
14965
+ const previous = rectBoundsFromOuterToInner[i - 1];
14966
+ const current = rectBoundsFromOuterToInner[i];
14967
+ if (current.minX < previous.minX || current.maxX > previous.maxX || current.minY > previous.minY || current.maxY < previous.maxY) {
14968
+ throw new Error(
14969
+ "Bounds must be ordered outer-to-inner with tighter X and larger Y span"
14970
+ );
14971
+ }
14972
+ }
14973
+ const buildTopLeftRouteFromInnerToOuter = () => {
14974
+ const route = [];
14975
+ let index2 = rectBoundsFromOuterToInner.length - 1;
14976
+ route.push({
14977
+ x: rectBoundsFromOuterToInner[index2].minX,
14978
+ y: rectBoundsFromOuterToInner[index2].maxY
14979
+ });
14980
+ while (index2 > 0) {
14981
+ const current = rectBoundsFromOuterToInner[index2];
14982
+ const previous = rectBoundsFromOuterToInner[index2 - 1];
14983
+ route.push({ x: current.minX, y: previous.maxY });
14984
+ route.push({ x: previous.minX, y: previous.maxY });
14985
+ index2 -= 1;
14986
+ }
14987
+ return route;
14988
+ };
14989
+ const buildTopRightRouteFromInnerToOuter = () => {
14990
+ const route = [];
14991
+ let index2 = rectBoundsFromOuterToInner.length - 1;
14992
+ route.push({
14993
+ x: rectBoundsFromOuterToInner[index2].maxX,
14994
+ y: rectBoundsFromOuterToInner[index2].maxY
14995
+ });
14996
+ while (index2 > 0) {
14997
+ const current = rectBoundsFromOuterToInner[index2];
14998
+ const previous = rectBoundsFromOuterToInner[index2 - 1];
14999
+ route.push({ x: current.maxX, y: previous.maxY });
15000
+ route.push({ x: previous.maxX, y: previous.maxY });
15001
+ index2 -= 1;
15002
+ }
15003
+ return route;
15004
+ };
15005
+ const buildBottomRightRouteFromInnerToOuter = () => {
15006
+ const route = [];
15007
+ let index2 = rectBoundsFromOuterToInner.length - 1;
15008
+ route.push({
15009
+ x: rectBoundsFromOuterToInner[index2].maxX,
15010
+ y: rectBoundsFromOuterToInner[index2].minY
15011
+ });
15012
+ while (index2 > 0) {
15013
+ const current = rectBoundsFromOuterToInner[index2];
15014
+ const previous = rectBoundsFromOuterToInner[index2 - 1];
15015
+ route.push({ x: current.maxX, y: previous.minY });
15016
+ route.push({ x: previous.maxX, y: previous.minY });
15017
+ index2 -= 1;
15018
+ }
15019
+ return route;
15020
+ };
15021
+ const buildBottomLeftRouteFromInnerToOuter = () => {
15022
+ const route = [];
15023
+ let index2 = rectBoundsFromOuterToInner.length - 1;
15024
+ route.push({
15025
+ x: rectBoundsFromOuterToInner[index2].minX,
15026
+ y: rectBoundsFromOuterToInner[index2].minY
15027
+ });
15028
+ while (index2 > 0) {
15029
+ const current = rectBoundsFromOuterToInner[index2];
15030
+ const previous = rectBoundsFromOuterToInner[index2 - 1];
15031
+ route.push({ x: current.minX, y: previous.minY });
15032
+ route.push({ x: previous.minX, y: previous.minY });
15033
+ index2 -= 1;
15034
+ }
15035
+ return route;
15036
+ };
15037
+ const topLeftInnerToOuter = buildTopLeftRouteFromInnerToOuter();
15038
+ const topRightInnerToOuter = buildTopRightRouteFromInnerToOuter();
15039
+ const bottomRightInnerToOuter = buildBottomRightRouteFromInnerToOuter();
15040
+ const bottomLeftInnerToOuter = buildBottomLeftRouteFromInnerToOuter();
15041
+ return [
15042
+ ...topLeftInnerToOuter.reverse(),
15043
+ ...topRightInnerToOuter,
15044
+ ...bottomRightInnerToOuter.reverse(),
15045
+ ...bottomLeftInnerToOuter
15046
+ ];
15047
+ };
14949
15048
  function convertMilToMm(value) {
14950
15049
  if (typeof value === "string") {
14951
15050
  if (value.trim().toLowerCase().endsWith("mil")) {
@@ -15080,12 +15179,39 @@ var dip = (raw_params) => {
15080
15179
  });
15081
15180
  }
15082
15181
  const silkscreenRefText = silkscreenRef(0, sh / 2 + 0.5, 0.4);
15182
+ const pinRowSpanX = parameters.w + parameters.od;
15183
+ const pinRowSpanY = padEdgeHeight;
15184
+ const courtyardStepOuterHalfWidth = pinRowSpanX / 2 + 0.25;
15185
+ const courtyardStepInnerHalfWidth = courtyardStepOuterHalfWidth;
15186
+ const courtyardStepOuterHalfHeight = pinRowSpanY / 2 + 0.72;
15187
+ const courtyardStepInnerHalfHeight = courtyardStepOuterHalfHeight;
15188
+ const courtyard = {
15189
+ type: "pcb_courtyard_outline",
15190
+ pcb_courtyard_outline_id: "",
15191
+ pcb_component_id: "",
15192
+ outline: createRectUnionOutline([
15193
+ {
15194
+ minX: -courtyardStepOuterHalfWidth,
15195
+ maxX: courtyardStepOuterHalfWidth,
15196
+ minY: -courtyardStepInnerHalfHeight,
15197
+ maxY: courtyardStepInnerHalfHeight
15198
+ },
15199
+ {
15200
+ minX: -courtyardStepInnerHalfWidth,
15201
+ maxX: courtyardStepInnerHalfWidth,
15202
+ minY: -courtyardStepOuterHalfHeight,
15203
+ maxY: courtyardStepOuterHalfHeight
15204
+ }
15205
+ ]),
15206
+ layer: "top"
15207
+ };
15083
15208
  return {
15084
15209
  circuitJson: [
15085
15210
  ...platedHoles,
15086
15211
  silkscreenBorder,
15087
15212
  silkscreenRefText,
15088
- ...silkscreenPins
15213
+ ...silkscreenPins,
15214
+ courtyard
15089
15215
  ],
15090
15216
  parameters
15091
15217
  };
@@ -15111,7 +15237,9 @@ var footprintSizes = [
15111
15237
  pw_mm_min: 0.4,
15112
15238
  ph_mm_min: 0.3,
15113
15239
  w_mm_min: 0.58,
15114
- h_mm_min: 0.21
15240
+ h_mm_min: 0.21,
15241
+ courtyard_width_mm: 1.2,
15242
+ courtyard_height_mm: 0.6
15115
15243
  },
15116
15244
  {
15117
15245
  imperial: "0504",
@@ -15129,7 +15257,9 @@ var footprintSizes = [
15129
15257
  pw_mm_min: 1.125,
15130
15258
  ph_mm_min: 3.4,
15131
15259
  w_mm_min: 5.4,
15132
- h_mm_min: 3.4
15260
+ h_mm_min: 3.4,
15261
+ courtyard_width_mm: 5.9,
15262
+ courtyard_height_mm: 3.9
15133
15263
  },
15134
15264
  {
15135
15265
  imperial: "0201",
@@ -15138,7 +15268,9 @@ var footprintSizes = [
15138
15268
  pw_mm_min: 0.46,
15139
15269
  ph_mm_min: 0.4,
15140
15270
  w_mm_min: 0.9,
15141
- h_mm_min: 0.3
15271
+ h_mm_min: 0.3,
15272
+ courtyard_width_mm: 1.4,
15273
+ courtyard_height_mm: 0.7
15142
15274
  },
15143
15275
  {
15144
15276
  imperial: "0402",
@@ -15147,7 +15279,9 @@ var footprintSizes = [
15147
15279
  pw_mm_min: 0.54,
15148
15280
  ph_mm_min: 0.64,
15149
15281
  w_mm_min: 1.56,
15150
- h_mm_min: 0.64
15282
+ h_mm_min: 0.64,
15283
+ courtyard_width_mm: 1.86,
15284
+ courtyard_height_mm: 0.94
15151
15285
  },
15152
15286
  {
15153
15287
  imperial: "0603",
@@ -15156,7 +15290,9 @@ var footprintSizes = [
15156
15290
  pw_mm_min: 0.8,
15157
15291
  ph_mm_min: 0.95,
15158
15292
  w_mm_min: 2.45,
15159
- h_mm_min: 0.95
15293
+ h_mm_min: 0.95,
15294
+ courtyard_width_mm: 2.96,
15295
+ courtyard_height_mm: 1.46
15160
15296
  },
15161
15297
  {
15162
15298
  imperial: "0805",
@@ -15165,7 +15301,9 @@ var footprintSizes = [
15165
15301
  pw_mm_min: 1.025,
15166
15302
  ph_mm_min: 1.4,
15167
15303
  w_mm_min: 2.8499999999999996,
15168
- h_mm_min: 1.4
15304
+ h_mm_min: 1.4,
15305
+ courtyard_width_mm: 3.36,
15306
+ courtyard_height_mm: 1.9
15169
15307
  },
15170
15308
  {
15171
15309
  imperial: "1206",
@@ -15174,7 +15312,9 @@ var footprintSizes = [
15174
15312
  pw_mm_min: 1.125,
15175
15313
  ph_mm_min: 1.75,
15176
15314
  w_mm_min: 4.05,
15177
- h_mm_min: 1.75
15315
+ h_mm_min: 1.75,
15316
+ courtyard_width_mm: 4.56,
15317
+ courtyard_height_mm: 2.26
15178
15318
  },
15179
15319
  {
15180
15320
  imperial: "1210",
@@ -15183,7 +15323,9 @@ var footprintSizes = [
15183
15323
  pw_mm_min: 1.125,
15184
15324
  ph_mm_min: 2.65,
15185
15325
  w_mm_min: 4.05,
15186
- h_mm_min: 2.65
15326
+ h_mm_min: 2.65,
15327
+ courtyard_width_mm: 4.56,
15328
+ courtyard_height_mm: 3.16
15187
15329
  },
15188
15330
  {
15189
15331
  imperial: "2010",
@@ -15192,7 +15334,9 @@ var footprintSizes = [
15192
15334
  pw_mm_min: 1.225,
15193
15335
  ph_mm_min: 2.65,
15194
15336
  w_mm_min: 5.85,
15195
- h_mm_min: 2.65
15337
+ h_mm_min: 2.65,
15338
+ courtyard_width_mm: 6.36,
15339
+ courtyard_height_mm: 3.16
15196
15340
  },
15197
15341
  {
15198
15342
  imperial: "2512",
@@ -15201,13 +15345,24 @@ var footprintSizes = [
15201
15345
  pw_mm_min: 1.225,
15202
15346
  ph_mm_min: 3.35,
15203
15347
  w_mm_min: 7.15,
15204
- h_mm_min: 3.35
15348
+ h_mm_min: 3.35,
15349
+ courtyard_width_mm: 7.66,
15350
+ courtyard_height_mm: 3.86
15205
15351
  }
15206
15352
  ];
15207
15353
  var metricMap = Object.fromEntries(footprintSizes.map((s) => [s.metric, s]));
15208
15354
  var imperialMap = Object.fromEntries(
15209
15355
  footprintSizes.map((s) => [s.imperial, s])
15210
15356
  );
15357
+ var createCourtyardRect = (width10, height10) => ({
15358
+ type: "pcb_courtyard_rect",
15359
+ pcb_courtyard_rect_id: "",
15360
+ pcb_component_id: "",
15361
+ center: { x: 0, y: 0 },
15362
+ width: width10,
15363
+ height: height10,
15364
+ layer: "top"
15365
+ });
15211
15366
  var passive_def = base_def.extend({
15212
15367
  tht: z3.boolean(),
15213
15368
  p: length.optional(),
@@ -15259,29 +15414,14 @@ var passive = (params) => {
15259
15414
  };
15260
15415
  const textY = textbottom ? -ph / 2 - 0.9 : ph / 2 + 0.9;
15261
15416
  const silkscreenRefText = silkscreenRef(0, textY, 0.2);
15262
- const excess = 0.25;
15263
- const silkXs = silkscreenLine.route.map((pt) => pt.x);
15264
- const silkYs = silkscreenLine.route.map((pt) => pt.y);
15265
- const crtMinX = Math.min(-(w ?? 0) / 2, -(p / 2 + pw / 2), ...silkXs) - excess;
15266
- const crtMaxX = Math.max((w ?? 0) / 2, p / 2 + pw / 2, ...silkXs) + excess;
15267
- const crtMinY = Math.min(-(h2 ?? 0) / 2, -ph / 2, ...silkYs) - excess;
15268
- const crtMaxY = Math.max((h2 ?? 0) / 2, ph / 2, ...silkYs) + excess;
15269
- const courtyard = {
15270
- type: "pcb_courtyard_rect",
15271
- pcb_courtyard_rect_id: "",
15272
- pcb_component_id: "",
15273
- center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
15274
- width: crtMaxX - crtMinX,
15275
- height: crtMaxY - crtMinY,
15276
- layer: "top"
15277
- };
15417
+ const courtyard = sz?.courtyard_width_mm && sz.courtyard_height_mm ? createCourtyardRect(sz.courtyard_width_mm, sz.courtyard_height_mm) : null;
15278
15418
  if (tht) {
15279
15419
  return [
15280
15420
  platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
15281
15421
  platedhole(2, p / 2, 0, pw, pw * 1 / 0.8),
15282
15422
  silkscreenLine,
15283
15423
  silkscreenRefText,
15284
- courtyard
15424
+ ...courtyard ? [courtyard] : []
15285
15425
  ];
15286
15426
  }
15287
15427
  return [
@@ -15289,7 +15429,7 @@ var passive = (params) => {
15289
15429
  rectpad(["2", "right"], p / 2, 0, pw, ph),
15290
15430
  silkscreenLine,
15291
15431
  silkscreenRefText,
15292
- courtyard
15432
+ ...courtyard ? [courtyard] : []
15293
15433
  ];
15294
15434
  };
15295
15435
  var diode = (parameters) => {
@@ -15302,7 +15442,15 @@ var led = (parameters) => {
15302
15442
  return { circuitJson: passive(parameters), parameters };
15303
15443
  };
15304
15444
  var chipArray = (params) => {
15305
- const { padSpacing: padSpacing7, padWidth, padHeight, padPitch, numRows, textbottom } = params;
15445
+ const {
15446
+ padSpacing: padSpacing7,
15447
+ padWidth,
15448
+ padHeight,
15449
+ padPitch,
15450
+ numRows,
15451
+ textbottom,
15452
+ courtyardOutline
15453
+ } = params;
15306
15454
  const yPositions = [];
15307
15455
  const halfRange = (numRows - 1) * (padPitch / 2);
15308
15456
  for (let i = 0; i < numRows; i++) {
@@ -15363,12 +15511,20 @@ var chipArray = (params) => {
15363
15511
  };
15364
15512
  const textY = textbottom ? bottom - 0.9 : top + 0.9;
15365
15513
  const silkscreenRefText = silkscreenRef(0, textY, 0.2);
15514
+ const courtyard = courtyardOutline ? {
15515
+ type: "pcb_courtyard_outline",
15516
+ pcb_courtyard_outline_id: "",
15517
+ pcb_component_id: "",
15518
+ layer: "top",
15519
+ outline: courtyardOutline
15520
+ } : null;
15366
15521
  return [
15367
15522
  ...pads,
15368
15523
  silkscreenTop,
15369
15524
  silkscreenBottom,
15370
15525
  pin1Marker,
15371
- silkscreenRefText
15526
+ silkscreenRefText,
15527
+ ...courtyard ? [courtyard] : []
15372
15528
  ];
15373
15529
  };
15374
15530
  var res0402Array2_def = base_def.extend({
@@ -15396,7 +15552,13 @@ var res0402Array2 = (rawParams) => {
15396
15552
  numRows: 2,
15397
15553
  textbottom: params.textbottom,
15398
15554
  convex: params.convex,
15399
- concave: params.concave
15555
+ concave: params.concave,
15556
+ courtyardOutline: [
15557
+ { x: -1, y: 0.95 },
15558
+ { x: -1, y: -0.95 },
15559
+ { x: 1, y: -0.95 },
15560
+ { x: 1, y: 0.95 }
15561
+ ]
15400
15562
  });
15401
15563
  };
15402
15564
  var res0402Array4_def = base_def.extend({
@@ -15421,7 +15583,13 @@ var res0402Array4 = (rawParams) => {
15421
15583
  numRows: 4,
15422
15584
  textbottom: params.textbottom,
15423
15585
  convex: params.convex,
15424
- concave: params.concave
15586
+ concave: params.concave,
15587
+ courtyardOutline: [
15588
+ { x: -1, y: 1.25 },
15589
+ { x: -1, y: -1.25 },
15590
+ { x: 1, y: -1.25 },
15591
+ { x: 1, y: 1.25 }
15592
+ ]
15425
15593
  });
15426
15594
  };
15427
15595
  var res0603Array2_def = base_def.extend({
@@ -15446,7 +15614,13 @@ var res0603Array2 = (rawParams) => {
15446
15614
  numRows: 2,
15447
15615
  textbottom: params.textbottom,
15448
15616
  convex: params.convex,
15449
- concave: params.concave
15617
+ concave: params.concave,
15618
+ courtyardOutline: [
15619
+ { x: -1.55, y: 1.05 },
15620
+ { x: -1.55, y: -1.05 },
15621
+ { x: 1.55, y: -1.05 },
15622
+ { x: 1.55, y: 1.05 }
15623
+ ]
15450
15624
  });
15451
15625
  };
15452
15626
  var res0603Array4_def = base_def.extend({
@@ -15471,7 +15645,13 @@ var res0603Array4 = (rawParams) => {
15471
15645
  numRows: 4,
15472
15646
  textbottom: params.textbottom,
15473
15647
  convex: params.convex,
15474
- concave: params.concave
15648
+ concave: params.concave,
15649
+ courtyardOutline: [
15650
+ { x: -1.55, y: 1.88 },
15651
+ { x: -1.55, y: -1.87 },
15652
+ { x: 1.55, y: -1.87 },
15653
+ { x: 1.55, y: 1.88 }
15654
+ ]
15475
15655
  });
15476
15656
  };
15477
15657
  var res0606Array2_def = base_def.extend({
@@ -15496,7 +15676,13 @@ var res0606Array2 = (rawParams) => {
15496
15676
  numRows: 2,
15497
15677
  textbottom: params.textbottom,
15498
15678
  convex: params.convex,
15499
- concave: params.concave
15679
+ concave: params.concave,
15680
+ courtyardOutline: [
15681
+ { x: -1.3, y: 1.05 },
15682
+ { x: -1.3, y: -1.05 },
15683
+ { x: 1.3, y: -1.05 },
15684
+ { x: 1.3, y: 1.05 }
15685
+ ]
15500
15686
  });
15501
15687
  };
15502
15688
  var res1206Array4_def = base_def.extend({
@@ -15521,7 +15707,13 @@ var res1206Array4 = (rawParams) => {
15521
15707
  numRows: 4,
15522
15708
  textbottom: params.textbottom,
15523
15709
  convex: params.convex,
15524
- concave: params.concave
15710
+ concave: params.concave,
15711
+ courtyardOutline: [
15712
+ { x: -2.21, y: 2.85 },
15713
+ { x: -2.21, y: -2.85 },
15714
+ { x: 2.2, y: -2.85 },
15715
+ { x: 2.2, y: 2.85 }
15716
+ ]
15525
15717
  });
15526
15718
  };
15527
15719
  var getArrayCount = (parameters) => {
@@ -15799,8 +15991,45 @@ var bga = (raw_params) => {
15799
15991
  route: markerRoute,
15800
15992
  stroke_width: 0.05
15801
15993
  };
15994
+ const padSpanX = (grid2.x - 1) * p + pad2;
15995
+ const padSpanY = (grid2.y - 1) * p + pad2;
15996
+ const bodySpanX = w ?? padSpanX;
15997
+ const bodySpanY = h2 ?? padSpanY;
15998
+ const courtyardEnvelopeHalfWidth = Math.max(padSpanX / 2, bodySpanX / 2);
15999
+ const courtyardEnvelopeHalfHeight = Math.max(padSpanY / 2, bodySpanY / 2);
16000
+ const courtyardClearanceX = 1.715;
16001
+ const courtyardClearanceY = 1.765;
16002
+ const courtyardStepOuterHalfWidth = courtyardEnvelopeHalfWidth + courtyardClearanceX;
16003
+ const courtyardStepInnerHalfWidth = courtyardStepOuterHalfWidth;
16004
+ const courtyardStepOuterHalfHeight = courtyardEnvelopeHalfHeight + courtyardClearanceY;
16005
+ const courtyardStepInnerHalfHeight = courtyardStepOuterHalfHeight;
16006
+ const courtyard = {
16007
+ type: "pcb_courtyard_outline",
16008
+ pcb_courtyard_outline_id: "",
16009
+ pcb_component_id: "",
16010
+ outline: createRectUnionOutline([
16011
+ {
16012
+ minX: -courtyardStepOuterHalfWidth,
16013
+ maxX: courtyardStepOuterHalfWidth,
16014
+ minY: -courtyardStepInnerHalfHeight,
16015
+ maxY: courtyardStepInnerHalfHeight
16016
+ },
16017
+ {
16018
+ minX: -courtyardStepInnerHalfWidth,
16019
+ maxX: courtyardStepInnerHalfWidth,
16020
+ minY: -courtyardStepOuterHalfHeight,
16021
+ maxY: courtyardStepOuterHalfHeight
16022
+ }
16023
+ ]),
16024
+ layer: "top"
16025
+ };
15802
16026
  return {
15803
- circuitJson: [...pads, silkscreenRefText, pin1Marker],
16027
+ circuitJson: [
16028
+ ...pads,
16029
+ silkscreenRefText,
16030
+ pin1Marker,
16031
+ courtyard
16032
+ ],
15804
16033
  parameters
15805
16034
  };
15806
16035
  };
@@ -15907,7 +16136,37 @@ var soicWithoutParsing = (parameters) => {
15907
16136
  { x: -sw / 2, y: -sh / 2 }
15908
16137
  ]
15909
16138
  };
15910
- return [...pads, silkscreenBorder, silkscreenRefText];
16139
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw;
16140
+ const courtyardStepInnerHalfWidth = parameters.w / 2 + 0.25;
16141
+ const courtyardStepOuterHalfWidth = courtyardStepInnerHalfWidth + 1.93;
16142
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.275;
16143
+ const courtyardStepOuterHalfHeight = pinRowSpanY / 2 + 0.635;
16144
+ const courtyard = {
16145
+ type: "pcb_courtyard_outline",
16146
+ pcb_courtyard_outline_id: "",
16147
+ pcb_component_id: "",
16148
+ layer: "top",
16149
+ outline: createRectUnionOutline([
16150
+ {
16151
+ minX: -courtyardStepOuterHalfWidth,
16152
+ maxX: courtyardStepOuterHalfWidth,
16153
+ minY: -courtyardStepInnerHalfHeight,
16154
+ maxY: courtyardStepInnerHalfHeight
16155
+ },
16156
+ {
16157
+ minX: -courtyardStepInnerHalfWidth,
16158
+ maxX: courtyardStepInnerHalfWidth,
16159
+ minY: -courtyardStepOuterHalfHeight,
16160
+ maxY: courtyardStepOuterHalfHeight
16161
+ }
16162
+ ])
16163
+ };
16164
+ return [
16165
+ ...pads,
16166
+ silkscreenBorder,
16167
+ silkscreenRefText,
16168
+ courtyard
16169
+ ];
15911
16170
  };
15912
16171
  var pin_order_specifier = z14.enum([
15913
16172
  "leftside",
@@ -16048,6 +16307,8 @@ var getQuadCoords = (params) => {
16048
16307
  var quad = (raw_params) => {
16049
16308
  const parameters = quad_def.parse(raw_params);
16050
16309
  const pads = [];
16310
+ let padOuterHalfX = 0;
16311
+ let padOuterHalfY = 0;
16051
16312
  const pin_map = getQuadPinMap(parameters);
16052
16313
  const spc = parameters.num_pins / 4;
16053
16314
  for (let i = 0; i < parameters.num_pins; i++) {
@@ -16064,21 +16325,27 @@ var quad = (raw_params) => {
16064
16325
  pl: parameters.pl,
16065
16326
  legsoutside: parameters.legsoutside
16066
16327
  });
16067
- let pw = parameters.pw;
16068
- let pl = parameters.pl;
16328
+ let padWidth = parameters.pw;
16329
+ let padHeight = parameters.pl;
16069
16330
  if (orientation2 === "vert") {
16070
16331
  ;
16071
- [pw, pl] = [pl, pw];
16332
+ [padWidth, padHeight] = [padHeight, padWidth];
16072
16333
  }
16073
16334
  const pn = pin_map[i + 1];
16074
- pads.push(rectpad(pn, x, y, pw, pl));
16335
+ padOuterHalfX = Math.max(padOuterHalfX, Math.abs(x) + padWidth / 2);
16336
+ padOuterHalfY = Math.max(padOuterHalfY, Math.abs(y) + padHeight / 2);
16337
+ pads.push(rectpad(pn, x, y, padWidth, padHeight));
16075
16338
  }
16076
16339
  if (parameters.thermalpad) {
16077
16340
  if (typeof parameters.thermalpad === "boolean") {
16078
16341
  const ibw = parameters.p * (spc - 1) + parameters.pw;
16079
16342
  const ibh = parameters.p * (spc - 1) + parameters.pw;
16343
+ padOuterHalfX = Math.max(padOuterHalfX, ibw / 2);
16344
+ padOuterHalfY = Math.max(padOuterHalfY, ibh / 2);
16080
16345
  pads.push(rectpad(["thermalpad"], 0, 0, ibw, ibh));
16081
16346
  } else {
16347
+ padOuterHalfX = Math.max(padOuterHalfX, parameters.thermalpad.x / 2);
16348
+ padOuterHalfY = Math.max(padOuterHalfY, parameters.thermalpad.y / 2);
16082
16349
  pads.push(
16083
16350
  rectpad(
16084
16351
  ["thermalpad"],
@@ -16221,11 +16488,53 @@ var quad = (raw_params) => {
16221
16488
  parameters.h / 2 + (parameters.legsoutside ? parameters.pl * 1.2 : 0.5),
16222
16489
  0.3
16223
16490
  );
16491
+ const roundUpToCourtyardOuterGrid = (value) => Math.ceil(value / 0.05) * 0.05;
16492
+ const pinRowSpanX = (spc - 1) * parameters.p + parameters.pw;
16493
+ const pinRowSpanY = (spc - 1) * parameters.p + parameters.pw;
16494
+ const courtyardStepInnerHalfWidth = pinRowSpanX / 2 + 0.25;
16495
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.25;
16496
+ const courtyardStepOuterHalfWidth = parameters.w / 2 + 0.25;
16497
+ const courtyardStepOuterHalfHeight = parameters.h / 2 + 0.25;
16498
+ const courtyardOuterHalfWidth = Math.max(
16499
+ courtyardStepOuterHalfWidth,
16500
+ roundUpToCourtyardOuterGrid(padOuterHalfX + 0.25)
16501
+ );
16502
+ const courtyardOuterHalfHeight = Math.max(
16503
+ courtyardStepOuterHalfHeight,
16504
+ roundUpToCourtyardOuterGrid(padOuterHalfY + 0.25)
16505
+ );
16506
+ const courtyard = {
16507
+ type: "pcb_courtyard_outline",
16508
+ pcb_courtyard_outline_id: "",
16509
+ pcb_component_id: "",
16510
+ layer: "top",
16511
+ outline: createRectUnionOutline([
16512
+ {
16513
+ minX: -courtyardOuterHalfWidth,
16514
+ maxX: courtyardOuterHalfWidth,
16515
+ minY: -courtyardStepInnerHalfHeight,
16516
+ maxY: courtyardStepInnerHalfHeight
16517
+ },
16518
+ {
16519
+ minX: -courtyardStepOuterHalfWidth,
16520
+ maxX: courtyardStepOuterHalfWidth,
16521
+ minY: -courtyardStepOuterHalfHeight,
16522
+ maxY: courtyardStepOuterHalfHeight
16523
+ },
16524
+ {
16525
+ minX: -courtyardStepInnerHalfWidth,
16526
+ maxX: courtyardStepInnerHalfWidth,
16527
+ minY: -courtyardOuterHalfHeight,
16528
+ maxY: courtyardOuterHalfHeight
16529
+ }
16530
+ ])
16531
+ };
16224
16532
  return {
16225
16533
  circuitJson: [
16226
16534
  ...pads,
16227
16535
  ...silkscreen_corners,
16228
- silkscreenRefText
16536
+ silkscreenRefText,
16537
+ courtyard
16229
16538
  ],
16230
16539
  parameters
16231
16540
  };
@@ -16431,8 +16740,35 @@ var ssop = (raw_params) => {
16431
16740
  { x: -sw / 2, y: -sh / 2 }
16432
16741
  ]
16433
16742
  };
16743
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw;
16744
+ const padToeHalfX = parameters.legsoutside ? parameters.w / 2 + parameters.pl : (parameters.w + 0.2) / 2 + parameters.pl / 2;
16745
+ const pinRowHalfY = pinRowSpanY / 2;
16746
+ const courtyardStepOuterHalfWidth = padToeHalfX + 0.25;
16747
+ const courtyardStepInnerHalfWidth = courtyardStepOuterHalfWidth;
16748
+ const courtyardStepOuterHalfHeight = pinRowHalfY + 0.445;
16749
+ const courtyardStepInnerHalfHeight = courtyardStepOuterHalfHeight;
16750
+ const courtyard = {
16751
+ type: "pcb_courtyard_outline",
16752
+ pcb_courtyard_outline_id: "",
16753
+ pcb_component_id: "",
16754
+ outline: createRectUnionOutline([
16755
+ {
16756
+ minX: -courtyardStepOuterHalfWidth,
16757
+ maxX: courtyardStepOuterHalfWidth,
16758
+ minY: -courtyardStepInnerHalfHeight,
16759
+ maxY: courtyardStepInnerHalfHeight
16760
+ },
16761
+ {
16762
+ minX: -courtyardStepInnerHalfWidth,
16763
+ maxX: courtyardStepInnerHalfWidth,
16764
+ minY: -courtyardStepOuterHalfHeight,
16765
+ maxY: courtyardStepOuterHalfHeight
16766
+ }
16767
+ ]),
16768
+ layer: "top"
16769
+ };
16434
16770
  return {
16435
- circuitJson: [...pads, silkscreenBorder, silkscreenRefText],
16771
+ circuitJson: [...pads, silkscreenBorder, silkscreenRefText, courtyard],
16436
16772
  parameters
16437
16773
  };
16438
16774
  };
@@ -16503,11 +16839,51 @@ var tssop = (raw_params) => {
16503
16839
  { x: -sw / 2, y: -sh / 2 }
16504
16840
  ]
16505
16841
  };
16842
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw;
16843
+ const pinToeHalfSpanX = parameters.w / 2 + (parameters.legsoutside ? parameters.pl : 0);
16844
+ const courtyardStepInnerHalfWidth = parameters.w / 2 + 0.25;
16845
+ const courtyardStepOuterHalfWidth = pinToeHalfSpanX + 0.18;
16846
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.25;
16847
+ const courtyardStepOuterHalfHeight = courtyardStepInnerHalfHeight + 0.35;
16848
+ const courtyard = {
16849
+ type: "pcb_courtyard_outline",
16850
+ pcb_courtyard_outline_id: "",
16851
+ pcb_component_id: "",
16852
+ layer: "top",
16853
+ outline: createRectUnionOutline([
16854
+ {
16855
+ minX: -courtyardStepOuterHalfWidth,
16856
+ maxX: courtyardStepOuterHalfWidth,
16857
+ minY: -courtyardStepInnerHalfHeight,
16858
+ maxY: courtyardStepInnerHalfHeight
16859
+ },
16860
+ {
16861
+ minX: -courtyardStepInnerHalfWidth,
16862
+ maxX: courtyardStepInnerHalfWidth,
16863
+ minY: -courtyardStepOuterHalfHeight,
16864
+ maxY: courtyardStepOuterHalfHeight
16865
+ }
16866
+ ])
16867
+ };
16506
16868
  return {
16507
- circuitJson: [...pads, silkscreenBorder, silkscreenRefText],
16869
+ circuitJson: [...pads, silkscreenBorder, silkscreenRefText, courtyard],
16508
16870
  parameters
16509
16871
  };
16510
16872
  };
16873
+ var sot363CourtyardOutline = [
16874
+ { x: -1.45, y: 0.93 },
16875
+ { x: -0.73, y: 0.93 },
16876
+ { x: -0.73, y: 1.1 },
16877
+ { x: 0.73, y: 1.1 },
16878
+ { x: 0.73, y: 0.93 },
16879
+ { x: 1.45, y: 0.93 },
16880
+ { x: 1.45, y: -0.93 },
16881
+ { x: 0.73, y: -0.93 },
16882
+ { x: 0.73, y: -1.1 },
16883
+ { x: -0.73, y: -1.1 },
16884
+ { x: -0.73, y: -0.93 },
16885
+ { x: -1.45, y: -0.93 }
16886
+ ];
16511
16887
  var sot363_def = base_def.extend({
16512
16888
  fn: z18.string(),
16513
16889
  num_pins: z18.literal(6).default(6),
@@ -16567,13 +16943,21 @@ var sot363 = (raw_params) => {
16567
16943
  pcb_silkscreen_path_id: "pin_marker_1"
16568
16944
  };
16569
16945
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 0.4, 0.25);
16946
+ const courtyard = {
16947
+ type: "pcb_courtyard_outline",
16948
+ pcb_courtyard_outline_id: "",
16949
+ pcb_component_id: "",
16950
+ outline: sot363CourtyardOutline,
16951
+ layer: "top"
16952
+ };
16570
16953
  return {
16571
16954
  circuitJson: [
16572
16955
  ...pads,
16573
16956
  silkscreenTopLine,
16574
16957
  silkscreenBottomLine,
16575
16958
  silkscreenRefText,
16576
- pin1Marking
16959
+ pin1Marking,
16960
+ courtyard
16577
16961
  ],
16578
16962
  parameters
16579
16963
  };
@@ -16585,6 +16969,12 @@ var getSot363PadCoord = (pn, w, p, pl) => {
16585
16969
  }
16586
16970
  return { x: 0.84, y: -p + (pn - 4) * p };
16587
16971
  };
16972
+ var sot886CourtyardOutline = [
16973
+ { x: -0.75, y: 1 },
16974
+ { x: -0.75, y: -1 },
16975
+ { x: 0.75, y: -1 },
16976
+ { x: 0.75, y: 1 }
16977
+ ];
16588
16978
  var sot886_def = base_def.extend({
16589
16979
  fn: z19.string(),
16590
16980
  num_pins: z19.literal(6).default(6),
@@ -16644,13 +17034,21 @@ var sot886 = (raw_params) => {
16644
17034
  pcb_silkscreen_path_id: "pin_marker_1"
16645
17035
  };
16646
17036
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 0.4, 0.25);
17037
+ const courtyard = {
17038
+ type: "pcb_courtyard_outline",
17039
+ pcb_courtyard_outline_id: "",
17040
+ pcb_component_id: "",
17041
+ outline: sot886CourtyardOutline,
17042
+ layer: "top"
17043
+ };
16647
17044
  return {
16648
17045
  circuitJson: [
16649
17046
  ...pads,
16650
17047
  silkscreenTopLine,
16651
17048
  silkscreenBottomLine,
16652
17049
  silkscreenRefText,
16653
- pin1Marking
17050
+ pin1Marking,
17051
+ courtyard
16654
17052
  ],
16655
17053
  parameters
16656
17054
  };
@@ -16662,12 +17060,48 @@ var getSot886PadCoord = (pn, w, p, pl) => {
16662
17060
  }
16663
17061
  return { x: padCenterOffset, y: -p + (pn - 4) * p };
16664
17062
  };
17063
+ var sot23_3CourtyardOutline = [
17064
+ { x: -2.05, y: 1.5 },
17065
+ { x: -1.05, y: 1.5 },
17066
+ { x: -1.05, y: 1.7 },
17067
+ { x: 1.05, y: 1.7 },
17068
+ { x: 1.05, y: 0.55 },
17069
+ { x: 2.05, y: 0.55 },
17070
+ { x: 2.05, y: -0.55 },
17071
+ { x: 1.05, y: -0.55 },
17072
+ { x: 1.05, y: -1.7 },
17073
+ { x: -1.05, y: -1.7 },
17074
+ { x: -1.05, y: -1.5 },
17075
+ { x: -2.05, y: -1.5 },
17076
+ { x: -2.05, y: -0.39 },
17077
+ { x: -1.05, y: -0.39 },
17078
+ { x: -1.05, y: 0.39 },
17079
+ { x: -2.05, y: 0.39 }
17080
+ ];
17081
+ var sot23_5CourtyardOutline = [
17082
+ { x: -2.05, y: 1.5 },
17083
+ { x: -1.05, y: 1.5 },
17084
+ { x: -1.05, y: 1.7 },
17085
+ { x: 1.05, y: 1.7 },
17086
+ { x: 1.05, y: 1.5 },
17087
+ { x: 2.05, y: 1.5 },
17088
+ { x: 2.05, y: 0.39 },
17089
+ { x: 1.05, y: 0.39 },
17090
+ { x: 1.05, y: -0.39 },
17091
+ { x: 2.05, y: -0.39 },
17092
+ { x: 2.05, y: -1.5 },
17093
+ { x: 1.05, y: -1.5 },
17094
+ { x: 1.05, y: -1.7 },
17095
+ { x: -1.05, y: -1.7 },
17096
+ { x: -1.05, y: -1.5 },
17097
+ { x: -2.05, y: -1.5 }
17098
+ ];
16665
17099
  var sot23_def = base_def.extend({
16666
17100
  fn: z20.string(),
16667
17101
  num_pins: z20.number().default(3),
16668
17102
  w: z20.string().default("1.92mm"),
16669
17103
  h: z20.string().default("2.74mm"),
16670
- pl: z20.string().default("1.32mm"),
17104
+ pl: z20.string().default("1.325mm"),
16671
17105
  pw: z20.string().default("0.6mm"),
16672
17106
  p: z20.string().default("0.95mm"),
16673
17107
  string: z20.string().optional()
@@ -16711,12 +17145,12 @@ var sot23 = (raw_params) => {
16711
17145
  var getCcwSot23Coords = (parameters) => {
16712
17146
  const { pn, w, h: h2, pl, p } = parameters;
16713
17147
  if (pn === 1) {
16714
- return { x: -1.155, y: p };
17148
+ return { x: -1.1375, y: p };
16715
17149
  }
16716
17150
  if (pn === 2) {
16717
- return { x: -1.155, y: -p };
17151
+ return { x: -1.1375, y: -p };
16718
17152
  }
16719
- return { x: 1.15, y: 0 };
17153
+ return { x: 1.1375, y: 0 };
16720
17154
  };
16721
17155
  var sot23_3 = (parameters) => {
16722
17156
  const pads = [];
@@ -16744,24 +17178,31 @@ var sot23_3 = (parameters) => {
16744
17178
  Number.parseInt(parameters.h),
16745
17179
  0.3
16746
17180
  );
16747
- return [...pads, silkscreenRefText];
17181
+ const courtyard = {
17182
+ type: "pcb_courtyard_outline",
17183
+ pcb_courtyard_outline_id: "",
17184
+ pcb_component_id: "",
17185
+ outline: sot23_3CourtyardOutline,
17186
+ layer: "top"
17187
+ };
17188
+ return [...pads, silkscreenRefText, courtyard];
16748
17189
  };
16749
17190
  var getCcwSot235Coords = (parameters) => {
16750
17191
  const { p, h: h2, pn } = parameters;
16751
17192
  if (pn === 1) {
16752
- return { x: -h2 / 2 - 0.5, y: p };
17193
+ return { x: -1.1375, y: p };
16753
17194
  }
16754
17195
  if (pn === 2) {
16755
- return { x: -h2 / 2 - 0.5, y: 0 };
17196
+ return { x: -1.1375, y: 0 };
16756
17197
  }
16757
17198
  if (pn === 3) {
16758
- return { x: -h2 / 2 - 0.5, y: -p };
17199
+ return { x: -1.1375, y: -p };
16759
17200
  }
16760
17201
  if (pn === 4) {
16761
- return { x: h2 / 2 + 0.5, y: -p };
17202
+ return { x: 1.1375, y: -p };
16762
17203
  }
16763
17204
  if (pn === 5) {
16764
- return { x: h2 / 2 + 0.5, y: p };
17205
+ return { x: 1.1375, y: p };
16765
17206
  }
16766
17207
  throw new Error("Invalid pin number");
16767
17208
  };
@@ -16845,12 +17286,20 @@ var sot23_5 = (parameters) => {
16845
17286
  ],
16846
17287
  stroke_width: 0.05
16847
17288
  };
17289
+ const courtyard = {
17290
+ type: "pcb_courtyard_outline",
17291
+ pcb_courtyard_outline_id: "",
17292
+ pcb_component_id: "",
17293
+ outline: sot23_5CourtyardOutline,
17294
+ layer: "top"
17295
+ };
16848
17296
  return [
16849
17297
  ...pads,
16850
17298
  silkscreenRefText,
16851
17299
  silkscreenPath1,
16852
17300
  silkscreenPath2,
16853
- pin1Indicator
17301
+ pin1Indicator,
17302
+ courtyard
16854
17303
  ];
16855
17304
  };
16856
17305
  var sot25_def = sot23_def.extend({});
@@ -16939,11 +17388,25 @@ var dfn = (raw_params) => {
16939
17388
  sh / 2 + 0.4,
16940
17389
  sh / 12
16941
17390
  );
17391
+ const roundUpToCourtyardGrid = (value) => Math.ceil(value / 0.05) * 0.05;
17392
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw;
17393
+ const courtyardHalfWidthMm = roundUpToCourtyardGrid(parameters.w / 2 + 0.25);
17394
+ const courtyardHalfHeightMm = roundUpToCourtyardGrid(pinRowSpanY / 2 + 0.45);
17395
+ const courtyard = {
17396
+ type: "pcb_courtyard_rect",
17397
+ pcb_courtyard_rect_id: "",
17398
+ pcb_component_id: "",
17399
+ center: { x: 0, y: 0 },
17400
+ width: courtyardHalfWidthMm * 2,
17401
+ height: courtyardHalfHeightMm * 2,
17402
+ layer: "top"
17403
+ };
16942
17404
  return {
16943
17405
  circuitJson: [
16944
17406
  ...pads,
16945
17407
  silkscreenRefText,
16946
- ...silkscreenPaths
17408
+ ...silkscreenPaths,
17409
+ courtyard
16947
17410
  ],
16948
17411
  parameters
16949
17412
  };
@@ -17293,11 +17756,50 @@ var pinrow = (raw_params) => {
17293
17756
  }
17294
17757
  }
17295
17758
  const refText = silkscreenRef(0, p, 0.5);
17759
+ const padHalfWidth = parameters.smd ? parameters.pw / 2 : od / 2;
17760
+ const padHalfHeight = parameters.smd ? parameters.pl / 2 : od / 2;
17761
+ const pinRowSpanX = (numPinsPerRow - 1) * p;
17762
+ const pinRowSpanY = (rows - 1) * p;
17763
+ const padOuterHalfWidth = pinRowSpanX / 2 + padHalfWidth;
17764
+ const padOuterHalfHeight = pinRowSpanY / 2 + padHalfHeight;
17765
+ const bodyHalfWidth = pinRowSpanX / 2 + p / 2;
17766
+ const bodyHalfHeight = pinRowSpanY / 2 + p / 2;
17767
+ const courtyardHalfWidth = Math.max(
17768
+ padOuterHalfWidth + 0.25,
17769
+ bodyHalfWidth + 0.5
17770
+ );
17771
+ const courtyardHalfHeight = Math.max(
17772
+ padOuterHalfHeight + 0.25,
17773
+ bodyHalfHeight + 0.5
17774
+ );
17775
+ const courtyard = {
17776
+ type: "pcb_courtyard_rect",
17777
+ pcb_courtyard_rect_id: "",
17778
+ pcb_component_id: "",
17779
+ center: { x: 0, y: -((rows - 1) * p) / 2 },
17780
+ width: 2 * courtyardHalfWidth,
17781
+ height: 2 * courtyardHalfHeight,
17782
+ layer: "top"
17783
+ };
17296
17784
  return {
17297
- circuitJson: [...holes, refText],
17785
+ circuitJson: [...holes, refText, courtyard],
17298
17786
  parameters
17299
17787
  };
17300
17788
  };
17789
+ var sot563CourtyardOutline = [
17790
+ { x: -1.2, y: 0.83 },
17791
+ { x: -0.75, y: 0.83 },
17792
+ { x: -0.75, y: 0.95 },
17793
+ { x: 0.75, y: 0.95 },
17794
+ { x: 0.75, y: 0.83 },
17795
+ { x: 1.2, y: 0.83 },
17796
+ { x: 1.2, y: -0.83 },
17797
+ { x: 0.75, y: -0.83 },
17798
+ { x: 0.75, y: -0.95 },
17799
+ { x: -0.75, y: -0.95 },
17800
+ { x: -0.75, y: -0.83 },
17801
+ { x: -1.2, y: -0.83 }
17802
+ ];
17301
17803
  var sot563_def = base_def.extend({
17302
17804
  fn: z24.string(),
17303
17805
  num_pins: z24.literal(6).default(6),
@@ -17357,13 +17859,21 @@ var sot563 = (raw_params) => {
17357
17859
  pcb_silkscreen_path_id: "pin_marker_1"
17358
17860
  };
17359
17861
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 0.4, 0.25);
17862
+ const courtyard = {
17863
+ type: "pcb_courtyard_outline",
17864
+ pcb_courtyard_outline_id: "",
17865
+ pcb_component_id: "",
17866
+ outline: sot563CourtyardOutline,
17867
+ layer: "top"
17868
+ };
17360
17869
  return {
17361
17870
  circuitJson: [
17362
17871
  ...pads,
17363
17872
  silkscreenTopLine,
17364
17873
  silkscreenBottomLine,
17365
17874
  silkscreenRefText,
17366
- pin1Marking
17875
+ pin1Marking,
17876
+ courtyard
17367
17877
  ],
17368
17878
  parameters
17369
17879
  };
@@ -17416,8 +17926,22 @@ var sot723 = (raw_params) => {
17416
17926
  length17.parse(parameters.h),
17417
17927
  0.2
17418
17928
  );
17929
+ const courtyardWidthMm = 1.8;
17930
+ const courtyardHeightMm = 1.8;
17931
+ const courtyard = {
17932
+ type: "pcb_courtyard_outline",
17933
+ pcb_courtyard_outline_id: "",
17934
+ pcb_component_id: "",
17935
+ outline: [
17936
+ { x: -courtyardWidthMm / 2, y: courtyardHeightMm / 2 },
17937
+ { x: courtyardWidthMm / 2, y: courtyardHeightMm / 2 },
17938
+ { x: courtyardWidthMm / 2, y: -courtyardHeightMm / 2 },
17939
+ { x: -courtyardWidthMm / 2, y: -courtyardHeightMm / 2 }
17940
+ ],
17941
+ layer: "top"
17942
+ };
17419
17943
  return {
17420
- circuitJson: [...pad2, silkscreenRefText],
17944
+ circuitJson: [...pad2, silkscreenRefText, courtyard],
17421
17945
  parameters
17422
17946
  };
17423
17947
  };
@@ -17470,9 +17994,21 @@ var sod123 = (raw_params) => {
17470
17994
  length18.parse(parameters.h) / 4 + 0.4,
17471
17995
  0.3
17472
17996
  );
17997
+ const courtyardWidthMm = 4.7;
17998
+ const courtyardHeightMm = 2.3;
17999
+ const courtyard = {
18000
+ type: "pcb_courtyard_rect",
18001
+ pcb_courtyard_rect_id: "",
18002
+ pcb_component_id: "",
18003
+ center: { x: 0, y: 0 },
18004
+ width: courtyardWidthMm,
18005
+ height: courtyardHeightMm,
18006
+ layer: "top"
18007
+ };
17473
18008
  return {
17474
18009
  circuitJson: sodWithoutParsing(parameters).concat(
17475
- silkscreenRefText
18010
+ silkscreenRefText,
18011
+ courtyard
17476
18012
  ),
17477
18013
  parameters
17478
18014
  };
@@ -17529,11 +18065,42 @@ var axial = (raw_params) => {
17529
18065
  pcb_silkscreen_path_id: ""
17530
18066
  };
17531
18067
  const silkscreenRefText = silkscreenRef(0, 1.5, 0.5);
18068
+ const pin1CenterX = -p / 2;
18069
+ const pin2CenterX = p / 2;
18070
+ const pinPadHalfX = od / 2;
18071
+ const pinPadHalfY = od / 2;
18072
+ const courtyardStepOuterMinX = pin1CenterX - pinPadHalfX - 0.35;
18073
+ const courtyardStepOuterMaxX = pin2CenterX + pinPadHalfX + 0.26;
18074
+ const courtyardStepOuterHalfHeight = pinPadHalfY + 0.35;
18075
+ const courtyardStepInnerMinX = courtyardStepOuterMinX;
18076
+ const courtyardStepInnerMaxX = courtyardStepOuterMaxX;
18077
+ const courtyardStepInnerHalfHeight = courtyardStepOuterHalfHeight;
18078
+ const courtyard = {
18079
+ type: "pcb_courtyard_outline",
18080
+ pcb_courtyard_outline_id: "",
18081
+ pcb_component_id: "",
18082
+ outline: createRectUnionOutline([
18083
+ {
18084
+ minX: courtyardStepOuterMinX,
18085
+ maxX: courtyardStepOuterMaxX,
18086
+ minY: -courtyardStepInnerHalfHeight,
18087
+ maxY: courtyardStepInnerHalfHeight
18088
+ },
18089
+ {
18090
+ minX: courtyardStepInnerMinX,
18091
+ maxX: courtyardStepInnerMaxX,
18092
+ minY: -courtyardStepOuterHalfHeight,
18093
+ maxY: courtyardStepOuterHalfHeight
18094
+ }
18095
+ ]),
18096
+ layer: "top"
18097
+ };
17532
18098
  return {
17533
18099
  circuitJson: [
17534
18100
  ...plated_holes,
17535
18101
  silkscreenLine,
17536
- silkscreenRefText
18102
+ silkscreenRefText,
18103
+ courtyard
17537
18104
  ],
17538
18105
  parameters
17539
18106
  };
@@ -17660,6 +18227,16 @@ var radial = (raw_params) => {
17660
18227
  if (hasPolarity) {
17661
18228
  circuitJson.push(plusHoriz, plusVert);
17662
18229
  }
18230
+ const courtyardRadiusMm = p + 0.25;
18231
+ const courtyard = {
18232
+ type: "pcb_courtyard_circle",
18233
+ pcb_courtyard_circle_id: "",
18234
+ pcb_component_id: "",
18235
+ center: { x: 0, y: 0 },
18236
+ radius: courtyardRadiusMm,
18237
+ layer: "top"
18238
+ };
18239
+ circuitJson.push(courtyard);
17663
18240
  return {
17664
18241
  circuitJson,
17665
18242
  parameters
@@ -17719,8 +18296,24 @@ var pushbutton = (raw_params) => {
17719
18296
  height10 / 2 + 0.4,
17720
18297
  0.5
17721
18298
  );
18299
+ const padOuterRadius = holeDiameter * 1.5 / 2;
18300
+ const pinRowSpanX = width10;
18301
+ const pinRowSpanY = height10;
18302
+ const padOuterHalfWidth = pinRowSpanX / 2 + padOuterRadius;
18303
+ const padOuterHalfHeight = pinRowSpanY / 2 + padOuterRadius;
18304
+ const courtyardHalfWidth = padOuterHalfWidth + 0.5;
18305
+ const courtyardHalfHeight = padOuterHalfHeight + 0.5;
18306
+ const courtyard = {
18307
+ type: "pcb_courtyard_rect",
18308
+ pcb_courtyard_rect_id: "",
18309
+ pcb_component_id: "",
18310
+ center: { x: 0, y: 0 },
18311
+ width: 2 * courtyardHalfWidth,
18312
+ height: 2 * courtyardHalfHeight,
18313
+ layer: "top"
18314
+ };
17722
18315
  return {
17723
- circuitJson: [...holes, ...silkscreenLines, silkscreenRefText],
18316
+ circuitJson: [...holes, ...silkscreenLines, silkscreenRefText, courtyard],
17724
18317
  parameters
17725
18318
  };
17726
18319
  };
@@ -18651,6 +19244,75 @@ var breakoutheaders = (raw_params) => {
18651
19244
  parameters: params
18652
19245
  };
18653
19246
  };
19247
+ var createCapsuleOutline = (options) => {
19248
+ const {
19249
+ centerX,
19250
+ centerY,
19251
+ straightHalfLength,
19252
+ radius,
19253
+ arcSegmentCount = 9,
19254
+ orientation: orientation2 = "horizontal"
19255
+ } = options;
19256
+ if (straightHalfLength < 0) {
19257
+ throw new Error("Capsule straightHalfLength must be non-negative");
19258
+ }
19259
+ if (radius <= 0) {
19260
+ throw new Error("Capsule radius must be positive");
19261
+ }
19262
+ if (arcSegmentCount < 2) {
19263
+ throw new Error("Capsule arcSegmentCount must be at least 2");
19264
+ }
19265
+ if (orientation2 === "horizontal") {
19266
+ const leftCenterX = centerX - straightHalfLength;
19267
+ const rightCenterX = centerX + straightHalfLength;
19268
+ const rightArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
19269
+ const theta = Math.PI / 2 - i * Math.PI / arcSegmentCount;
19270
+ return {
19271
+ x: rightCenterX + Math.cos(theta) * radius,
19272
+ y: centerY + Math.sin(theta) * radius
19273
+ };
19274
+ });
19275
+ const leftArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
19276
+ const theta = -Math.PI / 2 + i * Math.PI / arcSegmentCount;
19277
+ return {
19278
+ x: leftCenterX - Math.cos(theta) * radius,
19279
+ y: centerY + Math.sin(theta) * radius
19280
+ };
19281
+ });
19282
+ return [
19283
+ { x: leftCenterX, y: centerY + radius },
19284
+ { x: rightCenterX, y: centerY + radius },
19285
+ ...rightArc.slice(1, -1),
19286
+ { x: rightCenterX, y: centerY - radius },
19287
+ { x: leftCenterX, y: centerY - radius },
19288
+ ...leftArc.slice(1, -1)
19289
+ ];
19290
+ }
19291
+ const bottomCenterY = centerY - straightHalfLength;
19292
+ const topCenterY = centerY + straightHalfLength;
19293
+ const topArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
19294
+ const theta = Math.PI - i * Math.PI / arcSegmentCount;
19295
+ return {
19296
+ x: centerX + Math.cos(theta) * radius,
19297
+ y: topCenterY + Math.sin(theta) * radius
19298
+ };
19299
+ });
19300
+ const bottomArc = Array.from({ length: arcSegmentCount + 1 }, (_, i) => {
19301
+ const theta = i * Math.PI / arcSegmentCount;
19302
+ return {
19303
+ x: centerX + Math.cos(theta) * radius,
19304
+ y: bottomCenterY - Math.sin(theta) * radius
19305
+ };
19306
+ });
19307
+ return [
19308
+ { x: centerX - radius, y: bottomCenterY },
19309
+ { x: centerX - radius, y: topCenterY },
19310
+ ...topArc.slice(1, -1),
19311
+ { x: centerX + radius, y: topCenterY },
19312
+ { x: centerX + radius, y: bottomCenterY },
19313
+ ...bottomArc.slice(1, -1)
19314
+ ];
19315
+ };
18654
19316
  var generate_u_curve = (centerX, centerY, radius, direction) => {
18655
19317
  return Array.from({ length: 25 }, (_, i) => {
18656
19318
  const theta = i / 24 * Math.PI - Math.PI / 2;
@@ -18695,11 +19357,28 @@ var hc49 = (raw_params) => {
18695
19357
  pcb_silkscreen_path_id: ""
18696
19358
  };
18697
19359
  const silkscreenRefText = silkscreenRef(0, p / 4, 0.5);
19360
+ const padRowHalfWidth = p / 2 + od / 2;
19361
+ const courtyardCapsuleStraightHalfLength = padRowHalfWidth;
19362
+ const courtyardCapsuleRadius = Math.max(h2 / 2 + 0.25, w / 2 + 0.03);
19363
+ const courtyard = {
19364
+ type: "pcb_courtyard_outline",
19365
+ pcb_courtyard_outline_id: "",
19366
+ pcb_component_id: "",
19367
+ outline: createCapsuleOutline({
19368
+ centerX: 0,
19369
+ centerY: 0,
19370
+ straightHalfLength: courtyardCapsuleStraightHalfLength,
19371
+ radius: courtyardCapsuleRadius,
19372
+ arcSegmentCount: 9
19373
+ }),
19374
+ layer: "top"
19375
+ };
18698
19376
  return {
18699
19377
  circuitJson: [
18700
19378
  ...plated_holes,
18701
19379
  silkscreenBody,
18702
- silkscreenRefText
19380
+ silkscreenRefText,
19381
+ courtyard
18703
19382
  ],
18704
19383
  parameters
18705
19384
  };
@@ -18737,6 +19416,12 @@ var platedHolePill = (pn, x, y, holeDiameter, outerWidth, outerHeight) => {
18737
19416
  ccw_rotation: 0
18738
19417
  };
18739
19418
  };
19419
+ var to92CourtyardOutline = [
19420
+ { x: -2.73, y: 3.71 },
19421
+ { x: -2.73, y: -1.03 },
19422
+ { x: 2.73, y: -1.03 },
19423
+ { x: 2.73, y: 3.71 }
19424
+ ];
18740
19425
  var to92_def = base_def.extend({
18741
19426
  fn: z35.string(),
18742
19427
  num_pins: z35.union([z35.literal(3), z35.literal(2)]).default(3),
@@ -18845,11 +19530,19 @@ var to92 = (raw_params) => {
18845
19530
  pcb_silkscreen_path_id: ""
18846
19531
  };
18847
19532
  const silkscreenRefText = silkscreenRef(0, holeY + 1, 0.5);
19533
+ const courtyard = {
19534
+ type: "pcb_courtyard_outline",
19535
+ pcb_courtyard_outline_id: "",
19536
+ pcb_component_id: "",
19537
+ outline: to92CourtyardOutline,
19538
+ layer: "top"
19539
+ };
18848
19540
  return {
18849
19541
  circuitJson: [
18850
19542
  ...platedHoles,
18851
19543
  silkscreenBody,
18852
- silkscreenRefText
19544
+ silkscreenRefText,
19545
+ courtyard
18853
19546
  ],
18854
19547
  parameters
18855
19548
  };
@@ -18895,10 +19588,22 @@ var sod523 = (raw_params) => {
18895
19588
  stroke_width: 0.1,
18896
19589
  pcb_silkscreen_path_id: ""
18897
19590
  };
18898
- return {
18899
- circuitJson: sodWithoutParsing2(parameters).concat(
19591
+ const courtyardWidthMm = 2.5;
19592
+ const courtyardHeightMm = 1.4;
19593
+ const courtyard = {
19594
+ type: "pcb_courtyard_rect",
19595
+ pcb_courtyard_rect_id: "",
19596
+ pcb_component_id: "",
19597
+ center: { x: 0, y: 0 },
19598
+ width: courtyardWidthMm,
19599
+ height: courtyardHeightMm,
19600
+ layer: "top"
19601
+ };
19602
+ return {
19603
+ circuitJson: sodWithoutParsing2(parameters).concat(
18900
19604
  silkscreenLine,
18901
- silkscreenRefText
19605
+ silkscreenRefText,
19606
+ courtyard
18902
19607
  ),
18903
19608
  parameters
18904
19609
  };
@@ -18965,11 +19670,37 @@ var sop8 = (raw_params) => {
18965
19670
  ],
18966
19671
  stroke_width: 0.1
18967
19672
  };
19673
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * parameters.p + parameters.pw;
19674
+ const courtyardStepInnerHalfWidth = parameters.w / 2 - 1.395;
19675
+ const courtyardStepOuterHalfWidth = parameters.w / 2 + 0.255;
19676
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.25;
19677
+ const courtyardStepOuterHalfHeight = pinRowSpanY / 2 + 0.5;
19678
+ const courtyard = {
19679
+ type: "pcb_courtyard_outline",
19680
+ pcb_courtyard_outline_id: "",
19681
+ pcb_component_id: "",
19682
+ layer: "top",
19683
+ outline: createRectUnionOutline([
19684
+ {
19685
+ minX: -courtyardStepOuterHalfWidth,
19686
+ maxX: courtyardStepOuterHalfWidth,
19687
+ minY: -courtyardStepInnerHalfHeight,
19688
+ maxY: courtyardStepInnerHalfHeight
19689
+ },
19690
+ {
19691
+ minX: -courtyardStepInnerHalfWidth,
19692
+ maxX: courtyardStepInnerHalfWidth,
19693
+ minY: -courtyardStepOuterHalfHeight,
19694
+ maxY: courtyardStepOuterHalfHeight
19695
+ }
19696
+ ])
19697
+ };
18968
19698
  return {
18969
19699
  circuitJson: [
18970
19700
  ...pads,
18971
19701
  silkscreenRefText,
18972
- silkscreenLine
19702
+ silkscreenLine,
19703
+ courtyard
18973
19704
  ],
18974
19705
  parameters
18975
19706
  };
@@ -19015,10 +19746,22 @@ var sod80 = (raw_params) => {
19015
19746
  stroke_width: 0.1,
19016
19747
  pcb_silkscreen_path_id: ""
19017
19748
  };
19749
+ const courtyardWidthMm = 5.1;
19750
+ const courtyardHeightMm = 2.8;
19751
+ const courtyard = {
19752
+ type: "pcb_courtyard_rect",
19753
+ pcb_courtyard_rect_id: "",
19754
+ pcb_component_id: "",
19755
+ center: { x: 0, y: 0 },
19756
+ width: courtyardWidthMm,
19757
+ height: courtyardHeightMm,
19758
+ layer: "top"
19759
+ };
19018
19760
  return {
19019
19761
  circuitJson: sod80WithoutParsing(parameters).concat(
19020
19762
  silkscreenLine,
19021
- silkscreenRefText
19763
+ silkscreenRefText,
19764
+ courtyard
19022
19765
  ),
19023
19766
  parameters
19024
19767
  };
@@ -19087,10 +19830,22 @@ var sod123w = (raw_params) => {
19087
19830
  stroke_width: 0.1,
19088
19831
  pcb_silkscreen_path_id: ""
19089
19832
  };
19833
+ const courtyardWidthMm = 4.5;
19834
+ const courtyardHeightMm = 2.2;
19835
+ const courtyard = {
19836
+ type: "pcb_courtyard_rect",
19837
+ pcb_courtyard_rect_id: "",
19838
+ pcb_component_id: "",
19839
+ center: { x: 0, y: 0 },
19840
+ width: courtyardWidthMm,
19841
+ height: courtyardHeightMm,
19842
+ layer: "top"
19843
+ };
19090
19844
  return {
19091
19845
  circuitJson: sodWithoutParsing3(parameters).concat(
19092
19846
  silkscreenLine,
19093
- silkscreenRefText
19847
+ silkscreenRefText,
19848
+ courtyard
19094
19849
  ),
19095
19850
  parameters
19096
19851
  };
@@ -19162,10 +19917,22 @@ var sod323 = (raw_params) => {
19162
19917
  stroke_width: 0.1,
19163
19918
  pcb_silkscreen_path_id: ""
19164
19919
  };
19920
+ const courtyardWidthMm = 3.2;
19921
+ const courtyardHeightMm = 1.9;
19922
+ const courtyard = {
19923
+ type: "pcb_courtyard_rect",
19924
+ pcb_courtyard_rect_id: "",
19925
+ pcb_component_id: "",
19926
+ center: { x: 0, y: 0 },
19927
+ width: courtyardWidthMm,
19928
+ height: courtyardHeightMm,
19929
+ layer: "top"
19930
+ };
19165
19931
  return {
19166
19932
  circuitJson: sodWithoutParsing4(parameters).concat(
19167
19933
  silkscreenLine,
19168
- silkscreenRefText
19934
+ silkscreenRefText,
19935
+ courtyard
19169
19936
  ),
19170
19937
  parameters
19171
19938
  };
@@ -19207,40 +19974,76 @@ var sod_def5 = base_def.extend({
19207
19974
  });
19208
19975
  var sod923 = (raw_params) => {
19209
19976
  const parameters = sod_def5.parse(raw_params);
19210
- const silkscreenRefText = silkscreenRef(
19211
- 0,
19212
- length31.parse(parameters.h),
19213
- 0.3
19214
- );
19977
+ const w = length31.parse(parameters.w);
19978
+ const h2 = length31.parse(parameters.h);
19979
+ const pl = length31.parse(parameters.pl);
19980
+ const pw = length31.parse(parameters.pw);
19981
+ const p = length31.parse(parameters.p);
19982
+ const silkscreenRefText = silkscreenRef(0, h2, 0.3);
19215
19983
  const silkscreenLine = {
19216
19984
  type: "pcb_silkscreen_path",
19217
19985
  layer: "top",
19218
19986
  pcb_component_id: "",
19219
19987
  route: [
19220
19988
  {
19221
- x: length31.parse(parameters.p) / 2 + 0.15,
19222
- y: length31.parse(parameters.h) / 2
19989
+ x: p / 2 + 0.15,
19990
+ y: h2 / 2
19223
19991
  },
19224
19992
  {
19225
- x: -length31.parse(parameters.w) / 2 - 0.15,
19226
- y: length31.parse(parameters.h) / 2
19993
+ x: -w / 2 - 0.15,
19994
+ y: h2 / 2
19227
19995
  },
19228
19996
  {
19229
- x: -length31.parse(parameters.w) / 2 - 0.15,
19230
- y: -length31.parse(parameters.h) / 2
19997
+ x: -w / 2 - 0.15,
19998
+ y: -h2 / 2
19231
19999
  },
19232
20000
  {
19233
- x: length31.parse(parameters.p) / 2 + 0.15,
19234
- y: -length31.parse(parameters.h) / 2
20001
+ x: p / 2 + 0.15,
20002
+ y: -h2 / 2
19235
20003
  }
19236
20004
  ],
19237
20005
  stroke_width: 0.1,
19238
20006
  pcb_silkscreen_path_id: ""
19239
20007
  };
20008
+ const pinRowSpanX = p + pl;
20009
+ const pinRowSpanY = pw;
20010
+ const bodyHalfX = w / 2;
20011
+ const bodyHalfY = h2 / 2;
20012
+ const pinToeHalfX = pinRowSpanX / 2;
20013
+ const pinRowHalfY = pinRowSpanY / 2;
20014
+ const courtyardEnvelopeHalfWidth = Math.max(bodyHalfX, pinToeHalfX);
20015
+ const courtyardEnvelopeHalfHeight = Math.max(bodyHalfY, pinRowHalfY);
20016
+ const courtyardNarrowHalfWidth = Math.min(bodyHalfX, pinToeHalfX);
20017
+ const courtyardNarrowHalfHeight = Math.min(bodyHalfY, pinRowHalfY);
20018
+ const courtyardStepOuterHalfWidth = courtyardEnvelopeHalfWidth + 0.05;
20019
+ const courtyardStepInnerHalfWidth = courtyardNarrowHalfWidth - 0.055;
20020
+ const courtyardStepOuterHalfHeight = courtyardEnvelopeHalfHeight;
20021
+ const courtyardStepInnerHalfHeight = courtyardNarrowHalfHeight + 0.155;
20022
+ const courtyard = {
20023
+ type: "pcb_courtyard_outline",
20024
+ pcb_courtyard_outline_id: "",
20025
+ pcb_component_id: "",
20026
+ outline: createRectUnionOutline([
20027
+ {
20028
+ minX: -courtyardStepOuterHalfWidth,
20029
+ maxX: courtyardStepOuterHalfWidth,
20030
+ minY: -courtyardStepInnerHalfHeight,
20031
+ maxY: courtyardStepInnerHalfHeight
20032
+ },
20033
+ {
20034
+ minX: -courtyardStepInnerHalfWidth,
20035
+ maxX: courtyardStepInnerHalfWidth,
20036
+ minY: -courtyardStepOuterHalfHeight,
20037
+ maxY: courtyardStepOuterHalfHeight
20038
+ }
20039
+ ]),
20040
+ layer: "top"
20041
+ };
19240
20042
  return {
19241
20043
  circuitJson: sodWithoutParsing5(parameters).concat(
19242
20044
  silkscreenLine,
19243
- silkscreenRefText
20045
+ silkscreenRefText,
20046
+ courtyard
19244
20047
  ),
19245
20048
  parameters
19246
20049
  };
@@ -19313,10 +20116,22 @@ var sod882 = (raw_params) => {
19313
20116
  stroke_width: 0.1,
19314
20117
  pcb_silkscreen_path_id: ""
19315
20118
  };
20119
+ const courtyardWidthMm = 1.6;
20120
+ const courtyardHeightMm = 1.2;
20121
+ const courtyard = {
20122
+ type: "pcb_courtyard_rect",
20123
+ pcb_courtyard_rect_id: "",
20124
+ pcb_component_id: "",
20125
+ center: { x: 0, y: 0 },
20126
+ width: courtyardWidthMm,
20127
+ height: courtyardHeightMm,
20128
+ layer: "top"
20129
+ };
19316
20130
  return {
19317
20131
  circuitJson: sodWithoutParsing6(parameters).concat(
19318
20132
  silkscreenLine,
19319
- silkscreenRefText
20133
+ silkscreenRefText,
20134
+ courtyard
19320
20135
  ),
19321
20136
  parameters
19322
20137
  };
@@ -19351,7 +20166,7 @@ var sodWithoutParsing6 = (parameters) => {
19351
20166
  var sod_def7 = base_def.extend({
19352
20167
  fn: z42.string(),
19353
20168
  num_pins: z42.literal(2).default(2),
19354
- w: z42.string().default("3,05mm"),
20169
+ w: z42.string().default("3.05mm"),
19355
20170
  h: z42.string().default("1.65mm"),
19356
20171
  pl: z42.string().default("0.6mm"),
19357
20172
  pw: z42.string().default("0.6mm"),
@@ -19389,10 +20204,22 @@ var sod323f = (raw_params) => {
19389
20204
  stroke_width: 0.1,
19390
20205
  pcb_silkscreen_path_id: ""
19391
20206
  };
20207
+ const courtyardWidthMm = 3.2;
20208
+ const courtyardHeightMm = 1.9;
20209
+ const courtyard = {
20210
+ type: "pcb_courtyard_rect",
20211
+ pcb_courtyard_rect_id: "",
20212
+ pcb_component_id: "",
20213
+ center: { x: 0, y: 0 },
20214
+ width: courtyardWidthMm,
20215
+ height: courtyardHeightMm,
20216
+ layer: "top"
20217
+ };
19392
20218
  return {
19393
20219
  circuitJson: sodWithoutParsing7(parameters).concat(
19394
20220
  silkscreenLine,
19395
- silkscreenRefText
20221
+ silkscreenRefText,
20222
+ courtyard
19396
20223
  ),
19397
20224
  parameters
19398
20225
  };
@@ -19465,10 +20292,22 @@ var sod123f = (raw_params) => {
19465
20292
  stroke_width: 0.1,
19466
20293
  pcb_silkscreen_path_id: ""
19467
20294
  };
20295
+ const courtyardWidthMm = 4.4;
20296
+ const courtyardHeightMm = 2.3;
20297
+ const courtyard = {
20298
+ type: "pcb_courtyard_rect",
20299
+ pcb_courtyard_rect_id: "",
20300
+ pcb_component_id: "",
20301
+ center: { x: 0, y: 0 },
20302
+ width: courtyardWidthMm,
20303
+ height: courtyardHeightMm,
20304
+ layer: "top"
20305
+ };
19468
20306
  return {
19469
20307
  circuitJson: sodWithoutParsing8(parameters).concat(
19470
20308
  silkscreenLine,
19471
- silkscreenRefText
20309
+ silkscreenRefText,
20310
+ courtyard
19472
20311
  ),
19473
20312
  parameters
19474
20313
  };
@@ -19541,10 +20380,22 @@ var sod123fl = (raw_params) => {
19541
20380
  stroke_width: 0.1,
19542
20381
  pcb_silkscreen_path_id: ""
19543
20382
  };
20383
+ const courtyardWidthMm = 4.9;
20384
+ const courtyardHeightMm = 2.7;
20385
+ const courtyard = {
20386
+ type: "pcb_courtyard_rect",
20387
+ pcb_courtyard_rect_id: "",
20388
+ pcb_component_id: "",
20389
+ center: { x: 0, y: 0 },
20390
+ width: courtyardWidthMm,
20391
+ height: courtyardHeightMm,
20392
+ layer: "top"
20393
+ };
19544
20394
  return {
19545
20395
  circuitJson: sodWithoutParsing9(parameters).concat(
19546
20396
  silkscreenLine,
19547
- silkscreenRefText
20397
+ silkscreenRefText,
20398
+ courtyard
19548
20399
  ),
19549
20400
  parameters
19550
20401
  };
@@ -19617,10 +20468,22 @@ var sod723 = (raw_params) => {
19617
20468
  stroke_width: 0.1,
19618
20469
  pcb_silkscreen_path_id: ""
19619
20470
  };
20471
+ const courtyardWidthMm = 2.3;
20472
+ const courtyardHeightMm = 1.5;
20473
+ const courtyard = {
20474
+ type: "pcb_courtyard_rect",
20475
+ pcb_courtyard_rect_id: "",
20476
+ pcb_component_id: "",
20477
+ center: { x: 0, y: 0 },
20478
+ width: courtyardWidthMm,
20479
+ height: courtyardHeightMm,
20480
+ layer: "top"
20481
+ };
19620
20482
  return {
19621
20483
  circuitJson: sodWithoutParsing10(parameters).concat(
19622
20484
  silkscreenLine,
19623
- silkscreenRefText
20485
+ silkscreenRefText,
20486
+ courtyard
19624
20487
  ),
19625
20488
  parameters
19626
20489
  };
@@ -19693,10 +20556,22 @@ var sod128 = (raw_params) => {
19693
20556
  stroke_width: 0.1,
19694
20557
  pcb_silkscreen_path_id: ""
19695
20558
  };
20559
+ const courtyardWidthMm = 6.3;
20560
+ const courtyardHeightMm = 3;
20561
+ const courtyard = {
20562
+ type: "pcb_courtyard_rect",
20563
+ pcb_courtyard_rect_id: "",
20564
+ pcb_component_id: "",
20565
+ center: { x: 0, y: 0 },
20566
+ width: courtyardWidthMm,
20567
+ height: courtyardHeightMm,
20568
+ layer: "top"
20569
+ };
19696
20570
  return {
19697
20571
  circuitJson: sodWithoutParsing11(parameters).concat(
19698
20572
  silkscreenLine,
19699
- silkscreenRefText
20573
+ silkscreenRefText,
20574
+ courtyard
19700
20575
  ),
19701
20576
  parameters
19702
20577
  };
@@ -19728,6 +20603,18 @@ var sodWithoutParsing11 = (parameters) => {
19728
20603
  }
19729
20604
  return pads;
19730
20605
  };
20606
+ var sot89_3CourtyardOutline = [
20607
+ { x: -3.0875, y: -2.5 },
20608
+ { x: -3.0875, y: 2.5 },
20609
+ { x: 2.0125, y: 2.5 },
20610
+ { x: 2.0125, y: -2.5 }
20611
+ ];
20612
+ var sot89_5CourtyardOutline = [
20613
+ { x: -2.85, y: -2.5 },
20614
+ { x: -2.85, y: 2.5 },
20615
+ { x: 2.85, y: 2.5 },
20616
+ { x: 2.85, y: -2.5 }
20617
+ ];
19731
20618
  var sot89_def = base_def.extend({
19732
20619
  fn: z47.string(),
19733
20620
  num_pins: z47.union([z47.literal(3), z47.literal(5)]).default(3),
@@ -19778,11 +20665,19 @@ var sot89_3 = (parameters) => {
19778
20665
  type: "pcb_silkscreen_path",
19779
20666
  stroke_width: 0.1
19780
20667
  };
20668
+ const courtyard = {
20669
+ type: "pcb_courtyard_outline",
20670
+ pcb_courtyard_outline_id: "",
20671
+ pcb_component_id: "",
20672
+ outline: sot89_3CourtyardOutline,
20673
+ layer: "top"
20674
+ };
19781
20675
  return [
19782
20676
  ...pads,
19783
20677
  silkscreenPath1,
19784
20678
  silkscreenPath2,
19785
- silkscreenRefText
20679
+ silkscreenRefText,
20680
+ courtyard
19786
20681
  ];
19787
20682
  };
19788
20683
  var sot89_5 = (parameters) => {
@@ -19826,11 +20721,19 @@ var sot89_5 = (parameters) => {
19826
20721
  type: "pcb_silkscreen_path",
19827
20722
  stroke_width: 0.1
19828
20723
  };
20724
+ const courtyard = {
20725
+ type: "pcb_courtyard_outline",
20726
+ pcb_courtyard_outline_id: "",
20727
+ pcb_component_id: "",
20728
+ outline: sot89_5CourtyardOutline,
20729
+ layer: "top"
20730
+ };
19829
20731
  return [
19830
20732
  ...pads,
19831
20733
  silkscreenPath1,
19832
20734
  silkscreenPath2,
19833
- silkscreenRefText
20735
+ silkscreenRefText,
20736
+ courtyard
19834
20737
  ];
19835
20738
  };
19836
20739
  var sot89 = (raw_params) => {
@@ -19929,13 +20832,36 @@ var to220 = (raw_params) => {
19929
20832
  }
19930
20833
  ];
19931
20834
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 0.6, 0.5);
20835
+ const pinToeHalfSpanX = Math.max(...plated_holes.map((hole) => Math.abs(hole.x))) + od / 2;
20836
+ const pinToeTopY = holeY + od / 2;
20837
+ const pinToeBottomY = holeY - od / 2;
20838
+ const courtyardHalfWidth = Math.max(
20839
+ pinToeHalfSpanX + 0.25,
20840
+ halfWidth - od * 0.59
20841
+ );
20842
+ const courtyardTopY = halfHeight - od * 0.63;
20843
+ const courtyardBottomY = pinToeBottomY - (od / 2 + 0.01);
20844
+ const crtMinX = -courtyardHalfWidth;
20845
+ const crtMaxX = courtyardHalfWidth;
20846
+ const crtMinY = Math.min(courtyardBottomY, pinToeBottomY - 0.25);
20847
+ const crtMaxY = Math.max(courtyardTopY, pinToeTopY + 0.25);
20848
+ const courtyard = {
20849
+ type: "pcb_courtyard_rect",
20850
+ pcb_courtyard_rect_id: "",
20851
+ pcb_component_id: "",
20852
+ center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
20853
+ width: crtMaxX - crtMinX,
20854
+ height: crtMaxY - crtMinY,
20855
+ layer: "top"
20856
+ };
19932
20857
  return {
19933
20858
  circuitJson: [
19934
20859
  ...plated_holes,
19935
20860
  silkscreenBody,
19936
20861
  horizontalLine,
19937
20862
  ...verticalLines,
19938
- silkscreenRefText
20863
+ silkscreenRefText,
20864
+ courtyard
19939
20865
  ],
19940
20866
  parameters: { ...parameters, p: computedPitch }
19941
20867
  };
@@ -20037,10 +20963,22 @@ var minimelf = (raw_params) => {
20037
20963
  stroke_width: 0.1,
20038
20964
  pcb_silkscreen_path_id: ""
20039
20965
  };
20966
+ const courtyardWidthMm = 5.3;
20967
+ const courtyardHeightMm = 2.2;
20968
+ const courtyard = {
20969
+ type: "pcb_courtyard_rect",
20970
+ pcb_courtyard_rect_id: "",
20971
+ pcb_component_id: "",
20972
+ center: { x: 0, y: 0 },
20973
+ width: courtyardWidthMm,
20974
+ height: courtyardHeightMm,
20975
+ layer: "top"
20976
+ };
20040
20977
  return {
20041
20978
  circuitJson: miniMelfWithoutParsing(parameters).concat(
20042
20979
  silkscreenLine,
20043
- silkscreenRefText
20980
+ silkscreenRefText,
20981
+ courtyard
20044
20982
  ),
20045
20983
  parameters
20046
20984
  };
@@ -20109,10 +21047,22 @@ var sod882d = (raw_params) => {
20109
21047
  stroke_width: 0.1,
20110
21048
  pcb_silkscreen_path_id: ""
20111
21049
  };
21050
+ const courtyardWidthMm = 1.8;
21051
+ const courtyardHeightMm = 1.2;
21052
+ const courtyard = {
21053
+ type: "pcb_courtyard_rect",
21054
+ pcb_courtyard_rect_id: "",
21055
+ pcb_component_id: "",
21056
+ center: { x: 0, y: 0 },
21057
+ width: courtyardWidthMm,
21058
+ height: courtyardHeightMm,
21059
+ layer: "top"
21060
+ };
20112
21061
  return {
20113
21062
  circuitJson: sodWithoutParsing12(parameters).concat(
20114
21063
  silkscreenLine,
20115
- silkscreenRefText
21064
+ silkscreenRefText,
21065
+ courtyard
20116
21066
  ),
20117
21067
  parameters
20118
21068
  };
@@ -20185,10 +21135,22 @@ var melf = (raw_params) => {
20185
21135
  stroke_width: 0.1,
20186
21136
  pcb_silkscreen_path_id: ""
20187
21137
  };
21138
+ const courtyardWidthMm = 6.8;
21139
+ const courtyardHeightMm = 3.2;
21140
+ const courtyard = {
21141
+ type: "pcb_courtyard_rect",
21142
+ pcb_courtyard_rect_id: "",
21143
+ pcb_component_id: "",
21144
+ center: { x: 0, y: 0 },
21145
+ width: courtyardWidthMm,
21146
+ height: courtyardHeightMm,
21147
+ layer: "top"
21148
+ };
20188
21149
  return {
20189
21150
  circuitJson: melfWithoutParsing(parameters).concat(
20190
21151
  silkscreenLine,
20191
- silkscreenRefText
21152
+ silkscreenRefText,
21153
+ courtyard
20192
21154
  ),
20193
21155
  parameters
20194
21156
  };
@@ -20261,10 +21223,22 @@ var micromelf = (raw_params) => {
20261
21223
  stroke_width: 0.1,
20262
21224
  pcb_silkscreen_path_id: ""
20263
21225
  };
21226
+ const courtyardWidthMm = 2.9;
21227
+ const courtyardHeightMm = 1.7;
21228
+ const courtyard = {
21229
+ type: "pcb_courtyard_rect",
21230
+ pcb_courtyard_rect_id: "",
21231
+ pcb_component_id: "",
21232
+ center: { x: 0, y: 0 },
21233
+ width: courtyardWidthMm,
21234
+ height: courtyardHeightMm,
21235
+ layer: "top"
21236
+ };
20264
21237
  return {
20265
21238
  circuitJson: microMelfWithoutParsing(parameters).concat(
20266
21239
  silkscreenLine,
20267
- silkscreenRefText
21240
+ silkscreenRefText,
21241
+ courtyard
20268
21242
  ),
20269
21243
  parameters
20270
21244
  };
@@ -20301,9 +21275,9 @@ var sma_def = base_def.extend({
20301
21275
  num_pins: z54.literal(2).default(2),
20302
21276
  w: z54.string().default("7.10mm"),
20303
21277
  h: z54.string().default("3.40mm"),
20304
- pl: z54.string().default("2.45mm"),
21278
+ pl: z54.string().default("2.50mm"),
20305
21279
  pw: z54.string().default("1.80mm"),
20306
- p: z54.string().default("4.05mm")
21280
+ p: z54.string().default("4.00mm")
20307
21281
  });
20308
21282
  var sma = (raw_params) => {
20309
21283
  const parameters = sma_def.parse(raw_params);
@@ -20337,10 +21311,22 @@ var sma = (raw_params) => {
20337
21311
  stroke_width: 0.1,
20338
21312
  pcb_silkscreen_path_id: ""
20339
21313
  };
21314
+ const courtyardWidthMm = 7;
21315
+ const courtyardHeightMm = 3.5;
21316
+ const courtyard = {
21317
+ type: "pcb_courtyard_rect",
21318
+ pcb_courtyard_rect_id: "",
21319
+ pcb_component_id: "",
21320
+ center: { x: 0, y: 0 },
21321
+ width: courtyardWidthMm,
21322
+ height: courtyardHeightMm,
21323
+ layer: "top"
21324
+ };
20340
21325
  return {
20341
21326
  circuitJson: smaWithoutParsing(parameters).concat(
20342
21327
  silkscreenLine,
20343
- silkscreenRefText
21328
+ silkscreenRefText,
21329
+ courtyard
20344
21330
  ),
20345
21331
  parameters
20346
21332
  };
@@ -20412,10 +21398,22 @@ var smf = (raw_params) => {
20412
21398
  stroke_width: 0.1,
20413
21399
  pcb_silkscreen_path_id: ""
20414
21400
  };
21401
+ const courtyardWidthMm = 4.7;
21402
+ const courtyardHeightMm = 2.3;
21403
+ const courtyard = {
21404
+ type: "pcb_courtyard_rect",
21405
+ pcb_courtyard_rect_id: "",
21406
+ pcb_component_id: "",
21407
+ center: { x: 0, y: 0 },
21408
+ width: courtyardWidthMm,
21409
+ height: courtyardHeightMm,
21410
+ layer: "top"
21411
+ };
20415
21412
  return {
20416
21413
  circuitJson: smfWithoutParsing(parameters).concat(
20417
21414
  silkscreenLine,
20418
- silkscreenRefText
21415
+ silkscreenRefText,
21416
+ courtyard
20419
21417
  ),
20420
21418
  parameters
20421
21419
  };
@@ -20488,10 +21486,22 @@ var smb = (raw_params) => {
20488
21486
  stroke_width: 0.1,
20489
21487
  pcb_silkscreen_path_id: ""
20490
21488
  };
21489
+ const courtyardWidthMm = 7.3;
21490
+ const courtyardHeightMm = 4.5;
21491
+ const courtyard = {
21492
+ type: "pcb_courtyard_rect",
21493
+ pcb_courtyard_rect_id: "",
21494
+ pcb_component_id: "",
21495
+ center: { x: 0, y: 0 },
21496
+ width: courtyardWidthMm,
21497
+ height: courtyardHeightMm,
21498
+ layer: "top"
21499
+ };
20491
21500
  return {
20492
21501
  circuitJson: smbWithoutParsing(parameters).concat(
20493
21502
  silkscreenLine,
20494
- silkscreenRefText
21503
+ silkscreenRefText,
21504
+ courtyard
20495
21505
  ),
20496
21506
  parameters
20497
21507
  };
@@ -20528,8 +21538,8 @@ var smc_def = base_def.extend({
20528
21538
  num_pins: z57.literal(2).default(2),
20529
21539
  w: z57.string().default("10.70mm"),
20530
21540
  h: z57.string().default("6.60mm"),
20531
- pl: z57.string().default("3.30mm"),
20532
- pw: z57.string().default("2.50mm"),
21541
+ pl: z57.string().default("2.50mm"),
21542
+ pw: z57.string().default("3.30mm"),
20533
21543
  p: z57.string().default("6.80mm")
20534
21544
  });
20535
21545
  var smc = (raw_params) => {
@@ -20560,10 +21570,22 @@ var smc = (raw_params) => {
20560
21570
  stroke_width: 0.1,
20561
21571
  pcb_silkscreen_path_id: ""
20562
21572
  };
21573
+ const courtyardWidthMm = 9.8;
21574
+ const courtyardHeightMm = 6.7;
21575
+ const courtyard = {
21576
+ type: "pcb_courtyard_rect",
21577
+ pcb_courtyard_rect_id: "",
21578
+ pcb_component_id: "",
21579
+ center: { x: 0, y: 0 },
21580
+ width: courtyardWidthMm,
21581
+ height: courtyardHeightMm,
21582
+ layer: "top"
21583
+ };
20563
21584
  return {
20564
21585
  circuitJson: smcWithoutParsing(parameters).concat(
20565
21586
  silkscreenLine,
20566
- silkscreenRefText
21587
+ silkscreenRefText,
21588
+ courtyard
20567
21589
  ),
20568
21590
  parameters
20569
21591
  };
@@ -20656,6 +21678,8 @@ var get2CcwSot223Coords = (parameters) => {
20656
21678
  };
20657
21679
  var sot223_4 = (parameters) => {
20658
21680
  const pads = [];
21681
+ let padOuterHalfWidth = 0;
21682
+ let padOuterHalfHeight = 0;
20659
21683
  for (let i = 0; i < parameters.num_pins; i++) {
20660
21684
  const { x, y } = get2CcwSot223Coords({
20661
21685
  num_pins: parameters.num_pins,
@@ -20666,7 +21690,13 @@ var sot223_4 = (parameters) => {
20666
21690
  p: Number.parseFloat(parameters.p)
20667
21691
  });
20668
21692
  const pinWidth = i === 3 ? 3.8 : Number.parseFloat(parameters.pw);
20669
- pads.push(rectpad(i + 1, x, y, Number.parseFloat(parameters.pl), pinWidth));
21693
+ const pinLength = Number.parseFloat(parameters.pl);
21694
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
21695
+ padOuterHalfHeight = Math.max(
21696
+ padOuterHalfHeight,
21697
+ Math.abs(y) + pinWidth / 2
21698
+ );
21699
+ pads.push(rectpad(i + 1, x, y, pinLength, pinWidth));
20670
21700
  }
20671
21701
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
20672
21702
  const width10 = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -20695,11 +21725,31 @@ var sot223_4 = (parameters) => {
20695
21725
  type: "pcb_silkscreen_path",
20696
21726
  stroke_width: 0.1
20697
21727
  };
21728
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
21729
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
21730
+ const courtyardHalfWidth = Math.max(
21731
+ padOuterHalfWidth + 0.25,
21732
+ bodyHalfWidth + 0.15
21733
+ );
21734
+ const courtyardHalfHeight = Math.max(
21735
+ padOuterHalfHeight + 0.25,
21736
+ bodyHalfHeight + 0.15
21737
+ );
21738
+ const courtyard = {
21739
+ type: "pcb_courtyard_rect",
21740
+ pcb_courtyard_rect_id: "",
21741
+ pcb_component_id: "",
21742
+ center: { x: 0, y: 0 },
21743
+ width: 2 * courtyardHalfWidth,
21744
+ height: 2 * courtyardHalfHeight,
21745
+ layer: "top"
21746
+ };
20698
21747
  return [
20699
21748
  ...pads,
20700
21749
  silkscreenPath1,
20701
21750
  silkscreenPath2,
20702
- silkscreenRefText
21751
+ silkscreenRefText,
21752
+ courtyard
20703
21753
  ];
20704
21754
  };
20705
21755
  var sot223_8_def = extendSoicDef({
@@ -20728,6 +21778,8 @@ var get2CcwSot2235Coords = (parameters) => {
20728
21778
  };
20729
21779
  var sot223_5 = (parameters) => {
20730
21780
  const pads = [];
21781
+ let padOuterHalfWidth = 0;
21782
+ let padOuterHalfHeight = 0;
20731
21783
  for (let i = 1; i <= parameters.num_pins; i++) {
20732
21784
  const { x, y } = get2CcwSot2235Coords({
20733
21785
  h: Number.parseFloat(parameters.h),
@@ -20744,6 +21796,11 @@ var sot223_5 = (parameters) => {
20744
21796
  pinWidth = 1;
20745
21797
  pinLength = 2.2;
20746
21798
  }
21799
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
21800
+ padOuterHalfHeight = Math.max(
21801
+ padOuterHalfHeight,
21802
+ Math.abs(y) + pinWidth / 2
21803
+ );
20747
21804
  pads.push(rectpad(i, x, y, pinLength, pinWidth));
20748
21805
  }
20749
21806
  const width10 = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -20773,7 +21830,32 @@ var sot223_5 = (parameters) => {
20773
21830
  stroke_width: 0.1
20774
21831
  };
20775
21832
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
20776
- return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
21833
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
21834
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
21835
+ const courtyardHalfWidth = Math.max(
21836
+ padOuterHalfWidth + 0.25,
21837
+ bodyHalfWidth + 0.15
21838
+ );
21839
+ const courtyardHalfHeight = Math.max(
21840
+ padOuterHalfHeight + 0.25,
21841
+ bodyHalfHeight + 0.15
21842
+ );
21843
+ const courtyard = {
21844
+ type: "pcb_courtyard_rect",
21845
+ pcb_courtyard_rect_id: "",
21846
+ pcb_component_id: "",
21847
+ center: { x: 0, y: 0 },
21848
+ width: 2 * courtyardHalfWidth,
21849
+ height: 2 * courtyardHalfHeight,
21850
+ layer: "top"
21851
+ };
21852
+ return [
21853
+ ...pads,
21854
+ silkscreenPath1,
21855
+ silkscreenPath2,
21856
+ silkscreenRefText,
21857
+ courtyard
21858
+ ];
20777
21859
  };
20778
21860
  var get2CcwSot2236Coords = (parameters) => {
20779
21861
  const { p, h: h2, pn, w } = parameters;
@@ -20799,6 +21881,8 @@ var get2CcwSot2236Coords = (parameters) => {
20799
21881
  };
20800
21882
  var sot223_6 = (parameters) => {
20801
21883
  const pads = [];
21884
+ let padOuterHalfWidth = 0;
21885
+ let padOuterHalfHeight = 0;
20802
21886
  for (let i = 1; i <= parameters.num_pins; i++) {
20803
21887
  const { x, y } = get2CcwSot2236Coords({
20804
21888
  h: Number.parseFloat(parameters.h),
@@ -20815,6 +21899,11 @@ var sot223_6 = (parameters) => {
20815
21899
  pinWidth = 0.6;
20816
21900
  pinLength = 2.2;
20817
21901
  }
21902
+ padOuterHalfWidth = Math.max(padOuterHalfWidth, Math.abs(x) + pinLength / 2);
21903
+ padOuterHalfHeight = Math.max(
21904
+ padOuterHalfHeight,
21905
+ Math.abs(y) + pinWidth / 2
21906
+ );
20818
21907
  pads.push(rectpad(i, x, y, pinLength, pinWidth));
20819
21908
  }
20820
21909
  const width10 = Number.parseFloat(parameters.w) / 2 - 2.4;
@@ -20844,7 +21933,32 @@ var sot223_6 = (parameters) => {
20844
21933
  stroke_width: 0.1
20845
21934
  };
20846
21935
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
20847
- return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
21936
+ const bodyHalfWidth = Number.parseFloat(parameters.w) / 2;
21937
+ const bodyHalfHeight = Number.parseFloat(parameters.h) / 2;
21938
+ const courtyardHalfWidth = Math.max(
21939
+ padOuterHalfWidth + 0.25,
21940
+ bodyHalfWidth + 0.15
21941
+ );
21942
+ const courtyardHalfHeight = Math.max(
21943
+ padOuterHalfHeight + 0.25,
21944
+ bodyHalfHeight + 0.15
21945
+ );
21946
+ const courtyard = {
21947
+ type: "pcb_courtyard_rect",
21948
+ pcb_courtyard_rect_id: "",
21949
+ pcb_component_id: "",
21950
+ center: { x: 0, y: 0 },
21951
+ width: 2 * courtyardHalfWidth,
21952
+ height: 2 * courtyardHalfHeight,
21953
+ layer: "top"
21954
+ };
21955
+ return [
21956
+ ...pads,
21957
+ silkscreenPath1,
21958
+ silkscreenPath2,
21959
+ silkscreenRefText,
21960
+ courtyard
21961
+ ];
20848
21962
  };
20849
21963
  var sot23w_def = base_def.extend({
20850
21964
  fn: z59.string(),
@@ -20933,11 +22047,33 @@ var sot23w_3 = (parameters) => {
20933
22047
  type: "pcb_silkscreen_path",
20934
22048
  stroke_width: 0.1
20935
22049
  };
22050
+ const p = Number.parseFloat(parameters.p);
22051
+ const pl = Number.parseFloat(parameters.pl);
22052
+ const pw = Number.parseFloat(parameters.pw);
22053
+ const h2 = Number.parseFloat(parameters.h);
22054
+ const padToeHalfWidth = p + pl / 2;
22055
+ const pinRowHalfHeight = 0.95 + pw / 2;
22056
+ const bodyHalfHeight = h2 / 2;
22057
+ const courtyardHalfWidth = padToeHalfWidth + 0.25;
22058
+ const courtyardHalfHeight = Math.max(
22059
+ pinRowHalfHeight + 0.25,
22060
+ bodyHalfHeight + 0.09
22061
+ );
22062
+ const courtyard = {
22063
+ type: "pcb_courtyard_rect",
22064
+ pcb_courtyard_rect_id: "",
22065
+ pcb_component_id: "",
22066
+ center: { x: 0, y: 0 },
22067
+ width: 2 * courtyardHalfWidth,
22068
+ height: 2 * courtyardHalfHeight,
22069
+ layer: "top"
22070
+ };
20936
22071
  return [
20937
22072
  ...pads,
20938
22073
  silkscreenPath1,
20939
22074
  silkscreenPath2,
20940
- silkscreenRefText
22075
+ silkscreenRefText,
22076
+ courtyard
20941
22077
  ];
20942
22078
  };
20943
22079
  var to92s_def = base_def.extend({
@@ -21003,11 +22139,38 @@ var to92s = (raw_params) => {
21003
22139
  pcb_silkscreen_path_id: ""
21004
22140
  };
21005
22141
  const silkscreenRefText = silkscreenRef(0, holeY + 1, 0.5);
22142
+ const padOuterDiameter = Number.parseFloat(parameters.od);
22143
+ const padCenterY = holeY - padSpacing7;
22144
+ const padMinX = -padSpacing7 - padOuterDiameter / 2;
22145
+ const padMaxX = padSpacing7 + padOuterDiameter / 2;
22146
+ const padMinY = padCenterY - padOuterDiameter / 2;
22147
+ const padMaxY = padCenterY + padOuterDiameter / 2;
22148
+ const bodyMinX = -holeY;
22149
+ const bodyMaxX = holeY;
22150
+ const bodyMinY = 0;
22151
+ const bodyMaxY = holeY + 0.5;
22152
+ const courtyardMinX = Math.min(padMinX, bodyMinX) - 0.27;
22153
+ const courtyardMaxX = Math.max(padMaxX, bodyMaxX) + 0.13;
22154
+ const courtyardMinY = Math.min(padMinY, bodyMinY) - 0.42;
22155
+ const courtyardMaxY = Math.max(padMaxY, bodyMaxY) + 0.08;
22156
+ const courtyard = {
22157
+ type: "pcb_courtyard_rect",
22158
+ pcb_courtyard_rect_id: "",
22159
+ pcb_component_id: "",
22160
+ center: {
22161
+ x: (courtyardMinX + courtyardMaxX) / 2,
22162
+ y: (courtyardMinY + courtyardMaxY) / 2
22163
+ },
22164
+ width: courtyardMaxX - courtyardMinX,
22165
+ height: courtyardMaxY - courtyardMinY,
22166
+ layer: "top"
22167
+ };
21006
22168
  return {
21007
22169
  circuitJson: [
21008
22170
  ...platedHoles,
21009
22171
  silkscreenBody,
21010
- silkscreenRefText
22172
+ silkscreenRefText,
22173
+ courtyard
21011
22174
  ],
21012
22175
  parameters
21013
22176
  };
@@ -21031,6 +22194,26 @@ var jst_def = base_def.extend({
21031
22194
  ),
21032
22195
  string: z61.string().optional()
21033
22196
  });
22197
+ var createEmptyBounds = () => ({
22198
+ minX: Number.POSITIVE_INFINITY,
22199
+ maxX: Number.NEGATIVE_INFINITY,
22200
+ minY: Number.POSITIVE_INFINITY,
22201
+ maxY: Number.NEGATIVE_INFINITY
22202
+ });
22203
+ var modifyBoundsToIncludeRect = ({
22204
+ bounds,
22205
+ centerX,
22206
+ centerY,
22207
+ width: width10,
22208
+ height: height10
22209
+ }) => {
22210
+ const halfWidth = width10 / 2;
22211
+ const halfHeight = height10 / 2;
22212
+ bounds.minX = Math.min(bounds.minX, centerX - halfWidth);
22213
+ bounds.maxX = Math.max(bounds.maxX, centerX + halfWidth);
22214
+ bounds.minY = Math.min(bounds.minY, centerY - halfHeight);
22215
+ bounds.maxY = Math.max(bounds.maxY, centerY + halfHeight);
22216
+ };
21034
22217
  var variantDefaults = {
21035
22218
  ph: {
21036
22219
  p: length48.parse("2.2mm"),
@@ -21062,8 +22245,17 @@ function getVariant(params) {
21062
22245
  if (params.zh) return "zh";
21063
22246
  return "ph";
21064
22247
  }
21065
- function generatePads(variant, numPins, p, id, pw, pl) {
22248
+ function generatePads({
22249
+ variant,
22250
+ numPins,
22251
+ p,
22252
+ id,
22253
+ pw,
22254
+ pl
22255
+ }) {
21066
22256
  const pads = [];
22257
+ const padBounds = createEmptyBounds();
22258
+ let maxPadHalfY = 0;
21067
22259
  if (variant === "ph") {
21068
22260
  const startX = -((numPins - 1) / 2) * p;
21069
22261
  for (let i = 0; i < numPins; i++) {
@@ -21078,6 +22270,14 @@ function generatePads(variant, numPins, p, id, pw, pl) {
21078
22270
  rectPadHeight: pl
21079
22271
  })
21080
22272
  );
22273
+ modifyBoundsToIncludeRect({
22274
+ bounds: padBounds,
22275
+ centerX: x,
22276
+ centerY: 2,
22277
+ width: pw,
22278
+ height: pl
22279
+ });
22280
+ maxPadHalfY = Math.max(maxPadHalfY, pl / 2);
21081
22281
  }
21082
22282
  } else if (variant === "zh") {
21083
22283
  const startX = -((numPins - 1) / 2) * p;
@@ -21098,20 +22298,57 @@ function generatePads(variant, numPins, p, id, pw, pl) {
21098
22298
  } else {
21099
22299
  pads.push(platedHolePill(i + 1, x, 0, id, pw, pl));
21100
22300
  }
22301
+ modifyBoundsToIncludeRect({
22302
+ bounds: padBounds,
22303
+ centerX: x,
22304
+ centerY: 0,
22305
+ width: pw,
22306
+ height: pl
22307
+ });
22308
+ maxPadHalfY = Math.max(maxPadHalfY, pl / 2);
21101
22309
  }
21102
22310
  } else {
21103
22311
  const startX = -((numPins - 1) / 2) * p;
21104
22312
  for (let i = 0; i < numPins; i++) {
21105
22313
  const x = startX + i * p;
21106
22314
  pads.push(rectpad(i + 1, x, -1.325, pw, pl));
22315
+ modifyBoundsToIncludeRect({
22316
+ bounds: padBounds,
22317
+ centerX: x,
22318
+ centerY: -1.325,
22319
+ width: pw,
22320
+ height: pl
22321
+ });
22322
+ maxPadHalfY = Math.max(maxPadHalfY, pl / 2);
21107
22323
  }
21108
22324
  const sideOffset = (numPins - 1) / 2 * p + 1.3;
21109
22325
  pads.push(rectpad(numPins + 1, -sideOffset, 1.22, 1.2, 1.8));
21110
22326
  pads.push(rectpad(numPins + 2, sideOffset, 1.22, 1.2, 1.8));
22327
+ modifyBoundsToIncludeRect({
22328
+ bounds: padBounds,
22329
+ centerX: -sideOffset,
22330
+ centerY: 1.22,
22331
+ width: 1.2,
22332
+ height: 1.8
22333
+ });
22334
+ modifyBoundsToIncludeRect({
22335
+ bounds: padBounds,
22336
+ centerX: sideOffset,
22337
+ centerY: 1.22,
22338
+ width: 1.2,
22339
+ height: 1.8
22340
+ });
22341
+ maxPadHalfY = Math.max(maxPadHalfY, 0.9);
21111
22342
  }
21112
- return pads;
22343
+ return { pads, padBounds, maxPadHalfY };
21113
22344
  }
21114
- function generateSilkscreenBody(variant, w, h2, numPins, p) {
22345
+ function generateSilkscreenBody({
22346
+ variant,
22347
+ w,
22348
+ h: h2,
22349
+ numPins,
22350
+ p
22351
+ }) {
21115
22352
  if (variant === "ph") {
21116
22353
  return {
21117
22354
  type: "pcb_silkscreen_path",
@@ -21193,11 +22430,53 @@ var jst = (raw_params) => {
21193
22430
  `JST requires an explicit pin count (e.g. jst6_sh or .jst(6))${params.string ? `, from string "${params.string}"` : ""}`
21194
22431
  );
21195
22432
  }
21196
- const pads = generatePads(variant, numPins, p, id, pw, pl);
21197
- const silkscreenBody = generateSilkscreenBody(variant, w, h2, numPins, p);
22433
+ const padGeometry = generatePads({
22434
+ variant,
22435
+ numPins,
22436
+ p,
22437
+ id,
22438
+ pw,
22439
+ pl
22440
+ });
22441
+ const { pads, padBounds, maxPadHalfY } = padGeometry;
22442
+ const silkscreenBody = generateSilkscreenBody({
22443
+ variant,
22444
+ w,
22445
+ h: h2,
22446
+ numPins,
22447
+ p
22448
+ });
21198
22449
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 1, 0.5);
22450
+ const silkscreenXs = silkscreenBody.route.map((point) => point.x);
22451
+ const silkscreenYs = silkscreenBody.route.map((point) => point.y);
22452
+ const hasSilkscreenGeometry = silkscreenXs.length > 0 && silkscreenYs.length > 0;
22453
+ const featureMinX = hasSilkscreenGeometry ? Math.min(padBounds.minX, Math.min(...silkscreenXs)) : padBounds.minX;
22454
+ const featureMaxX = hasSilkscreenGeometry ? Math.max(padBounds.maxX, Math.max(...silkscreenXs)) : padBounds.maxX;
22455
+ const featureMinY = hasSilkscreenGeometry ? Math.min(padBounds.minY, Math.min(...silkscreenYs)) : padBounds.minY;
22456
+ const featureMaxY = hasSilkscreenGeometry ? Math.max(padBounds.maxY, Math.max(...silkscreenYs)) : padBounds.maxY;
22457
+ const courtyardSideClearanceX = 0.5;
22458
+ const courtyardFrontClearanceY = 0.05;
22459
+ const courtyardRearClearanceY = maxPadHalfY + 0.085;
22460
+ const crtMinX = featureMinX - courtyardSideClearanceX;
22461
+ const crtMaxX = featureMaxX + courtyardSideClearanceX;
22462
+ const crtMinY = featureMinY - courtyardRearClearanceY;
22463
+ const crtMaxY = featureMaxY + courtyardFrontClearanceY;
22464
+ const courtyard = {
22465
+ type: "pcb_courtyard_rect",
22466
+ pcb_courtyard_rect_id: "",
22467
+ pcb_component_id: "",
22468
+ center: { x: (crtMinX + crtMaxX) / 2, y: (crtMinY + crtMaxY) / 2 },
22469
+ width: crtMaxX - crtMinX,
22470
+ height: crtMaxY - crtMinY,
22471
+ layer: "top"
22472
+ };
21199
22473
  return {
21200
- circuitJson: [...pads, silkscreenBody, silkscreenRefText],
22474
+ circuitJson: [
22475
+ ...pads,
22476
+ silkscreenBody,
22477
+ silkscreenRefText,
22478
+ courtyard
22479
+ ],
21201
22480
  parameters: {
21202
22481
  ...params,
21203
22482
  p,
@@ -21254,10 +22533,22 @@ var sod110 = (raw_params) => {
21254
22533
  stroke_width: 0.1,
21255
22534
  pcb_silkscreen_path_id: ""
21256
22535
  };
22536
+ const courtyardWidthMm = 3.2;
22537
+ const courtyardHeightMm = 2;
22538
+ const courtyard = {
22539
+ type: "pcb_courtyard_rect",
22540
+ pcb_courtyard_rect_id: "",
22541
+ pcb_component_id: "",
22542
+ center: { x: 0, y: 0 },
22543
+ width: courtyardWidthMm,
22544
+ height: courtyardHeightMm,
22545
+ layer: "top"
22546
+ };
21257
22547
  return {
21258
22548
  circuitJson: sodWithoutParsing13(parameters).concat(
21259
22549
  silkscreenLine,
21260
- silkscreenRefText
22550
+ silkscreenRefText,
22551
+ courtyard
21261
22552
  ),
21262
22553
  parameters
21263
22554
  };
@@ -21393,13 +22684,39 @@ var vssop = (raw_params) => {
21393
22684
  silkscreenBoxHeight / 2 + 0.5,
21394
22685
  0.3
21395
22686
  );
22687
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * p + pw;
22688
+ const courtyardStepInnerHalfWidth = w / 2 + 0.25;
22689
+ const courtyardStepOuterHalfWidth = courtyardStepInnerHalfWidth + 1.43;
22690
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.255;
22691
+ const courtyardStepOuterHalfHeight = h2 / 2 + 0.25;
22692
+ const courtyard = {
22693
+ type: "pcb_courtyard_outline",
22694
+ pcb_courtyard_outline_id: "",
22695
+ pcb_component_id: "",
22696
+ layer: "top",
22697
+ outline: createRectUnionOutline([
22698
+ {
22699
+ minX: -courtyardStepOuterHalfWidth,
22700
+ maxX: courtyardStepOuterHalfWidth,
22701
+ minY: -courtyardStepInnerHalfHeight,
22702
+ maxY: courtyardStepInnerHalfHeight
22703
+ },
22704
+ {
22705
+ minX: -courtyardStepInnerHalfWidth,
22706
+ maxX: courtyardStepInnerHalfWidth,
22707
+ minY: -courtyardStepOuterHalfHeight,
22708
+ maxY: courtyardStepOuterHalfHeight
22709
+ }
22710
+ ])
22711
+ };
21396
22712
  return {
21397
22713
  circuitJson: [
21398
22714
  ...pads,
21399
22715
  silkscreenTopLine,
21400
22716
  silkscreenBottomLine,
21401
22717
  silkscreenRefText,
21402
- pin1Marking
22718
+ pin1Marking,
22719
+ courtyard
21403
22720
  ],
21404
22721
  parameters
21405
22722
  };
@@ -21410,7 +22727,7 @@ var getVssopPadCoord = (pinCount, pn, w, p) => {
21410
22727
  const col = pn <= half ? -1 : 1;
21411
22728
  const row = (half - 1) / 2 - rowIndex;
21412
22729
  return {
21413
- x: col * length50.parse(pinCount === 8 ? "1.8mm" : "2.2mm"),
22730
+ x: col * 2.11,
21414
22731
  y: row * p
21415
22732
  };
21416
22733
  };
@@ -21535,13 +22852,39 @@ var msop = (raw_params) => {
21535
22852
  silkscreenBoxHeight / 2 + 0.5,
21536
22853
  0.3
21537
22854
  );
22855
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * p + pw;
22856
+ const courtyardStepInnerHalfWidth = w / 2 + 0.25;
22857
+ const courtyardStepOuterHalfWidth = courtyardStepInnerHalfWidth + 1.43;
22858
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.255;
22859
+ const courtyardStepOuterHalfHeight = h2 / 2 + 0.25;
22860
+ const courtyard = {
22861
+ type: "pcb_courtyard_outline",
22862
+ pcb_courtyard_outline_id: "",
22863
+ pcb_component_id: "",
22864
+ layer: "top",
22865
+ outline: createRectUnionOutline([
22866
+ {
22867
+ minX: -courtyardStepOuterHalfWidth,
22868
+ maxX: courtyardStepOuterHalfWidth,
22869
+ minY: -courtyardStepInnerHalfHeight,
22870
+ maxY: courtyardStepInnerHalfHeight
22871
+ },
22872
+ {
22873
+ minX: -courtyardStepInnerHalfWidth,
22874
+ maxX: courtyardStepInnerHalfWidth,
22875
+ minY: -courtyardStepOuterHalfHeight,
22876
+ maxY: courtyardStepOuterHalfHeight
22877
+ }
22878
+ ])
22879
+ };
21538
22880
  return {
21539
22881
  circuitJson: [
21540
22882
  ...pads,
21541
22883
  silkscreenTopLine,
21542
22884
  silkscreenBottomLine,
21543
22885
  silkscreenRefText,
21544
- pin1Marking
22886
+ pin1Marking,
22887
+ courtyard
21545
22888
  ],
21546
22889
  parameters
21547
22890
  };
@@ -21587,10 +22930,22 @@ var sod323w = (raw_params) => {
21587
22930
  stroke_width: 0.1,
21588
22931
  pcb_silkscreen_path_id: ""
21589
22932
  };
22933
+ const courtyardWidthMm = 4.3;
22934
+ const courtyardHeightMm = 2.15;
22935
+ const courtyard = {
22936
+ type: "pcb_courtyard_rect",
22937
+ pcb_courtyard_rect_id: "",
22938
+ pcb_component_id: "",
22939
+ center: { x: 0, y: 0 },
22940
+ width: courtyardWidthMm,
22941
+ height: courtyardHeightMm,
22942
+ layer: "top"
22943
+ };
21590
22944
  return {
21591
22945
  circuitJson: sodWithoutParsing14(parameters).concat(
21592
22946
  silkscreenLine,
21593
- silkscreenRefText
22947
+ silkscreenRefText,
22948
+ courtyard
21594
22949
  ),
21595
22950
  parameters
21596
22951
  };
@@ -21663,10 +23018,22 @@ var sod323fl = (raw_params) => {
21663
23018
  stroke_width: 0.1,
21664
23019
  pcb_silkscreen_path_id: ""
21665
23020
  };
23021
+ const courtyardWidthMm = 3.7;
23022
+ const courtyardHeightMm = 2.15;
23023
+ const courtyard = {
23024
+ type: "pcb_courtyard_rect",
23025
+ pcb_courtyard_rect_id: "",
23026
+ pcb_component_id: "",
23027
+ center: { x: 0, y: 0 },
23028
+ width: courtyardWidthMm,
23029
+ height: courtyardHeightMm,
23030
+ layer: "top"
23031
+ };
21666
23032
  return {
21667
23033
  circuitJson: sodWithoutParsing15(parameters).concat(
21668
23034
  silkscreenLine,
21669
- silkscreenRefText
23035
+ silkscreenRefText,
23036
+ courtyard
21670
23037
  ),
21671
23038
  parameters
21672
23039
  };
@@ -21788,13 +23155,43 @@ var son = (raw_params) => {
21788
23155
  silkscreenBoxHeight / 2 + 0.5,
21789
23156
  0.3
21790
23157
  );
23158
+ const pinColumnCenterX = Math.abs(
23159
+ getSonPadCoord(parameters.num_pins, 1, w, p).x
23160
+ );
23161
+ const pinRowSpanY = (parameters.num_pins / 2 - 1) * p + pw;
23162
+ const pinRowSpanX = pinColumnCenterX * 2 + pl;
23163
+ const courtyardStepInnerHalfWidth = w / 2 + 0.25;
23164
+ const courtyardStepOuterHalfWidth = pinRowSpanX / 2 + 0.25;
23165
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.25;
23166
+ const courtyardStepOuterHalfHeight = h2 / 2 + 0.25;
23167
+ const courtyard = {
23168
+ type: "pcb_courtyard_outline",
23169
+ pcb_courtyard_outline_id: "",
23170
+ pcb_component_id: "",
23171
+ layer: "top",
23172
+ outline: createRectUnionOutline([
23173
+ {
23174
+ minX: -courtyardStepOuterHalfWidth,
23175
+ maxX: courtyardStepOuterHalfWidth,
23176
+ minY: -courtyardStepInnerHalfHeight,
23177
+ maxY: courtyardStepInnerHalfHeight
23178
+ },
23179
+ {
23180
+ minX: -courtyardStepInnerHalfWidth,
23181
+ maxX: courtyardStepInnerHalfWidth,
23182
+ minY: -courtyardStepOuterHalfHeight,
23183
+ maxY: courtyardStepOuterHalfHeight
23184
+ }
23185
+ ])
23186
+ };
21791
23187
  return {
21792
23188
  circuitJson: [
21793
23189
  ...pads,
21794
23190
  silkscreenTopLine,
21795
23191
  silkscreenBottomLine,
21796
23192
  silkscreenRefText,
21797
- pin1Marking
23193
+ pin1Marking,
23194
+ courtyard
21798
23195
  ],
21799
23196
  parameters
21800
23197
  };
@@ -21845,8 +23242,49 @@ var vson = (raw_params) => {
21845
23242
  grid2.y / 2 + p,
21846
23243
  grid2.y / 6
21847
23244
  );
23245
+ const pinRowSpanY = (num_pins / 2 - 1) * p + pinh;
23246
+ const pinRowSpanX = w + pinw;
23247
+ const courtyardStepInnerHalfWidth = grid2.x / 2 + 0.25;
23248
+ const courtyardStepOuterHalfWidth = pinRowSpanX / 2 + 0.25;
23249
+ const pinRowCourtyardHalfY = pinRowSpanY / 2 + 0.25;
23250
+ const pinRowExtendedCourtyardHalfY = pinRowSpanY / 2 + 0.45 + Math.max(0, 0.8 - p);
23251
+ const courtyardStepOuterHalfHeight = Math.min(
23252
+ grid2.y / 2 + 0.25,
23253
+ pinRowExtendedCourtyardHalfY
23254
+ );
23255
+ const courtyardStepNotchDepthY = Math.max(
23256
+ 0,
23257
+ 0.37 - Math.max(
23258
+ 0,
23259
+ courtyardStepOuterHalfWidth - courtyardStepInnerHalfWidth - 0.38
23260
+ ) * 1.4
23261
+ );
23262
+ const courtyardStepInnerHalfHeight = Math.max(
23263
+ pinRowCourtyardHalfY,
23264
+ courtyardStepOuterHalfHeight - courtyardStepNotchDepthY
23265
+ );
23266
+ const courtyard = {
23267
+ type: "pcb_courtyard_outline",
23268
+ pcb_courtyard_outline_id: "",
23269
+ pcb_component_id: "",
23270
+ layer: "top",
23271
+ outline: createRectUnionOutline([
23272
+ {
23273
+ minX: -courtyardStepOuterHalfWidth,
23274
+ maxX: courtyardStepOuterHalfWidth,
23275
+ minY: -courtyardStepInnerHalfHeight,
23276
+ maxY: courtyardStepInnerHalfHeight
23277
+ },
23278
+ {
23279
+ minX: -courtyardStepInnerHalfWidth,
23280
+ maxX: courtyardStepInnerHalfWidth,
23281
+ minY: -courtyardStepOuterHalfHeight,
23282
+ maxY: courtyardStepOuterHalfHeight
23283
+ }
23284
+ ])
23285
+ };
21848
23286
  return {
21849
- circuitJson: [...pads, ...silkscreenPaths, silkscreenRefText],
23287
+ circuitJson: [...pads, ...silkscreenPaths, silkscreenRefText, courtyard],
21850
23288
  parameters
21851
23289
  };
21852
23290
  };
@@ -22008,8 +23446,22 @@ var solderjumper = (params) => {
22008
23446
  const refOffset = 0.6;
22009
23447
  const refY = outlineCenterY + outlineHeight / 2 + refOffset;
22010
23448
  const silk = silkscreenRef(outlineCenterX, refY, 0.4);
23449
+ const pinRowSpanX = (num_pins - 1) * padSpacing7;
23450
+ const padOuterHalfWidth = pinRowSpanX / 2 + padWidth / 2;
23451
+ const padOuterHalfHeight = padHeight / 2;
23452
+ const courtyardHalfWidth = padOuterHalfWidth + 0.5;
23453
+ const courtyardHalfHeight = padOuterHalfHeight + 0.5;
23454
+ const courtyard = {
23455
+ type: "pcb_courtyard_rect",
23456
+ pcb_courtyard_rect_id: "",
23457
+ pcb_component_id: "",
23458
+ center: { x: pinRowSpanX / 2, y: 0 },
23459
+ width: 2 * courtyardHalfWidth,
23460
+ height: 2 * courtyardHalfHeight,
23461
+ layer: "top"
23462
+ };
22011
23463
  return {
22012
- circuitJson: [...pads, ...traces, silkscreenRect, silk],
23464
+ circuitJson: [...pads, ...traces, silkscreenRect, silk, courtyard],
22013
23465
  parameters: params
22014
23466
  };
22015
23467
  };
@@ -22154,12 +23606,64 @@ var generateSot457Elements = (params) => {
22154
23606
  ],
22155
23607
  stroke_width: 0.05
22156
23608
  };
23609
+ let courtyard;
23610
+ if (params.wave) {
23611
+ const pinRowSpanX = 2 * pitch;
23612
+ const pinRowSpanY = 2 * pitch;
23613
+ const padOuterHalfWidth = pinRowSpanX / 2 + padWidth / 2;
23614
+ const padOuterHalfHeight = pinRowSpanY / 2 + padLength / 2;
23615
+ const courtyardHalfWidth = padOuterHalfWidth + 0.25;
23616
+ const courtyardHalfHeight = padOuterHalfHeight + 0.25;
23617
+ courtyard = {
23618
+ type: "pcb_courtyard_rect",
23619
+ pcb_courtyard_rect_id: "",
23620
+ pcb_component_id: "",
23621
+ center: { x: 0, y: 0 },
23622
+ width: 2 * courtyardHalfWidth,
23623
+ height: 2 * courtyardHalfHeight,
23624
+ layer: "top"
23625
+ };
23626
+ } else {
23627
+ const padCenterX = width10 / 2 + 0.1;
23628
+ const padToeHalfWidth = padCenterX + padLength / 2;
23629
+ const pinRowHalfHeight = pitch + padWidth / 2;
23630
+ const bodyHalfWidth = width10 / 2;
23631
+ const bodyHalfHeight = height10 / 2;
23632
+ const courtyardStepOuterHalfWidth = padToeHalfWidth + 0.25;
23633
+ const courtyardStepInnerHalfWidth = bodyHalfWidth + 0.08;
23634
+ const courtyardStepOuterHalfHeight = pinRowHalfHeight + 0.25;
23635
+ const courtyardStepInnerHalfHeight = Math.max(
23636
+ bodyHalfHeight + 0.45,
23637
+ courtyardStepOuterHalfHeight
23638
+ );
23639
+ courtyard = {
23640
+ type: "pcb_courtyard_outline",
23641
+ pcb_courtyard_outline_id: "",
23642
+ pcb_component_id: "",
23643
+ outline: createRectUnionOutline([
23644
+ {
23645
+ minX: -courtyardStepOuterHalfWidth,
23646
+ maxX: courtyardStepOuterHalfWidth,
23647
+ minY: -courtyardStepOuterHalfHeight,
23648
+ maxY: courtyardStepOuterHalfHeight
23649
+ },
23650
+ {
23651
+ minX: -courtyardStepInnerHalfWidth,
23652
+ maxX: courtyardStepInnerHalfWidth,
23653
+ minY: -courtyardStepInnerHalfHeight,
23654
+ maxY: courtyardStepInnerHalfHeight
23655
+ }
23656
+ ]),
23657
+ layer: "top"
23658
+ };
23659
+ }
22157
23660
  return [
22158
23661
  silkscreenRefText,
22159
23662
  silkscreenPath1,
22160
23663
  silkscreenPath2,
22161
23664
  pin1Indicator,
22162
- ...pads
23665
+ ...pads,
23666
+ courtyard
22163
23667
  ];
22164
23668
  };
22165
23669
  var sot457 = (rawParams) => {
@@ -22176,6 +23680,12 @@ var sot457 = (rawParams) => {
22176
23680
  parameters
22177
23681
  };
22178
23682
  };
23683
+ var sot963CourtyardOutline = [
23684
+ { x: -0.8, y: 0.75 },
23685
+ { x: 0.8, y: 0.75 },
23686
+ { x: 0.8, y: -0.75 },
23687
+ { x: -0.8, y: -0.75 }
23688
+ ];
22179
23689
  var sot963_def = base_def.extend({
22180
23690
  fn: z70.string(),
22181
23691
  num_pins: z70.literal(6).default(6),
@@ -22235,13 +23745,21 @@ var sot963 = (raw_params) => {
22235
23745
  pcb_silkscreen_path_id: "pin_marker_1"
22236
23746
  };
22237
23747
  const silkscreenRefText = silkscreenRef(0, h2 / 2 + 0.4, 0.25);
23748
+ const courtyard = {
23749
+ type: "pcb_courtyard_outline",
23750
+ pcb_courtyard_outline_id: "",
23751
+ pcb_component_id: "",
23752
+ outline: sot963CourtyardOutline,
23753
+ layer: "top"
23754
+ };
22238
23755
  return {
22239
23756
  circuitJson: [
22240
23757
  ...pads,
22241
23758
  silkscreenTopLine,
22242
23759
  silkscreenBottomLine,
22243
23760
  silkscreenRefText,
22244
- pin1Marking
23761
+ pin1Marking,
23762
+ courtyard
22245
23763
  ],
22246
23764
  parameters
22247
23765
  };
@@ -22318,12 +23836,28 @@ var potentiometer = (raw_params) => {
22318
23836
  };
22319
23837
  const W = Number.parseFloat(parameters.w) / 2;
22320
23838
  const silkscreenRefText = silkscreenRef(W, y + 1, 0.5);
23839
+ const padRadius = Number.parseFloat(parameters.od) / 2;
23840
+ const pinRowSpanX = Number.parseFloat(parameters.h);
23841
+ const pinRowSpanY = Number.parseFloat(parameters.ca) / 2;
23842
+ const courtyardMinX = -(padRadius + 0.25);
23843
+ const courtyardMaxX = pinRowSpanX + padRadius + 0.25;
23844
+ const courtyardHalfHeight = pinRowSpanY + 0.25;
23845
+ const courtyard = {
23846
+ type: "pcb_courtyard_rect",
23847
+ pcb_courtyard_rect_id: "",
23848
+ pcb_component_id: "",
23849
+ center: { x: (courtyardMinX + courtyardMaxX) / 2, y: 0 },
23850
+ width: courtyardMaxX - courtyardMinX,
23851
+ height: 2 * courtyardHalfHeight,
23852
+ layer: "top"
23853
+ };
22321
23854
  return {
22322
23855
  circuitJson: [
22323
23856
  ...platedHoles,
22324
23857
  silkscreenBody,
22325
23858
  silkscreenBody2,
22326
- silkscreenRefText
23859
+ silkscreenRefText,
23860
+ courtyard
22327
23861
  ],
22328
23862
  parameters
22329
23863
  };
@@ -22425,6 +23959,18 @@ var electrolytic = (raw_params) => {
22425
23959
  pcb_silkscreen_path_id: ""
22426
23960
  };
22427
23961
  const silkscreenRefText = silkscreenRef(0, d / 2 + 1, 0.5);
23962
+ const bodyOuterRadius = d / 2;
23963
+ const pinOuterRadius = p / 2 + od / 2;
23964
+ const courtyardClearance = 0.25;
23965
+ const courtyardRadius = Math.max(bodyOuterRadius, pinOuterRadius) + courtyardClearance;
23966
+ const courtyard = {
23967
+ type: "pcb_courtyard_circle",
23968
+ pcb_courtyard_circle_id: "",
23969
+ pcb_component_id: "",
23970
+ center: { x: 0, y: 0 },
23971
+ radius: courtyardRadius,
23972
+ layer: "top"
23973
+ };
22428
23974
  return {
22429
23975
  circuitJson: [
22430
23976
  ...plated_holes,
@@ -22433,7 +23979,8 @@ var electrolytic = (raw_params) => {
22433
23979
  silkscreenBody,
22434
23980
  silkscreenpath2,
22435
23981
  silkscreenline,
22436
- silkscreenRefText
23982
+ silkscreenRefText,
23983
+ courtyard
22437
23984
  ],
22438
23985
  parameters
22439
23986
  };
@@ -22479,10 +24026,22 @@ var smbf = (raw_params) => {
22479
24026
  stroke_width: 0.1,
22480
24027
  pcb_silkscreen_path_id: ""
22481
24028
  };
24029
+ const courtyardWidthMm = 7;
24030
+ const courtyardHeightMm = 3.5;
24031
+ const courtyard = {
24032
+ type: "pcb_courtyard_rect",
24033
+ pcb_courtyard_rect_id: "",
24034
+ pcb_component_id: "",
24035
+ center: { x: 0, y: 0 },
24036
+ width: courtyardWidthMm,
24037
+ height: courtyardHeightMm,
24038
+ layer: "top"
24039
+ };
22482
24040
  return {
22483
24041
  circuitJson: smbfWithoutParsing(parameters).concat(
22484
24042
  silkscreenLine,
22485
- silkscreenRefText
24043
+ silkscreenRefText,
24044
+ courtyard
22486
24045
  ),
22487
24046
  parameters
22488
24047
  };
@@ -22513,6 +24072,24 @@ var smbfWithoutParsing = (parameters) => {
22513
24072
  }
22514
24073
  return pads;
22515
24074
  };
24075
+ var sot323CourtyardOutline = [
24076
+ { x: -1.45, y: 0.98 },
24077
+ { x: -0.73, y: 0.98 },
24078
+ { x: -0.73, y: 1.1 },
24079
+ { x: 0.73, y: 1.1 },
24080
+ { x: 0.73, y: 0.33 },
24081
+ { x: 1.45, y: 0.33 },
24082
+ { x: 1.45, y: -0.33 },
24083
+ { x: 0.73, y: -0.33 },
24084
+ { x: 0.73, y: -1.1 },
24085
+ { x: -0.73, y: -1.1 },
24086
+ { x: -0.73, y: -0.98 },
24087
+ { x: -1.45, y: -0.98 },
24088
+ { x: -1.45, y: -0.32 },
24089
+ { x: -0.73, y: -0.32 },
24090
+ { x: -0.73, y: 0.32 },
24091
+ { x: -1.45, y: 0.32 }
24092
+ ];
22516
24093
  var sot323_def = base_def.extend({
22517
24094
  fn: z74.string(),
22518
24095
  num_pins: z74.number().default(3),
@@ -22600,11 +24177,19 @@ var sot323_3 = (parameters) => {
22600
24177
  type: "pcb_silkscreen_path",
22601
24178
  stroke_width: 0.1
22602
24179
  };
24180
+ const courtyard = {
24181
+ type: "pcb_courtyard_outline",
24182
+ pcb_courtyard_outline_id: "",
24183
+ pcb_component_id: "",
24184
+ outline: sot323CourtyardOutline,
24185
+ layer: "top"
24186
+ };
22603
24187
  return [
22604
24188
  ...pads,
22605
24189
  silkscreenPath1,
22606
24190
  silkscreenPath2,
22607
- silkscreenRefText
24191
+ silkscreenRefText,
24192
+ courtyard
22608
24193
  ];
22609
24194
  };
22610
24195
  var smtpad_def = base_def.extend({
@@ -22849,14 +24434,60 @@ var sotWithoutParsing = (parameters) => {
22849
24434
  ],
22850
24435
  stroke_width: 0.05
22851
24436
  };
24437
+ const h_val = Number.parseFloat(parameters.h);
24438
+ const p_val = Number.parseFloat(parameters.p);
24439
+ const pl_val = Number.parseFloat(parameters.pl);
24440
+ const pw_val = Number.parseFloat(parameters.pw);
24441
+ const pinColumnCenterX = h_val / 2 + 0.5;
24442
+ const pinRowSpanY = p_val * 2 + pw_val;
24443
+ const pinToeHalfSpanX = pinColumnCenterX + pl_val / 2;
24444
+ const courtyardStepInnerHalfWidth = h_val / 2 + 0.25;
24445
+ const courtyardStepOuterHalfWidth = pinToeHalfSpanX + 0.25;
24446
+ const courtyardStepInnerHalfHeight = pinRowSpanY / 2 + 0.2;
24447
+ const courtyardStepOuterHalfHeight = courtyardStepInnerHalfHeight + 0.2;
24448
+ const courtyard = {
24449
+ type: "pcb_courtyard_outline",
24450
+ pcb_courtyard_outline_id: "",
24451
+ pcb_component_id: "",
24452
+ layer: "top",
24453
+ outline: createRectUnionOutline([
24454
+ {
24455
+ minX: -courtyardStepOuterHalfWidth,
24456
+ maxX: courtyardStepOuterHalfWidth,
24457
+ minY: -courtyardStepInnerHalfHeight,
24458
+ maxY: courtyardStepInnerHalfHeight
24459
+ },
24460
+ {
24461
+ minX: -courtyardStepInnerHalfWidth,
24462
+ maxX: courtyardStepInnerHalfWidth,
24463
+ minY: -courtyardStepOuterHalfHeight,
24464
+ maxY: courtyardStepOuterHalfHeight
24465
+ }
24466
+ ])
24467
+ };
22852
24468
  return [
22853
24469
  ...pads,
22854
24470
  silkscreenRefText,
22855
24471
  silkscreenPath1,
22856
24472
  silkscreenPath2,
22857
- pin1Indicator
24473
+ pin1Indicator,
24474
+ courtyard
22858
24475
  ];
22859
24476
  };
24477
+ var sot343CourtyardOutline = [
24478
+ { x: -1.703, y: 0.98 },
24479
+ { x: -0.983, y: 0.98 },
24480
+ { x: -0.983, y: 1.1 },
24481
+ { x: 0.477, y: 1.1 },
24482
+ { x: 0.477, y: 0.98 },
24483
+ { x: 1.197, y: 0.98 },
24484
+ { x: 1.197, y: -0.98 },
24485
+ { x: 0.477, y: -0.98 },
24486
+ { x: 0.477, y: -1.1 },
24487
+ { x: -0.983, y: -1.1 },
24488
+ { x: -0.983, y: -0.98 },
24489
+ { x: -1.703, y: -0.98 }
24490
+ ];
22860
24491
  var sot343_def = base_def.extend({
22861
24492
  fn: z78.string(),
22862
24493
  num_pins: z78.number().default(4),
@@ -22951,11 +24582,19 @@ var sot343_4 = (parameters) => {
22951
24582
  type: "pcb_silkscreen_path",
22952
24583
  stroke_width: 0.1
22953
24584
  };
24585
+ const courtyard = {
24586
+ type: "pcb_courtyard_outline",
24587
+ pcb_courtyard_outline_id: "",
24588
+ pcb_component_id: "",
24589
+ outline: sot343CourtyardOutline,
24590
+ layer: "top"
24591
+ };
22954
24592
  return [
22955
24593
  ...pads,
22956
24594
  silkscreenPathTop,
22957
24595
  silkscreenPathBottom,
22958
- silkscreenRefText
24596
+ silkscreenRefText,
24597
+ courtyard
22959
24598
  ];
22960
24599
  };
22961
24600
  var m2host_def = base_def.extend({
@@ -23551,6 +25190,18 @@ var mountedpcbmodule = (raw_params) => {
23551
25190
  parameters
23552
25191
  };
23553
25192
  };
25193
+ var to92lCourtyardOutline = [
25194
+ { x: -1.45, y: 2.75 },
25195
+ { x: -1.45, y: -1.85 },
25196
+ { x: 4.05, y: -1.85 },
25197
+ { x: 4.05, y: 2.75 }
25198
+ ];
25199
+ var to92lInlineCourtyardOutline = [
25200
+ { x: -1.55, y: 2.75 },
25201
+ { x: -1.55, y: -1.85 },
25202
+ { x: 3.95, y: -1.85 },
25203
+ { x: 3.95, y: 2.75 }
25204
+ ];
23554
25205
  var to92l_def = base_def.extend({
23555
25206
  fn: z81.string(),
23556
25207
  num_pins: z81.number().default(3),
@@ -23609,8 +25260,20 @@ var to92l = (raw_params) => {
23609
25260
  cy + radius + 1,
23610
25261
  0.5
23611
25262
  );
25263
+ const courtyard = {
25264
+ type: "pcb_courtyard_outline",
25265
+ pcb_courtyard_outline_id: "",
25266
+ pcb_component_id: "",
25267
+ outline: parameters.inline ? to92lInlineCourtyardOutline : to92lCourtyardOutline,
25268
+ layer: "top"
25269
+ };
23612
25270
  return {
23613
- circuitJson: [...holes, silkBody, silkscreenRefText],
25271
+ circuitJson: [
25272
+ ...holes,
25273
+ silkBody,
25274
+ silkscreenRefText,
25275
+ courtyard
25276
+ ],
23614
25277
  parameters
23615
25278
  };
23616
25279
  };
@@ -23635,7 +25298,7 @@ var applyNoSilkscreen = (elements, parameters) => {
23635
25298
  var applyOrigin = (elements, origin) => {
23636
25299
  if (!origin) return elements;
23637
25300
  const pads = elements.filter(
23638
- (el) => el.type === "pcb_smtpad" || el.type === "pcb_plated_hole" || el.type === "pcb_thtpad"
25301
+ (el) => el.type === "pcb_smtpad" || el.type === "pcb_plated_hole"
23639
25302
  );
23640
25303
  if (pads.length === 0) return elements;
23641
25304
  let minX = Number.POSITIVE_INFINITY;
@@ -23660,9 +25323,6 @@ var applyOrigin = (elements, origin) => {
23660
25323
  } else if (pad2.type === "pcb_plated_hole") {
23661
25324
  const d = pad2.outer_diameter ?? pad2.hole_diameter;
23662
25325
  updateBounds(pad2.x, pad2.y, d, d);
23663
- } else if (pad2.type === "pcb_thtpad") {
23664
- const d = pad2.diameter;
23665
- updateBounds(pad2.x, pad2.y, d, d);
23666
25326
  }
23667
25327
  }
23668
25328
  let dx = 0;
@@ -23728,7 +25388,7 @@ function isNotNull(value) {
23728
25388
  return value !== null && value !== void 0;
23729
25389
  }
23730
25390
  var normalizeDefinition = (def) => {
23731
- return def.trim().replace(/^sot-223-(\d+)(?=_|$)/i, "sot223_$1").replace(/^to-220f-(\d+)(?=_|$)/i, "to220f_$1");
25391
+ return def.trim().replace(/^sot23-(\d+)(?=_|$)/i, "sot23_$1").replace(/^sot-223-(\d+)(?=_|$)/i, "sot223_$1").replace(/^to-220f-(\d+)(?=_|$)/i, "to220f_$1").replace(/^jst_(ph|sh|zh)_(\d+)(?=_|$)/i, "jst$2_$1");
23732
25392
  };
23733
25393
  var string2 = (def) => {
23734
25394
  let fp2 = footprinter();
@@ -30325,7 +31985,7 @@ import * as THREE20 from "three";
30325
31985
  // package.json
30326
31986
  var package_default = {
30327
31987
  name: "@tscircuit/3d-viewer",
30328
- version: "0.0.548",
31988
+ version: "0.0.550",
30329
31989
  main: "./dist/index.js",
30330
31990
  module: "./dist/index.js",
30331
31991
  type: "module",
@@ -30354,8 +32014,8 @@ var package_default = {
30354
32014
  dependencies: {
30355
32015
  "@jscad/regl-renderer": "^2.6.12",
30356
32016
  "@jscad/stl-serializer": "^2.1.20",
30357
- "circuit-json": "^0.0.405",
30358
- "circuit-to-canvas": "^0.0.94",
32017
+ "circuit-json": "^0.0.407",
32018
+ "circuit-to-canvas": "^0.0.96",
30359
32019
  "react-hot-toast": "^2.6.0",
30360
32020
  three: "^0.165.0",
30361
32021
  "three-stdlib": "^2.36.0",
@@ -30393,7 +32053,7 @@ var package_default = {
30393
32053
  "react-use-gesture": "^9.1.3",
30394
32054
  semver: "^7.7.0",
30395
32055
  "strip-ansi": "^7.1.0",
30396
- tscircuit: "^0.0.1541",
32056
+ tscircuit: "^0.0.1609",
30397
32057
  tsup: "^8.3.6",
30398
32058
  typescript: "^5.7.3",
30399
32059
  vite: "^7.1.5",