easyeda 0.0.176 → 0.0.178
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 +40 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-SRGPYV5T.js → chunk-SQYZHX3A.js} +41 -5
- package/dist/{chunk-SRGPYV5T.js.map → chunk-SQYZHX3A.js.map} +1 -1
- package/dist/cli/main.js +3 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.d.ts +712 -712
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -2128,7 +2128,7 @@ var findBoundsAndCenter = (elements) => {
|
|
|
2128
2128
|
};
|
|
2129
2129
|
|
|
2130
2130
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2131
|
-
import { compose, scale, translate } from "transformation-matrix";
|
|
2131
|
+
import { compose, scale, translate, applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
2132
2132
|
|
|
2133
2133
|
// lib/compute-center-offset.ts
|
|
2134
2134
|
import { mm } from "@tscircuit/mm";
|
|
@@ -2213,6 +2213,26 @@ var handleHole = (hole, index) => {
|
|
|
2213
2213
|
pcb_hole_id: `pcb_hole_${index + 1}`
|
|
2214
2214
|
});
|
|
2215
2215
|
};
|
|
2216
|
+
var handleHoleCutout = (hole, index) => {
|
|
2217
|
+
return pcb_cutout.parse({
|
|
2218
|
+
type: "pcb_cutout",
|
|
2219
|
+
pcb_cutout_id: `pcb_cutout_from_hole_${index + 1}`,
|
|
2220
|
+
shape: "circle",
|
|
2221
|
+
center: { x: milx10(hole.center.x), y: milx10(hole.center.y) },
|
|
2222
|
+
radius: milx10(hole.radius)
|
|
2223
|
+
});
|
|
2224
|
+
};
|
|
2225
|
+
var handleCutout = (solidRegion, index) => {
|
|
2226
|
+
return pcb_cutout.parse({
|
|
2227
|
+
type: "pcb_cutout",
|
|
2228
|
+
pcb_cutout_id: `pcb_cutout_${index + 1}`,
|
|
2229
|
+
shape: "polygon",
|
|
2230
|
+
points: solidRegion.points.map((p) => ({
|
|
2231
|
+
x: milx10(p.x),
|
|
2232
|
+
y: milx10(p.y)
|
|
2233
|
+
}))
|
|
2234
|
+
});
|
|
2235
|
+
};
|
|
2216
2236
|
var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecenter = true } = {}) => {
|
|
2217
2237
|
const soupElements = [];
|
|
2218
2238
|
const centerOffset = computeCenterOffset(easyEdaJson);
|
|
@@ -2346,6 +2366,12 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
2346
2366
|
(shape) => shape.type === "HOLE"
|
|
2347
2367
|
).forEach((h, index) => {
|
|
2348
2368
|
soupElements.push(handleHole(h, index));
|
|
2369
|
+
soupElements.push(handleHoleCutout(h, index));
|
|
2370
|
+
});
|
|
2371
|
+
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
2372
|
+
(shape) => shape.type === "SOLIDREGION" && shape.fillStyle === "cutout"
|
|
2373
|
+
).forEach((sr, index) => {
|
|
2374
|
+
soupElements.push(handleCutout(sr, index));
|
|
2349
2375
|
});
|
|
2350
2376
|
easyEdaJson.packageDetail.dataStr.shape.forEach((shape, index) => {
|
|
2351
2377
|
if (shape.type === "TRACK") {
|
|
@@ -2399,10 +2425,20 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
2399
2425
|
// we set it to (0,0)
|
|
2400
2426
|
soupElements.filter((e) => e.type !== "pcb_component")
|
|
2401
2427
|
);
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2428
|
+
const matrix = compose(
|
|
2429
|
+
translate(-bounds.center.x, bounds.center.y),
|
|
2430
|
+
scale(1, -1)
|
|
2405
2431
|
);
|
|
2432
|
+
transformPCBElements(soupElements, matrix);
|
|
2433
|
+
soupElements.forEach((e) => {
|
|
2434
|
+
if (e.type === "pcb_cutout") {
|
|
2435
|
+
if (e.shape === "polygon") {
|
|
2436
|
+
e.points = e.points.map((p) => applyToPoint2(matrix, p));
|
|
2437
|
+
} else {
|
|
2438
|
+
e.center = applyToPoint2(matrix, e.center);
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
});
|
|
2406
2442
|
pcb_component2.center = { x: 0, y: 0 };
|
|
2407
2443
|
}
|
|
2408
2444
|
return soupElements;
|
|
@@ -3427,4 +3463,4 @@ export {
|
|
|
3427
3463
|
convertRawEasyToTsx,
|
|
3428
3464
|
convertEasyEdaJsonToVariousFormats
|
|
3429
3465
|
};
|
|
3430
|
-
//# sourceMappingURL=chunk-
|
|
3466
|
+
//# sourceMappingURL=chunk-SQYZHX3A.js.map
|