circuit-json-to-kicad 0.0.24 → 0.0.25
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/index.js +26 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1511,11 +1511,27 @@ function createThruHolePadFromCircuitJson({
|
|
|
1511
1511
|
let padSize;
|
|
1512
1512
|
let drill;
|
|
1513
1513
|
let rotation = 0;
|
|
1514
|
+
const hasHoleOffset = "hole_offset_x" in platedHole || "hole_offset_y" in platedHole;
|
|
1515
|
+
let drillOffset;
|
|
1516
|
+
if (hasHoleOffset) {
|
|
1517
|
+
const rawOffset = {
|
|
1518
|
+
x: platedHole.hole_offset_x ?? 0,
|
|
1519
|
+
y: platedHole.hole_offset_y ?? 0
|
|
1520
|
+
};
|
|
1521
|
+
if (rawOffset.x !== 0 || rawOffset.y !== 0) {
|
|
1522
|
+
const rotatedOffset = applyToPoint6(rotationMatrix, {
|
|
1523
|
+
x: -rawOffset.x,
|
|
1524
|
+
y: rawOffset.y
|
|
1525
|
+
});
|
|
1526
|
+
drillOffset = rotatedOffset;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1514
1529
|
if (platedHole.shape === "circle") {
|
|
1515
1530
|
padShape = "circle";
|
|
1516
1531
|
padSize = [platedHole.outer_diameter, platedHole.outer_diameter];
|
|
1517
1532
|
drill = new PadDrill({
|
|
1518
|
-
diameter: platedHole.hole_diameter
|
|
1533
|
+
diameter: platedHole.hole_diameter,
|
|
1534
|
+
offset: drillOffset
|
|
1519
1535
|
});
|
|
1520
1536
|
} else if (platedHole.shape === "pill" || platedHole.shape === "oval") {
|
|
1521
1537
|
padShape = "oval";
|
|
@@ -1526,7 +1542,8 @@ function createThruHolePadFromCircuitJson({
|
|
|
1526
1542
|
drill = new PadDrill({
|
|
1527
1543
|
oval: true,
|
|
1528
1544
|
diameter: platedHole.hole_width,
|
|
1529
|
-
width: platedHole.hole_height
|
|
1545
|
+
width: platedHole.hole_height,
|
|
1546
|
+
offset: drillOffset
|
|
1530
1547
|
});
|
|
1531
1548
|
} else if (platedHole.shape === "pill_hole_with_rect_pad") {
|
|
1532
1549
|
padShape = "rect";
|
|
@@ -1537,7 +1554,8 @@ function createThruHolePadFromCircuitJson({
|
|
|
1537
1554
|
drill = new PadDrill({
|
|
1538
1555
|
oval: true,
|
|
1539
1556
|
diameter: platedHole.hole_width,
|
|
1540
|
-
width: platedHole.hole_height
|
|
1557
|
+
width: platedHole.hole_height,
|
|
1558
|
+
offset: drillOffset
|
|
1541
1559
|
});
|
|
1542
1560
|
} else if (platedHole.shape === "circular_hole_with_rect_pad") {
|
|
1543
1561
|
padShape = "rect";
|
|
@@ -1546,7 +1564,8 @@ function createThruHolePadFromCircuitJson({
|
|
|
1546
1564
|
platedHole.rect_pad_height
|
|
1547
1565
|
];
|
|
1548
1566
|
drill = new PadDrill({
|
|
1549
|
-
diameter: platedHole.hole_diameter
|
|
1567
|
+
diameter: platedHole.hole_diameter,
|
|
1568
|
+
offset: drillOffset
|
|
1550
1569
|
});
|
|
1551
1570
|
} else if (platedHole.shape === "rotated_pill_hole_with_rect_pad") {
|
|
1552
1571
|
padShape = "rect";
|
|
@@ -1557,13 +1576,14 @@ function createThruHolePadFromCircuitJson({
|
|
|
1557
1576
|
drill = new PadDrill({
|
|
1558
1577
|
oval: true,
|
|
1559
1578
|
diameter: platedHole.hole_width,
|
|
1560
|
-
width: platedHole.hole_height
|
|
1579
|
+
width: platedHole.hole_height,
|
|
1580
|
+
offset: drillOffset
|
|
1561
1581
|
});
|
|
1562
1582
|
rotation = platedHole.rect_ccw_rotation || 0;
|
|
1563
1583
|
} else {
|
|
1564
1584
|
padShape = "circle";
|
|
1565
1585
|
padSize = [1.6, 1.6];
|
|
1566
|
-
drill = new PadDrill({ diameter: 0.8 });
|
|
1586
|
+
drill = new PadDrill({ diameter: 0.8, offset: drillOffset });
|
|
1567
1587
|
}
|
|
1568
1588
|
return new FootprintPad2({
|
|
1569
1589
|
number: String(padNumber),
|