@tscircuit/core 0.0.1900 → 0.0.1902
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 +5 -1
- package/dist/index.js +253 -42
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1589,8 +1589,12 @@ interface RoutingPhaseDrcTolerances {
|
|
|
1589
1589
|
minViaHoleDiameter?: number;
|
|
1590
1590
|
minViaPadDiameter?: number;
|
|
1591
1591
|
}
|
|
1592
|
+
interface PrecomputedRoutingResult {
|
|
1593
|
+
traces: SimplifiedPcbTrace[];
|
|
1594
|
+
outputSimpleRouteJson?: SimpleRouteJson;
|
|
1595
|
+
}
|
|
1592
1596
|
interface RoutingPhasePlan {
|
|
1593
|
-
|
|
1597
|
+
getPrecomputedRoutingResult?: (input: SimpleRouteJson) => PrecomputedRoutingResult;
|
|
1594
1598
|
routingPhaseIndex: number | null;
|
|
1595
1599
|
phaseName?: AutoroutingPhaseProps["name"];
|
|
1596
1600
|
routingPcbGroupId?: PcbGroupId;
|
package/dist/index.js
CHANGED
|
@@ -16617,7 +16617,7 @@ import {
|
|
|
16617
16617
|
} from "@tscircuit/checks";
|
|
16618
16618
|
import { getBoundsFromPoints as getBoundsFromPoints10 } from "@tscircuit/math-utils";
|
|
16619
16619
|
import { boardProps } from "@tscircuit/props";
|
|
16620
|
-
import { compose as
|
|
16620
|
+
import { compose as compose16, translate as translate16 } from "transformation-matrix";
|
|
16621
16621
|
|
|
16622
16622
|
// lib/utils/autorouting/getAncestorSubcircuitIds.ts
|
|
16623
16623
|
var getDescendantSubcircuitIds = (db, root_subcircuit_id) => {
|
|
@@ -61216,8 +61216,191 @@ var Group_getFanoutPourNetMap = (group, routingPhasePlans) => {
|
|
|
61216
61216
|
// lib/components/primitive-components/Group/Group_getRoutingPhasePlans.ts
|
|
61217
61217
|
import { getBoundsFromPoints as getBoundsFromPoints8 } from "@tscircuit/math-utils";
|
|
61218
61218
|
|
|
61219
|
-
// lib/components/primitive-components/
|
|
61219
|
+
// lib/components/primitive-components/Group/get-saved-autorouting-phase-traces.ts
|
|
61220
61220
|
import { applyToPoint as applyToPoint30, compose as compose12, translate as translate12 } from "transformation-matrix";
|
|
61221
|
+
var touchesEndpoint = (point6, endpoint) => Math.hypot(point6.x - endpoint.x, point6.y - endpoint.y) < 1e-4 && (point6.layers ?? [point6.layer]).includes(endpoint.layer);
|
|
61222
|
+
function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
61223
|
+
const group = phase.getGroup();
|
|
61224
|
+
const transformBeforeLayout = group._computePcbGlobalTransformBeforeLayout();
|
|
61225
|
+
const boardLayers = getViaBoardLayers(input.layerCount);
|
|
61226
|
+
const remainingPointsByConnection = new Map(
|
|
61227
|
+
input.connections.map((connection) => [
|
|
61228
|
+
connection,
|
|
61229
|
+
[...connection.pointsToConnect]
|
|
61230
|
+
])
|
|
61231
|
+
);
|
|
61232
|
+
const coveredConnections = /* @__PURE__ */ new Set();
|
|
61233
|
+
const savedPorts = /* @__PURE__ */ new Set();
|
|
61234
|
+
const traces = [];
|
|
61235
|
+
for (const [pathIndex, path] of (phase._parsedProps.pcbTracePaths ?? []).entries()) {
|
|
61236
|
+
const port = phase.getSubcircuit().selectOne(path.connection, { type: "port" });
|
|
61237
|
+
if (!port)
|
|
61238
|
+
throw new Error(
|
|
61239
|
+
`Saved phase path "${path.connection}" must select a PCB port`
|
|
61240
|
+
);
|
|
61241
|
+
if (savedPorts.has(port))
|
|
61242
|
+
throw new Error(`Duplicate saved phase path for "${path.connection}"`);
|
|
61243
|
+
savedPorts.add(port);
|
|
61244
|
+
const connections = input.connections.filter(
|
|
61245
|
+
(connection2) => connection2.pointsToConnect.some(
|
|
61246
|
+
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
61247
|
+
)
|
|
61248
|
+
);
|
|
61249
|
+
if (connections.length !== 1) {
|
|
61250
|
+
throw new Error(
|
|
61251
|
+
`Saved phase path "${path.connection}" must select exactly one connection in this phase`
|
|
61252
|
+
);
|
|
61253
|
+
}
|
|
61254
|
+
const connection = connections[0];
|
|
61255
|
+
const remainingPoints = remainingPointsByConnection.get(connection);
|
|
61256
|
+
const startIndex = remainingPoints.findIndex(
|
|
61257
|
+
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
61258
|
+
);
|
|
61259
|
+
if (startIndex < 0)
|
|
61260
|
+
throw new Error(
|
|
61261
|
+
`Saved phase path "${path.connection}" starts at an endpoint already joined by another path`
|
|
61262
|
+
);
|
|
61263
|
+
const portBeforeLayout = port._getGlobalPcbPositionBeforeLayout();
|
|
61264
|
+
const portAfterLayout = port._getGlobalPcbPositionAfterLayout();
|
|
61265
|
+
const transform = compose12(
|
|
61266
|
+
translate12(
|
|
61267
|
+
portAfterLayout.x - portBeforeLayout.x,
|
|
61268
|
+
portAfterLayout.y - portBeforeLayout.y
|
|
61269
|
+
),
|
|
61270
|
+
transformBeforeLayout
|
|
61271
|
+
);
|
|
61272
|
+
const route = path.route.map((point6) => ({
|
|
61273
|
+
...point6,
|
|
61274
|
+
...applyToPoint30(transform, point6)
|
|
61275
|
+
}));
|
|
61276
|
+
for (const point6 of route) {
|
|
61277
|
+
const layers = point6.route_type === "wire" ? [point6.layer] : [point6.from_layer, point6.to_layer];
|
|
61278
|
+
if (layers.some((layer) => !boardLayers.includes(layer))) {
|
|
61279
|
+
throw new Error(
|
|
61280
|
+
`Saved phase path "${path.connection}" uses a layer unavailable on this board`
|
|
61281
|
+
);
|
|
61282
|
+
}
|
|
61283
|
+
}
|
|
61284
|
+
const first = route[0];
|
|
61285
|
+
const last = route.at(-1);
|
|
61286
|
+
const firstLayer = first.route_type === "wire" ? first.layer : first.from_layer;
|
|
61287
|
+
const lastLayer = last.route_type === "wire" ? last.layer : last.to_layer;
|
|
61288
|
+
if (!touchesEndpoint(remainingPoints[startIndex], {
|
|
61289
|
+
...first,
|
|
61290
|
+
layer: firstLayer
|
|
61291
|
+
})) {
|
|
61292
|
+
throw new Error(
|
|
61293
|
+
`Saved phase path "${path.connection}" must start at its PCB port on an available layer`
|
|
61294
|
+
);
|
|
61295
|
+
}
|
|
61296
|
+
const endIndex = remainingPoints.findIndex(
|
|
61297
|
+
(point6, index) => index !== startIndex && touchesEndpoint(point6, { ...last, layer: lastLayer })
|
|
61298
|
+
);
|
|
61299
|
+
if (!input.allowViaInPad && (first.route_type === "via" || last.route_type === "via" && endIndex >= 0)) {
|
|
61300
|
+
throw new Error(
|
|
61301
|
+
`Saved phase path "${path.connection}" has a via at a pad; enable allowViaInPad`
|
|
61302
|
+
);
|
|
61303
|
+
}
|
|
61304
|
+
const pcbTraceId = `saved_phase_${group.pcb_group_id}_${phase._parsedProps.phaseIndex ?? "default"}_${pathIndex}`;
|
|
61305
|
+
if (endIndex < 0 && !isFanout) {
|
|
61306
|
+
throw new Error(
|
|
61307
|
+
`Saved phase path "${path.connection}" must end at another connection endpoint; use autorouter="fanout" for saved escapes`
|
|
61308
|
+
);
|
|
61309
|
+
}
|
|
61310
|
+
if (endIndex >= 0) {
|
|
61311
|
+
remainingPoints.splice(startIndex, 1);
|
|
61312
|
+
} else {
|
|
61313
|
+
remainingPoints[startIndex] = {
|
|
61314
|
+
x: last.x,
|
|
61315
|
+
y: last.y,
|
|
61316
|
+
layer: lastLayer,
|
|
61317
|
+
layers: [lastLayer],
|
|
61318
|
+
pointId: `${pcbTraceId}_exit`
|
|
61319
|
+
};
|
|
61320
|
+
}
|
|
61321
|
+
const width = route.find((point6) => point6.route_type === "wire")?.width ?? input.minTraceWidth;
|
|
61322
|
+
const routeWithViaContacts = route.flatMap(
|
|
61323
|
+
(point6) => point6.route_type === "via" ? [
|
|
61324
|
+
{
|
|
61325
|
+
route_type: "wire",
|
|
61326
|
+
x: point6.x,
|
|
61327
|
+
y: point6.y,
|
|
61328
|
+
layer: point6.from_layer,
|
|
61329
|
+
width
|
|
61330
|
+
},
|
|
61331
|
+
point6,
|
|
61332
|
+
{
|
|
61333
|
+
route_type: "wire",
|
|
61334
|
+
x: point6.x,
|
|
61335
|
+
y: point6.y,
|
|
61336
|
+
layer: point6.to_layer,
|
|
61337
|
+
width
|
|
61338
|
+
}
|
|
61339
|
+
] : [point6]
|
|
61340
|
+
);
|
|
61341
|
+
if (last.route_type === "via") {
|
|
61342
|
+
routeWithViaContacts.push({
|
|
61343
|
+
route_type: "wire",
|
|
61344
|
+
x: last.x,
|
|
61345
|
+
y: last.y,
|
|
61346
|
+
layer: last.to_layer,
|
|
61347
|
+
width
|
|
61348
|
+
});
|
|
61349
|
+
}
|
|
61350
|
+
coveredConnections.add(connection);
|
|
61351
|
+
traces.push({
|
|
61352
|
+
type: "pcb_trace",
|
|
61353
|
+
pcb_trace_id: pcbTraceId,
|
|
61354
|
+
connection_name: connection.name,
|
|
61355
|
+
connectsTo: [
|
|
61356
|
+
connection.source_trace_id,
|
|
61357
|
+
...connection.pointsToConnect.map((point6) => point6.pointId)
|
|
61358
|
+
].filter((id) => Boolean(id)),
|
|
61359
|
+
route: routeWithViaContacts
|
|
61360
|
+
});
|
|
61361
|
+
}
|
|
61362
|
+
for (const connection of input.connections) {
|
|
61363
|
+
if (!coveredConnections.has(connection)) {
|
|
61364
|
+
throw new Error(
|
|
61365
|
+
`pcbTracePaths must cover every connection in the phase; missing: ${connection.name}`
|
|
61366
|
+
);
|
|
61367
|
+
}
|
|
61368
|
+
if (!isFanout && remainingPointsByConnection.get(connection).length > 1) {
|
|
61369
|
+
throw new Error(
|
|
61370
|
+
`Saved phase paths for "${connection.name}" must connect every endpoint; use autorouter="fanout" for saved escapes`
|
|
61371
|
+
);
|
|
61372
|
+
}
|
|
61373
|
+
}
|
|
61374
|
+
const remainingConnections = input.connections.flatMap((connection) => {
|
|
61375
|
+
const pointsToConnect = remainingPointsByConnection.get(connection);
|
|
61376
|
+
return pointsToConnect.length > 1 ? [{ ...connection, pointsToConnect }] : [];
|
|
61377
|
+
});
|
|
61378
|
+
const remainingConnectionNames = new Set(
|
|
61379
|
+
remainingConnections.map((connection) => connection.name)
|
|
61380
|
+
);
|
|
61381
|
+
return {
|
|
61382
|
+
traces,
|
|
61383
|
+
outputSimpleRouteJson: isFanout ? {
|
|
61384
|
+
...input,
|
|
61385
|
+
connections: remainingConnections,
|
|
61386
|
+
buses: input.buses?.map((bus) => ({
|
|
61387
|
+
...bus,
|
|
61388
|
+
connectionNames: bus.connectionNames.filter(
|
|
61389
|
+
(name) => remainingConnectionNames.has(name)
|
|
61390
|
+
)
|
|
61391
|
+
})).filter((bus) => bus.connectionNames.length > 0),
|
|
61392
|
+
differentialPairs: input.differentialPairs?.filter(
|
|
61393
|
+
(pair) => pair.connectionNames.every(
|
|
61394
|
+
(name) => remainingConnectionNames.has(name)
|
|
61395
|
+
)
|
|
61396
|
+
),
|
|
61397
|
+
traces: [...input.traces ?? [], ...traces]
|
|
61398
|
+
} : void 0
|
|
61399
|
+
};
|
|
61400
|
+
}
|
|
61401
|
+
|
|
61402
|
+
// lib/components/primitive-components/Breakout/get-saved-fanout-traces.ts
|
|
61403
|
+
import { applyToPoint as applyToPoint31, compose as compose13, translate as translate13 } from "transformation-matrix";
|
|
61221
61404
|
|
|
61222
61405
|
// lib/components/primitive-components/BreakoutPoint.ts
|
|
61223
61406
|
import { breakoutPointProps } from "@tscircuit/props";
|
|
@@ -61381,13 +61564,13 @@ function getSavedFanoutTraces(breakout, input) {
|
|
|
61381
61564
|
);
|
|
61382
61565
|
const pcbExit = db.pcb_breakout_point.get(exit.pcb_breakout_point_id);
|
|
61383
61566
|
const localExit = path.route.at(-1);
|
|
61384
|
-
const transform =
|
|
61567
|
+
const transform = compose13(
|
|
61385
61568
|
exit._computePcbGlobalTransformBeforeLayout(),
|
|
61386
|
-
|
|
61569
|
+
translate13(-localExit.x, -localExit.y)
|
|
61387
61570
|
);
|
|
61388
|
-
const originalExit =
|
|
61571
|
+
const originalExit = applyToPoint31(transform, localExit);
|
|
61389
61572
|
const route = path.route.map((point6) => {
|
|
61390
|
-
const position =
|
|
61573
|
+
const position = applyToPoint31(transform, point6);
|
|
61391
61574
|
return {
|
|
61392
61575
|
...point6,
|
|
61393
61576
|
x: position.x + pcbExit.x - originalExit.x,
|
|
@@ -61546,15 +61729,21 @@ function convertPortSelectorToEndpointKey(selector) {
|
|
|
61546
61729
|
return selector.trim().replace(/\s*>\s*/g, ".").replace(/\s+/g, ".").replace(/^\./, "").replace(/\.\./g, ".");
|
|
61547
61730
|
}
|
|
61548
61731
|
function getConnectionSelectorsFromAutoroutingPhaseProps(phaseProps) {
|
|
61732
|
+
if (phaseProps.connection === void 0 && phaseProps.connections === void 0) {
|
|
61733
|
+
return phaseProps.pcbTracePaths?.map((path) => path.connection) ?? [];
|
|
61734
|
+
}
|
|
61549
61735
|
return [
|
|
61550
61736
|
...phaseProps.connection ? [phaseProps.connection] : [],
|
|
61551
61737
|
...phaseProps.connections ?? []
|
|
61552
61738
|
];
|
|
61553
61739
|
}
|
|
61554
61740
|
function traceHasEndpointMatchingConnectionSelector(trace, connectionSelectorEndpointKey) {
|
|
61555
|
-
|
|
61741
|
+
if (trace.getTracePortPathSelectors().some(
|
|
61556
61742
|
(selector) => convertPortSelectorToEndpointKey(selector) === connectionSelectorEndpointKey
|
|
61557
|
-
)
|
|
61743
|
+
))
|
|
61744
|
+
return true;
|
|
61745
|
+
const port = trace.getSubcircuit().selectOne(connectionSelectorEndpointKey, { type: "port" });
|
|
61746
|
+
return port !== null && (trace._findConnectedPorts().ports?.includes(port) ?? false);
|
|
61558
61747
|
}
|
|
61559
61748
|
function getAutoroutersByPhaseIndex(group) {
|
|
61560
61749
|
const autoroutingPhases = group.selectAll(
|
|
@@ -61698,7 +61887,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
61698
61887
|
}
|
|
61699
61888
|
}
|
|
61700
61889
|
}
|
|
61701
|
-
if (phaseProps.reroute) {
|
|
61890
|
+
if (phaseProps.reroute || phaseProps.pcbTracePaths !== void 0) {
|
|
61702
61891
|
getOrCreateRoutingPhasePlan(plansByPhaseIndex, phaseIndex);
|
|
61703
61892
|
}
|
|
61704
61893
|
}
|
|
@@ -61721,6 +61910,18 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
61721
61910
|
plan.fanoutPourNetMap = phaseProps?.fanoutPourNetMap ?? groupFanoutProps.fanoutPourNetMap;
|
|
61722
61911
|
plan.drcTolerances = phaseProps ? getDrcTolerancesFromAutoroutingPhaseProps(phaseProps) : void 0;
|
|
61723
61912
|
}
|
|
61913
|
+
for (const phase of group.selectAll(
|
|
61914
|
+
"autoroutingphase"
|
|
61915
|
+
)) {
|
|
61916
|
+
if (phase._parsedProps.pcbTracePaths === void 0) continue;
|
|
61917
|
+
const plan = plansByPhaseIndex.get(phase._parsedProps.phaseIndex ?? null);
|
|
61918
|
+
if (!plan) continue;
|
|
61919
|
+
const config = plan.autorouter !== void 0 ? getPresetAutoroutingConfig(plan.autorouter, group.root?.platform) : group._getAutorouterConfig();
|
|
61920
|
+
const isFanout = ["fanout", "single_layer_fanout"].includes(
|
|
61921
|
+
config.preset ?? ""
|
|
61922
|
+
);
|
|
61923
|
+
plan.getPrecomputedRoutingResult = (input) => getSavedAutoroutingPhaseTraces(phase, input, isFanout);
|
|
61924
|
+
}
|
|
61724
61925
|
const breakoutPlans = [];
|
|
61725
61926
|
for (const breakout of breakouts) {
|
|
61726
61927
|
const breakoutProps2 = breakout._parsedProps;
|
|
@@ -61771,7 +61972,9 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
61771
61972
|
groupMode: "subcircuit",
|
|
61772
61973
|
allowViaInPad: (typeof breakoutProps2.autorouter === "object" ? breakoutProps2.autorouter.allowViaInPad : void 0) ?? group._getAutorouterConfig().allowViaInPad
|
|
61773
61974
|
},
|
|
61774
|
-
|
|
61975
|
+
getPrecomputedRoutingResult: (input) => ({
|
|
61976
|
+
traces: getSavedFanoutTraces(breakout, input)
|
|
61977
|
+
})
|
|
61775
61978
|
});
|
|
61776
61979
|
continue;
|
|
61777
61980
|
}
|
|
@@ -61833,7 +62036,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
61833
62036
|
var package_default = {
|
|
61834
62037
|
name: "@tscircuit/core",
|
|
61835
62038
|
type: "module",
|
|
61836
|
-
version: "0.0.
|
|
62039
|
+
version: "0.0.1901",
|
|
61837
62040
|
types: "dist/index.d.ts",
|
|
61838
62041
|
main: "dist/index.js",
|
|
61839
62042
|
module: "dist/index.js",
|
|
@@ -61888,7 +62091,7 @@ var package_default = {
|
|
|
61888
62091
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
61889
62092
|
"@tscircuit/props": "^0.0.653",
|
|
61890
62093
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
61891
|
-
"@tscircuit/schematic-trace-solver": "^0.0.
|
|
62094
|
+
"@tscircuit/schematic-trace-solver": "^0.0.196",
|
|
61892
62095
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
61893
62096
|
"@tscircuit/soup-util": "^0.0.41",
|
|
61894
62097
|
"@tscircuit/via-stitch-solver": "github:tscircuit/via-stitch-solver#75653b6440e75584b052f03595afd34283ae7558",
|
|
@@ -63691,10 +63894,14 @@ var Group5 = class extends NormalComponent3 {
|
|
|
63691
63894
|
});
|
|
63692
63895
|
};
|
|
63693
63896
|
const routingStages = routingPhasePlans.flatMap((routingPhasePlan) => {
|
|
63694
|
-
const
|
|
63897
|
+
const resolvedPhaseAutorouterConfig = routingPhasePlan.autorouter ? getPresetAutoroutingConfig(
|
|
63695
63898
|
routingPhasePlan.autorouter,
|
|
63696
63899
|
this.root?.platform
|
|
63697
63900
|
) : autorouterConfig;
|
|
63901
|
+
const phaseAutorouterConfig = routingPhasePlan.getPrecomputedRoutingResult ? {
|
|
63902
|
+
...resolvedPhaseAutorouterConfig,
|
|
63903
|
+
allowViaInPad: (typeof routingPhasePlan.autorouter === "object" ? routingPhasePlan.autorouter.allowViaInPad : void 0) ?? autorouterConfig.allowViaInPad
|
|
63904
|
+
} : resolvedPhaseAutorouterConfig;
|
|
63698
63905
|
const stages = getLocalAutoroutingStages(
|
|
63699
63906
|
phaseAutorouterConfig,
|
|
63700
63907
|
this.root?.platform
|
|
@@ -63964,10 +64171,11 @@ var Group5 = class extends NormalComponent3 {
|
|
|
63964
64171
|
routingPhasePlan.drcTolerances
|
|
63965
64172
|
);
|
|
63966
64173
|
simpleRouteJson.allowViaInPad = phaseAutorouterConfig.allowViaInPad;
|
|
64174
|
+
const getPrecomputedRoutingResult = usesPreviousStageOutput ? void 0 : routingPhasePlan.getPrecomputedRoutingResult;
|
|
63967
64175
|
const simplificationHasNoTraceInput = Boolean(
|
|
63968
64176
|
isTraceSimplificationPhase && simpleRouteJson.traces?.length === 0
|
|
63969
64177
|
);
|
|
63970
|
-
if ((hasPhasedAutorouting || isReroutePhase) && (simpleRouteJson.connections.length === 0 && !isTraceSimplificationPhase || simplificationHasNoTraceInput)) {
|
|
64178
|
+
if ((hasPhasedAutorouting || isReroutePhase || usesPreviousStageOutput) && (simpleRouteJson.connections.length === 0 && !isTraceSimplificationPhase && !getPrecomputedRoutingResult || simplificationHasNoTraceInput)) {
|
|
63971
64179
|
if (phaseStageIndex === 0) {
|
|
63972
64180
|
emitRoutingPhaseDebugObject(routingPhasePlan, simpleRouteJson.bounds);
|
|
63973
64181
|
}
|
|
@@ -63983,7 +64191,7 @@ var Group5 = class extends NormalComponent3 {
|
|
|
63983
64191
|
}
|
|
63984
64192
|
}
|
|
63985
64193
|
const fanoutMode = phaseAutorouterConfig.preset;
|
|
63986
|
-
if ((fanoutMode === "fanout" || fanoutMode === "single_layer_fanout") && !routingPhasePlan.fanoutRegionPcbGroupId) {
|
|
64194
|
+
if ((fanoutMode === "fanout" || fanoutMode === "single_layer_fanout") && !routingPhasePlan.fanoutRegionPcbGroupId && !getPrecomputedRoutingResult) {
|
|
63987
64195
|
routingPhasePlan.fanoutBounds = FanoutAutorouter.resolveFanoutBounds(
|
|
63988
64196
|
simpleRouteJson,
|
|
63989
64197
|
{
|
|
@@ -64029,8 +64237,8 @@ var Group5 = class extends NormalComponent3 {
|
|
|
64029
64237
|
autorouterVersion: autorouterVersion2,
|
|
64030
64238
|
effort
|
|
64031
64239
|
};
|
|
64032
|
-
const autorouterName =
|
|
64033
|
-
const solverName =
|
|
64240
|
+
const autorouterName = getPrecomputedRoutingResult ? "precomputed" : phaseAutorouterConfig.algorithmFn ? "custom" : localAutorouterStrategy.name;
|
|
64241
|
+
const solverName = getPrecomputedRoutingResult || phaseAutorouterConfig.algorithmFn ? void 0 : localAutorouterStrategy.getSolverName(commonAutorouterOptions);
|
|
64034
64242
|
const localAutoroutingCacheSolverOptions = {
|
|
64035
64243
|
autorouterName,
|
|
64036
64244
|
solverName,
|
|
@@ -64043,13 +64251,13 @@ var Group5 = class extends NormalComponent3 {
|
|
|
64043
64251
|
autorouterVersion: commonAutorouterOptions.autorouterVersion,
|
|
64044
64252
|
effort: commonAutorouterOptions.effort
|
|
64045
64253
|
};
|
|
64046
|
-
const cacheEngine =
|
|
64254
|
+
const cacheEngine = getPrecomputedRoutingResult || phaseAutorouterConfig.algorithmFn || !localAutorouterStrategy.cacheable ? void 0 : this.root?.platform?.localCacheEngine;
|
|
64047
64255
|
const cacheKey = cacheEngine ? getLocalAutoroutingCacheKey(
|
|
64048
64256
|
simpleRouteJson,
|
|
64049
64257
|
localAutoroutingCacheSolverOptions
|
|
64050
64258
|
) : void 0;
|
|
64051
64259
|
const cachedResult = cacheKey ? await getCachedLocalAutoroutingPhaseResult({ cacheEngine, cacheKey }) : null;
|
|
64052
|
-
const cacheDisabledReason =
|
|
64260
|
+
const cacheDisabledReason = getPrecomputedRoutingResult ? "precomputed" : phaseAutorouterConfig.algorithmFn ? "custom_algorithm" : !localAutorouterStrategy.cacheable ? "strategy_not_cacheable" : !cacheEngine ? "no_cache_engine" : void 0;
|
|
64053
64261
|
const autoroutingMetadata = {
|
|
64054
64262
|
routingPhaseIndex: routingStageIndex,
|
|
64055
64263
|
phaseOrdinal: routingStageIndex + 1,
|
|
@@ -64081,8 +64289,11 @@ var Group5 = class extends NormalComponent3 {
|
|
|
64081
64289
|
let autorouter;
|
|
64082
64290
|
try {
|
|
64083
64291
|
let traces;
|
|
64084
|
-
|
|
64085
|
-
|
|
64292
|
+
let precomputedOutputSimpleRouteJson;
|
|
64293
|
+
if (getPrecomputedRoutingResult) {
|
|
64294
|
+
const result = getPrecomputedRoutingResult(simpleRouteJson);
|
|
64295
|
+
traces = result.traces;
|
|
64296
|
+
precomputedOutputSimpleRouteJson = result.outputSimpleRouteJson;
|
|
64086
64297
|
for (const trace of traces)
|
|
64087
64298
|
fixedFanoutTraceIds.add(trace.pcb_trace_id);
|
|
64088
64299
|
} else if (cachedResult) {
|
|
@@ -64148,7 +64359,7 @@ var Group5 = class extends NormalComponent3 {
|
|
|
64148
64359
|
activeAutorouter.start();
|
|
64149
64360
|
traces = await routingPromise;
|
|
64150
64361
|
}
|
|
64151
|
-
let transformedSimpleRouteJson = autorouter?.getOutputSimpleRouteJson?.();
|
|
64362
|
+
let transformedSimpleRouteJson = precomputedOutputSimpleRouteJson ?? autorouter?.getOutputSimpleRouteJson?.();
|
|
64152
64363
|
if (transformedSimpleRouteJson && !usesPreviousStageOutput && ["fanout", "single_layer_fanout"].includes(
|
|
64153
64364
|
phaseAutorouterConfig.preset ?? ""
|
|
64154
64365
|
) && routingPhasePlan.routingPcbGroupId) {
|
|
@@ -65088,7 +65299,7 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
|
|
|
65088
65299
|
import { ledProps } from "@tscircuit/props";
|
|
65089
65300
|
|
|
65090
65301
|
// lib/components/normal-components/Led_addPolarityFabricationSymbol.ts
|
|
65091
|
-
import { applyToPoint as
|
|
65302
|
+
import { applyToPoint as applyToPoint32, compose as compose14, rotate as rotate6, translate as translate14 } from "transformation-matrix";
|
|
65092
65303
|
var generatedNotes = /* @__PURE__ */ new WeakMap();
|
|
65093
65304
|
var getPolarity2 = (port) => {
|
|
65094
65305
|
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
@@ -65129,11 +65340,11 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
65129
65340
|
const distance22 = Math.hypot(k.x - a.x, k.y - a.y);
|
|
65130
65341
|
if (distance22 < 1e-6) return;
|
|
65131
65342
|
const angle = Math.atan2(k.y - a.y, k.x - a.x);
|
|
65132
|
-
const frame =
|
|
65133
|
-
|
|
65343
|
+
const frame = compose14(
|
|
65344
|
+
translate14((a.x + k.x) / 2, (a.y + k.y) / 2),
|
|
65134
65345
|
rotate6(angle)
|
|
65135
65346
|
);
|
|
65136
|
-
const point6 = (x, y) =>
|
|
65347
|
+
const point6 = (x, y) => applyToPoint32(frame, { x, y });
|
|
65137
65348
|
const common = {
|
|
65138
65349
|
pcb_component_id: pcb.pcb_component_id,
|
|
65139
65350
|
subcircuit_id: led.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
@@ -67248,10 +67459,10 @@ import {
|
|
|
67248
67459
|
Polygon as Polygon2,
|
|
67249
67460
|
Segment
|
|
67250
67461
|
} from "@flatten-js/core";
|
|
67251
|
-
import { compose as
|
|
67462
|
+
import { compose as compose15, rotate as rotate7, translate as translate15 } from "transformation-matrix";
|
|
67252
67463
|
var placePolygon = (polygon, center, degrees = 0) => {
|
|
67253
|
-
const { a, b, c, d, e, f } =
|
|
67254
|
-
|
|
67464
|
+
const { a, b, c, d, e, f } = compose15(
|
|
67465
|
+
translate15(center.x, center.y),
|
|
67255
67466
|
rotate7(degrees * Math.PI / 180)
|
|
67256
67467
|
);
|
|
67257
67468
|
return polygon.transform(new Matrix(a, b, c, d, e, f));
|
|
@@ -67940,9 +68151,9 @@ var Board = class extends Group5 {
|
|
|
67940
68151
|
_computePcbGlobalTransformBeforeLayout() {
|
|
67941
68152
|
if (this._panelPositionOffset) {
|
|
67942
68153
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
67943
|
-
return
|
|
68154
|
+
return compose16(
|
|
67944
68155
|
parentTransform,
|
|
67945
|
-
|
|
68156
|
+
translate16(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
67946
68157
|
);
|
|
67947
68158
|
}
|
|
67948
68159
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -68573,7 +68784,7 @@ import { distance as distance20 } from "circuit-json";
|
|
|
68573
68784
|
// lib/components/normal-components/Subpanel.ts
|
|
68574
68785
|
import { subpanelProps } from "@tscircuit/props";
|
|
68575
68786
|
import { distance as distance19 } from "circuit-json";
|
|
68576
|
-
import { compose as
|
|
68787
|
+
import { compose as compose17, identity as identity8, translate as translate17 } from "transformation-matrix";
|
|
68577
68788
|
|
|
68578
68789
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
68579
68790
|
import * as Flatten from "@flatten-js/core";
|
|
@@ -69085,9 +69296,9 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
69085
69296
|
_computePcbGlobalTransformBeforeLayout() {
|
|
69086
69297
|
if (this._panelPositionOffset) {
|
|
69087
69298
|
const parentTransform = this.parent?._computePcbGlobalTransformBeforeLayout?.() ?? identity8();
|
|
69088
|
-
return
|
|
69299
|
+
return compose17(
|
|
69089
69300
|
parentTransform,
|
|
69090
|
-
|
|
69301
|
+
translate17(this._panelPositionOffset.x, this._panelPositionOffset.y)
|
|
69091
69302
|
);
|
|
69092
69303
|
}
|
|
69093
69304
|
return super._computePcbGlobalTransformBeforeLayout();
|
|
@@ -70754,7 +70965,7 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
|
|
|
70754
70965
|
|
|
70755
70966
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
70756
70967
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
70757
|
-
import { applyToPoint as
|
|
70968
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
70758
70969
|
var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
70759
70970
|
fabrication_note_dimension_id = null;
|
|
70760
70971
|
isPcbPrimitive = true;
|
|
@@ -70773,13 +70984,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
70773
70984
|
this.renderError(
|
|
70774
70985
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
70775
70986
|
);
|
|
70776
|
-
return
|
|
70987
|
+
return applyToPoint33(transform, { x: 0, y: 0 });
|
|
70777
70988
|
}
|
|
70778
70989
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
70779
70990
|
}
|
|
70780
70991
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
70781
70992
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
70782
|
-
return
|
|
70993
|
+
return applyToPoint33(transform, { x: numericX, y: numericY });
|
|
70783
70994
|
}
|
|
70784
70995
|
doInitialPcbPrimitiveRender() {
|
|
70785
70996
|
if (this.root?.pcbDisabled) return;
|
|
@@ -70874,7 +71085,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
70874
71085
|
|
|
70875
71086
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
70876
71087
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
70877
|
-
import { applyToPoint as
|
|
71088
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
70878
71089
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
70879
71090
|
pcb_note_dimension_id = null;
|
|
70880
71091
|
isPcbPrimitive = true;
|
|
@@ -70891,7 +71102,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
70891
71102
|
);
|
|
70892
71103
|
if (!target) {
|
|
70893
71104
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
70894
|
-
return
|
|
71105
|
+
return applyToPoint34(transform, { x: 0, y: 0 });
|
|
70895
71106
|
}
|
|
70896
71107
|
const targetPcbComponentId = target.pcb_component_id;
|
|
70897
71108
|
const root = this.root;
|
|
@@ -70908,7 +71119,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
70908
71119
|
}
|
|
70909
71120
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
70910
71121
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
70911
|
-
return
|
|
71122
|
+
return applyToPoint34(transform, { x: numericX, y: numericY });
|
|
70912
71123
|
}
|
|
70913
71124
|
doInitialPcbPrimitiveRender() {
|
|
70914
71125
|
if (this.root?.pcbDisabled) return;
|
|
@@ -73659,7 +73870,7 @@ import {
|
|
|
73659
73870
|
getTransformedSvgPathRoutes,
|
|
73660
73871
|
loadImageSource
|
|
73661
73872
|
} from "@tscircuit/image-utils";
|
|
73662
|
-
import { applyToPoint as
|
|
73873
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
73663
73874
|
var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
73664
73875
|
pcb_silkscreen_graphic_id = null;
|
|
73665
73876
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -73761,7 +73972,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
73761
73972
|
{ x: halfWidth, y: -halfHeight },
|
|
73762
73973
|
{ x: -halfWidth, y: -halfHeight }
|
|
73763
73974
|
]).map(
|
|
73764
|
-
(point6) =>
|
|
73975
|
+
(point6) => applyToPoint35(transform, point6)
|
|
73765
73976
|
)
|
|
73766
73977
|
},
|
|
73767
73978
|
inner_rings: []
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1902",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
57
57
|
"@tscircuit/props": "^0.0.653",
|
|
58
58
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
59
|
-
"@tscircuit/schematic-trace-solver": "^0.0.
|
|
59
|
+
"@tscircuit/schematic-trace-solver": "^0.0.196",
|
|
60
60
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
61
61
|
"@tscircuit/soup-util": "^0.0.41",
|
|
62
62
|
"@tscircuit/via-stitch-solver": "github:tscircuit/via-stitch-solver#75653b6440e75584b052f03595afd34283ae7558",
|