@tscircuit/core 0.0.49 → 0.0.50
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.js
CHANGED
|
@@ -2469,6 +2469,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2469
2469
|
});
|
|
2470
2470
|
const routes = [];
|
|
2471
2471
|
for (const [a, b] of pairs(orderedRoutePoints)) {
|
|
2472
|
+
const dominantLayer = "via_to_layer" in a ? a.via_to_layer : null;
|
|
2472
2473
|
const BOUNDS_MARGIN = 2;
|
|
2473
2474
|
const ijump = new IJumpAutorouter({
|
|
2474
2475
|
OBSTACLE_MARGIN: 0.3,
|
|
@@ -2477,7 +2478,10 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2477
2478
|
connections: [
|
|
2478
2479
|
{
|
|
2479
2480
|
name: this.source_trace_id,
|
|
2480
|
-
pointsToConnect: [
|
|
2481
|
+
pointsToConnect: [
|
|
2482
|
+
{ ...a, layer: dominantLayer ?? "top" },
|
|
2483
|
+
{ ...b, layer: dominantLayer ?? "top" }
|
|
2484
|
+
]
|
|
2481
2485
|
}
|
|
2482
2486
|
],
|
|
2483
2487
|
layerCount: 2,
|
|
@@ -2497,10 +2501,10 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2497
2501
|
return;
|
|
2498
2502
|
}
|
|
2499
2503
|
const [trace] = traces;
|
|
2500
|
-
if (
|
|
2504
|
+
if (dominantLayer) {
|
|
2501
2505
|
trace.route = trace.route.map((p) => {
|
|
2502
2506
|
if (p.route_type === "wire") {
|
|
2503
|
-
p.layer =
|
|
2507
|
+
p.layer = dominantLayer;
|
|
2504
2508
|
}
|
|
2505
2509
|
return p;
|
|
2506
2510
|
});
|
|
@@ -2558,6 +2562,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2558
2562
|
if (elm.type === "schematic_component") {
|
|
2559
2563
|
obstacles.push({
|
|
2560
2564
|
type: "rect",
|
|
2565
|
+
layers: ["top"],
|
|
2561
2566
|
center: elm.center,
|
|
2562
2567
|
width: elm.size.width,
|
|
2563
2568
|
height: elm.size.height,
|
|
@@ -2566,13 +2571,14 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2566
2571
|
}
|
|
2567
2572
|
}
|
|
2568
2573
|
for (const { port } of ports) {
|
|
2569
|
-
connection.pointsToConnect.push(
|
|
2570
|
-
projectPointInDirection(
|
|
2574
|
+
connection.pointsToConnect.push({
|
|
2575
|
+
...projectPointInDirection(
|
|
2571
2576
|
port._getGlobalSchematicPositionBeforeLayout(),
|
|
2572
2577
|
port.facingDirection,
|
|
2573
2578
|
0.1501
|
|
2574
|
-
)
|
|
2575
|
-
|
|
2579
|
+
),
|
|
2580
|
+
layer: "top"
|
|
2581
|
+
});
|
|
2576
2582
|
}
|
|
2577
2583
|
const bounds = computeObstacleBounds(obstacles);
|
|
2578
2584
|
const simpleRouteJsonInput = {
|
|
@@ -411,7 +411,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
411
411
|
|
|
412
412
|
const routes: PCBTrace["route"][] = []
|
|
413
413
|
for (const [a, b] of pairs(orderedRoutePoints)) {
|
|
414
|
+
const dominantLayer =
|
|
415
|
+
"via_to_layer" in a ? (a.via_to_layer as LayerRef) : null
|
|
414
416
|
const BOUNDS_MARGIN = 2 //mm
|
|
417
|
+
|
|
415
418
|
const ijump = new IJumpAutorouter({
|
|
416
419
|
OBSTACLE_MARGIN: 0.3,
|
|
417
420
|
input: {
|
|
@@ -419,7 +422,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
419
422
|
connections: [
|
|
420
423
|
{
|
|
421
424
|
name: this.source_trace_id!,
|
|
422
|
-
pointsToConnect: [
|
|
425
|
+
pointsToConnect: [
|
|
426
|
+
{ ...a, layer: dominantLayer ?? "top" },
|
|
427
|
+
{ ...b, layer: dominantLayer ?? "top" },
|
|
428
|
+
],
|
|
423
429
|
},
|
|
424
430
|
],
|
|
425
431
|
layerCount: 2,
|
|
@@ -444,10 +450,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
444
450
|
// https://github.com/tscircuit/autorouting-dataset/issues/35
|
|
445
451
|
// For now, we'll move the trace to whatever layer the first point
|
|
446
452
|
// specifies we should have "via'd" to
|
|
447
|
-
if (
|
|
453
|
+
if (dominantLayer) {
|
|
448
454
|
trace.route = trace.route.map((p) => {
|
|
449
455
|
if (p.route_type === "wire") {
|
|
450
|
-
p.layer =
|
|
456
|
+
p.layer = dominantLayer
|
|
451
457
|
}
|
|
452
458
|
return p
|
|
453
459
|
})
|
|
@@ -521,6 +527,7 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
521
527
|
if (elm.type === "schematic_component") {
|
|
522
528
|
obstacles.push({
|
|
523
529
|
type: "rect",
|
|
530
|
+
layers: ["top"],
|
|
524
531
|
center: elm.center,
|
|
525
532
|
width: elm.size.width,
|
|
526
533
|
height: elm.size.height,
|
|
@@ -530,13 +537,14 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
530
537
|
}
|
|
531
538
|
|
|
532
539
|
for (const { port } of ports) {
|
|
533
|
-
connection.pointsToConnect.push(
|
|
534
|
-
projectPointInDirection(
|
|
540
|
+
connection.pointsToConnect.push({
|
|
541
|
+
...projectPointInDirection(
|
|
535
542
|
port._getGlobalSchematicPositionBeforeLayout(),
|
|
536
543
|
port.facingDirection!,
|
|
537
544
|
0.1501,
|
|
538
545
|
),
|
|
539
|
-
|
|
546
|
+
layer: "top",
|
|
547
|
+
})
|
|
540
548
|
}
|
|
541
549
|
|
|
542
550
|
const bounds = computeObstacleBounds(obstacles)
|
|
@@ -12,6 +12,7 @@ export type SimplifiedPcbTrace = {
|
|
|
12
12
|
export type Obstacle = {
|
|
13
13
|
// TODO include ovals
|
|
14
14
|
type: "rect" // NOTE: most datasets do not contain ovals
|
|
15
|
+
layers: string[]
|
|
15
16
|
center: { x: number; y: number }
|
|
16
17
|
width: number
|
|
17
18
|
height: number
|
|
@@ -20,7 +21,7 @@ export type Obstacle = {
|
|
|
20
21
|
|
|
21
22
|
export interface SimpleRouteConnection {
|
|
22
23
|
name: string
|
|
23
|
-
pointsToConnect: Array<{ x: number; y: number }>
|
|
24
|
+
pointsToConnect: Array<{ x: number; y: number; layer: string }>
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface SimpleRouteJson {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"module": "index.ts",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.50",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/react": "^18.3.3",
|
|
24
24
|
"@types/react-reconciler": "^0.28.8",
|
|
25
25
|
"bun-match-svg": "0.0.2",
|
|
26
|
-
"circuit-to-svg": "^0.0.
|
|
26
|
+
"circuit-to-svg": "^0.0.22",
|
|
27
27
|
"debug": "^4.3.6",
|
|
28
28
|
"howfat": "^0.3.8",
|
|
29
29
|
"looks-same": "^9.0.1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@lume/kiwi": "^0.4.3",
|
|
37
|
-
"@tscircuit/infgrid-ijump-astar": "^0.0.
|
|
37
|
+
"@tscircuit/infgrid-ijump-astar": "^0.0.10",
|
|
38
38
|
"@tscircuit/props": "^0.0.62",
|
|
39
39
|
"@tscircuit/soup": "^0.0.67",
|
|
40
40
|
"@tscircuit/soup-util": "^0.0.23",
|