@tscircuit/checks 0.0.154 → 0.0.156

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 CHANGED
@@ -573,10 +573,6 @@ var getPcbBoard = (circuitJson) => circuitJson.find((el) => el.type === "pcb_boa
573
573
  var getBoardDrcValue = (board, key) => board?.[key];
574
574
 
575
575
  // lib/check-pad-clearance/common.ts
576
- var formatMm = (value) => {
577
- const rounded = Math.round(value * 1e3) / 1e3;
578
- return `${Number(rounded.toFixed(3))}mm`;
579
- };
580
576
  var getPadBounds = (pad) => getBoundsOfPcbElements2([pad]);
581
577
  var getPadCenter = (pad) => {
582
578
  const bounds = getPadBounds(pad);
@@ -2401,6 +2397,9 @@ function doPcbElementsOverlap(elem1, elem2) {
2401
2397
  const layers1 = getElementLayers(elem1);
2402
2398
  const layers2 = getElementLayers(elem2);
2403
2399
  if (!doLayersOverlap(layers1, layers2)) return false;
2400
+ if (elem1.type === "pcb_smtpad" && elem2.type === "pcb_smtpad") {
2401
+ return getPadToPadGap(elem1, elem2) <= 0;
2402
+ }
2404
2403
  const bounds1 = getBoundsOfPcbElements4([elem1]);
2405
2404
  const bounds2 = getBoundsOfPcbElements4([elem2]);
2406
2405
  return doBoundsOverlap(bounds1, bounds2);
@@ -2597,6 +2596,7 @@ import {
2597
2596
  getPrimaryId as getPrimaryId3,
2598
2597
  getReadableNameForElement as getReadableNameForElement6
2599
2598
  } from "@tscircuit/circuit-json-util";
2599
+ import { formatMm } from "format-si-unit";
2600
2600
  import {
2601
2601
  getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson8
2602
2602
  } from "circuit-json-to-connectivity-map";
@@ -2661,6 +2661,7 @@ import {
2661
2661
  getPrimaryId as getPrimaryId4,
2662
2662
  getReadableNameForElement as getReadableNameForElement7
2663
2663
  } from "@tscircuit/circuit-json-util";
2664
+ import { formatMm as formatMm2 } from "format-si-unit";
2664
2665
  import {
2665
2666
  getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson9
2666
2667
  } from "circuit-json-to-connectivity-map";
@@ -2703,7 +2704,7 @@ function checkPadTraceClearance(circuitJson, {
2703
2704
  type: "pcb_pad_trace_clearance_error",
2704
2705
  pcb_pad_trace_clearance_error_id: `pad_trace_clearance_${pairId}`,
2705
2706
  error_type: "pcb_pad_trace_clearance_error",
2706
- message: `Pad ${getReadableNameForElement7(circuitJson, padId)} and trace ${getReadableNameForElement7(circuitJson, segment.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,
2707
+ message: `Pad ${getReadableNameForElement7(circuitJson, padId)} and trace ${getReadableNameForElement7(circuitJson, segment.pcb_trace_id)} are too close (clearance: ${formatMm2(gap)}, minimum: ${formatMm2(minClearance)})`,
2707
2708
  pcb_pad_id: padId,
2708
2709
  pcb_trace_id: segment.pcb_trace_id,
2709
2710
  minimum_clearance: minClearance,
@@ -2721,6 +2722,7 @@ function checkPadTraceClearance(circuitJson, {
2721
2722
 
2722
2723
  // lib/check-via-trace-clearance.ts
2723
2724
  import { getReadableNameForElement as getReadableNameForElement8 } from "@tscircuit/circuit-json-util";
2725
+ import { formatMm as formatMm3 } from "format-si-unit";
2724
2726
  import {
2725
2727
  getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson10
2726
2728
  } from "circuit-json-to-connectivity-map";
@@ -2754,7 +2756,7 @@ function checkViaTraceClearance(circuitJson, {
2754
2756
  type: "pcb_via_trace_clearance_error",
2755
2757
  pcb_via_trace_clearance_error_id: `via_trace_clearance_${pairId}`,
2756
2758
  error_type: "pcb_via_trace_clearance_error",
2757
- message: `Via ${getReadableNameForElement8(circuitJson, via.pcb_via_id)} and trace ${getReadableNameForElement8(circuitJson, segment.pcb_trace_id)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(minClearance)})`,
2759
+ message: `Via ${getReadableNameForElement8(circuitJson, via.pcb_via_id)} and trace ${getReadableNameForElement8(circuitJson, segment.pcb_trace_id)} are too close (clearance: ${formatMm3(gap)}, minimum: ${formatMm3(minClearance)})`,
2758
2760
  pcb_via_id: via.pcb_via_id,
2759
2761
  pcb_trace_id: segment.pcb_trace_id,
2760
2762
  minimum_clearance: minClearance,
@@ -2775,6 +2777,7 @@ import {
2775
2777
  getPrimaryId as getPrimaryId5,
2776
2778
  getReadableNameForElement as getReadableNameForElement9
2777
2779
  } from "@tscircuit/circuit-json-util";
2780
+ import { formatMm as formatMm4 } from "format-si-unit";
2778
2781
  import {
2779
2782
  getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson11
2780
2783
  } from "circuit-json-to-connectivity-map";
@@ -2817,7 +2820,7 @@ function checkViaPadClearance(circuitJson, {
2817
2820
  type: "pcb_pad_pad_clearance_error",
2818
2821
  pcb_pad_pad_clearance_error_id: `via_pad_clearance_${via.pcb_via_id}_${padId}`,
2819
2822
  error_type: "pcb_pad_pad_clearance_error",
2820
- message: `Via ${getReadableNameForElement9(circuitJson, via.pcb_via_id)} and pad ${getReadableNameForElement9(circuitJson, padId)} are too close (clearance: ${formatMm(gap)}, minimum: ${formatMm(requiredClearance)})`,
2823
+ message: `Via ${getReadableNameForElement9(circuitJson, via.pcb_via_id)} and pad ${getReadableNameForElement9(circuitJson, padId)} are too close (clearance: ${formatMm4(gap)}, minimum: ${formatMm4(requiredClearance)})`,
2821
2824
  pcb_pad_ids: [via.pcb_via_id, padId],
2822
2825
  minimum_clearance: requiredClearance,
2823
2826
  actual_clearance: gap,