easyeda 0.0.57 → 0.0.59
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.
|
@@ -1486,6 +1486,11 @@ var computeCenterOffset = (easyeda) => {
|
|
|
1486
1486
|
|
|
1487
1487
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1488
1488
|
import { mm as mm2 } from "@tscircuit/mm";
|
|
1489
|
+
|
|
1490
|
+
// lib/utils/easyeda-unit-to-mm.ts
|
|
1491
|
+
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
1492
|
+
|
|
1493
|
+
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1489
1494
|
var mil2mm = (mil) => {
|
|
1490
1495
|
if (typeof mil === "number") return mm2(`${mil}mil`);
|
|
1491
1496
|
if (mil.match(/^\d+$/)) return mm2(`${mil}mil`);
|
|
@@ -1507,7 +1512,7 @@ var handleSilkscreenPath = (track, index) => {
|
|
|
1507
1512
|
x: milx10(point2.x),
|
|
1508
1513
|
y: milx10(point2.y)
|
|
1509
1514
|
})),
|
|
1510
|
-
stroke_width: track.width
|
|
1515
|
+
stroke_width: mil10ToMm(track.width)
|
|
1511
1516
|
});
|
|
1512
1517
|
};
|
|
1513
1518
|
var handleSilkscreenArc = (arc, index) => {
|
|
@@ -1530,7 +1535,7 @@ var handleSilkscreenArc = (arc, index) => {
|
|
|
1530
1535
|
x: milx10(p.x),
|
|
1531
1536
|
y: milx10(p.y)
|
|
1532
1537
|
})),
|
|
1533
|
-
stroke_width:
|
|
1538
|
+
stroke_width: mil10ToMm(arc.width)
|
|
1534
1539
|
});
|
|
1535
1540
|
};
|
|
1536
1541
|
var handleHole = (hole, index) => {
|
|
@@ -1977,6 +1982,7 @@ var ShapesArraySchema = z59.array(ShapeItemSchema);
|
|
|
1977
1982
|
|
|
1978
1983
|
// lib/schemas/single-letter-shape-schema.ts
|
|
1979
1984
|
import { z as z60 } from "zod";
|
|
1985
|
+
import "@tscircuit/mm";
|
|
1980
1986
|
var PointSchema2 = z60.object({
|
|
1981
1987
|
x: z60.number(),
|
|
1982
1988
|
y: z60.number()
|
|
@@ -2128,7 +2134,7 @@ var parsePath = (str) => {
|
|
|
2128
2134
|
type: "PATH",
|
|
2129
2135
|
pathData,
|
|
2130
2136
|
fillColor,
|
|
2131
|
-
strokeWidth: Number(strokeWidth),
|
|
2137
|
+
strokeWidth: mil10ToMm(Number(strokeWidth)),
|
|
2132
2138
|
strokeColor,
|
|
2133
2139
|
id
|
|
2134
2140
|
};
|
|
@@ -2470,27 +2476,40 @@ var convertBetterEasyToTsx = async ({
|
|
|
2470
2476
|
const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
|
|
2471
2477
|
const pn = normalizeManufacturerPartNumber(rawPn);
|
|
2472
2478
|
const [cad_component2] = su_default(circuitJson).cad_component.list();
|
|
2473
|
-
const pinLabels = {};
|
|
2474
|
-
for (const shape of betterEasy.dataStr.shape) {
|
|
2475
|
-
if (shape.type === "PIN") {
|
|
2476
|
-
const isPinLabelNumeric = /^\d+$/.test(shape.label);
|
|
2477
|
-
const label = isPinLabelNumeric ? `pin${shape.label}` : shape.label;
|
|
2478
|
-
pinLabels[shape.pinNumber.toString()] = label;
|
|
2479
|
-
}
|
|
2480
|
-
}
|
|
2481
2479
|
const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
2482
|
-
const
|
|
2483
|
-
|
|
2480
|
+
const hasStringPinNumbers = pins.some(
|
|
2481
|
+
(pin) => typeof pin.pinNumber === "string"
|
|
2482
|
+
);
|
|
2483
|
+
let modifiedPins = pins;
|
|
2484
|
+
if (hasStringPinNumbers) {
|
|
2485
|
+
modifiedPins = pins.map((pin, idx) => {
|
|
2486
|
+
const originalPinNumber = pin.pinNumber.toString();
|
|
2487
|
+
const newPinNumber = idx + 1;
|
|
2488
|
+
return {
|
|
2489
|
+
...pin,
|
|
2490
|
+
pinNumber: newPinNumber,
|
|
2491
|
+
label: pin.label
|
|
2492
|
+
};
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
const leftPins = modifiedPins.filter((pin) => pin.rotation === 180);
|
|
2496
|
+
const rightPins = modifiedPins.filter((pin) => pin.rotation === 0);
|
|
2484
2497
|
const schPinArrangement = {
|
|
2485
2498
|
leftSide: {
|
|
2486
2499
|
direction: "top-to-bottom",
|
|
2487
|
-
pins: leftPins.map((pin) => pin.pinNumber)
|
|
2500
|
+
pins: leftPins.map((pin) => Number(pin.pinNumber))
|
|
2488
2501
|
},
|
|
2489
2502
|
rightSide: {
|
|
2490
2503
|
direction: "bottom-to-top",
|
|
2491
|
-
pins: rightPins.map((pin) => pin.pinNumber).reverse()
|
|
2504
|
+
pins: rightPins.map((pin) => Number(pin.pinNumber)).reverse()
|
|
2492
2505
|
}
|
|
2493
2506
|
};
|
|
2507
|
+
const pinLabels = {};
|
|
2508
|
+
for (const pin of modifiedPins) {
|
|
2509
|
+
const isPinLabelNumeric = /^\d+$/.test(pin.label);
|
|
2510
|
+
const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
|
|
2511
|
+
pinLabels[pin.pinNumber] = label;
|
|
2512
|
+
}
|
|
2494
2513
|
let modelObjUrl;
|
|
2495
2514
|
if (cad_component2.model_obj_url) {
|
|
2496
2515
|
const isValidUrl = await checkModelObjUrlValidity(
|
|
@@ -2613,4 +2632,4 @@ export {
|
|
|
2613
2632
|
convertRawEasyToTsx,
|
|
2614
2633
|
convertEasyEdaJsonToVariousFormats
|
|
2615
2634
|
};
|
|
2616
|
-
//# sourceMappingURL=chunk-
|
|
2635
|
+
//# sourceMappingURL=chunk-X4DC7FIK.js.map
|