@tscircuit/capacity-autorouter 0.0.88 → 0.0.89

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.d.ts CHANGED
@@ -35,8 +35,10 @@ interface SimpleRouteConnection {
35
35
  x: number;
36
36
  y: number;
37
37
  layer: string;
38
+ pointId?: string;
38
39
  pcb_port_id?: string;
39
40
  }>;
41
+ externallyConnectedPointIds?: string[][];
40
42
  }
41
43
  interface SimplifiedPcbTrace {
42
44
  type: "pcb_trace";
package/dist/index.js CHANGED
@@ -9615,16 +9615,34 @@ var NetToPointPairsSolver = class extends BaseSolver {
9615
9615
  return;
9616
9616
  }
9617
9617
  const connection = this.unprocessedConnections.pop();
9618
+ const externalGroups = connection.externallyConnectedPointIds ?? [];
9619
+ const pointIdToGroup = /* @__PURE__ */ new Map();
9620
+ externalGroups.forEach(
9621
+ (group, idx) => group.forEach((pid) => pointIdToGroup.set(pid, idx))
9622
+ );
9623
+ const areExternallyConnected = (a, b) => {
9624
+ if (!a.pointId || !b.pointId) return false;
9625
+ const g1 = pointIdToGroup.get(a.pointId);
9626
+ const g2 = pointIdToGroup.get(b.pointId);
9627
+ return g1 !== void 0 && g1 === g2;
9628
+ };
9618
9629
  if (connection.pointsToConnect.length === 2) {
9630
+ if (areExternallyConnected(
9631
+ connection.pointsToConnect[0],
9632
+ connection.pointsToConnect[1]
9633
+ )) {
9634
+ return;
9635
+ }
9619
9636
  this.newConnections.push(connection);
9620
9637
  return;
9621
9638
  }
9622
9639
  const edges = buildMinimumSpanningTree(connection.pointsToConnect);
9623
- for (let i = 0; i < edges.length; i++) {
9624
- const edge = edges[i];
9640
+ let mstIdx = 0;
9641
+ for (const edge of edges) {
9642
+ if (areExternallyConnected(edge.from, edge.to)) continue;
9625
9643
  this.newConnections.push({
9626
9644
  pointsToConnect: [edge.from, edge.to],
9627
- name: `${connection.name}_mst${i}`
9645
+ name: `${connection.name}_mst${mstIdx++}`
9628
9646
  });
9629
9647
  }
9630
9648
  }