easyeda 0.0.356 → 0.0.358

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.
@@ -9847,6 +9847,225 @@ var transformPCBElements = (elms, matrix) => {
9847
9847
  }
9848
9848
  return transformedElms;
9849
9849
  };
9850
+ var mergeBounds = (currentBounds, nextBounds) => ({
9851
+ minX: Math.min(currentBounds.minX, nextBounds.minX),
9852
+ minY: Math.min(currentBounds.minY, nextBounds.minY),
9853
+ maxX: Math.max(currentBounds.maxX, nextBounds.maxX),
9854
+ maxY: Math.max(currentBounds.maxY, nextBounds.maxY)
9855
+ });
9856
+ var getCircleBounds = (x, y, diameter) => {
9857
+ const radius = diameter / 2;
9858
+ return {
9859
+ minX: x - radius,
9860
+ minY: y - radius,
9861
+ maxX: x + radius,
9862
+ maxY: y + radius
9863
+ };
9864
+ };
9865
+ var getRotatedRectBounds = (x, y, width, height, rotationDegrees) => {
9866
+ const halfWidth = width / 2;
9867
+ const halfHeight = height / 2;
9868
+ const theta = rotationDegrees * Math.PI / 180;
9869
+ const cosTheta = Math.cos(theta);
9870
+ const sinTheta = Math.sin(theta);
9871
+ const corners = [
9872
+ { x: -halfWidth, y: -halfHeight },
9873
+ { x: halfWidth, y: -halfHeight },
9874
+ { x: halfWidth, y: halfHeight },
9875
+ { x: -halfWidth, y: halfHeight }
9876
+ ].map((corner) => ({
9877
+ x: x + corner.x * cosTheta - corner.y * sinTheta,
9878
+ y: y + corner.x * sinTheta + corner.y * cosTheta
9879
+ }));
9880
+ return {
9881
+ minX: Math.min(...corners.map((corner) => corner.x)),
9882
+ minY: Math.min(...corners.map((corner) => corner.y)),
9883
+ maxX: Math.max(...corners.map((corner) => corner.x)),
9884
+ maxY: Math.max(...corners.map((corner) => corner.y))
9885
+ };
9886
+ };
9887
+ var getRotatedOvalBounds = (x, y, width, height, rotationDegrees) => {
9888
+ const radiusX = width / 2;
9889
+ const radiusY = height / 2;
9890
+ const theta = rotationDegrees * Math.PI / 180;
9891
+ const cosTheta = Math.cos(theta);
9892
+ const sinTheta = Math.sin(theta);
9893
+ const halfWidth = Math.hypot(radiusX * cosTheta, radiusY * sinTheta);
9894
+ const halfHeight = Math.hypot(radiusX * sinTheta, radiusY * cosTheta);
9895
+ return {
9896
+ minX: x - halfWidth,
9897
+ minY: y - halfHeight,
9898
+ maxX: x + halfWidth,
9899
+ maxY: y + halfHeight
9900
+ };
9901
+ };
9902
+ var getRotatedPillBounds = (x, y, width, height, rotationDegrees) => {
9903
+ const radius = Math.min(width, height) / 2;
9904
+ const halfLineLength = Math.max(width, height) / 2 - radius;
9905
+ const theta = rotationDegrees * Math.PI / 180;
9906
+ const axis = width >= height ? { x: halfLineLength, y: 0 } : { x: 0, y: halfLineLength };
9907
+ const rotatedAxis = {
9908
+ x: axis.x * Math.cos(theta) - axis.y * Math.sin(theta),
9909
+ y: axis.x * Math.sin(theta) + axis.y * Math.cos(theta)
9910
+ };
9911
+ const halfWidth = Math.abs(rotatedAxis.x) + radius;
9912
+ const halfHeight = Math.abs(rotatedAxis.y) + radius;
9913
+ return {
9914
+ minX: x - halfWidth,
9915
+ minY: y - halfHeight,
9916
+ maxX: x + halfWidth,
9917
+ maxY: y + halfHeight
9918
+ };
9919
+ };
9920
+ var getBoundsFromPoints = (points) => {
9921
+ if (points.length === 0) return null;
9922
+ return {
9923
+ minX: Math.min(...points.map((point2) => point2.x)),
9924
+ minY: Math.min(...points.map((point2) => point2.y)),
9925
+ maxX: Math.max(...points.map((point2) => point2.x)),
9926
+ maxY: Math.max(...points.map((point2) => point2.y))
9927
+ };
9928
+ };
9929
+ var getRoutePoints = (route) => {
9930
+ if (!Array.isArray(route)) return [];
9931
+ return route.flatMap((point2) => {
9932
+ if (!point2 || typeof point2 !== "object") return [];
9933
+ if ("x" in point2 && "y" in point2 && typeof point2.x === "number" && typeof point2.y === "number") {
9934
+ return [{ x: point2.x, y: point2.y }];
9935
+ }
9936
+ if ("start" in point2 && "end" in point2) {
9937
+ const positions = [point2.start, point2.end];
9938
+ return positions.filter(
9939
+ (position2) => Boolean(
9940
+ position2 && typeof position2 === "object" && "x" in position2 && "y" in position2 && typeof position2.x === "number" && typeof position2.y === "number"
9941
+ )
9942
+ );
9943
+ }
9944
+ return [];
9945
+ });
9946
+ };
9947
+ var getPcbElementBounds = (elm) => {
9948
+ if (!elm.type.startsWith("pcb_")) return null;
9949
+ if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
9950
+ return getBoundsFromPoints(elm.points);
9951
+ }
9952
+ if (elm.type === "pcb_hole" && elm.hole_shape === "circle") {
9953
+ return getCircleBounds(elm.x, elm.y, elm.hole_diameter);
9954
+ }
9955
+ if (elm.type === "pcb_plated_hole") {
9956
+ let platedHoleBounds;
9957
+ if ("outer_diameter" in elm && typeof elm.outer_diameter === "number") {
9958
+ platedHoleBounds = getCircleBounds(elm.x, elm.y, elm.outer_diameter);
9959
+ } else if ("hole_diameter" in elm && typeof elm.hole_diameter === "number") {
9960
+ platedHoleBounds = getCircleBounds(elm.x, elm.y, elm.hole_diameter);
9961
+ }
9962
+ if ((elm.shape === "oval" || elm.shape === "pill") && typeof elm.outer_width === "number" && typeof elm.outer_height === "number") {
9963
+ const getOuterBounds = elm.shape === "pill" ? getRotatedPillBounds : getRotatedOvalBounds;
9964
+ platedHoleBounds = getOuterBounds(
9965
+ elm.x,
9966
+ elm.y,
9967
+ elm.outer_width,
9968
+ elm.outer_height,
9969
+ elm.ccw_rotation ?? 0
9970
+ );
9971
+ }
9972
+ if ("rect_pad_width" in elm && typeof elm.rect_pad_width === "number" && "rect_pad_height" in elm && typeof elm.rect_pad_height === "number") {
9973
+ const rectBounds = getRotatedRectBounds(
9974
+ elm.x,
9975
+ elm.y,
9976
+ elm.rect_pad_width,
9977
+ elm.rect_pad_height,
9978
+ "rect_ccw_rotation" in elm ? elm.rect_ccw_rotation ?? 0 : 0
9979
+ );
9980
+ platedHoleBounds = platedHoleBounds ? mergeBounds(platedHoleBounds, rectBounds) : rectBounds;
9981
+ }
9982
+ if ("hole_diameter" in elm && typeof elm.hole_diameter === "number") {
9983
+ const drillBounds = getCircleBounds(
9984
+ elm.x + ("hole_offset_x" in elm ? elm.hole_offset_x ?? 0 : 0),
9985
+ elm.y + ("hole_offset_y" in elm ? elm.hole_offset_y ?? 0 : 0),
9986
+ elm.hole_diameter
9987
+ );
9988
+ platedHoleBounds = platedHoleBounds ? mergeBounds(platedHoleBounds, drillBounds) : drillBounds;
9989
+ }
9990
+ if (platedHoleBounds) return platedHoleBounds;
9991
+ }
9992
+ const elementRecord = elm;
9993
+ const routeBounds = getBoundsFromPoints(getRoutePoints(elementRecord.route));
9994
+ if (routeBounds) return routeBounds;
9995
+ const outlineBounds = getBoundsFromPoints(
9996
+ getRoutePoints(elementRecord.outline)
9997
+ );
9998
+ if (outlineBounds) return outlineBounds;
9999
+ const pointsBounds = getBoundsFromPoints(getRoutePoints(elementRecord.points));
10000
+ if (pointsBounds) return pointsBounds;
10001
+ let centerX;
10002
+ let centerY;
10003
+ let width;
10004
+ let height;
10005
+ if ("x" in elm && "y" in elm) {
10006
+ centerX = Number(elm.x);
10007
+ centerY = Number(elm.y);
10008
+ }
10009
+ if ("outer_diameter" in elm) {
10010
+ width = Number(elm.outer_diameter);
10011
+ height = Number(elm.outer_diameter);
10012
+ }
10013
+ if ("width" in elm) {
10014
+ width = Number(elm.width);
10015
+ }
10016
+ if ("height" in elm) {
10017
+ height = Number(elm.height);
10018
+ }
10019
+ if ("center" in elm && elm.center && typeof elm.center === "object" && "x" in elm.center && "y" in elm.center) {
10020
+ centerX = Number(elm.center.x);
10021
+ centerY = Number(elm.center.y);
10022
+ }
10023
+ let rotation2 = 0;
10024
+ if ("rotation" in elm && typeof elm.rotation === "number") {
10025
+ rotation2 = elm.rotation;
10026
+ }
10027
+ if ("ccw_rotation" in elm && typeof elm.ccw_rotation === "number") {
10028
+ rotation2 = elm.ccw_rotation;
10029
+ }
10030
+ if (centerX !== void 0 && centerY !== void 0) {
10031
+ if (width !== void 0 && height !== void 0) {
10032
+ return rotation2 ? getRotatedRectBounds(centerX, centerY, width, height, rotation2) : {
10033
+ minX: centerX - width / 2,
10034
+ minY: centerY - height / 2,
10035
+ maxX: centerX + width / 2,
10036
+ maxY: centerY + height / 2
10037
+ };
10038
+ }
10039
+ if ("radius" in elm && typeof elm.radius === "number") {
10040
+ return getCircleBounds(centerX, centerY, elm.radius * 2);
10041
+ }
10042
+ return { minX: centerX, minY: centerY, maxX: centerX, maxY: centerY };
10043
+ }
10044
+ const anchoredPoint = [elementRecord.anchor_position, elementRecord.position].filter(
10045
+ (position2) => Boolean(
10046
+ position2 && typeof position2 === "object" && "x" in position2 && "y" in position2 && typeof position2.x === "number" && typeof position2.y === "number"
10047
+ )
10048
+ ).at(0);
10049
+ return anchoredPoint ? {
10050
+ minX: anchoredPoint.x,
10051
+ minY: anchoredPoint.y,
10052
+ maxX: anchoredPoint.x,
10053
+ maxY: anchoredPoint.y
10054
+ } : null;
10055
+ };
10056
+ var getBoundsOfPcbElements = (elements) => {
10057
+ let bounds = {
10058
+ minX: Number.POSITIVE_INFINITY,
10059
+ minY: Number.POSITIVE_INFINITY,
10060
+ maxX: Number.NEGATIVE_INFINITY,
10061
+ maxY: Number.NEGATIVE_INFINITY
10062
+ };
10063
+ for (const element of elements) {
10064
+ const elementBounds = getPcbElementBounds(element);
10065
+ if (elementBounds) bounds = mergeBounds(bounds, elementBounds);
10066
+ }
10067
+ return bounds;
10068
+ };
9850
10069
  function stringHash(str) {
9851
10070
  let hash = 0;
9852
10071
  if (str.length == 0) return hash;
@@ -10063,6 +10282,121 @@ var PIN1_LOCATION_PARTS = {
10063
10282
  };
10064
10283
  var PIN1_LOCATIONS = Object.keys(PIN1_LOCATION_PARTS);
10065
10284
 
10285
+ // node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
10286
+ function orientation(p, q, r) {
10287
+ const val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
10288
+ if (val === 0) return 0;
10289
+ return val > 0 ? 1 : 2;
10290
+ }
10291
+ function distance2(p1, p2) {
10292
+ const dx = p1.x - p2.x;
10293
+ const dy = p1.y - p2.y;
10294
+ return Math.sqrt(dx * dx + dy * dy);
10295
+ }
10296
+
10297
+ // node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
10298
+ var getUnitVectorFromDirection = (direction) => {
10299
+ switch (direction) {
10300
+ case "up":
10301
+ return { x: 0, y: 1 };
10302
+ case "down":
10303
+ return { x: 0, y: -1 };
10304
+ case "left":
10305
+ return { x: -1, y: 0 };
10306
+ case "right":
10307
+ return { x: 1, y: 0 };
10308
+ }
10309
+ };
10310
+
10311
+ // node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
10312
+ var getBoundsCenter = (bounds) => ({
10313
+ x: (bounds.minX + bounds.maxX) / 2,
10314
+ y: (bounds.minY + bounds.maxY) / 2
10315
+ });
10316
+
10317
+ // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
10318
+ var getBoundsFromPoints2 = (points) => {
10319
+ if (points.length === 0) {
10320
+ return null;
10321
+ }
10322
+ let minX = points[0].x;
10323
+ let minY = points[0].y;
10324
+ let maxX = points[0].x;
10325
+ let maxY = points[0].y;
10326
+ for (let i = 1; i < points.length; i++) {
10327
+ const point2 = points[i];
10328
+ if (point2.x < minX) minX = point2.x;
10329
+ if (point2.y < minY) minY = point2.y;
10330
+ if (point2.x > maxX) maxX = point2.x;
10331
+ if (point2.y > maxY) maxY = point2.y;
10332
+ }
10333
+ return { minX, minY, maxX, maxY };
10334
+ };
10335
+
10336
+ // lib/utils/get-board-outline-polygons.ts
10337
+ var same = (a, b) => distance2(a, b) < 1e-4;
10338
+ var getBoardOutlinePolygons = (tracks) => {
10339
+ const remainingEdges = tracks.flatMap(
10340
+ (track) => track.points.slice(1).map((point2, i) => [track.points[i], point2])
10341
+ ).filter(([a, b]) => !same(a, b));
10342
+ const polygons = [];
10343
+ while (remainingEdges.length) {
10344
+ const edges = [remainingEdges.shift()];
10345
+ while (true) {
10346
+ const index = remainingEdges.findIndex(
10347
+ (edge) => edge.some((p) => edges.flat().some((q) => same(p, q)))
10348
+ );
10349
+ if (index === -1) break;
10350
+ edges.push(remainingEdges.splice(index, 1)[0]);
10351
+ }
10352
+ const endpoints = edges.flat();
10353
+ if (endpoints.some((p) => endpoints.filter((q) => same(p, q)).length > 2))
10354
+ continue;
10355
+ const route = edges.shift();
10356
+ let changed = true;
10357
+ while (changed) {
10358
+ changed = false;
10359
+ for (let i = 0; i < edges.length; i++) {
10360
+ const [a, b] = edges[i];
10361
+ if (same(route.at(-1), a)) route.push(b);
10362
+ else if (same(route.at(-1), b)) route.push(a);
10363
+ else if (same(route[0], b)) route.unshift(a);
10364
+ else if (same(route[0], a)) route.unshift(b);
10365
+ else continue;
10366
+ edges.splice(i, 1);
10367
+ changed = true;
10368
+ break;
10369
+ }
10370
+ }
10371
+ if (same(route[0], route.at(-1))) route.pop();
10372
+ else {
10373
+ const first = route[0];
10374
+ const last = route.at(-1);
10375
+ if (Math.abs(first.x - last.x) > 1e-4 && Math.abs(first.y - last.y) > 1e-4)
10376
+ continue;
10377
+ }
10378
+ if (route.some((p, i) => route.slice(i + 1).some((q) => same(p, q))))
10379
+ continue;
10380
+ while (route.length > 2) {
10381
+ const index = route.findIndex(
10382
+ (p, i) => orientation(
10383
+ route[(i + route.length - 1) % route.length],
10384
+ p,
10385
+ route[(i + 1) % route.length]
10386
+ ) === 0
10387
+ );
10388
+ if (index === -1) break;
10389
+ route.splice(index, 1);
10390
+ }
10391
+ const area = route.reduce((sum, p, i) => {
10392
+ const q = route[(i + 1) % route.length];
10393
+ return sum + p.x * q.y - q.x * p.y;
10394
+ }, 0);
10395
+ if (route.length >= 3 && Math.abs(area) > 1e-8) polygons.push(route);
10396
+ }
10397
+ return polygons;
10398
+ };
10399
+
10066
10400
  // node_modules/@tscircuit/mm/dist/index.js
10067
10401
  var unitToMm = {
10068
10402
  in: 25.4,
@@ -10396,52 +10730,6 @@ var isLedCategoryComponent = (betterEasy) => {
10396
10730
  ].some(categoryValueContainsLed);
10397
10731
  };
10398
10732
 
10399
- // node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
10400
- function distance2(p1, p2) {
10401
- const dx = p1.x - p2.x;
10402
- const dy = p1.y - p2.y;
10403
- return Math.sqrt(dx * dx + dy * dy);
10404
- }
10405
-
10406
- // node_modules/@tscircuit/math-utils/dist/chunk-GIGMPRPV.js
10407
- var getUnitVectorFromDirection = (direction) => {
10408
- switch (direction) {
10409
- case "up":
10410
- return { x: 0, y: 1 };
10411
- case "down":
10412
- return { x: 0, y: -1 };
10413
- case "left":
10414
- return { x: -1, y: 0 };
10415
- case "right":
10416
- return { x: 1, y: 0 };
10417
- }
10418
- };
10419
-
10420
- // node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
10421
- var getBoundsCenter = (bounds) => ({
10422
- x: (bounds.minX + bounds.maxX) / 2,
10423
- y: (bounds.minY + bounds.maxY) / 2
10424
- });
10425
-
10426
- // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
10427
- var getBoundsFromPoints = (points) => {
10428
- if (points.length === 0) {
10429
- return null;
10430
- }
10431
- let minX = points[0].x;
10432
- let minY = points[0].y;
10433
- let maxX = points[0].x;
10434
- let maxY = points[0].y;
10435
- for (let i = 1; i < points.length; i++) {
10436
- const point2 = points[i];
10437
- if (point2.x < minX) minX = point2.x;
10438
- if (point2.y < minY) minY = point2.y;
10439
- if (point2.x > maxX) maxX = point2.x;
10440
- if (point2.y > maxY) maxY = point2.y;
10441
- }
10442
- return { minX, minY, maxX, maxY };
10443
- };
10444
-
10445
10733
  // lib/websafe/get-easyeda-cad-placement-helpers.ts
10446
10734
  var getCadSvgNode = (easyEdaJson) => {
10447
10735
  const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
@@ -10488,7 +10776,7 @@ var getEasyEdaModelOriginOnBoardMm = ({
10488
10776
  }
10489
10777
  let modelOriginMm = null;
10490
10778
  if (points.length > 0) {
10491
- const bounds = getBoundsFromPoints(points);
10779
+ const bounds = getBoundsFromPoints2(points);
10492
10780
  modelOriginMm = bounds ? getBoundsCenter(bounds) : null;
10493
10781
  } else {
10494
10782
  const [originX, originY] = String(svgNode.svgData.attrs?.c_origin ?? "0,0").split(",").map((value) => Number(value.trim()));
@@ -10579,6 +10867,39 @@ var parseCadOffsetsFromSvgNode = (svgNode) => {
10579
10867
  })()
10580
10868
  };
10581
10869
  };
10870
+ var getCadModelOutlineBounds = (svgNode) => {
10871
+ const points = [];
10872
+ for (const childNode of svgNode?.svgData.childNodes ?? []) {
10873
+ if (typeof childNode !== "object" || childNode === null) continue;
10874
+ const attrs = childNode.attrs;
10875
+ if (typeof attrs !== "object" || attrs === null) continue;
10876
+ const rawPoints = attrs.points;
10877
+ if (typeof rawPoints !== "string") continue;
10878
+ const coordinates = rawPoints.trim().split(/\s+/).map(Number);
10879
+ for (let index = 0; index + 1 < coordinates.length; index += 2) {
10880
+ const x = coordinates[index];
10881
+ const y = coordinates[index + 1];
10882
+ if (!Number.isFinite(x) || !Number.isFinite(y)) continue;
10883
+ points.push({ x: milx10(x), y: milx10(y) });
10884
+ }
10885
+ }
10886
+ if (points.length === 0) return void 0;
10887
+ return {
10888
+ minX: Math.min(...points.map((point2) => point2.x)),
10889
+ minY: Math.min(...points.map((point2) => point2.y)),
10890
+ maxX: Math.max(...points.map((point2) => point2.x)),
10891
+ maxY: Math.max(...points.map((point2) => point2.y))
10892
+ };
10893
+ };
10894
+ var unionBounds = (first, second) => {
10895
+ if (!second) return first;
10896
+ return {
10897
+ minX: Math.min(first.minX, second.minX),
10898
+ minY: Math.min(first.minY, second.minY),
10899
+ maxX: Math.max(first.maxX, second.maxX),
10900
+ maxY: Math.max(first.maxY, second.maxY)
10901
+ };
10902
+ };
10582
10903
  var readModelHeightMm = (raw) => {
10583
10904
  const fallback = 3.5;
10584
10905
  if (raw == null) return fallback;
@@ -11034,6 +11355,19 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
11034
11355
  ).forEach((sr, index) => {
11035
11356
  circuitElements.push(handleCutout(sr, index));
11036
11357
  });
11358
+ const boardOutlineTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
11359
+ (shape) => shape.type === "TRACK" && shape.layer === 10
11360
+ );
11361
+ getBoardOutlinePolygons(boardOutlineTracks).forEach((points, index) => {
11362
+ circuitElements.push(
11363
+ pcb_cutout.parse({
11364
+ type: "pcb_cutout",
11365
+ pcb_cutout_id: `pcb_cutout_outline_${index + 1}`,
11366
+ shape: "polygon",
11367
+ points: points.map((p) => ({ x: milx10(p.x), y: milx10(p.y) }))
11368
+ })
11369
+ );
11370
+ });
11037
11371
  let hasFoundDesignator = false;
11038
11372
  const silkscreenTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
11039
11373
  (shape) => shape.type === "TRACK" && isSilkscreenLayer(shape.layer)
@@ -11157,17 +11491,29 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
11157
11491
  );
11158
11492
  }
11159
11493
  const hasExplicitCourtyard = circuitElements.some(
11160
- (e) => e.type === "pcb_courtyard_outline"
11494
+ (e) => e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect"
11161
11495
  );
11162
11496
  if (!hasExplicitCourtyard) {
11163
11497
  const bbox = easyEdaJson.packageDetail.dataStr.BBox;
11164
- if (bbox) {
11498
+ const modelOutlineBounds = getCadModelOutlineBounds(svgNode);
11499
+ const packageElements = circuitElements.filter(
11500
+ (element) => element.type === "pcb_smtpad" || element.type === "pcb_plated_hole" || element.type === "pcb_hole" || element.type === "pcb_via"
11501
+ );
11502
+ const packageElementBounds = packageElements.length > 0 ? getBoundsOfPcbElements(packageElements) : void 0;
11503
+ const fallbackBounds = bbox ? {
11504
+ minX: milx10(bbox.x),
11505
+ minY: milx10(bbox.y),
11506
+ maxX: milx10(bbox.x + bbox.width),
11507
+ maxY: milx10(bbox.y + bbox.height)
11508
+ } : void 0;
11509
+ const courtyardBounds = modelOutlineBounds ? unionBounds(modelOutlineBounds, packageElementBounds) : fallbackBounds;
11510
+ if (courtyardBounds) {
11165
11511
  const strokeWidth = 0.05;
11166
11512
  const margin = 0.25;
11167
- const x1 = milx10(bbox.x) - margin;
11168
- const y1 = milx10(bbox.y) - margin;
11169
- const x2 = milx10(bbox.x + bbox.width) + margin;
11170
- const y2 = milx10(bbox.y + bbox.height) + margin;
11513
+ const x1 = courtyardBounds.minX - margin;
11514
+ const y1 = courtyardBounds.minY - margin;
11515
+ const x2 = courtyardBounds.maxX + margin;
11516
+ const y2 = courtyardBounds.maxY + margin;
11171
11517
  circuitElements.push(
11172
11518
  pcb_courtyard_outline.parse({
11173
11519
  type: "pcb_courtyard_outline",
@@ -12614,6 +12960,13 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
12614
12960
  const pcbNoteDimensions = su(circuitJson).pcb_note_dimension.list();
12615
12961
  const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
12616
12962
  const elementStrings = [];
12963
+ for (const cutout of su(circuitJson).pcb_cutout.list()) {
12964
+ if (cutout.shape === "polygon") {
12965
+ elementStrings.push(
12966
+ `<cutout shape="polygon" points={${JSON.stringify(cutout.points)}} />`
12967
+ );
12968
+ }
12969
+ }
12617
12970
  for (const hole of holes) {
12618
12971
  if (hole.hole_shape === "circle") {
12619
12972
  elementStrings.push(