@tscircuit/core 0.0.2167 → 0.0.2168

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.
Files changed (2) hide show
  1. package/dist/index.js +34 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18141,7 +18141,11 @@ function NormalComponent_doInitialComponentAvailabilityWarning(component, { refr
18141
18141
  }
18142
18142
 
18143
18143
  // lib/components/base-components/NormalComponent/NormalComponent_doInitialSupplierFootprintMismatchWarning.ts
18144
- import { getBoundsOfPcbElements } from "@tscircuit/circuit-json-util";
18144
+ import {
18145
+ getPlatedHolePolygon,
18146
+ getSmtPadPolygon,
18147
+ placePolygon
18148
+ } from "@tscircuit/circuit-json-util";
18145
18149
  import {
18146
18150
  supplierProps as supplierProps4
18147
18151
  } from "@tscircuit/props";
@@ -18151,12 +18155,24 @@ import {
18151
18155
  } from "circuit-json";
18152
18156
  var SUPPLIER_FOOTPRINT_IOU_WARNING_THRESHOLD = 0.8;
18153
18157
  var supplierNames3 = supplierProps4.shape.supplierPartNumbers.unwrap().keySchema.options;
18154
- var isCopperElement = (elm) => elm.type === "pcb_smtpad" || elm.type === "pcb_plated_hole";
18155
18158
  var isValidBounds = (bounds) => Number.isFinite(bounds.minX) && Number.isFinite(bounds.minY) && Number.isFinite(bounds.maxX) && Number.isFinite(bounds.maxY) && bounds.maxX > bounds.minX && bounds.maxY > bounds.minY;
18156
- var getCopperBounds = (elements) => {
18157
- const copperElements = elements.filter(isCopperElement);
18158
- if (copperElements.length === 0) return null;
18159
- const bounds = getBoundsOfPcbElements(copperElements);
18159
+ var getCopperBounds = (elements, ccwRotationDegrees = 0) => {
18160
+ const bounds = {
18161
+ minX: Infinity,
18162
+ minY: Infinity,
18163
+ maxX: -Infinity,
18164
+ maxY: -Infinity
18165
+ };
18166
+ for (const element of elements) {
18167
+ if (element.type !== "pcb_smtpad" && element.type !== "pcb_plated_hole")
18168
+ continue;
18169
+ const polygon = element.type === "pcb_smtpad" ? getSmtPadPolygon(element) : getPlatedHolePolygon(element, ccwRotationDegrees);
18170
+ const box = placePolygon(polygon, { x: 0, y: 0 }, -ccwRotationDegrees).box;
18171
+ bounds.minX = Math.min(bounds.minX, box.xmin);
18172
+ bounds.minY = Math.min(bounds.minY, box.ymin);
18173
+ bounds.maxX = Math.max(bounds.maxX, box.xmax);
18174
+ bounds.maxY = Math.max(bounds.maxY, box.ymax);
18175
+ }
18160
18176
  if (!isValidBounds(bounds)) return null;
18161
18177
  return bounds;
18162
18178
  };
@@ -18218,7 +18234,11 @@ function NormalComponent_doInitialSupplierFootprintMismatchWarning(component) {
18218
18234
  pcb_component_id: component.pcb_component_id
18219
18235
  })
18220
18236
  ];
18221
- const localBounds = getCopperBounds(localCopperElements);
18237
+ const pcbComponent = db2.pcb_component.get(component.pcb_component_id);
18238
+ const localBounds = getCopperBounds(
18239
+ localCopperElements,
18240
+ pcbComponent.rotation
18241
+ );
18222
18242
  if (!localBounds) return;
18223
18243
  component._hasStartedSupplierFootprintMismatchWarningCheck = true;
18224
18244
  component._queueAsyncEffect("check-supplier-footprint-mismatch", async () => {
@@ -111325,7 +111345,7 @@ var Group_doInitialAssignSchematicSheetToConnectedComponents = (group) => {
111325
111345
  };
111326
111346
 
111327
111347
  // lib/components/primitive-components/Group/Group_doInitialPcbCalcPlacementResolution.ts
111328
- import { getBoundsOfPcbElements as getBoundsOfPcbElements2 } from "@tscircuit/circuit-json-util";
111348
+ import { getBoundsOfPcbElements } from "@tscircuit/circuit-json-util";
111329
111349
  var SUPPORTED_COMPONENT_FIELDS = /* @__PURE__ */ new Set([
111330
111350
  "x",
111331
111351
  "y",
@@ -111613,7 +111633,7 @@ function updateVarsForNamedComponent(component, vars) {
111613
111633
  });
111614
111634
  const padElementsByReference = collectPadElementsByReference(component);
111615
111635
  for (const [referencePath, elements] of padElementsByReference.entries()) {
111616
- const bounds = getBoundsOfPcbElements2(elements);
111636
+ const bounds = getBoundsOfPcbElements(elements);
111617
111637
  const minX = bounds.minX;
111618
111638
  const maxX = bounds.maxX;
111619
111639
  const minY = bounds.minY;
@@ -119455,7 +119475,7 @@ var RoutingPhasePreparationError = class extends Error {
119455
119475
  var package_default = {
119456
119476
  name: "@tscircuit/core",
119457
119477
  type: "module",
119458
- version: "0.0.2166",
119478
+ version: "0.0.2167",
119459
119479
  types: "dist/index.d.ts",
119460
119480
  main: "dist/index.js",
119461
119481
  module: "dist/index.js",
@@ -124668,9 +124688,9 @@ import {
124668
124688
  import Flatbush2 from "flatbush";
124669
124689
  import {
124670
124690
  copperPolygonsTouch,
124671
- getPlatedHolePolygon,
124691
+ getPlatedHolePolygon as getPlatedHolePolygon2,
124672
124692
  getPourPolygon,
124673
- getSmtPadPolygon,
124693
+ getSmtPadPolygon as getSmtPadPolygon2,
124674
124694
  getTraceSegmentPolygon,
124675
124695
  getViaPolygon
124676
124696
  } from "@tscircuit/circuit-json-util";
@@ -124727,7 +124747,7 @@ var findFloatingCopper = (circuitJson, generatedStitchingViaIds = /* @__PURE__ *
124727
124747
  const netId = connectivity.getNetConnectedToId(element.pcb_smtpad_id);
124728
124748
  if (netId && pouredNets.has(netId))
124729
124749
  add({
124730
- polygon: getSmtPadPolygon(element),
124750
+ polygon: getSmtPadPolygon2(element),
124731
124751
  layers: [element.layer],
124732
124752
  netId,
124733
124753
  isTerminal: !!element.pcb_port_id
@@ -124736,7 +124756,7 @@ var findFloatingCopper = (circuitJson, generatedStitchingViaIds = /* @__PURE__ *
124736
124756
  const netId = connectivity.getNetConnectedToId(element.pcb_plated_hole_id);
124737
124757
  if (netId && pouredNets.has(netId))
124738
124758
  add({
124739
- polygon: getPlatedHolePolygon(
124759
+ polygon: getPlatedHolePolygon2(
124740
124760
  element,
124741
124761
  element.pcb_component_id ? components.get(element.pcb_component_id)?.rotation : 0
124742
124762
  ),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2167",
4
+ "version": "0.0.2168",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",