easyeda 0.0.59 → 0.0.61

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
- soupElements.push(
1585
- pcb_plated_hole.parse({
1586
- type: "pcb_plated_hole",
1587
- pcb_plated_hole_id: `pcb_plated_hole_${index + 1}`,
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
- port_hints: [portNumber],
1595
- pcb_component_id: "pcb_component_1",
1596
- pcb_port_id: `pcb_port_${index + 1}`,
1597
- layers: ["top"]
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="oval" />`
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) {
@@ -2632,4 +2661,4 @@ export {
2632
2661
  convertRawEasyToTsx,
2633
2662
  convertEasyEdaJsonToVariousFormats
2634
2663
  };
2635
- //# sourceMappingURL=chunk-X4DC7FIK.js.map
2664
+ //# sourceMappingURL=chunk-MRLBLBCQ.js.map