easyeda 0.0.370 → 0.0.371
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.js +70 -34
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +70 -34
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +71 -35
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -18100,6 +18100,43 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
18100
18100
|
// lib/utils/easyeda-unit-to-mm.ts
|
|
18101
18101
|
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
18102
18102
|
|
|
18103
|
+
// lib/utils/expand-easyeda-path-data.ts
|
|
18104
|
+
var expandEasyEdaPathData = (pathData) => {
|
|
18105
|
+
const rawRoute = [];
|
|
18106
|
+
let currentPoint;
|
|
18107
|
+
for (const commandMatch of pathData.matchAll(/([MLAZ])([^MLAZ]*)/gi)) {
|
|
18108
|
+
const command = commandMatch[1]?.toUpperCase();
|
|
18109
|
+
const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
18110
|
+
if ((command === "M" || command === "L") && values.length >= 2) {
|
|
18111
|
+
currentPoint = { x: values[0], y: values[1] };
|
|
18112
|
+
rawRoute.push(currentPoint);
|
|
18113
|
+
} else if (command === "A" && currentPoint && values.length >= 7) {
|
|
18114
|
+
const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
|
|
18115
|
+
const generatedArcRoute = generateArcFromSweep(
|
|
18116
|
+
currentPoint.x,
|
|
18117
|
+
currentPoint.y,
|
|
18118
|
+
endX,
|
|
18119
|
+
endY,
|
|
18120
|
+
radiusX,
|
|
18121
|
+
largeArcFlag === 1,
|
|
18122
|
+
sweepFlag === 1
|
|
18123
|
+
);
|
|
18124
|
+
const maxArcSegments = 16;
|
|
18125
|
+
const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
|
|
18126
|
+
{ length: maxArcSegments + 1 },
|
|
18127
|
+
(_, pointIndex) => generatedArcRoute.at(
|
|
18128
|
+
Math.round(
|
|
18129
|
+
pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
|
|
18130
|
+
)
|
|
18131
|
+
)
|
|
18132
|
+
).filter((point4) => !!point4);
|
|
18133
|
+
rawRoute.push(...arcRoute.slice(1));
|
|
18134
|
+
currentPoint = { x: endX, y: endY };
|
|
18135
|
+
}
|
|
18136
|
+
}
|
|
18137
|
+
return rawRoute;
|
|
18138
|
+
};
|
|
18139
|
+
|
|
18103
18140
|
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
18104
18141
|
function orientation(p, q, r) {
|
|
18105
18142
|
const val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
@@ -18215,6 +18252,22 @@ var getBoardOutlinePolygons = (tracks) => {
|
|
|
18215
18252
|
return polygons;
|
|
18216
18253
|
};
|
|
18217
18254
|
|
|
18255
|
+
// lib/utils/get-easyeda-npth-slot-geometry.ts
|
|
18256
|
+
var getEasyEdaNpthSlotGeometry = (solidRegion) => {
|
|
18257
|
+
const rawRoute = expandEasyEdaPathData(solidRegion.pathData);
|
|
18258
|
+
if (rawRoute.length < 2) return null;
|
|
18259
|
+
const points = rawRoute.map((point4) => ({
|
|
18260
|
+
x: mil2mm(point4.x) * 10,
|
|
18261
|
+
y: mil2mm(point4.y) * 10
|
|
18262
|
+
}));
|
|
18263
|
+
const firstPoint = points[0];
|
|
18264
|
+
const lastPoint = points.at(-1);
|
|
18265
|
+
if (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y) {
|
|
18266
|
+
points.push({ ...firstPoint });
|
|
18267
|
+
}
|
|
18268
|
+
return { points };
|
|
18269
|
+
};
|
|
18270
|
+
|
|
18218
18271
|
// lib/utils/normalize-pin-labels.ts
|
|
18219
18272
|
var normalizeActiveLowPinLabel = (label) => {
|
|
18220
18273
|
const hasActiveLowMarker = label.startsWith("#") || label.endsWith("#");
|
|
@@ -18803,40 +18856,7 @@ var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.pars
|
|
|
18803
18856
|
stroke_width: mil10ToMm(track.width)
|
|
18804
18857
|
});
|
|
18805
18858
|
var handleFabricationNoteSolidRegion = (solidRegion, index) => {
|
|
18806
|
-
const rawRoute =
|
|
18807
|
-
let currentPoint;
|
|
18808
|
-
for (const commandMatch of solidRegion.pathData.matchAll(
|
|
18809
|
-
/([MLAZ])([^MLAZ]*)/gi
|
|
18810
|
-
)) {
|
|
18811
|
-
const command = commandMatch[1]?.toUpperCase();
|
|
18812
|
-
const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
18813
|
-
if ((command === "M" || command === "L") && values.length >= 2) {
|
|
18814
|
-
currentPoint = { x: values[0], y: values[1] };
|
|
18815
|
-
rawRoute.push(currentPoint);
|
|
18816
|
-
} else if (command === "A" && currentPoint && values.length >= 7) {
|
|
18817
|
-
const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
|
|
18818
|
-
const generatedArcRoute = generateArcFromSweep(
|
|
18819
|
-
currentPoint.x,
|
|
18820
|
-
currentPoint.y,
|
|
18821
|
-
endX,
|
|
18822
|
-
endY,
|
|
18823
|
-
radiusX,
|
|
18824
|
-
largeArcFlag === 1,
|
|
18825
|
-
sweepFlag === 1
|
|
18826
|
-
);
|
|
18827
|
-
const maxArcSegments = 16;
|
|
18828
|
-
const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
|
|
18829
|
-
{ length: maxArcSegments + 1 },
|
|
18830
|
-
(_, pointIndex) => generatedArcRoute.at(
|
|
18831
|
-
Math.round(
|
|
18832
|
-
pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
|
|
18833
|
-
)
|
|
18834
|
-
)
|
|
18835
|
-
).filter((point4) => !!point4);
|
|
18836
|
-
rawRoute.push(...arcRoute.slice(1));
|
|
18837
|
-
currentPoint = { x: endX, y: endY };
|
|
18838
|
-
}
|
|
18839
|
-
}
|
|
18859
|
+
const rawRoute = expandEasyEdaPathData(solidRegion.pathData);
|
|
18840
18860
|
const route = rawRoute.map((point4) => ({
|
|
18841
18861
|
x: mil10ToMm(point4.x),
|
|
18842
18862
|
y: mil10ToMm(point4.y)
|
|
@@ -18967,9 +18987,11 @@ var handleCutout = (solidRegion, index) => {
|
|
|
18967
18987
|
});
|
|
18968
18988
|
};
|
|
18969
18989
|
var LEAD_SHAPE_LAYER = 100;
|
|
18990
|
+
var NPTH_FILL_STYLE = "npth";
|
|
18970
18991
|
var isPcbSolidRegionCutout = (shape) => {
|
|
18971
18992
|
return shape.fillStyle === "cutout" && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
18972
18993
|
};
|
|
18994
|
+
var isPcbSolidRegionNpth = (shape) => shape.fillStyle === NPTH_FILL_STYLE && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
18973
18995
|
var getCadPositionZMmFromMetadata = (easyEdaJson) => {
|
|
18974
18996
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
18975
18997
|
(shape) => shape.type === "SVGNODE" && shape.svgData.attrs?.uuid
|
|
@@ -19165,6 +19187,20 @@ var convertEasyEdaJsonToCircuitJsonWithPinAttributes = (easyEdaJson, {
|
|
|
19165
19187
|
).forEach((sr, index) => {
|
|
19166
19188
|
circuitElements.push(handleCutout(sr, index));
|
|
19167
19189
|
});
|
|
19190
|
+
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
19191
|
+
(shape) => shape.type === "SOLIDREGION" && isPcbSolidRegionNpth(shape)
|
|
19192
|
+
).forEach((sr, index) => {
|
|
19193
|
+
const geometry = getEasyEdaNpthSlotGeometry(sr);
|
|
19194
|
+
if (!geometry) return;
|
|
19195
|
+
circuitElements.push(
|
|
19196
|
+
pcb_cutout.parse({
|
|
19197
|
+
type: "pcb_cutout",
|
|
19198
|
+
pcb_cutout_id: `pcb_cutout_npth_${index + 1}`,
|
|
19199
|
+
shape: "polygon",
|
|
19200
|
+
points: geometry.points
|
|
19201
|
+
})
|
|
19202
|
+
);
|
|
19203
|
+
});
|
|
19168
19204
|
const boardOutlineTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
19169
19205
|
(shape) => shape.type === "TRACK" && shape.layer === 10
|
|
19170
19206
|
);
|