@tscircuit/capacity-autorouter 0.0.6 → 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 +31 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
@@ -4477,6 +4477,30 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4477
4477
|
result.push(points[points.length - 1]);
|
|
4478
4478
|
return result;
|
|
4479
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
|
+
}
|
|
4480
4504
|
/**
|
|
4481
4505
|
* Returns the SimpleRouteJson with routes converted to SimplifiedPcbTraces
|
|
4482
4506
|
*/
|
|
@@ -4487,9 +4511,13 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4487
4511
|
const traces = [];
|
|
4488
4512
|
for (const route of this.highDensityRouteSolver.routes) {
|
|
4489
4513
|
const simplifiedRoute = this.simplifyRoute(route.route);
|
|
4514
|
+
const originalConnectionName = this.getOriginalConnectionName(
|
|
4515
|
+
route.connectionName
|
|
4516
|
+
);
|
|
4490
4517
|
const trace = {
|
|
4491
4518
|
type: "pcb_trace",
|
|
4492
4519
|
pcb_trace_id: route.connectionName,
|
|
4520
|
+
connection_name: originalConnectionName,
|
|
4493
4521
|
route: []
|
|
4494
4522
|
};
|
|
4495
4523
|
let currentLayer = simplifiedRoute[0]?.z.toString() || "0";
|
|
@@ -4501,8 +4529,8 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4501
4529
|
route_type: "via",
|
|
4502
4530
|
x: point.x,
|
|
4503
4531
|
y: point.y,
|
|
4504
|
-
from_layer: currentLayer,
|
|
4505
|
-
to_layer: nextLayerStr
|
|
4532
|
+
from_layer: this.mapLayer(currentLayer),
|
|
4533
|
+
to_layer: this.mapLayer(nextLayerStr)
|
|
4506
4534
|
});
|
|
4507
4535
|
currentLayer = nextLayerStr;
|
|
4508
4536
|
}
|
|
@@ -4511,7 +4539,7 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
4511
4539
|
x: point.x,
|
|
4512
4540
|
y: point.y,
|
|
4513
4541
|
width: route.traceThickness || this.highDensityRouteSolver.defaultTraceThickness,
|
|
4514
|
-
layer: currentLayer
|
|
4542
|
+
layer: this.mapLayer(currentLayer)
|
|
4515
4543
|
});
|
|
4516
4544
|
}
|
|
4517
4545
|
traces.push(trace);
|