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/index.js
CHANGED
|
@@ -14273,6 +14273,43 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
14273
14273
|
// lib/utils/easyeda-unit-to-mm.ts
|
|
14274
14274
|
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
14275
14275
|
|
|
14276
|
+
// lib/utils/expand-easyeda-path-data.ts
|
|
14277
|
+
var expandEasyEdaPathData = (pathData) => {
|
|
14278
|
+
const rawRoute = [];
|
|
14279
|
+
let currentPoint;
|
|
14280
|
+
for (const commandMatch of pathData.matchAll(/([MLAZ])([^MLAZ]*)/gi)) {
|
|
14281
|
+
const command = commandMatch[1]?.toUpperCase();
|
|
14282
|
+
const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
14283
|
+
if ((command === "M" || command === "L") && values.length >= 2) {
|
|
14284
|
+
currentPoint = { x: values[0], y: values[1] };
|
|
14285
|
+
rawRoute.push(currentPoint);
|
|
14286
|
+
} else if (command === "A" && currentPoint && values.length >= 7) {
|
|
14287
|
+
const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
|
|
14288
|
+
const generatedArcRoute = generateArcFromSweep(
|
|
14289
|
+
currentPoint.x,
|
|
14290
|
+
currentPoint.y,
|
|
14291
|
+
endX,
|
|
14292
|
+
endY,
|
|
14293
|
+
radiusX,
|
|
14294
|
+
largeArcFlag === 1,
|
|
14295
|
+
sweepFlag === 1
|
|
14296
|
+
);
|
|
14297
|
+
const maxArcSegments = 16;
|
|
14298
|
+
const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
|
|
14299
|
+
{ length: maxArcSegments + 1 },
|
|
14300
|
+
(_, pointIndex) => generatedArcRoute.at(
|
|
14301
|
+
Math.round(
|
|
14302
|
+
pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
|
|
14303
|
+
)
|
|
14304
|
+
)
|
|
14305
|
+
).filter((point4) => !!point4);
|
|
14306
|
+
rawRoute.push(...arcRoute.slice(1));
|
|
14307
|
+
currentPoint = { x: endX, y: endY };
|
|
14308
|
+
}
|
|
14309
|
+
}
|
|
14310
|
+
return rawRoute;
|
|
14311
|
+
};
|
|
14312
|
+
|
|
14276
14313
|
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
14277
14314
|
function orientation(p, q, r) {
|
|
14278
14315
|
const val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
|
|
@@ -14388,6 +14425,22 @@ var getBoardOutlinePolygons = (tracks) => {
|
|
|
14388
14425
|
return polygons;
|
|
14389
14426
|
};
|
|
14390
14427
|
|
|
14428
|
+
// lib/utils/get-easyeda-npth-slot-geometry.ts
|
|
14429
|
+
var getEasyEdaNpthSlotGeometry = (solidRegion) => {
|
|
14430
|
+
const rawRoute = expandEasyEdaPathData(solidRegion.pathData);
|
|
14431
|
+
if (rawRoute.length < 2) return null;
|
|
14432
|
+
const points = rawRoute.map((point4) => ({
|
|
14433
|
+
x: mil2mm(point4.x) * 10,
|
|
14434
|
+
y: mil2mm(point4.y) * 10
|
|
14435
|
+
}));
|
|
14436
|
+
const firstPoint = points[0];
|
|
14437
|
+
const lastPoint = points.at(-1);
|
|
14438
|
+
if (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y) {
|
|
14439
|
+
points.push({ ...firstPoint });
|
|
14440
|
+
}
|
|
14441
|
+
return { points };
|
|
14442
|
+
};
|
|
14443
|
+
|
|
14391
14444
|
// lib/utils/normalize-pin-labels.ts
|
|
14392
14445
|
var normalizeActiveLowPinLabel = (label) => {
|
|
14393
14446
|
const hasActiveLowMarker = label.startsWith("#") || label.endsWith("#");
|
|
@@ -14976,40 +15029,7 @@ var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.pars
|
|
|
14976
15029
|
stroke_width: mil10ToMm(track.width)
|
|
14977
15030
|
});
|
|
14978
15031
|
var handleFabricationNoteSolidRegion = (solidRegion, index) => {
|
|
14979
|
-
const rawRoute =
|
|
14980
|
-
let currentPoint;
|
|
14981
|
-
for (const commandMatch of solidRegion.pathData.matchAll(
|
|
14982
|
-
/([MLAZ])([^MLAZ]*)/gi
|
|
14983
|
-
)) {
|
|
14984
|
-
const command = commandMatch[1]?.toUpperCase();
|
|
14985
|
-
const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
|
|
14986
|
-
if ((command === "M" || command === "L") && values.length >= 2) {
|
|
14987
|
-
currentPoint = { x: values[0], y: values[1] };
|
|
14988
|
-
rawRoute.push(currentPoint);
|
|
14989
|
-
} else if (command === "A" && currentPoint && values.length >= 7) {
|
|
14990
|
-
const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
|
|
14991
|
-
const generatedArcRoute = generateArcFromSweep(
|
|
14992
|
-
currentPoint.x,
|
|
14993
|
-
currentPoint.y,
|
|
14994
|
-
endX,
|
|
14995
|
-
endY,
|
|
14996
|
-
radiusX,
|
|
14997
|
-
largeArcFlag === 1,
|
|
14998
|
-
sweepFlag === 1
|
|
14999
|
-
);
|
|
15000
|
-
const maxArcSegments = 16;
|
|
15001
|
-
const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
|
|
15002
|
-
{ length: maxArcSegments + 1 },
|
|
15003
|
-
(_, pointIndex) => generatedArcRoute.at(
|
|
15004
|
-
Math.round(
|
|
15005
|
-
pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
|
|
15006
|
-
)
|
|
15007
|
-
)
|
|
15008
|
-
).filter((point4) => !!point4);
|
|
15009
|
-
rawRoute.push(...arcRoute.slice(1));
|
|
15010
|
-
currentPoint = { x: endX, y: endY };
|
|
15011
|
-
}
|
|
15012
|
-
}
|
|
15032
|
+
const rawRoute = expandEasyEdaPathData(solidRegion.pathData);
|
|
15013
15033
|
const route = rawRoute.map((point4) => ({
|
|
15014
15034
|
x: mil10ToMm(point4.x),
|
|
15015
15035
|
y: mil10ToMm(point4.y)
|
|
@@ -15140,9 +15160,11 @@ var handleCutout = (solidRegion, index) => {
|
|
|
15140
15160
|
});
|
|
15141
15161
|
};
|
|
15142
15162
|
var LEAD_SHAPE_LAYER = 100;
|
|
15163
|
+
var NPTH_FILL_STYLE = "npth";
|
|
15143
15164
|
var isPcbSolidRegionCutout = (shape) => {
|
|
15144
15165
|
return shape.fillStyle === "cutout" && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
15145
15166
|
};
|
|
15167
|
+
var isPcbSolidRegionNpth = (shape) => shape.fillStyle === NPTH_FILL_STYLE && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
15146
15168
|
var getCadPositionZMmFromMetadata = (easyEdaJson) => {
|
|
15147
15169
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
15148
15170
|
(shape) => shape.type === "SVGNODE" && shape.svgData.attrs?.uuid
|
|
@@ -15338,6 +15360,20 @@ var convertEasyEdaJsonToCircuitJsonWithPinAttributes = (easyEdaJson, {
|
|
|
15338
15360
|
).forEach((sr, index) => {
|
|
15339
15361
|
circuitElements.push(handleCutout(sr, index));
|
|
15340
15362
|
});
|
|
15363
|
+
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
15364
|
+
(shape) => shape.type === "SOLIDREGION" && isPcbSolidRegionNpth(shape)
|
|
15365
|
+
).forEach((sr, index) => {
|
|
15366
|
+
const geometry = getEasyEdaNpthSlotGeometry(sr);
|
|
15367
|
+
if (!geometry) return;
|
|
15368
|
+
circuitElements.push(
|
|
15369
|
+
pcb_cutout.parse({
|
|
15370
|
+
type: "pcb_cutout",
|
|
15371
|
+
pcb_cutout_id: `pcb_cutout_npth_${index + 1}`,
|
|
15372
|
+
shape: "polygon",
|
|
15373
|
+
points: geometry.points
|
|
15374
|
+
})
|
|
15375
|
+
);
|
|
15376
|
+
});
|
|
15341
15377
|
const boardOutlineTracks = easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
15342
15378
|
(shape) => shape.type === "TRACK" && shape.layer === 10
|
|
15343
15379
|
);
|