easyeda 0.0.58 → 0.0.60
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.
|
@@ -1581,20 +1581,51 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1581
1581
|
name: portNumber
|
|
1582
1582
|
});
|
|
1583
1583
|
if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
|
|
1584
|
-
|
|
1585
|
-
pcb_plated_hole
|
|
1586
|
-
|
|
1587
|
-
|
|
1584
|
+
const commonPlatedHoleProps = {
|
|
1585
|
+
type: "pcb_plated_hole",
|
|
1586
|
+
pcb_plated_hole_id: `pcb_plated_hole_${index + 1}`,
|
|
1587
|
+
x: mil2mm(pad.center.x),
|
|
1588
|
+
y: mil2mm(pad.center.y),
|
|
1589
|
+
layers: ["top"],
|
|
1590
|
+
port_hints: [portNumber],
|
|
1591
|
+
pcb_component_id: "pcb_component_1",
|
|
1592
|
+
pcb_port_id: `pcb_port_${index + 1}`
|
|
1593
|
+
};
|
|
1594
|
+
let additionalPlatedHoleProps;
|
|
1595
|
+
if (pad.shape === "OVAL") {
|
|
1596
|
+
const largestOuterDimensionName = mil2mm(pad.width) > mil2mm(pad.height) ? "width" : "height";
|
|
1597
|
+
const smallestOuterDimension = Math.min(
|
|
1598
|
+
mil2mm(pad.width),
|
|
1599
|
+
mil2mm(pad.height)
|
|
1600
|
+
);
|
|
1601
|
+
const largestOuterDimension = Math.max(
|
|
1602
|
+
mil2mm(pad.width),
|
|
1603
|
+
mil2mm(pad.height)
|
|
1604
|
+
);
|
|
1605
|
+
const distanceFromOuterPlatingToHole = smallestOuterDimension / 2 - mil2mm(pad.holeRadius);
|
|
1606
|
+
const largestInnerDimension = largestOuterDimension - distanceFromOuterPlatingToHole * 2;
|
|
1607
|
+
const smallestInnerDimension = mil2mm(pad.holeRadius) * 2;
|
|
1608
|
+
const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
|
|
1609
|
+
const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
|
|
1610
|
+
additionalPlatedHoleProps = {
|
|
1611
|
+
shape: "pill",
|
|
1612
|
+
outer_width: mil2mm(pad.width),
|
|
1613
|
+
outer_height: mil2mm(pad.height),
|
|
1614
|
+
hole_width: innerWidth,
|
|
1615
|
+
hole_height: innerHeight
|
|
1616
|
+
};
|
|
1617
|
+
} else {
|
|
1618
|
+
additionalPlatedHoleProps = {
|
|
1588
1619
|
shape: "circle",
|
|
1589
|
-
x: mil2mm(pad.center.x),
|
|
1590
|
-
y: mil2mm(pad.center.y),
|
|
1591
1620
|
hole_diameter: mil2mm(pad.holeRadius) * 2,
|
|
1592
1621
|
outer_diameter: mil2mm(pad.width),
|
|
1593
|
-
radius: mil2mm(pad.holeRadius)
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1622
|
+
radius: mil2mm(pad.holeRadius)
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
soupElements.push(
|
|
1626
|
+
pcb_plated_hole.parse({
|
|
1627
|
+
...commonPlatedHoleProps,
|
|
1628
|
+
...additionalPlatedHoleProps
|
|
1598
1629
|
})
|
|
1599
1630
|
);
|
|
1600
1631
|
} else {
|
|
@@ -2370,16 +2401,14 @@ var generateFootprintTsx = (circuitJson) => {
|
|
|
2370
2401
|
}
|
|
2371
2402
|
}
|
|
2372
2403
|
for (const platedHole of platedHoles) {
|
|
2373
|
-
if (platedHole.shape === "oval") {
|
|
2404
|
+
if (platedHole.shape === "oval" || platedHole.shape === "pill") {
|
|
2374
2405
|
elementStrings.push(
|
|
2375
|
-
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" outerHeight="${mmStr(platedHole.outer_height)}" outerWidth="${mmStr(platedHole.outer_width)}" holeHeight="${mmStr(platedHole.hole_height)}" holeWidth="${mmStr(platedHole.hole_width)}" height="${mmStr(platedHole.hole_height)}" shape="
|
|
2406
|
+
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" outerHeight="${mmStr(platedHole.outer_height)}" outerWidth="${mmStr(platedHole.outer_width)}" holeHeight="${mmStr(platedHole.hole_height)}" holeWidth="${mmStr(platedHole.hole_width)}" height="${mmStr(platedHole.hole_height)}" shape="${platedHole.shape}" />`
|
|
2376
2407
|
);
|
|
2377
2408
|
} else if (platedHole.shape === "circle") {
|
|
2378
2409
|
elementStrings.push(
|
|
2379
2410
|
`<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" outerDiameter="${mmStr(platedHole.outer_diameter)}" holeDiameter="${mmStr(platedHole.hole_diameter)}" shape="circle" />`
|
|
2380
2411
|
);
|
|
2381
|
-
} else if (platedHole.shape === "pill") {
|
|
2382
|
-
console.warn("Unhandled pill hole in conversion (needs implementation)");
|
|
2383
2412
|
}
|
|
2384
2413
|
}
|
|
2385
2414
|
for (const smtPad of smtPads) {
|
|
@@ -2476,27 +2505,40 @@ var convertBetterEasyToTsx = async ({
|
|
|
2476
2505
|
const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
|
|
2477
2506
|
const pn = normalizeManufacturerPartNumber(rawPn);
|
|
2478
2507
|
const [cad_component2] = su_default(circuitJson).cad_component.list();
|
|
2479
|
-
const pinLabels = {};
|
|
2480
|
-
for (const shape of betterEasy.dataStr.shape) {
|
|
2481
|
-
if (shape.type === "PIN") {
|
|
2482
|
-
const isPinLabelNumeric = /^\d+$/.test(shape.label);
|
|
2483
|
-
const label = isPinLabelNumeric ? `pin${shape.label}` : shape.label;
|
|
2484
|
-
pinLabels[shape.pinNumber.toString()] = label;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
2508
|
const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
2488
|
-
const
|
|
2489
|
-
|
|
2509
|
+
const hasStringPinNumbers = pins.some(
|
|
2510
|
+
(pin) => typeof pin.pinNumber === "string"
|
|
2511
|
+
);
|
|
2512
|
+
let modifiedPins = pins;
|
|
2513
|
+
if (hasStringPinNumbers) {
|
|
2514
|
+
modifiedPins = pins.map((pin, idx) => {
|
|
2515
|
+
const originalPinNumber = pin.pinNumber.toString();
|
|
2516
|
+
const newPinNumber = idx + 1;
|
|
2517
|
+
return {
|
|
2518
|
+
...pin,
|
|
2519
|
+
pinNumber: newPinNumber,
|
|
2520
|
+
label: pin.label
|
|
2521
|
+
};
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
const leftPins = modifiedPins.filter((pin) => pin.rotation === 180);
|
|
2525
|
+
const rightPins = modifiedPins.filter((pin) => pin.rotation === 0);
|
|
2490
2526
|
const schPinArrangement = {
|
|
2491
2527
|
leftSide: {
|
|
2492
2528
|
direction: "top-to-bottom",
|
|
2493
|
-
pins: leftPins.map((pin) => pin.pinNumber)
|
|
2529
|
+
pins: leftPins.map((pin) => Number(pin.pinNumber))
|
|
2494
2530
|
},
|
|
2495
2531
|
rightSide: {
|
|
2496
2532
|
direction: "bottom-to-top",
|
|
2497
|
-
pins: rightPins.map((pin) => pin.pinNumber).reverse()
|
|
2533
|
+
pins: rightPins.map((pin) => Number(pin.pinNumber)).reverse()
|
|
2498
2534
|
}
|
|
2499
2535
|
};
|
|
2536
|
+
const pinLabels = {};
|
|
2537
|
+
for (const pin of modifiedPins) {
|
|
2538
|
+
const isPinLabelNumeric = /^\d+$/.test(pin.label);
|
|
2539
|
+
const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
|
|
2540
|
+
pinLabels[pin.pinNumber] = label;
|
|
2541
|
+
}
|
|
2500
2542
|
let modelObjUrl;
|
|
2501
2543
|
if (cad_component2.model_obj_url) {
|
|
2502
2544
|
const isValidUrl = await checkModelObjUrlValidity(
|
|
@@ -2619,4 +2661,4 @@ export {
|
|
|
2619
2661
|
convertRawEasyToTsx,
|
|
2620
2662
|
convertEasyEdaJsonToVariousFormats
|
|
2621
2663
|
};
|
|
2622
|
-
//# sourceMappingURL=chunk-
|
|
2664
|
+
//# sourceMappingURL=chunk-MRLBLBCQ.js.map
|