@tscircuit/checks 0.0.171 → 0.0.172
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 +7 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3605,6 +3605,7 @@ function checkViaPadClearance(circuitJson, {
|
|
|
3605
3605
|
|
|
3606
3606
|
// lib/check-vias-in-pads.ts
|
|
3607
3607
|
import { getPrimaryId as getPrimaryId7 } from "@tscircuit/circuit-json-util";
|
|
3608
|
+
import { getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson12 } from "circuit-json-to-connectivity-map";
|
|
3608
3609
|
function checkViasInPads(circuitJson) {
|
|
3609
3610
|
const board = getPcbBoard(circuitJson);
|
|
3610
3611
|
if (board && "is_via_in_pad_allowed" in board && board.is_via_in_pad_allowed === true) {
|
|
@@ -3615,6 +3616,7 @@ function checkViasInPads(circuitJson) {
|
|
|
3615
3616
|
);
|
|
3616
3617
|
const pads = getPads(circuitJson);
|
|
3617
3618
|
if (vias.length === 0 || pads.length === 0) return [];
|
|
3619
|
+
const connMap = getFullConnectivityMapFromCircuitJson12(circuitJson);
|
|
3618
3620
|
const padOrdinals = new Map(
|
|
3619
3621
|
pads.map((pad, index) => [getPrimaryId7(pad), index])
|
|
3620
3622
|
);
|
|
@@ -3625,18 +3627,14 @@ function checkViasInPads(circuitJson) {
|
|
|
3625
3627
|
});
|
|
3626
3628
|
const errors = [];
|
|
3627
3629
|
for (const via of vias) {
|
|
3628
|
-
const nearbyPads = padIndex.getObjectsInBounds(
|
|
3629
|
-
minX: via.x,
|
|
3630
|
-
minY: via.y,
|
|
3631
|
-
maxX: via.x,
|
|
3632
|
-
maxY: via.y
|
|
3633
|
-
});
|
|
3630
|
+
const nearbyPads = padIndex.getObjectsInBounds(getPadBounds(via));
|
|
3634
3631
|
for (const pad of nearbyPads) {
|
|
3632
|
+
const padId = getPrimaryId7(pad);
|
|
3635
3633
|
const viaLayers = getLayersOfPcbElement(via);
|
|
3636
3634
|
const padLayers = getLayersOfPcbElement(pad);
|
|
3637
3635
|
if (!viaLayers.some((layer) => padLayers.includes(layer))) continue;
|
|
3638
|
-
if (
|
|
3639
|
-
|
|
3636
|
+
if (connMap.areIdsConnected(via.pcb_via_id, padId)) continue;
|
|
3637
|
+
if (getPadToPadGap(via, pad) > 0) continue;
|
|
3640
3638
|
const padOrdinal = padOrdinals.get(padId) ?? 0;
|
|
3641
3639
|
const padName = getReadableNameForFootprintPad(
|
|
3642
3640
|
circuitJson,
|
|
@@ -3647,7 +3645,7 @@ function checkViasInPads(circuitJson) {
|
|
|
3647
3645
|
type: "pcb_placement_error",
|
|
3648
3646
|
pcb_placement_error_id: `via_in_pad_${via.pcb_via_id}_${padId}`,
|
|
3649
3647
|
error_type: "pcb_placement_error",
|
|
3650
|
-
message: `Via at (${via.x.toFixed(2)}mm, ${via.y.toFixed(2)}mm)
|
|
3648
|
+
message: `Via copper at (${via.x.toFixed(2)}mm, ${via.y.toFixed(2)}mm) overlaps ${padName}`,
|
|
3651
3649
|
subcircuit_id: via.subcircuit_id ?? pad.subcircuit_id
|
|
3652
3650
|
});
|
|
3653
3651
|
}
|