@tscircuit/capacity-autorouter 0.0.12 → 0.0.14

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
@@ -650,6 +650,9 @@ declare class CapacityPathingSolver4_FlexibleNegativeCapacity extends CapacityPa
650
650
  computeH(prevCandidate: Candidate, node: CapacityMeshNode, endGoal: CapacityMeshNode): number;
651
651
  }
652
652
 
653
+ /**
654
+ * Merge targets that are close to each other into a single target
655
+ */
653
656
  declare class CapacityNodeTargetMerger extends BaseSolver {
654
657
  nodes: CapacityMeshNode[];
655
658
  connMap: ConnectivityMap;
package/dist/index.js CHANGED
@@ -4204,7 +4204,7 @@ var NetToPointPairsSolver = class extends BaseSolver {
4204
4204
  super();
4205
4205
  this.ogSrj = ogSrj;
4206
4206
  this.colorMap = colorMap;
4207
- this.unprocessedConnections = ogSrj.connections;
4207
+ this.unprocessedConnections = [...ogSrj.connections];
4208
4208
  this.newConnections = [];
4209
4209
  }
4210
4210
  unprocessedConnections;
@@ -4545,6 +4545,10 @@ var MultipleHighDensityRouteStitchSolver = class extends BaseSolver {
4545
4545
  this.solved = true;
4546
4546
  return;
4547
4547
  }
4548
+ if (unsolvedRoute.hdRoutes.length === 0) {
4549
+ console.warn(`No routes to stitch for ${unsolvedRoute.connectionName}`);
4550
+ return;
4551
+ }
4548
4552
  this.activeSolver = new SingleHighDensityRouteStitchSolver({
4549
4553
  hdRoutes: unsolvedRoute.hdRoutes,
4550
4554
  start: unsolvedRoute.start,
@@ -4962,19 +4966,16 @@ var CapacityMeshSolver = class extends BaseSolver {
4962
4966
  const hdRoutes = this.highDensityStitchSolver.mergedHdRoutes.filter(
4963
4967
  (r) => r.connectionName === connection.name
4964
4968
  );
4965
- if (hdRoutes.length > 1) {
4966
- throw new Error("Multiple hdRoutes found for connection");
4969
+ for (let i = 0; i < hdRoutes.length; i++) {
4970
+ const hdRoute = hdRoutes[i];
4971
+ const simplifiedPcbTrace = {
4972
+ type: "pcb_trace",
4973
+ pcb_trace_id: `${connection.name}_${i}`,
4974
+ connection_name: this.getOriginalConnectionName(connection.name),
4975
+ route: convertHdRouteToSimplifiedRoute(hdRoute, this.srj.layerCount)
4976
+ };
4977
+ traces.push(simplifiedPcbTrace);
4967
4978
  }
4968
- const simplifiedPcbTrace = {
4969
- type: "pcb_trace",
4970
- pcb_trace_id: connection.name,
4971
- connection_name: this.getOriginalConnectionName(connection.name),
4972
- route: convertHdRouteToSimplifiedRoute(
4973
- hdRoutes[0],
4974
- this.srj.layerCount
4975
- )
4976
- };
4977
- traces.push(simplifiedPcbTrace);
4978
4979
  }
4979
4980
  return traces;
4980
4981
  }