@tscircuit/cli 0.1.2037 → 0.1.2038
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.
- package/dist/cli/main.js +132 -63
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -56970,7 +56970,7 @@ var require_fast_json_stable_stringify = __commonJS2(function(exports2, module2)
|
|
|
56970
56970
|
};
|
|
56971
56971
|
});
|
|
56972
56972
|
|
|
56973
|
-
// node_modules/circuit-json-to-gerber/dist/chunk-
|
|
56973
|
+
// node_modules/circuit-json-to-gerber/dist/chunk-WLO6XF2E.js
|
|
56974
56974
|
import { z as z4 } from "zod";
|
|
56975
56975
|
import { z as z23 } from "zod";
|
|
56976
56976
|
import { z as z32 } from "zod";
|
|
@@ -57031,6 +57031,7 @@ import {
|
|
|
57031
57031
|
translate as translate8
|
|
57032
57032
|
} from "transformation-matrix";
|
|
57033
57033
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect2 } from "@tscircuit/math-utils";
|
|
57034
|
+
import { applyToPoint as applyToPoint27, compose as compose22, rotate as rotate22, translate as translate22 } from "transformation-matrix";
|
|
57034
57035
|
import {
|
|
57035
57036
|
glyphAdvanceRatio,
|
|
57036
57037
|
glyphWidthRatio,
|
|
@@ -57046,16 +57047,15 @@ import {
|
|
|
57046
57047
|
translate as translate52
|
|
57047
57048
|
} from "transformation-matrix";
|
|
57048
57049
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect3 } from "@tscircuit/math-utils";
|
|
57049
|
-
import { applyToPoint as
|
|
57050
|
+
import { applyToPoint as applyToPoint32, compose as compose32, rotate as rotate32, translate as translate32 } from "transformation-matrix";
|
|
57050
57051
|
import { getBoundFromCenteredRect as getBoundFromCenteredRect4 } from "@tscircuit/math-utils";
|
|
57051
57052
|
import {
|
|
57052
|
-
applyToPoint as
|
|
57053
|
-
compose as
|
|
57053
|
+
applyToPoint as applyToPoint42,
|
|
57054
|
+
compose as compose42,
|
|
57054
57055
|
identity as identity22,
|
|
57055
|
-
rotate as
|
|
57056
|
-
translate as
|
|
57056
|
+
rotate as rotate42,
|
|
57057
|
+
translate as translate42
|
|
57057
57058
|
} from "transformation-matrix";
|
|
57058
|
-
import { applyToPoint as applyToPoint42, compose as compose42, rotate as rotate42, translate as translate42 } from "transformation-matrix";
|
|
57059
57059
|
function pairs3(arr) {
|
|
57060
57060
|
const result = [];
|
|
57061
57061
|
for (let i = 0;i < arr.length - 1; i++) {
|
|
@@ -57191,6 +57191,13 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
57191
57191
|
} else {
|
|
57192
57192
|
addConfigIfNew(getApertureConfigFromPcbPlatedHole(elm));
|
|
57193
57193
|
}
|
|
57194
|
+
if ("rect_pad_width" in elm && typeof elm.rect_pad_width === "number" && "rect_pad_height" in elm && typeof elm.rect_pad_height === "number" && "rect_ccw_rotation" in elm && typeof elm.rect_ccw_rotation === "number" && isGeometryChangingRectRotation({
|
|
57195
|
+
width: elm.rect_pad_width,
|
|
57196
|
+
height: elm.rect_pad_height,
|
|
57197
|
+
ccwRotationDegrees: elm.rect_ccw_rotation
|
|
57198
|
+
})) {
|
|
57199
|
+
addConfigIfNew(REGION_APERTURE_CONFIG);
|
|
57200
|
+
}
|
|
57194
57201
|
}
|
|
57195
57202
|
} else if (elm.type === "pcb_hole") {
|
|
57196
57203
|
if (!isCopperLayer && !isSoldermaskLayer)
|
|
@@ -57366,12 +57373,6 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57366
57373
|
if (element.type !== "pcb_plated_hole" && element.type !== "pcb_via") {
|
|
57367
57374
|
return;
|
|
57368
57375
|
}
|
|
57369
|
-
if ("from_layer" in element && typeof element.from_layer === "string" && "to_layer" in element && typeof element.to_layer === "string") {
|
|
57370
|
-
return normalizeLayerSpan({
|
|
57371
|
-
from_layer: element.from_layer,
|
|
57372
|
-
to_layer: element.to_layer
|
|
57373
|
-
}, layerCount);
|
|
57374
|
-
}
|
|
57375
57376
|
let layers = [];
|
|
57376
57377
|
if ("layers" in element && Array.isArray(element.layers)) {
|
|
57377
57378
|
layers = element.layers;
|
|
@@ -57383,6 +57384,12 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57383
57384
|
to_layer: sortedLayers[sortedLayers.length - 1]
|
|
57384
57385
|
};
|
|
57385
57386
|
}
|
|
57387
|
+
if ("from_layer" in element && typeof element.from_layer === "string" && "to_layer" in element && typeof element.to_layer === "string") {
|
|
57388
|
+
return normalizeLayerSpan({
|
|
57389
|
+
from_layer: element.from_layer,
|
|
57390
|
+
to_layer: element.to_layer
|
|
57391
|
+
}, layerCount);
|
|
57392
|
+
}
|
|
57386
57393
|
return {
|
|
57387
57394
|
from_layer: "top",
|
|
57388
57395
|
to_layer: "bottom"
|
|
@@ -57428,8 +57435,22 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57428
57435
|
const requestedLayerSpan = getRequestedLayerSpan(layer_span);
|
|
57429
57436
|
const span = normalizeLayerSpan(requestedLayerSpan, layerCount);
|
|
57430
57437
|
return `Plated,${getLayerNumber(span.from_layer, layerCount)},${getLayerNumber(span.to_layer, layerCount)},PTH`;
|
|
57431
|
-
}, getTraceRouteViaElements = (circuitJson) => {
|
|
57438
|
+
}, getViaDrillLocationKey = (via) => JSON.stringify([via.x, via.y, via.hole_diameter]), getTraceRouteViaElements = (circuitJson) => {
|
|
57432
57439
|
const routeVias = [];
|
|
57440
|
+
const layerCount = getLayerCount(circuitJson);
|
|
57441
|
+
const physicalViaSpans = /* @__PURE__ */ new Map;
|
|
57442
|
+
for (const element of circuitJson) {
|
|
57443
|
+
if (element.type !== "pcb_via")
|
|
57444
|
+
continue;
|
|
57445
|
+
const span = getPlatedElementLayerSpan(element, layerCount);
|
|
57446
|
+
const key = getViaDrillLocationKey(element);
|
|
57447
|
+
const spans = physicalViaSpans.get(key) ?? [];
|
|
57448
|
+
spans.push({
|
|
57449
|
+
firstLayer: getLayerNumber(span.from_layer, layerCount),
|
|
57450
|
+
lastLayer: getLayerNumber(span.to_layer, layerCount)
|
|
57451
|
+
});
|
|
57452
|
+
physicalViaSpans.set(key, spans);
|
|
57453
|
+
}
|
|
57433
57454
|
for (const element of circuitJson) {
|
|
57434
57455
|
if (element.type !== "pcb_trace") {
|
|
57435
57456
|
continue;
|
|
@@ -57440,6 +57461,16 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57440
57461
|
}
|
|
57441
57462
|
const fromLayer = point.from_layer;
|
|
57442
57463
|
const toLayer = point.to_layer;
|
|
57464
|
+
const fromLayerNumber = getLayerNumber(fromLayer, layerCount);
|
|
57465
|
+
const toLayerNumber = getLayerNumber(toLayer, layerCount);
|
|
57466
|
+
const existingSpans = physicalViaSpans.get(getViaDrillLocationKey({
|
|
57467
|
+
x: point.x,
|
|
57468
|
+
y: point.y,
|
|
57469
|
+
hole_diameter: point.hole_diameter
|
|
57470
|
+
}));
|
|
57471
|
+
if (existingSpans?.some(({ firstLayer, lastLayer }) => firstLayer <= Math.min(fromLayerNumber, toLayerNumber) && lastLayer >= Math.max(fromLayerNumber, toLayerNumber))) {
|
|
57472
|
+
continue;
|
|
57473
|
+
}
|
|
57443
57474
|
routeVias.push({
|
|
57444
57475
|
type: "pcb_via",
|
|
57445
57476
|
pcb_via_id: `${element.pcb_trace_id}_route_via_${index}`,
|
|
@@ -57454,10 +57485,20 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57454
57485
|
}
|
|
57455
57486
|
}
|
|
57456
57487
|
return routeVias;
|
|
57457
|
-
}, getDrillableElements = (circuitJson) =>
|
|
57458
|
-
|
|
57459
|
-
|
|
57460
|
-
|
|
57488
|
+
}, getDrillableElements = (circuitJson) => {
|
|
57489
|
+
const layerCount = getLayerCount(circuitJson);
|
|
57490
|
+
const seenViaDrills = /* @__PURE__ */ new Set;
|
|
57491
|
+
return [...circuitJson, ...getTraceRouteViaElements(circuitJson)].filter((element) => {
|
|
57492
|
+
if (element.type !== "pcb_via")
|
|
57493
|
+
return true;
|
|
57494
|
+
const span = getPlatedElementLayerSpan(element, layerCount);
|
|
57495
|
+
const key = `${getViaDrillLocationKey(element)}:${span.from_layer}:${span.to_layer}`;
|
|
57496
|
+
if (seenViaDrills.has(key))
|
|
57497
|
+
return false;
|
|
57498
|
+
seenViaDrills.add(key);
|
|
57499
|
+
return true;
|
|
57500
|
+
});
|
|
57501
|
+
}, circleCutoutPolygonSegmentCount = 64, getBoardOutlinePolygons = (circuitJson) => {
|
|
57461
57502
|
return circuitJson.flatMap((element) => {
|
|
57462
57503
|
if (element.type !== "pcb_board") {
|
|
57463
57504
|
return [];
|
|
@@ -57585,7 +57626,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57585
57626
|
return element.ccw_rotation;
|
|
57586
57627
|
}
|
|
57587
57628
|
return 0;
|
|
57588
|
-
},
|
|
57629
|
+
}, convertCircuitJsonToExcellonDrillCommands = ({
|
|
57589
57630
|
circuitJson,
|
|
57590
57631
|
is_plated,
|
|
57591
57632
|
flip_y_axis = false,
|
|
@@ -57731,7 +57772,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57731
57772
|
return true;
|
|
57732
57773
|
}
|
|
57733
57774
|
return "hole_width" in element && typeof element.hole_width === "number" && "hole_height" in element && typeof element.hole_height === "number";
|
|
57734
|
-
},
|
|
57775
|
+
}, convertCircuitJsonToExcellonDrillCommandLayers = ({
|
|
57735
57776
|
circuitJson,
|
|
57736
57777
|
flip_y_axis = false
|
|
57737
57778
|
}) => {
|
|
@@ -57745,7 +57786,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57745
57786
|
}));
|
|
57746
57787
|
const platedDrillLayers = Object.fromEntries([...platedSpans.entries()].sort().map(([spanKey, span]) => [
|
|
57747
57788
|
`drill-${spanKey}.drl`,
|
|
57748
|
-
|
|
57789
|
+
convertCircuitJsonToExcellonDrillCommands({
|
|
57749
57790
|
circuitJson,
|
|
57750
57791
|
is_plated: true,
|
|
57751
57792
|
flip_y_axis,
|
|
@@ -57761,7 +57802,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57761
57802
|
}
|
|
57762
57803
|
return {
|
|
57763
57804
|
...platedDrillLayers,
|
|
57764
|
-
"drill_npth.drl":
|
|
57805
|
+
"drill_npth.drl": convertCircuitJsonToExcellonDrillCommands({
|
|
57765
57806
|
circuitJson,
|
|
57766
57807
|
is_plated: false,
|
|
57767
57808
|
flip_y_axis
|
|
@@ -57953,6 +57994,31 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
57953
57994
|
default:
|
|
57954
57995
|
return null;
|
|
57955
57996
|
}
|
|
57997
|
+
}, isGeometryChangingRectRotation = ({
|
|
57998
|
+
width,
|
|
57999
|
+
height,
|
|
58000
|
+
ccwRotationDegrees
|
|
58001
|
+
}) => {
|
|
58002
|
+
const isSquare = Math.abs(width - height) <= 0.000000001;
|
|
58003
|
+
const symmetryPeriod = isSquare ? 90 : 180;
|
|
58004
|
+
const normalizedRotation = (ccwRotationDegrees % symmetryPeriod + symmetryPeriod) % symmetryPeriod;
|
|
58005
|
+
return normalizedRotation > 0.000000001 && symmetryPeriod - normalizedRotation > 0.000000001;
|
|
58006
|
+
}, getRotatedRectPoints = ({
|
|
58007
|
+
center,
|
|
58008
|
+
width,
|
|
58009
|
+
height,
|
|
58010
|
+
ccwRotationDegrees
|
|
58011
|
+
}) => {
|
|
58012
|
+
const halfWidth = width / 2;
|
|
58013
|
+
const halfHeight = height / 2;
|
|
58014
|
+
const ccwRotationRadians = ccwRotationDegrees * Math.PI / 180;
|
|
58015
|
+
const rectToPcbTransform = compose22(translate22(center.x, center.y), rotate22(ccwRotationRadians));
|
|
58016
|
+
return [
|
|
58017
|
+
{ x: -halfWidth, y: halfHeight },
|
|
58018
|
+
{ x: halfWidth, y: halfHeight },
|
|
58019
|
+
{ x: halfWidth, y: -halfHeight },
|
|
58020
|
+
{ x: -halfWidth, y: -halfHeight }
|
|
58021
|
+
].map((point) => applyToPoint27(rectToPcbTransform, point));
|
|
57956
58022
|
}, getLayerRefFromGerberLayerName = (glayer_name) => {
|
|
57957
58023
|
if (glayer_name.startsWith("F_"))
|
|
57958
58024
|
return "top";
|
|
@@ -58592,9 +58658,9 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58592
58658
|
const w = width / 2;
|
|
58593
58659
|
const h = height / 2;
|
|
58594
58660
|
const r = Math.max(0, Math.min(corner_radius ?? 0, Math.abs(w), Math.abs(h)));
|
|
58595
|
-
let transformMatrix =
|
|
58661
|
+
let transformMatrix = translate32(center.x, center.y);
|
|
58596
58662
|
if (rotation) {
|
|
58597
|
-
transformMatrix =
|
|
58663
|
+
transformMatrix = compose32(transformMatrix, rotate32(rotation * Math.PI / 180));
|
|
58598
58664
|
}
|
|
58599
58665
|
if (r === 0) {
|
|
58600
58666
|
return [
|
|
@@ -58602,7 +58668,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58602
58668
|
{ x: w, y: h },
|
|
58603
58669
|
{ x: w, y: -h },
|
|
58604
58670
|
{ x: -w, y: -h }
|
|
58605
|
-
].map((point) =>
|
|
58671
|
+
].map((point) => applyToPoint32(transformMatrix, point));
|
|
58606
58672
|
}
|
|
58607
58673
|
const points = [];
|
|
58608
58674
|
const corners = [
|
|
@@ -58621,7 +58687,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58621
58687
|
});
|
|
58622
58688
|
}
|
|
58623
58689
|
}
|
|
58624
|
-
return points.map((point) =>
|
|
58690
|
+
return points.map((point) => applyToPoint32(transformMatrix, point));
|
|
58625
58691
|
}, getCircleCutoutOutlinePolygon = (cutout) => {
|
|
58626
58692
|
const points = [];
|
|
58627
58693
|
for (let i = 0;i < circleCutoutPolygonSegmentCount2; i++) {
|
|
@@ -58713,9 +58779,9 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58713
58779
|
const r = Math.max(0, Math.min(cr, Math.abs(w), Math.abs(h)));
|
|
58714
58780
|
let rotationTransform = identity22();
|
|
58715
58781
|
if (rotation) {
|
|
58716
|
-
rotationTransform =
|
|
58782
|
+
rotationTransform = rotate42(rotation * Math.PI / 180);
|
|
58717
58783
|
}
|
|
58718
|
-
const transformMatrix =
|
|
58784
|
+
const transformMatrix = compose42(translate42(center.x, center.y), rotationTransform);
|
|
58719
58785
|
if (r > 0) {
|
|
58720
58786
|
emitRoundedRect({ w, h, r, transformMatrix, builder, mfy, drawCw });
|
|
58721
58787
|
} else {
|
|
@@ -58744,7 +58810,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58744
58810
|
if (shouldReverse) {
|
|
58745
58811
|
pts = [...cwPoints].reverse();
|
|
58746
58812
|
}
|
|
58747
|
-
const tpts = pts.map((p) =>
|
|
58813
|
+
const tpts = pts.map((p) => applyToPoint42(transformMatrix, p));
|
|
58748
58814
|
builder.add("move_operation", { x: tpts[0].x, y: mfy(tpts[0].y) });
|
|
58749
58815
|
for (let i = 1;i < tpts.length; i++) {
|
|
58750
58816
|
builder.add("plot_operation", { x: tpts[i].x, y: mfy(tpts[i].y) });
|
|
@@ -58770,13 +58836,13 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58770
58836
|
}
|
|
58771
58837
|
let currentPoint;
|
|
58772
58838
|
const addLine = (pt) => {
|
|
58773
|
-
const tpt =
|
|
58839
|
+
const tpt = applyToPoint42(transformMatrix, pt);
|
|
58774
58840
|
builder.add("plot_operation", { x: tpt.x, y: mfy(tpt.y) });
|
|
58775
58841
|
currentPoint = tpt;
|
|
58776
58842
|
};
|
|
58777
58843
|
const addArc = (endPt, centerPt) => {
|
|
58778
|
-
const tEnd =
|
|
58779
|
-
const tCenter =
|
|
58844
|
+
const tEnd = applyToPoint42(transformMatrix, endPt);
|
|
58845
|
+
const tCenter = applyToPoint42(transformMatrix, centerPt);
|
|
58780
58846
|
builder.add(arcMode, {}).add("plot_operation", {
|
|
58781
58847
|
x: tEnd.x,
|
|
58782
58848
|
y: mfy(tEnd.y),
|
|
@@ -58809,7 +58875,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58809
58875
|
}
|
|
58810
58876
|
];
|
|
58811
58877
|
const startPt = { x: -w + r, y: h };
|
|
58812
|
-
const tStart =
|
|
58878
|
+
const tStart = applyToPoint42(transformMatrix, startPt);
|
|
58813
58879
|
builder.add("move_operation", { x: tStart.x, y: mfy(tStart.y) });
|
|
58814
58880
|
currentPoint = tStart;
|
|
58815
58881
|
for (const seg of cwSegments) {
|
|
@@ -58818,7 +58884,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58818
58884
|
}
|
|
58819
58885
|
} else {
|
|
58820
58886
|
const startPt = { x: w - r, y: h };
|
|
58821
|
-
const tStart =
|
|
58887
|
+
const tStart = applyToPoint42(transformMatrix, startPt);
|
|
58822
58888
|
builder.add("move_operation", { x: tStart.x, y: mfy(tStart.y) });
|
|
58823
58889
|
currentPoint = tStart;
|
|
58824
58890
|
addLine({ x: -w + r, y: h });
|
|
@@ -58853,22 +58919,6 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58853
58919
|
builder.add("plot_operation", { x: ordered[i].x, y: mfy(ordered[i].y) });
|
|
58854
58920
|
}
|
|
58855
58921
|
builder.add("plot_operation", { x: ordered[0].x, y: mfy(ordered[0].y) });
|
|
58856
|
-
}, getRotatedRectPoints = ({
|
|
58857
|
-
center,
|
|
58858
|
-
width,
|
|
58859
|
-
height,
|
|
58860
|
-
ccwRotationDegrees
|
|
58861
|
-
}) => {
|
|
58862
|
-
const halfWidth = width / 2;
|
|
58863
|
-
const halfHeight = height / 2;
|
|
58864
|
-
const ccwRotationRadians = ccwRotationDegrees * Math.PI / 180;
|
|
58865
|
-
const rectToPcbTransform = compose42(translate42(center.x, center.y), rotate42(ccwRotationRadians));
|
|
58866
|
-
return [
|
|
58867
|
-
{ x: -halfWidth, y: halfHeight },
|
|
58868
|
-
{ x: halfWidth, y: halfHeight },
|
|
58869
|
-
{ x: halfWidth, y: -halfHeight },
|
|
58870
|
-
{ x: -halfWidth, y: -halfHeight }
|
|
58871
|
-
].map((point) => applyToPoint42(rectToPcbTransform, point));
|
|
58872
58922
|
}, getEllipsePoints = ({
|
|
58873
58923
|
x,
|
|
58874
58924
|
y,
|
|
@@ -58926,7 +58976,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
58926
58976
|
throw new Error(`Expected inner layer, got ${layerRef}`);
|
|
58927
58977
|
}
|
|
58928
58978
|
return `In${layerRef.replace("inner", "")}_Cu`;
|
|
58929
|
-
},
|
|
58979
|
+
}, convertCircuitJsonToGerberCommands = (circuitJson, opts = {}) => {
|
|
58930
58980
|
opts.flip_y_axis ??= false;
|
|
58931
58981
|
const hasPanel = circuitJson.some((e) => e.type === "pcb_panel");
|
|
58932
58982
|
const hasBoard = circuitJson.some((e) => e.type === "pcb_board");
|
|
@@ -59416,6 +59466,8 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
59416
59466
|
}
|
|
59417
59467
|
if (!bPoint)
|
|
59418
59468
|
continue;
|
|
59469
|
+
if (a.x === bPoint.x && a.y === bPoint.y)
|
|
59470
|
+
continue;
|
|
59419
59471
|
const glayer = glayers[getGerberLayerName(layer, "copper")];
|
|
59420
59472
|
glayer.push(...gerberBuilder().add("select_aperture", {
|
|
59421
59473
|
aperture_number: findApertureNumber(glayer, {
|
|
@@ -59425,6 +59477,8 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
59425
59477
|
}
|
|
59426
59478
|
} else if (a.route_type === "via" && b.route_type === "wire") {
|
|
59427
59479
|
if (b.layer === layer) {
|
|
59480
|
+
if (a.x === b.x && a.y === b.y)
|
|
59481
|
+
continue;
|
|
59428
59482
|
const glayer = glayers[getGerberLayerName(layer, "copper")];
|
|
59429
59483
|
glayer.push(...gerberBuilder().add("select_aperture", {
|
|
59430
59484
|
aperture_number: findApertureNumber(glayer, {
|
|
@@ -59853,15 +59907,29 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
59853
59907
|
...element.shape !== "circle" ? { outer_width: padW, outer_height: padH } : {}
|
|
59854
59908
|
});
|
|
59855
59909
|
}
|
|
59856
|
-
const
|
|
59910
|
+
const rectRotation = "rect_ccw_rotation" in element && typeof element.rect_ccw_rotation === "number" ? element.rect_ccw_rotation : undefined;
|
|
59911
|
+
const renderAsRotatedRectRegion = rectRotation !== undefined && isGeometryChangingRectRotation({
|
|
59912
|
+
width: aperturePadW,
|
|
59913
|
+
height: aperturePadH,
|
|
59914
|
+
ccwRotationDegrees: rectRotation
|
|
59915
|
+
});
|
|
59916
|
+
if (renderAsRotatedRectRegion) {
|
|
59917
|
+
addClosedRegionFromPoints({
|
|
59918
|
+
target: glayer,
|
|
59919
|
+
apertureSource: glayer,
|
|
59920
|
+
points: getRotatedRectPoints({
|
|
59921
|
+
center: { x: element.x, y: element.y },
|
|
59922
|
+
width: aperturePadW,
|
|
59923
|
+
height: aperturePadH,
|
|
59924
|
+
ccwRotationDegrees: rectRotation
|
|
59925
|
+
})
|
|
59926
|
+
});
|
|
59927
|
+
continue;
|
|
59928
|
+
}
|
|
59857
59929
|
const gb = gerberBuilder().add("select_aperture", {
|
|
59858
59930
|
aperture_number: findApertureNumber(glayer, apertureConfig)
|
|
59859
59931
|
});
|
|
59860
|
-
if (rotation)
|
|
59861
|
-
gb.add("load_rotation", { rotation_degrees: rotation });
|
|
59862
59932
|
gb.add("flash_operation", { x: element.x, y: mfy(element.y) });
|
|
59863
|
-
if (rotation)
|
|
59864
|
-
gb.add("load_rotation", { rotation_degrees: 0 });
|
|
59865
59933
|
glayer.push(...gb.build());
|
|
59866
59934
|
}
|
|
59867
59935
|
}
|
|
@@ -60030,13 +60098,13 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
60030
60098
|
glayers[key].push(...gerberBuilder().add("end_of_file", {}).build());
|
|
60031
60099
|
}
|
|
60032
60100
|
return glayers;
|
|
60033
|
-
}, convertCircuitJsonToGerberFiles = (circuitJson, options = {}) => {
|
|
60101
|
+
}, convertSoupToGerberCommands, convertCircuitJsonToGerberFiles = (circuitJson, options = {}) => {
|
|
60034
60102
|
const { flip_y_axis = false } = options;
|
|
60035
|
-
const gerberCommandLayers =
|
|
60103
|
+
const gerberCommandLayers = convertCircuitJsonToGerberCommands(circuitJson, {
|
|
60036
60104
|
flip_y_axis
|
|
60037
60105
|
});
|
|
60038
60106
|
const gerberFiles = Object.fromEntries(Object.entries(stringifyGerberCommandLayers(gerberCommandLayers)).map(([layerName, contents]) => [`${layerName}.gbr`, contents]));
|
|
60039
|
-
const drillCommandLayers =
|
|
60107
|
+
const drillCommandLayers = convertCircuitJsonToExcellonDrillCommandLayers({
|
|
60040
60108
|
circuitJson,
|
|
60041
60109
|
flip_y_axis
|
|
60042
60110
|
});
|
|
@@ -60046,7 +60114,7 @@ var import_polygon_clipping2, import_fast_json_stable_stringify, import_polygon_
|
|
|
60046
60114
|
]));
|
|
60047
60115
|
return { ...gerberFiles, ...drillFiles };
|
|
60048
60116
|
};
|
|
60049
|
-
var
|
|
60117
|
+
var init_chunk_WLO6XF2E = __esm(() => {
|
|
60050
60118
|
import_polygon_clipping2 = __toESM3(require_polygon_clipping_cjs(), 1);
|
|
60051
60119
|
import_fast_json_stable_stringify = __toESM3(require_fast_json_stable_stringify(), 1);
|
|
60052
60120
|
import_polygon_clipping3 = __toESM3(require_polygon_clipping_cjs(), 1);
|
|
@@ -60661,7 +60729,7 @@ ${template_code}%`;
|
|
|
60661
60729
|
};
|
|
60662
60730
|
package_default5 = {
|
|
60663
60731
|
name: "circuit-json-to-gerber",
|
|
60664
|
-
version: "0.0.
|
|
60732
|
+
version: "0.0.104",
|
|
60665
60733
|
repository: {
|
|
60666
60734
|
type: "git",
|
|
60667
60735
|
url: "https://github.com/tscircuit/circuit-json-to-gerber"
|
|
@@ -60740,11 +60808,12 @@ ${template_code}%`;
|
|
|
60740
60808
|
paste: "Paste"
|
|
60741
60809
|
};
|
|
60742
60810
|
outerLayerRefs = ["top", "bottom"];
|
|
60811
|
+
convertSoupToGerberCommands = convertCircuitJsonToGerberCommands;
|
|
60743
60812
|
});
|
|
60744
60813
|
|
|
60745
60814
|
// node_modules/circuit-json-to-gerber/dist/index.js
|
|
60746
60815
|
var init_dist = __esm(() => {
|
|
60747
|
-
|
|
60816
|
+
init_chunk_WLO6XF2E();
|
|
60748
60817
|
});
|
|
60749
60818
|
|
|
60750
60819
|
// node_modules/@tracespace/xml-id/index.js
|
|
@@ -153224,7 +153293,7 @@ var package_default = {
|
|
|
153224
153293
|
"circuit-json-to-connectivity-map": "^0.0.25",
|
|
153225
153294
|
"circuit-json-to-fdm-component-box": "^0.0.2",
|
|
153226
153295
|
"circuit-json-to-footprinter": "^0.0.54",
|
|
153227
|
-
"circuit-json-to-gerber": "^0.0.
|
|
153296
|
+
"circuit-json-to-gerber": "^0.0.105",
|
|
153228
153297
|
"circuit-json-to-kicad": "0.0.181",
|
|
153229
153298
|
"circuit-json-to-pnp-csv": "^0.0.13",
|
|
153230
153299
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
package/dist/lib/index.js
CHANGED
|
@@ -69159,7 +69159,7 @@ var package_default = {
|
|
|
69159
69159
|
"circuit-json-to-connectivity-map": "^0.0.25",
|
|
69160
69160
|
"circuit-json-to-fdm-component-box": "^0.0.2",
|
|
69161
69161
|
"circuit-json-to-footprinter": "^0.0.54",
|
|
69162
|
-
"circuit-json-to-gerber": "^0.0.
|
|
69162
|
+
"circuit-json-to-gerber": "^0.0.105",
|
|
69163
69163
|
"circuit-json-to-kicad": "0.0.181",
|
|
69164
69164
|
"circuit-json-to-pnp-csv": "^0.0.13",
|
|
69165
69165
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2038",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tscircuit/cli"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"circuit-json-to-connectivity-map": "^0.0.25",
|
|
48
48
|
"circuit-json-to-fdm-component-box": "^0.0.2",
|
|
49
49
|
"circuit-json-to-footprinter": "^0.0.54",
|
|
50
|
-
"circuit-json-to-gerber": "^0.0.
|
|
50
|
+
"circuit-json-to-gerber": "^0.0.105",
|
|
51
51
|
"circuit-json-to-kicad": "0.0.181",
|
|
52
52
|
"circuit-json-to-pnp-csv": "^0.0.13",
|
|
53
53
|
"circuit-json-to-readable-netlist": "^0.0.15",
|