kicad-to-circuit-json 0.0.2 → 0.0.3
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 +27 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -481,7 +481,14 @@ function processPad(ctx, pad, componentId, kicadComponentPos, componentRotation)
|
|
|
481
481
|
const drill = pad.drill;
|
|
482
482
|
const totalRotation = -componentRotation - padRotation;
|
|
483
483
|
if (padType === "smd") {
|
|
484
|
-
createSmdPad(
|
|
484
|
+
createSmdPad({
|
|
485
|
+
ctx,
|
|
486
|
+
pad,
|
|
487
|
+
componentId,
|
|
488
|
+
pos: globalPos,
|
|
489
|
+
size,
|
|
490
|
+
shape: padShape
|
|
491
|
+
});
|
|
485
492
|
} else if (padType === "np_thru_hole") {
|
|
486
493
|
createNpthHole(ctx, pad, componentId, globalPos, drill);
|
|
487
494
|
} else {
|
|
@@ -497,19 +504,32 @@ function processPad(ctx, pad, componentId, kicadComponentPos, componentRotation)
|
|
|
497
504
|
);
|
|
498
505
|
}
|
|
499
506
|
}
|
|
500
|
-
function createSmdPad(
|
|
507
|
+
function createSmdPad({
|
|
508
|
+
ctx,
|
|
509
|
+
pad,
|
|
510
|
+
componentId,
|
|
511
|
+
pos,
|
|
512
|
+
size,
|
|
513
|
+
shape
|
|
514
|
+
}) {
|
|
501
515
|
const layers = pad.layers || [];
|
|
502
516
|
const layer = determinePadLayer(layers);
|
|
503
|
-
|
|
517
|
+
let smtpad = {
|
|
518
|
+
type: "pcb_smtpad",
|
|
519
|
+
pcb_smtpad_id: "",
|
|
504
520
|
pcb_component_id: componentId,
|
|
505
521
|
x: pos.x,
|
|
506
522
|
y: pos.y,
|
|
507
523
|
layer,
|
|
508
|
-
shape: shape === "circle" ? "circle" : "rect",
|
|
509
|
-
width: size.x,
|
|
510
|
-
height: size.y,
|
|
511
524
|
port_hints: [pad.number?.toString()]
|
|
512
|
-
}
|
|
525
|
+
};
|
|
526
|
+
const roundrectRatio = pad._sxRoundrectRatio?.value ?? pad.roundrect_rratio;
|
|
527
|
+
if (shape === "roundrect" && roundrectRatio !== void 0) {
|
|
528
|
+
const minDimension = Math.min(size.x, size.y);
|
|
529
|
+
const cornerRadius = minDimension * roundrectRatio / 2;
|
|
530
|
+
smtpad.corner_radius = cornerRadius;
|
|
531
|
+
}
|
|
532
|
+
ctx.db.pcb_smtpad.insert(smtpad);
|
|
513
533
|
if (ctx.stats) {
|
|
514
534
|
ctx.stats.pads = (ctx.stats.pads || 0) + 1;
|
|
515
535
|
}
|