easyeda 0.0.326 → 0.0.328
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/browser/index.d.ts +29 -11
- package/dist/browser/index.js +175 -28
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +29 -11
- package/dist/index.js +175 -28
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +177 -30
- package/dist/main.cjs.map +1 -1
- package/package.json +2 -2
package/dist/main.cjs
CHANGED
|
@@ -1026,7 +1026,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
1026
1026
|
var package_default = {
|
|
1027
1027
|
name: "easyeda",
|
|
1028
1028
|
type: "module",
|
|
1029
|
-
version: "0.0.
|
|
1029
|
+
version: "0.0.327",
|
|
1030
1030
|
files: [
|
|
1031
1031
|
"dist"
|
|
1032
1032
|
],
|
|
@@ -1039,7 +1039,7 @@ var package_default = {
|
|
|
1039
1039
|
devDependencies: {
|
|
1040
1040
|
"@biomejs/biome": "^1.9.4",
|
|
1041
1041
|
"@tscircuit/alphabet": "^0.0.22",
|
|
1042
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
1042
|
+
"@tscircuit/circuit-json-util": "^0.0.111",
|
|
1043
1043
|
"@tscircuit/math-utils": "^0.0.36",
|
|
1044
1044
|
"@tscircuit/mm": "^0.0.9",
|
|
1045
1045
|
"@tscircuit/props": "^0.0.598",
|
|
@@ -6686,9 +6686,9 @@ var insertionDirectionToVec = (direction) => {
|
|
|
6686
6686
|
return { x: -1, y: 0 };
|
|
6687
6687
|
case "from_right":
|
|
6688
6688
|
return { x: 1, y: 0 };
|
|
6689
|
-
case "
|
|
6689
|
+
case "from_top":
|
|
6690
6690
|
return { x: 0, y: 1 };
|
|
6691
|
-
case "
|
|
6691
|
+
case "from_bottom":
|
|
6692
6692
|
return { x: 0, y: -1 };
|
|
6693
6693
|
}
|
|
6694
6694
|
};
|
|
@@ -6698,11 +6698,15 @@ var vecToInsertionDirection = ({
|
|
|
6698
6698
|
}) => {
|
|
6699
6699
|
if (x > 0) return "from_right";
|
|
6700
6700
|
if (x < 0) return "from_left";
|
|
6701
|
-
if (y > 0) return "
|
|
6702
|
-
return "
|
|
6701
|
+
if (y > 0) return "from_top";
|
|
6702
|
+
return "from_bottom";
|
|
6703
6703
|
};
|
|
6704
6704
|
var transformInsertionDirection = (direction, opts) => {
|
|
6705
|
-
if (!direction
|
|
6705
|
+
if (!direction) return direction;
|
|
6706
|
+
if (direction === "from_above" || direction === "from_below") {
|
|
6707
|
+
if (!opts.isFlipped) return direction;
|
|
6708
|
+
return direction === "from_above" ? "from_below" : "from_above";
|
|
6709
|
+
}
|
|
6706
6710
|
let { x, y } = insertionDirectionToVec(direction);
|
|
6707
6711
|
let quarterTurns = Math.round(opts.rotationDegrees / 90);
|
|
6708
6712
|
while (quarterTurns > 0) {
|
|
@@ -6725,7 +6729,7 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
6725
6729
|
const flipPadWidthHeight = Math.abs(getQuarterTurns(tsr.rotation.angle)) % 2 === 1;
|
|
6726
6730
|
const rotationDegrees = tsr.rotation.angle / Math.PI * 180;
|
|
6727
6731
|
const isFlipped = tsr.scale.sy < 0;
|
|
6728
|
-
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
6732
|
+
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste" || elm.type === "pcb_port") {
|
|
6729
6733
|
const { x, y } = applyToPoint(matrix, {
|
|
6730
6734
|
x: Number(elm.x),
|
|
6731
6735
|
y: Number(elm.y)
|
|
@@ -6745,10 +6749,14 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
6745
6749
|
elm.center = applyToPoint(matrix, elm.center);
|
|
6746
6750
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
6747
6751
|
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
6752
|
+
} else if (elm.type === "pcb_copper_text") {
|
|
6753
|
+
if (elm.anchor_position) {
|
|
6754
|
+
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
6755
|
+
}
|
|
6748
6756
|
} else if (elm.type === "pcb_courtyard_rect") {
|
|
6749
6757
|
elm.center = applyToPoint(matrix, elm.center);
|
|
6750
6758
|
elm.ccw_rotation = ((elm.ccw_rotation ?? 0) + rotationDegrees) % 360;
|
|
6751
|
-
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
|
|
6759
|
+
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_silkscreen_pill" || elm.type === "pcb_silkscreen_oval" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
|
|
6752
6760
|
elm.center = applyToPoint(matrix, elm.center);
|
|
6753
6761
|
} else if (elm.type === "pcb_component") {
|
|
6754
6762
|
elm.center = applyToPoint(matrix, elm.center);
|
|
@@ -6785,7 +6793,19 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
6785
6793
|
p.y = tp.y;
|
|
6786
6794
|
return p;
|
|
6787
6795
|
});
|
|
6788
|
-
} else if (elm.type === "
|
|
6796
|
+
} else if (elm.type === "pcb_trace") {
|
|
6797
|
+
elm.route = elm.route.map((rp) => {
|
|
6798
|
+
if (!("x" in rp)) {
|
|
6799
|
+
rp.start = applyToPoint(matrix, rp.start);
|
|
6800
|
+
rp.end = applyToPoint(matrix, rp.end);
|
|
6801
|
+
return rp;
|
|
6802
|
+
}
|
|
6803
|
+
const tp = applyToPoint(matrix, rp);
|
|
6804
|
+
rp.x = tp.x;
|
|
6805
|
+
rp.y = tp.y;
|
|
6806
|
+
return rp;
|
|
6807
|
+
});
|
|
6808
|
+
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace_hint" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
6789
6809
|
elm.route = elm.route.map((rp) => {
|
|
6790
6810
|
const tp = applyToPoint(matrix, rp);
|
|
6791
6811
|
rp.x = tp.x;
|
|
@@ -6818,7 +6838,7 @@ var transformPCBElements = (elms, matrix) => {
|
|
|
6818
6838
|
let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
|
|
6819
6839
|
if (flipPadWidthHeight) {
|
|
6820
6840
|
transformedElms = transformedElms.map((elm) => {
|
|
6821
|
-
if (elm.type === "pcb_smtpad" && (elm.shape === "rect" || elm.shape === "pill")) {
|
|
6841
|
+
if ((elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste") && (elm.shape === "rect" || elm.shape === "pill")) {
|
|
6822
6842
|
;
|
|
6823
6843
|
[elm.width, elm.height] = [elm.height, elm.width];
|
|
6824
6844
|
}
|
|
@@ -6973,7 +6993,10 @@ var getDebugLayoutObject = (lo) => {
|
|
|
6973
6993
|
const content = lo;
|
|
6974
6994
|
if (x === void 0 || y === void 0) return null;
|
|
6975
6995
|
if (width === void 0) {
|
|
6976
|
-
if ("
|
|
6996
|
+
if ("radius" in lo) {
|
|
6997
|
+
width = lo.radius * 2;
|
|
6998
|
+
height = lo.radius * 2;
|
|
6999
|
+
} else if ("outer_diameter" in lo) {
|
|
6977
7000
|
width = lo.outer_diameter;
|
|
6978
7001
|
height = lo.outer_diameter;
|
|
6979
7002
|
} else if ("rect_pad_width" in lo && "rect_pad_height" in lo) {
|
|
@@ -7028,6 +7051,17 @@ var findBoundsAndCenter = (elements) => {
|
|
|
7028
7051
|
const center = { x: minX + width / 2, y: minY + height / 2 };
|
|
7029
7052
|
return { center, width, height };
|
|
7030
7053
|
};
|
|
7054
|
+
var PIN1_LOCATION_PARTS = {
|
|
7055
|
+
leftside_top: { side: "leftside", alignment: "top" },
|
|
7056
|
+
leftside_bottom: { side: "leftside", alignment: "bottom" },
|
|
7057
|
+
rightside_top: { side: "rightside", alignment: "top" },
|
|
7058
|
+
rightside_bottom: { side: "rightside", alignment: "bottom" },
|
|
7059
|
+
topside_left: { side: "topside", alignment: "left" },
|
|
7060
|
+
topside_right: { side: "topside", alignment: "right" },
|
|
7061
|
+
bottomside_left: { side: "bottomside", alignment: "left" },
|
|
7062
|
+
bottomside_right: { side: "bottomside", alignment: "right" }
|
|
7063
|
+
};
|
|
7064
|
+
var PIN1_LOCATIONS = Object.keys(PIN1_LOCATION_PARTS);
|
|
7031
7065
|
|
|
7032
7066
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
7033
7067
|
var unitToMm = {
|
|
@@ -7519,6 +7553,62 @@ var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.pars
|
|
|
7519
7553
|
})),
|
|
7520
7554
|
stroke_width: mil10ToMm(track.width)
|
|
7521
7555
|
});
|
|
7556
|
+
var handleFabricationNoteSolidRegion = (solidRegion, index) => {
|
|
7557
|
+
const rawRoute = [];
|
|
7558
|
+
let currentPoint;
|
|
7559
|
+
for (const commandMatch of solidRegion.pathData.matchAll(
|
|
7560
|
+
/([MLAZ])([^MLAZ]*)/gi
|
|
7561
|
+
)) {
|
|
7562
|
+
const command = commandMatch[1]?.toUpperCase();
|
|
7563
|
+
const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
7564
|
+
if ((command === "M" || command === "L") && values.length >= 2) {
|
|
7565
|
+
currentPoint = { x: values[0], y: values[1] };
|
|
7566
|
+
rawRoute.push(currentPoint);
|
|
7567
|
+
} else if (command === "A" && currentPoint && values.length >= 7) {
|
|
7568
|
+
const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
|
|
7569
|
+
const generatedArcRoute = generateArcFromSweep(
|
|
7570
|
+
currentPoint.x,
|
|
7571
|
+
currentPoint.y,
|
|
7572
|
+
endX,
|
|
7573
|
+
endY,
|
|
7574
|
+
radiusX,
|
|
7575
|
+
largeArcFlag === 1,
|
|
7576
|
+
sweepFlag === 1
|
|
7577
|
+
);
|
|
7578
|
+
const maxArcSegments = 16;
|
|
7579
|
+
const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
|
|
7580
|
+
{ length: maxArcSegments + 1 },
|
|
7581
|
+
(_, pointIndex) => generatedArcRoute.at(
|
|
7582
|
+
Math.round(
|
|
7583
|
+
pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
|
|
7584
|
+
)
|
|
7585
|
+
)
|
|
7586
|
+
).filter((point2) => !!point2);
|
|
7587
|
+
rawRoute.push(...arcRoute.slice(1));
|
|
7588
|
+
currentPoint = { x: endX, y: endY };
|
|
7589
|
+
}
|
|
7590
|
+
}
|
|
7591
|
+
const route = rawRoute.map((point2) => ({
|
|
7592
|
+
x: mil10ToMm(point2.x),
|
|
7593
|
+
y: mil10ToMm(point2.y)
|
|
7594
|
+
}));
|
|
7595
|
+
const firstPoint = route[0];
|
|
7596
|
+
const lastPoint = route.at(-1);
|
|
7597
|
+
if (firstPoint && lastPoint && (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y)) {
|
|
7598
|
+
route.push({ ...firstPoint });
|
|
7599
|
+
}
|
|
7600
|
+
if (route.length < 2) return null;
|
|
7601
|
+
return pcb_fabrication_note_path.parse({
|
|
7602
|
+
type: "pcb_fabrication_note_path",
|
|
7603
|
+
pcb_fabrication_note_path_id: `pcb_fabrication_note_solid_region_${index + 1}`,
|
|
7604
|
+
pcb_component_id: "pcb_component_1",
|
|
7605
|
+
layer: "top",
|
|
7606
|
+
route,
|
|
7607
|
+
// EasyEDA solid regions have no stroke width. Use its standard 1-unit
|
|
7608
|
+
// document stroke so the closed region remains visible as a note path.
|
|
7609
|
+
stroke_width: mil10ToMm(1)
|
|
7610
|
+
});
|
|
7611
|
+
};
|
|
7522
7612
|
var getSideFromLayer = (layer) => {
|
|
7523
7613
|
if (layer === 4 || layer === 14) return "bottom";
|
|
7524
7614
|
return "top";
|
|
@@ -7545,24 +7635,17 @@ var handleSilkscreenArc = (arc, index) => {
|
|
|
7545
7635
|
stroke_width: mil10ToMm(arc.width)
|
|
7546
7636
|
});
|
|
7547
7637
|
};
|
|
7548
|
-
var SILKSCREEN_CIRCLE_SEGMENTS = 24;
|
|
7549
7638
|
var handleSilkscreenCircle = (circle, index) => {
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
|
|
7554
|
-
return {
|
|
7555
|
-
x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
|
|
7556
|
-
y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
|
|
7557
|
-
};
|
|
7558
|
-
}
|
|
7559
|
-
);
|
|
7560
|
-
return pcb_silkscreen_path.parse({
|
|
7561
|
-
type: "pcb_silkscreen_path",
|
|
7562
|
-
pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
|
|
7639
|
+
return pcb_silkscreen_circle.parse({
|
|
7640
|
+
type: "pcb_silkscreen_circle",
|
|
7641
|
+
pcb_silkscreen_circle_id: `pcb_silkscreen_circle_${index + 1}`,
|
|
7563
7642
|
pcb_component_id: "pcb_component_1",
|
|
7564
7643
|
layer: getSideFromLayer(circle.layer),
|
|
7565
|
-
|
|
7644
|
+
center: {
|
|
7645
|
+
x: milx10(circle.center.x),
|
|
7646
|
+
y: milx10(circle.center.y)
|
|
7647
|
+
},
|
|
7648
|
+
radius: milx10(circle.radius),
|
|
7566
7649
|
stroke_width: mil10ToMm(circle.width)
|
|
7567
7650
|
});
|
|
7568
7651
|
};
|
|
@@ -7896,6 +7979,9 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
7896
7979
|
} else if (isDocumentLayer(shape.layer)) {
|
|
7897
7980
|
circuitElements.push(handleFabricationNotePath(shape, index));
|
|
7898
7981
|
}
|
|
7982
|
+
} else if (shape.type === "SOLIDREGION" && isDocumentLayer(shape.layermask)) {
|
|
7983
|
+
const fabricationNote = handleFabricationNoteSolidRegion(shape, index);
|
|
7984
|
+
if (fabricationNote) circuitElements.push(fabricationNote);
|
|
7899
7985
|
} else if (shape.type === "CIRCLE") {
|
|
7900
7986
|
if (isSilkscreenLayer(shape.layer)) {
|
|
7901
7987
|
circuitElements.push(handleSilkscreenCircle(shape, index));
|
|
@@ -7962,7 +8048,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
7962
8048
|
);
|
|
7963
8049
|
}
|
|
7964
8050
|
const pcbElements = circuitElements.filter(
|
|
7965
|
-
(e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
|
|
8051
|
+
(e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_circle" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
|
|
7966
8052
|
);
|
|
7967
8053
|
if (pcbElements.length > 0) {
|
|
7968
8054
|
const bounds = findBoundsAndCenter(pcbElements);
|
|
@@ -8029,7 +8115,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
8029
8115
|
}
|
|
8030
8116
|
if (shouldRecenter) {
|
|
8031
8117
|
const elementsForBounds = circuitElements.filter(
|
|
8032
|
-
(e) => e.type !== "pcb_component" && e.type !== "cad_component"
|
|
8118
|
+
(e) => e.type !== "pcb_component" && e.type !== "cad_component" && e.type !== "pcb_silkscreen_circle"
|
|
8033
8119
|
);
|
|
8034
8120
|
const bounds = findBoundsAndCenter(elementsForBounds);
|
|
8035
8121
|
if (Number.isFinite(bounds.center.x) && Number.isFinite(bounds.center.y)) {
|
|
@@ -8209,6 +8295,7 @@ var CircleSchema = BaseShapeSchema.extend({
|
|
|
8209
8295
|
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
8210
8296
|
type: import_zod193.z.literal("SOLIDREGION"),
|
|
8211
8297
|
layermask: import_zod193.z.number(),
|
|
8298
|
+
pathData: import_zod193.z.string(),
|
|
8212
8299
|
points: import_zod193.z.array(PointSchema),
|
|
8213
8300
|
fillStyle: import_zod193.z.string().default("none")
|
|
8214
8301
|
});
|
|
@@ -8403,6 +8490,7 @@ var ShapeItemSchema = import_zod193.z.object({
|
|
|
8403
8490
|
return SolidRegionSchema.parse({
|
|
8404
8491
|
type: "SOLIDREGION",
|
|
8405
8492
|
layermask: Number(layermask),
|
|
8493
|
+
pathData,
|
|
8406
8494
|
points,
|
|
8407
8495
|
fillStyle: fillStyle || void 0,
|
|
8408
8496
|
id
|
|
@@ -9056,15 +9144,27 @@ var mapPortHints = (portHints, portHintsMap) => {
|
|
|
9056
9144
|
if (!portHintsMap || !portHints) return portHints;
|
|
9057
9145
|
return [...new Set(portHints.flatMap((hint) => portHintsMap[hint] ?? [hint]))];
|
|
9058
9146
|
};
|
|
9147
|
+
var getLayerAttr = (layer) => layer && layer !== "top" ? ` layer="${layer}"` : "";
|
|
9148
|
+
var getRotationAttr = (rotation2) => rotation2 ? ` pcbRotation="${rotation2}deg"` : "";
|
|
9149
|
+
var getStringAttr = (name, value) => value === void 0 ? "" : ` ${name}=${JSON.stringify(value)}`;
|
|
9059
9150
|
var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
9060
9151
|
const holes = su(circuitJson).pcb_hole.list();
|
|
9061
9152
|
const platedHoles = su(circuitJson).pcb_plated_hole.list();
|
|
9062
9153
|
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
9063
9154
|
const vias = su(circuitJson).pcb_via.list();
|
|
9064
9155
|
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
9156
|
+
const silkscreenCircles = su(circuitJson).pcb_silkscreen_circle.list();
|
|
9065
9157
|
const silkscreenRects = su(circuitJson).pcb_silkscreen_rect.list();
|
|
9066
9158
|
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
9067
9159
|
const fabricationNotePaths = su(circuitJson).pcb_fabrication_note_path.list();
|
|
9160
|
+
const fabricationNoteTexts = su(circuitJson).pcb_fabrication_note_text.list();
|
|
9161
|
+
const fabricationNoteRects = su(circuitJson).pcb_fabrication_note_rect.list();
|
|
9162
|
+
const fabricationNoteDimensions = su(circuitJson).pcb_fabrication_note_dimension.list();
|
|
9163
|
+
const pcbNoteTexts = su(circuitJson).pcb_note_text.list();
|
|
9164
|
+
const pcbNoteRects = su(circuitJson).pcb_note_rect.list();
|
|
9165
|
+
const pcbNotePaths = su(circuitJson).pcb_note_path.list();
|
|
9166
|
+
const pcbNoteLines = su(circuitJson).pcb_note_line.list();
|
|
9167
|
+
const pcbNoteDimensions = su(circuitJson).pcb_note_dimension.list();
|
|
9068
9168
|
const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
|
|
9069
9169
|
const elementStrings = [];
|
|
9070
9170
|
for (const hole of holes) {
|
|
@@ -9132,6 +9232,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
9132
9232
|
`<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
|
|
9133
9233
|
);
|
|
9134
9234
|
}
|
|
9235
|
+
for (const silkscreenCircle of silkscreenCircles) {
|
|
9236
|
+
elementStrings.push(
|
|
9237
|
+
`<silkscreencircle pcbX="${mmStr(silkscreenCircle.center.x)}" pcbY="${mmStr(silkscreenCircle.center.y)}" radius="${mmStr(silkscreenCircle.radius)}" />`
|
|
9238
|
+
);
|
|
9239
|
+
}
|
|
9135
9240
|
for (const silkscreenRect of silkscreenRects) {
|
|
9136
9241
|
const rotation2 = silkscreenRect.ccw_rotation || 0;
|
|
9137
9242
|
const rotationAttr = rotation2 ? ` pcbRotation="${rotation2}deg"` : "";
|
|
@@ -9152,7 +9257,49 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
9152
9257
|
}
|
|
9153
9258
|
for (const fabricationNotePath of fabricationNotePaths) {
|
|
9154
9259
|
elementStrings.push(
|
|
9155
|
-
`<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr(fabricationNotePath.stroke_width)}" />`
|
|
9260
|
+
`<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr(fabricationNotePath.stroke_width)}"${getStringAttr("color", fabricationNotePath.color)}${getLayerAttr(fabricationNotePath.layer)} />`
|
|
9261
|
+
);
|
|
9262
|
+
}
|
|
9263
|
+
for (const fabricationNoteText of fabricationNoteTexts) {
|
|
9264
|
+
elementStrings.push(
|
|
9265
|
+
`<fabricationnotetext text=${JSON.stringify(fabricationNoteText.text)} pcbX="${mmStr(fabricationNoteText.anchor_position.x)}" pcbY="${mmStr(fabricationNoteText.anchor_position.y)}" anchorAlignment="${fabricationNoteText.anchor_alignment}"${getStringAttr("font", fabricationNoteText.font)}${fabricationNoteText.font_size === void 0 ? "" : ` fontSize="${mmStr(fabricationNoteText.font_size)}"`}${getStringAttr("color", fabricationNoteText.color)}${getRotationAttr(fabricationNoteText.ccw_rotation)}${getLayerAttr(fabricationNoteText.layer)} />`
|
|
9266
|
+
);
|
|
9267
|
+
}
|
|
9268
|
+
for (const fabricationNoteRect of fabricationNoteRects) {
|
|
9269
|
+
elementStrings.push(
|
|
9270
|
+
`<fabricationnoterect pcbX="${mmStr(fabricationNoteRect.center.x)}" pcbY="${mmStr(fabricationNoteRect.center.y)}" width="${mmStr(fabricationNoteRect.width)}" height="${mmStr(fabricationNoteRect.height)}" strokeWidth="${mmStr(fabricationNoteRect.stroke_width)}"${fabricationNoteRect.corner_radius === void 0 ? "" : ` cornerRadius="${mmStr(fabricationNoteRect.corner_radius)}"`}${fabricationNoteRect.is_filled === void 0 ? "" : ` isFilled={${fabricationNoteRect.is_filled}}`}${fabricationNoteRect.has_stroke === void 0 ? "" : ` hasStroke={${fabricationNoteRect.has_stroke}}`}${fabricationNoteRect.is_stroke_dashed === void 0 ? "" : ` isStrokeDashed={${fabricationNoteRect.is_stroke_dashed}}`}${getStringAttr("color", fabricationNoteRect.color)}${getLayerAttr(fabricationNoteRect.layer)} />`
|
|
9271
|
+
);
|
|
9272
|
+
}
|
|
9273
|
+
for (const fabricationNoteDimension of fabricationNoteDimensions) {
|
|
9274
|
+
const offset = "offset" in fabricationNoteDimension ? fabricationNoteDimension.offset : fabricationNoteDimension.offset_distance;
|
|
9275
|
+
elementStrings.push(
|
|
9276
|
+
`<fabricationnotedimension from={${JSON.stringify(fabricationNoteDimension.from)}} to={${JSON.stringify(fabricationNoteDimension.to)}}${getStringAttr("text", fabricationNoteDimension.text)}${getStringAttr("font", fabricationNoteDimension.font)}${fabricationNoteDimension.font_size === void 0 ? "" : ` fontSize="${mmStr(fabricationNoteDimension.font_size)}"`}${fabricationNoteDimension.arrow_size === void 0 ? "" : ` arrowSize="${mmStr(fabricationNoteDimension.arrow_size)}"`}${offset === void 0 ? "" : ` offset="${mmStr(offset)}"`}${getStringAttr("color", fabricationNoteDimension.color)}${getLayerAttr(fabricationNoteDimension.layer)} />`
|
|
9277
|
+
);
|
|
9278
|
+
}
|
|
9279
|
+
for (const pcbNoteText of pcbNoteTexts) {
|
|
9280
|
+
elementStrings.push(
|
|
9281
|
+
`<pcbnotetext text=${JSON.stringify(pcbNoteText.text ?? "")} pcbX="${mmStr(pcbNoteText.anchor_position.x)}" pcbY="${mmStr(pcbNoteText.anchor_position.y)}" anchorAlignment="${pcbNoteText.anchor_alignment}"${getStringAttr("font", pcbNoteText.font)}${pcbNoteText.font_size === void 0 ? "" : ` fontSize="${mmStr(pcbNoteText.font_size)}"`}${getStringAttr("color", pcbNoteText.color)}${getLayerAttr(pcbNoteText.layer)} />`
|
|
9282
|
+
);
|
|
9283
|
+
}
|
|
9284
|
+
for (const pcbNoteRect of pcbNoteRects) {
|
|
9285
|
+
elementStrings.push(
|
|
9286
|
+
`<pcbnoterect pcbX="${mmStr(pcbNoteRect.center.x)}" pcbY="${mmStr(pcbNoteRect.center.y)}" width="${mmStr(pcbNoteRect.width)}" height="${mmStr(pcbNoteRect.height)}" strokeWidth="${mmStr(pcbNoteRect.stroke_width)}"${pcbNoteRect.corner_radius === void 0 ? "" : ` cornerRadius="${mmStr(pcbNoteRect.corner_radius)}"`}${pcbNoteRect.is_filled === void 0 ? "" : ` isFilled={${pcbNoteRect.is_filled}}`}${pcbNoteRect.has_stroke === void 0 ? "" : ` hasStroke={${pcbNoteRect.has_stroke}}`}${pcbNoteRect.is_stroke_dashed === void 0 ? "" : ` isStrokeDashed={${pcbNoteRect.is_stroke_dashed}}`}${getStringAttr("color", pcbNoteRect.color)}${getLayerAttr(pcbNoteRect.layer)} />`
|
|
9287
|
+
);
|
|
9288
|
+
}
|
|
9289
|
+
for (const pcbNotePath of pcbNotePaths) {
|
|
9290
|
+
elementStrings.push(
|
|
9291
|
+
`<pcbnotepath route={${JSON.stringify(pcbNotePath.route)}} strokeWidth="${mmStr(pcbNotePath.stroke_width)}"${getStringAttr("color", pcbNotePath.color)}${getLayerAttr(pcbNotePath.layer)} />`
|
|
9292
|
+
);
|
|
9293
|
+
}
|
|
9294
|
+
for (const pcbNoteLine of pcbNoteLines) {
|
|
9295
|
+
elementStrings.push(
|
|
9296
|
+
`<pcbnoteline x1="${mmStr(pcbNoteLine.x1)}" y1="${mmStr(pcbNoteLine.y1)}" x2="${mmStr(pcbNoteLine.x2)}" y2="${mmStr(pcbNoteLine.y2)}" strokeWidth="${mmStr(pcbNoteLine.stroke_width)}"${pcbNoteLine.is_dashed === void 0 ? "" : ` isDashed={${pcbNoteLine.is_dashed}}`}${getStringAttr("color", pcbNoteLine.color)}${getLayerAttr(pcbNoteLine.layer)} />`
|
|
9297
|
+
);
|
|
9298
|
+
}
|
|
9299
|
+
for (const pcbNoteDimension of pcbNoteDimensions) {
|
|
9300
|
+
const offset = pcbNoteDimension.offset_distance;
|
|
9301
|
+
elementStrings.push(
|
|
9302
|
+
`<pcbnotedimension from={${JSON.stringify(pcbNoteDimension.from)}} to={${JSON.stringify(pcbNoteDimension.to)}}${getStringAttr("text", pcbNoteDimension.text)}${getStringAttr("font", pcbNoteDimension.font)}${pcbNoteDimension.font_size === void 0 ? "" : ` fontSize="${mmStr(pcbNoteDimension.font_size)}"`}${pcbNoteDimension.arrow_size === void 0 ? "" : ` arrowSize="${mmStr(pcbNoteDimension.arrow_size)}"`}${offset === void 0 ? "" : ` offset="${mmStr(offset)}"`}${getStringAttr("color", pcbNoteDimension.color)}${getLayerAttr(pcbNoteDimension.layer)} />`
|
|
9156
9303
|
);
|
|
9157
9304
|
}
|
|
9158
9305
|
for (const courtyardOutline of courtyardOutlines) {
|