@tscircuit/core 0.0.52 → 0.0.54
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
|
@@ -244,7 +244,7 @@ declare const netProps: z.ZodObject<{
|
|
|
244
244
|
declare class Net extends PrimitiveComponent<typeof netProps> {
|
|
245
245
|
source_net_id?: string;
|
|
246
246
|
getPortSelector(): string;
|
|
247
|
-
|
|
247
|
+
doInitialSourceRender(): void;
|
|
248
248
|
/**
|
|
249
249
|
* Get all ports connected to this net.
|
|
250
250
|
*
|
package/dist/index.js
CHANGED
|
@@ -1489,7 +1489,7 @@ var Net = class extends PrimitiveComponent {
|
|
|
1489
1489
|
getPortSelector() {
|
|
1490
1490
|
return `net.${this.props.name}`;
|
|
1491
1491
|
}
|
|
1492
|
-
|
|
1492
|
+
doInitialSourceRender() {
|
|
1493
1493
|
const { db } = this.root;
|
|
1494
1494
|
const { _parsedProps: props } = this;
|
|
1495
1495
|
const net = db.source_net.insert({
|
|
@@ -2074,8 +2074,7 @@ import "zod";
|
|
|
2074
2074
|
import { traceProps } from "@tscircuit/props";
|
|
2075
2075
|
import {
|
|
2076
2076
|
IJumpAutorouter,
|
|
2077
|
-
getObstaclesFromSoup
|
|
2078
|
-
markObstaclesAsConnected
|
|
2077
|
+
getObstaclesFromSoup
|
|
2079
2078
|
} from "@tscircuit/infgrid-ijump-astar";
|
|
2080
2079
|
|
|
2081
2080
|
// lib/utils/autorouting/computeObstacleBounds.ts
|
|
@@ -2234,6 +2233,7 @@ function tryNow(fn) {
|
|
|
2234
2233
|
}
|
|
2235
2234
|
|
|
2236
2235
|
// lib/components/primitive-components/Trace.ts
|
|
2236
|
+
import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map";
|
|
2237
2237
|
var portToObjective = (port) => {
|
|
2238
2238
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
2239
2239
|
return {
|
|
@@ -2458,14 +2458,17 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2458
2458
|
);
|
|
2459
2459
|
return;
|
|
2460
2460
|
}
|
|
2461
|
-
const
|
|
2461
|
+
const connMap = getFullConnectivityMapFromCircuitJson(
|
|
2462
|
+
this.root.db.toArray()
|
|
2463
|
+
);
|
|
2464
|
+
const [obstacles, errGettingObstacles] = tryNow(
|
|
2462
2465
|
() => getObstaclesFromSoup(this.root.db.toArray())
|
|
2463
2466
|
);
|
|
2464
|
-
if (
|
|
2467
|
+
if (errGettingObstacles) {
|
|
2465
2468
|
this.renderError({
|
|
2466
2469
|
type: "pcb_error",
|
|
2467
2470
|
error_type: "pcb_trace_error",
|
|
2468
|
-
message: `Error getting obstacles for autorouting: ${
|
|
2471
|
+
message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
|
|
2469
2472
|
source_trace_id: this.source_trace_id,
|
|
2470
2473
|
center: { x: 0, y: 0 },
|
|
2471
2474
|
pcb_port_ids: ports.map((p) => p.pcb_port_id),
|
|
@@ -2474,19 +2477,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2474
2477
|
});
|
|
2475
2478
|
return;
|
|
2476
2479
|
}
|
|
2477
|
-
markObstaclesAsConnected(
|
|
2478
|
-
obstacles,
|
|
2479
|
-
orderedRouteObjectives,
|
|
2480
|
-
this.source_trace_id
|
|
2481
|
-
);
|
|
2482
|
-
const allConnectedTraceIds = this._getAllTracesConnectedToSameNet().map(
|
|
2483
|
-
(t) => t.source_trace_id
|
|
2484
|
-
);
|
|
2485
2480
|
for (const obstacle of obstacles) {
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2481
|
+
const connectedTo = obstacle.connectedTo;
|
|
2482
|
+
if (connectedTo.length > 0) {
|
|
2483
|
+
const netId = connMap.getNetConnectedToId(obstacle.connectedTo[0]);
|
|
2484
|
+
if (netId) {
|
|
2485
|
+
obstacle.connectedTo.push(netId);
|
|
2486
|
+
}
|
|
2490
2487
|
}
|
|
2491
2488
|
}
|
|
2492
2489
|
const candidateLayerSelections = candidateLayerCombinations[0].layer_path;
|
|
@@ -2509,7 +2506,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2509
2506
|
obstacles,
|
|
2510
2507
|
connections: [
|
|
2511
2508
|
{
|
|
2512
|
-
name: this.source_trace_id,
|
|
2509
|
+
name: connMap.getNetConnectedToId(this.source_trace_id),
|
|
2513
2510
|
pointsToConnect: [
|
|
2514
2511
|
{ ...a, layer: dominantLayer ?? "top" },
|
|
2515
2512
|
{ ...b, layer: dominantLayer ?? "top" }
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
isMatchingSelector,
|
|
40
40
|
} from "lib/utils/selector-matching"
|
|
41
41
|
import { tryNow } from "lib/utils/try-now"
|
|
42
|
+
import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map"
|
|
42
43
|
|
|
43
44
|
type PcbRouteObjective =
|
|
44
45
|
| RouteHintPoint
|
|
@@ -356,17 +357,21 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
356
357
|
return
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
const connMap = getFullConnectivityMapFromCircuitJson(
|
|
361
|
+
this.root!.db.toArray(),
|
|
362
|
+
)
|
|
363
|
+
|
|
359
364
|
// Cache the PCB obstacles, they'll be needed for each segment between
|
|
360
365
|
// ports/hints
|
|
361
|
-
const [obstacles,
|
|
366
|
+
const [obstacles, errGettingObstacles] = tryNow(() =>
|
|
362
367
|
getObstaclesFromSoup(this.root!.db.toArray()),
|
|
363
368
|
)
|
|
364
369
|
|
|
365
|
-
if (
|
|
370
|
+
if (errGettingObstacles) {
|
|
366
371
|
this.renderError({
|
|
367
372
|
type: "pcb_error",
|
|
368
373
|
error_type: "pcb_trace_error",
|
|
369
|
-
message: `Error getting obstacles for autorouting: ${
|
|
374
|
+
message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
|
|
370
375
|
source_trace_id: this.source_trace_id!,
|
|
371
376
|
center: { x: 0, y: 0 },
|
|
372
377
|
pcb_port_ids: ports.map((p) => p.pcb_port_id!),
|
|
@@ -376,22 +381,13 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
376
381
|
return
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
markObstaclesAsConnected(
|
|
380
|
-
obstacles,
|
|
381
|
-
orderedRouteObjectives,
|
|
382
|
-
this.source_trace_id!,
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
const allConnectedTraceIds = this._getAllTracesConnectedToSameNet().map(
|
|
386
|
-
(t) => t.source_trace_id,
|
|
387
|
-
)
|
|
388
384
|
for (const obstacle of obstacles) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
)
|
|
393
|
-
|
|
394
|
-
|
|
385
|
+
const connectedTo = obstacle.connectedTo
|
|
386
|
+
if (connectedTo.length > 0) {
|
|
387
|
+
const netId = connMap.getNetConnectedToId(obstacle.connectedTo[0])
|
|
388
|
+
if (netId) {
|
|
389
|
+
obstacle.connectedTo.push(netId)
|
|
390
|
+
}
|
|
395
391
|
}
|
|
396
392
|
}
|
|
397
393
|
|
|
@@ -424,7 +420,7 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
|
|
|
424
420
|
obstacles,
|
|
425
421
|
connections: [
|
|
426
422
|
{
|
|
427
|
-
name: this.source_trace_id!,
|
|
423
|
+
name: connMap.getNetConnectedToId(this.source_trace_id!)!,
|
|
428
424
|
pointsToConnect: [
|
|
429
425
|
{ ...a, layer: dominantLayer ?? "top" },
|
|
430
426
|
{ ...b, layer: dominantLayer ?? "top" },
|
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.54",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
@@ -34,10 +34,11 @@
|
|
|
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.13",
|
|
38
38
|
"@tscircuit/props": "^0.0.62",
|
|
39
39
|
"@tscircuit/soup": "^0.0.67",
|
|
40
40
|
"@tscircuit/soup-util": "^0.0.23",
|
|
41
|
+
"circuit-json-to-connectivity-map": "^0.0.8",
|
|
41
42
|
"footprinter": "^0.0.44",
|
|
42
43
|
"react": "^18.3.1",
|
|
43
44
|
"react-reconciler": "^0.29.2",
|