@tscircuit/capacity-autorouter 0.0.63 → 0.0.65

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/README.md CHANGED
@@ -6,6 +6,12 @@ An MIT-licensed full-pipeline PCB autorouter library for node.js and TypeScript
6
6
 
7
7
  Check out this [short youtube explanation of this autorouter](https://youtu.be/MmTk0806fAo)
8
8
 
9
+ ## How to file a bug report
10
+
11
+ 1. You should have [created a bug report via the tscircuit errors tab](https://docs.tscircuit.com/contributing/report-autorouter-bugs)
12
+ 2. Run `bun run bug-report <bug-report-url>`
13
+ 3. This will download the bug report and create a debugging fixture file in the `examples/bug-reports` directory, you can then find the bug report in the server (via `bun run start`)
14
+
9
15
  ## Installation
10
16
 
11
17
  ```bash
package/dist/index.d.ts CHANGED
@@ -978,7 +978,7 @@ declare class SingleHighDensityRouteStitchSolver extends BaseSolver {
978
978
  };
979
979
  colorMap: Record<string, string>;
980
980
  constructor(opts: {
981
- connectionName?: string;
981
+ connectionName: string;
982
982
  hdRoutes: HighDensityIntraNodeRoute$1[];
983
983
  start: {
984
984
  x: number;
@@ -991,6 +991,8 @@ declare class SingleHighDensityRouteStitchSolver extends BaseSolver {
991
991
  z: number;
992
992
  };
993
993
  colorMap?: Record<string, string>;
994
+ defaultTraceThickness?: number;
995
+ defaultViaDiameter?: number;
994
996
  });
995
997
  /**
996
998
  * Scan `remainingHdRoutes` and find a route that has **one** end that is not
@@ -1025,6 +1027,8 @@ declare class MultipleHighDensityRouteStitchSolver extends BaseSolver {
1025
1027
  activeSolver: SingleHighDensityRouteStitchSolver | null;
1026
1028
  mergedHdRoutes: HighDensityIntraNodeRoute$1[];
1027
1029
  colorMap: Record<string, string>;
1030
+ defaultTraceThickness: number;
1031
+ defaultViaDiameter: number;
1028
1032
  constructor(opts: {
1029
1033
  connections: SimpleRouteConnection[];
1030
1034
  hdRoutes: HighDensityIntraNodeRoute$1[];
package/dist/index.js CHANGED
@@ -9685,6 +9685,30 @@ var SingleHighDensityRouteStitchSolver = class extends BaseSolver {
9685
9685
  super();
9686
9686
  this.remainingHdRoutes = [...opts.hdRoutes];
9687
9687
  this.colorMap = opts.colorMap ?? {};
9688
+ if (opts.hdRoutes.length === 0) {
9689
+ this.start = opts.start;
9690
+ this.end = opts.end;
9691
+ const routePoints = [
9692
+ { x: opts.start.x, y: opts.start.y, z: opts.start.z }
9693
+ ];
9694
+ const vias = [];
9695
+ if (opts.start.z !== opts.end.z) {
9696
+ routePoints.push({ x: opts.start.x, y: opts.start.y, z: opts.end.z });
9697
+ vias.push({ x: opts.start.x, y: opts.start.y });
9698
+ }
9699
+ routePoints.push({ x: opts.end.x, y: opts.end.y, z: opts.end.z });
9700
+ this.mergedHdRoute = {
9701
+ connectionName: opts.connectionName,
9702
+ route: routePoints,
9703
+ vias,
9704
+ viaDiameter: opts.defaultViaDiameter ?? 0.6,
9705
+ // Use default or fallback
9706
+ traceThickness: opts.defaultTraceThickness ?? 0.15
9707
+ // Use default or fallback
9708
+ };
9709
+ this.solved = true;
9710
+ return;
9711
+ }
9688
9712
  const { firstRoute } = this.getDisjointedRoute();
9689
9713
  const firstRouteToStartDist = Math.min(
9690
9714
  distance(firstRoute.route[0], opts.start),
@@ -9702,7 +9726,8 @@ var SingleHighDensityRouteStitchSolver = class extends BaseSolver {
9702
9726
  this.end = opts.start;
9703
9727
  }
9704
9728
  this.mergedHdRoute = {
9705
- connectionName: opts.connectionName ?? firstRoute.connectionName,
9729
+ connectionName: opts.connectionName,
9730
+ // Use mandatory connectionName
9706
9731
  route: [
9707
9732
  {
9708
9733
  x: this.start.x,
@@ -9867,9 +9892,18 @@ var MultipleHighDensityRouteStitchSolver = class extends BaseSolver {
9867
9892
  activeSolver = null;
9868
9893
  mergedHdRoutes = [];
9869
9894
  colorMap = {};
9895
+ defaultTraceThickness;
9896
+ defaultViaDiameter;
9870
9897
  constructor(opts) {
9871
9898
  super();
9872
9899
  this.colorMap = opts.colorMap ?? {};
9900
+ if (opts.hdRoutes.length > 0) {
9901
+ this.defaultTraceThickness = opts.hdRoutes[0].traceThickness;
9902
+ this.defaultViaDiameter = opts.hdRoutes[0].viaDiameter;
9903
+ } else {
9904
+ this.defaultTraceThickness = 0.15;
9905
+ this.defaultViaDiameter = 0.6;
9906
+ }
9873
9907
  this.unsolvedRoutes = opts.connections.map((c) => ({
9874
9908
  connectionName: c.name,
9875
9909
  hdRoutes: opts.hdRoutes.filter((r) => r.connectionName === c.name),
@@ -9906,7 +9940,9 @@ var MultipleHighDensityRouteStitchSolver = class extends BaseSolver {
9906
9940
  hdRoutes: unsolvedRoute.hdRoutes,
9907
9941
  start: unsolvedRoute.start,
9908
9942
  end: unsolvedRoute.end,
9909
- colorMap: this.colorMap
9943
+ colorMap: this.colorMap,
9944
+ defaultTraceThickness: this.defaultTraceThickness,
9945
+ defaultViaDiameter: this.defaultViaDiameter
9910
9946
  });
9911
9947
  }
9912
9948
  visualize() {