@tscircuit/capacity-autorouter 0.0.5 → 0.0.7
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 +14 -0
- package/dist/index.js +38 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -32,11 +32,13 @@ interface SimpleRouteConnection {
|
|
|
32
32
|
x: number;
|
|
33
33
|
y: number;
|
|
34
34
|
layer: string;
|
|
35
|
+
pcb_port_id?: string;
|
|
35
36
|
}>;
|
|
36
37
|
}
|
|
37
38
|
type SimplifiedPcbTraces = Array<{
|
|
38
39
|
type: "pcb_trace";
|
|
39
40
|
pcb_trace_id: TraceId;
|
|
41
|
+
connection_name: string;
|
|
40
42
|
route: Array<{
|
|
41
43
|
route_type: "wire";
|
|
42
44
|
x: number;
|
|
@@ -822,6 +824,18 @@ declare class CapacityMeshSolver extends BaseSolver {
|
|
|
822
824
|
* Simplifies a route by merging consecutive points along the same line
|
|
823
825
|
*/
|
|
824
826
|
private simplifyRoute;
|
|
827
|
+
/**
|
|
828
|
+
* Maps numeric layer to named layer
|
|
829
|
+
* @param layer Numeric layer (0, 1, etc)
|
|
830
|
+
* @returns Named layer ("top", "bottom", etc)
|
|
831
|
+
*/
|
|
832
|
+
private mapLayer;
|
|
833
|
+
/**
|
|
834
|
+
* Get original connection name from connection name with MST suffix
|
|
835
|
+
* @param mstConnectionName The MST-suffixed connection name (e.g. "connection1_mst0")
|
|
836
|
+
* @returns The original connection name (e.g. "connection1")
|
|
837
|
+
*/
|
|
838
|
+
private getOriginalConnectionName;
|
|
825
839
|
/**
|
|
826
840
|
* Returns the SimpleRouteJson with routes converted to SimplifiedPcbTraces
|
|
827
841
|
*/
|
package/dist/index.js
CHANGED
|
@@ -4209,10 +4209,11 @@ var NetToPointPairsSolver = class extends BaseSolver {
|
|
|
4209
4209
|
return;
|
|
4210
4210
|
}
|
|
4211
4211
|
const edges = buildMinimumSpanningTree(connection.pointsToConnect);
|
|
4212
|
-
for (
|
|
4212
|
+
for (let i = 0; i < edges.length; i++) {
|
|
4213
|
+
const edge = edges[i];
|
|
4213
4214
|
this.newConnections.push({
|
|
4214
4215
|
pointsToConnect: [edge.from, edge.to],
|
|
4215
|
-
name: connection.name
|
|
4216
|
+
name: `${connection.name}_mst${i}`
|
|
4216
4217
|
});
|
|
4217
4218
|
}
|
|
4218
4219
|
}
|
|
@@ -4339,10 +4340,10 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4339
4340
|
return;
|
|
4340
4341
|
}
|
|
4341
4342
|
if (!this.nodeSolver) {
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
);
|
|
4343
|
+
const newSrj = this.netToPointPairsSolver.getNewSimpleRouteJson();
|
|
4344
|
+
this.connMap = getConnectivityMapFromSimpleRouteJson(newSrj);
|
|
4345
|
+
this.colorMap = getColorMap(newSrj, this.connMap);
|
|
4346
|
+
this.nodeSolver = new CapacityMeshNodeSolver(newSrj, this.opts);
|
|
4346
4347
|
this.activeSolver = this.nodeSolver;
|
|
4347
4348
|
return;
|
|
4348
4349
|
}
|
|
@@ -4476,6 +4477,30 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4476
4477
|
result.push(points[points.length - 1]);
|
|
4477
4478
|
return result;
|
|
4478
4479
|
}
|
|
4480
|
+
/**
|
|
4481
|
+
* Maps numeric layer to named layer
|
|
4482
|
+
* @param layer Numeric layer (0, 1, etc)
|
|
4483
|
+
* @returns Named layer ("top", "bottom", etc)
|
|
4484
|
+
*/
|
|
4485
|
+
mapLayer(layer) {
|
|
4486
|
+
switch (layer) {
|
|
4487
|
+
case "0":
|
|
4488
|
+
return "top";
|
|
4489
|
+
case "1":
|
|
4490
|
+
return "bottom";
|
|
4491
|
+
default:
|
|
4492
|
+
return `layer${layer}`;
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
/**
|
|
4496
|
+
* Get original connection name from connection name with MST suffix
|
|
4497
|
+
* @param mstConnectionName The MST-suffixed connection name (e.g. "connection1_mst0")
|
|
4498
|
+
* @returns The original connection name (e.g. "connection1")
|
|
4499
|
+
*/
|
|
4500
|
+
getOriginalConnectionName(mstConnectionName) {
|
|
4501
|
+
const match = mstConnectionName.match(/^(.+?)_mst\d+$/);
|
|
4502
|
+
return match ? match[1] : mstConnectionName;
|
|
4503
|
+
}
|
|
4479
4504
|
/**
|
|
4480
4505
|
* Returns the SimpleRouteJson with routes converted to SimplifiedPcbTraces
|
|
4481
4506
|
*/
|
|
@@ -4486,9 +4511,13 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4486
4511
|
const traces = [];
|
|
4487
4512
|
for (const route of this.highDensityRouteSolver.routes) {
|
|
4488
4513
|
const simplifiedRoute = this.simplifyRoute(route.route);
|
|
4514
|
+
const originalConnectionName = this.getOriginalConnectionName(
|
|
4515
|
+
route.connectionName
|
|
4516
|
+
);
|
|
4489
4517
|
const trace = {
|
|
4490
4518
|
type: "pcb_trace",
|
|
4491
4519
|
pcb_trace_id: route.connectionName,
|
|
4520
|
+
connection_name: originalConnectionName,
|
|
4492
4521
|
route: []
|
|
4493
4522
|
};
|
|
4494
4523
|
let currentLayer = simplifiedRoute[0]?.z.toString() || "0";
|
|
@@ -4500,8 +4529,8 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4500
4529
|
route_type: "via",
|
|
4501
4530
|
x: point.x,
|
|
4502
4531
|
y: point.y,
|
|
4503
|
-
from_layer: currentLayer,
|
|
4504
|
-
to_layer: nextLayerStr
|
|
4532
|
+
from_layer: this.mapLayer(currentLayer),
|
|
4533
|
+
to_layer: this.mapLayer(nextLayerStr)
|
|
4505
4534
|
});
|
|
4506
4535
|
currentLayer = nextLayerStr;
|
|
4507
4536
|
}
|
|
@@ -4510,7 +4539,7 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4510
4539
|
x: point.x,
|
|
4511
4540
|
y: point.y,
|
|
4512
4541
|
width: route.traceThickness || this.highDensityRouteSolver.defaultTraceThickness,
|
|
4513
|
-
layer: currentLayer
|
|
4542
|
+
layer: this.mapLayer(currentLayer)
|
|
4514
4543
|
});
|
|
4515
4544
|
}
|
|
4516
4545
|
traces.push(trace);
|