@tscircuit/checks 0.0.181 → 0.0.182
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 +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -607,6 +607,14 @@ var getBoardDrcValue = (board, key) => board?.[key];
|
|
|
607
607
|
// lib/check-pad-clearance/common.ts
|
|
608
608
|
var getPadBounds = (pad) => {
|
|
609
609
|
if (pad.type === "pcb_keepout") {
|
|
610
|
+
if (pad.shape === "outline") {
|
|
611
|
+
return {
|
|
612
|
+
minX: Math.min(...pad.outline.map((point) => point.x)),
|
|
613
|
+
minY: Math.min(...pad.outline.map((point) => point.y)),
|
|
614
|
+
maxX: Math.max(...pad.outline.map((point) => point.x)),
|
|
615
|
+
maxY: Math.max(...pad.outline.map((point) => point.y))
|
|
616
|
+
};
|
|
617
|
+
}
|
|
610
618
|
if (pad.shape === "circle") {
|
|
611
619
|
return {
|
|
612
620
|
minX: pad.center.x - pad.radius,
|
|
@@ -625,7 +633,7 @@ var getPadBounds = (pad) => {
|
|
|
625
633
|
return getBoundsOfPcbElements2([pad]);
|
|
626
634
|
};
|
|
627
635
|
var getPadCenter = (pad) => {
|
|
628
|
-
if (pad.type === "pcb_keepout") return pad.center;
|
|
636
|
+
if (pad.type === "pcb_keepout" && pad.shape !== "outline") return pad.center;
|
|
629
637
|
const bounds = getPadBounds(pad);
|
|
630
638
|
return midpoint(
|
|
631
639
|
{ x: bounds.minX, y: bounds.minY },
|
|
@@ -650,6 +658,12 @@ var getCircleShape = (pad) => {
|
|
|
650
658
|
};
|
|
651
659
|
var getPolygonShape = (pad) => {
|
|
652
660
|
if (pad.type === "pcb_keepout") {
|
|
661
|
+
if (pad.shape === "outline") {
|
|
662
|
+
return {
|
|
663
|
+
kind: "polygon",
|
|
664
|
+
points: pad.outline
|
|
665
|
+
};
|
|
666
|
+
}
|
|
653
667
|
if (pad.shape !== "rect") {
|
|
654
668
|
throw new Error(`Expected rectangular keepout, got ${pad.shape}`);
|
|
655
669
|
}
|
|
@@ -2378,6 +2392,7 @@ function checkPcbComponentOverCutout(circuitJson) {
|
|
|
2378
2392
|
height: component.height
|
|
2379
2393
|
});
|
|
2380
2394
|
for (const { cutout, polygon: cutoutPolygon } of cutoutPolygons) {
|
|
2395
|
+
if (cutout.pcb_component_id === component.pcb_component_id) continue;
|
|
2381
2396
|
if (!doPolygonsOverlap(componentPolygon, cutoutPolygon)) continue;
|
|
2382
2397
|
const componentName = getReadableNameForComponent(
|
|
2383
2398
|
circuitJson,
|