@tscircuit/core 0.0.1999 → 0.0.2001
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 +488 -478
- package/dist/index.js +386 -245
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -222,7 +222,7 @@ function createPcbFold(records, thickness) {
|
|
|
222
222
|
}
|
|
223
223
|
return result;
|
|
224
224
|
};
|
|
225
|
-
const
|
|
225
|
+
const inverse3 = ({
|
|
226
226
|
p,
|
|
227
227
|
anchor,
|
|
228
228
|
direction
|
|
@@ -243,8 +243,8 @@ function createPcbFold(records, thickness) {
|
|
|
243
243
|
};
|
|
244
244
|
return {
|
|
245
245
|
bends,
|
|
246
|
-
inversePoint: (p, anchor) =>
|
|
247
|
-
inverseDirection: (p, anchor) =>
|
|
246
|
+
inversePoint: (p, anchor) => inverse3({ p, anchor, direction: false }),
|
|
247
|
+
inverseDirection: (p, anchor) => inverse3({ p, anchor, direction: true }),
|
|
248
248
|
point: (p, anchor = p) => transform({ p, anchor, direction: false }),
|
|
249
249
|
direction: (p, anchor) => transform({ p, anchor, direction: true }),
|
|
250
250
|
assertRigid(points, label) {
|
|
@@ -16345,7 +16345,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
16345
16345
|
originalLayer: footprintChild._parsedProps.originalLayer
|
|
16346
16346
|
};
|
|
16347
16347
|
}
|
|
16348
|
-
const footprint = this.
|
|
16348
|
+
const footprint = this.resolveFootprint();
|
|
16349
16349
|
if (isValidElement(footprint)) {
|
|
16350
16350
|
const footprintProps2 = footprint.props;
|
|
16351
16351
|
return {
|
|
@@ -16361,6 +16361,10 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
16361
16361
|
originalLayer: footprint._parsedProps?.originalLayer ?? footprint.props?.originalLayer
|
|
16362
16362
|
};
|
|
16363
16363
|
}
|
|
16364
|
+
if (typeof footprint === "string" && /^(pinrow|headermodule|smdpinheader)(?=\d|_|$)/.test(footprint)) {
|
|
16365
|
+
const params = fp.string(footprint).params();
|
|
16366
|
+
if (!params.rightangle) return { insertionDirection: "from_above" };
|
|
16367
|
+
}
|
|
16364
16368
|
return void 0;
|
|
16365
16369
|
}
|
|
16366
16370
|
_getPcbComponentLayer() {
|
|
@@ -18875,6 +18879,314 @@ function inflateSourceFiducial(sourceElm, inflatorContext) {
|
|
|
18875
18879
|
}
|
|
18876
18880
|
}
|
|
18877
18881
|
|
|
18882
|
+
// lib/components/primitive-components/Group/get-autorouting-phase-pcb-trace-paths.ts
|
|
18883
|
+
import { fanoutTracePath as fanoutTracePath2 } from "@tscircuit/props";
|
|
18884
|
+
import { applyToPoint as applyToPoint28, inverse as inverse2 } from "transformation-matrix";
|
|
18885
|
+
|
|
18886
|
+
// lib/components/primitive-components/Group/get-saved-pcb-trace-path-transform.ts
|
|
18887
|
+
import { compose as compose9, translate as translate7 } from "transformation-matrix";
|
|
18888
|
+
function getSavedPcbTracePathTransform(group, port) {
|
|
18889
|
+
const before = port._getGlobalPcbPositionBeforeLayout();
|
|
18890
|
+
const after = port._getGlobalPcbPositionAfterLayout();
|
|
18891
|
+
return compose9(
|
|
18892
|
+
translate7(after.x - before.x, after.y - before.y),
|
|
18893
|
+
group._computePcbGlobalTransformBeforeLayout()
|
|
18894
|
+
);
|
|
18895
|
+
}
|
|
18896
|
+
|
|
18897
|
+
// lib/components/primitive-components/Group/get-saved-autorouting-phase-traces.ts
|
|
18898
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
18899
|
+
import "@tscircuit/props";
|
|
18900
|
+
var touchesEndpoint = (point6, endpoint) => Math.hypot(point6.x - endpoint.x, point6.y - endpoint.y) < 1e-4 && point6.layer === endpoint.layer;
|
|
18901
|
+
function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
18902
|
+
return getSavedAutoroutingPhaseTracesFromPaths({
|
|
18903
|
+
group: phase.getGroup(),
|
|
18904
|
+
subcircuit: phase.getSubcircuit(),
|
|
18905
|
+
paths: phase._parsedProps.pcbTracePaths ?? [],
|
|
18906
|
+
phaseIndex: phase._parsedProps.phaseIndex,
|
|
18907
|
+
input,
|
|
18908
|
+
isFanout
|
|
18909
|
+
});
|
|
18910
|
+
}
|
|
18911
|
+
function getSavedAutoroutingPhaseTracesFromPaths({
|
|
18912
|
+
group,
|
|
18913
|
+
subcircuit,
|
|
18914
|
+
paths,
|
|
18915
|
+
phaseIndex,
|
|
18916
|
+
input,
|
|
18917
|
+
isFanout
|
|
18918
|
+
}) {
|
|
18919
|
+
const boardLayers = getViaBoardLayers(input.layerCount);
|
|
18920
|
+
const remainingPointsByConnection = new Map(
|
|
18921
|
+
input.connections.map((connection) => [
|
|
18922
|
+
connection,
|
|
18923
|
+
[...connection.pointsToConnect]
|
|
18924
|
+
])
|
|
18925
|
+
);
|
|
18926
|
+
const coveredConnections = /* @__PURE__ */ new Set();
|
|
18927
|
+
const savedPorts = /* @__PURE__ */ new Set();
|
|
18928
|
+
const traces = [];
|
|
18929
|
+
for (const [pathIndex, path] of paths.entries()) {
|
|
18930
|
+
const port = subcircuit.selectOne(path.connection, {
|
|
18931
|
+
type: "port"
|
|
18932
|
+
});
|
|
18933
|
+
if (!port)
|
|
18934
|
+
throw new Error(
|
|
18935
|
+
`Saved phase path "${path.connection}" must select a PCB port`
|
|
18936
|
+
);
|
|
18937
|
+
if (savedPorts.has(port))
|
|
18938
|
+
throw new Error(`Duplicate saved phase path for "${path.connection}"`);
|
|
18939
|
+
savedPorts.add(port);
|
|
18940
|
+
const connections = input.connections.filter(
|
|
18941
|
+
(connection2) => connection2.pointsToConnect.some(
|
|
18942
|
+
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
18943
|
+
)
|
|
18944
|
+
);
|
|
18945
|
+
if (connections.length !== 1) {
|
|
18946
|
+
throw new Error(
|
|
18947
|
+
`Saved phase path "${path.connection}" must select exactly one connection in this phase`
|
|
18948
|
+
);
|
|
18949
|
+
}
|
|
18950
|
+
const connection = connections[0];
|
|
18951
|
+
const remainingPoints = remainingPointsByConnection.get(connection);
|
|
18952
|
+
const startIndex = remainingPoints.findIndex(
|
|
18953
|
+
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
18954
|
+
);
|
|
18955
|
+
if (startIndex < 0)
|
|
18956
|
+
throw new Error(
|
|
18957
|
+
`Saved phase path "${path.connection}" starts at an endpoint already joined by another path`
|
|
18958
|
+
);
|
|
18959
|
+
const transform = getSavedPcbTracePathTransform(group, port);
|
|
18960
|
+
const route = path.route.map((point6) => ({
|
|
18961
|
+
...point6,
|
|
18962
|
+
...applyToPoint27(transform, point6)
|
|
18963
|
+
}));
|
|
18964
|
+
for (const point6 of route) {
|
|
18965
|
+
const layers = point6.route_type === "wire" ? [point6.layer] : [point6.from_layer, point6.to_layer];
|
|
18966
|
+
if (layers.some((layer) => !boardLayers.includes(layer))) {
|
|
18967
|
+
throw new Error(
|
|
18968
|
+
`Saved phase path "${path.connection}" uses a layer unavailable on this board`
|
|
18969
|
+
);
|
|
18970
|
+
}
|
|
18971
|
+
}
|
|
18972
|
+
const first = route[0];
|
|
18973
|
+
const last = route.at(-1);
|
|
18974
|
+
const firstLayer = first.route_type === "wire" ? first.layer : first.from_layer;
|
|
18975
|
+
const lastLayer = last.route_type === "wire" ? last.layer : last.to_layer;
|
|
18976
|
+
if (!touchesEndpoint(remainingPoints[startIndex], {
|
|
18977
|
+
...first,
|
|
18978
|
+
layer: firstLayer
|
|
18979
|
+
})) {
|
|
18980
|
+
throw new Error(
|
|
18981
|
+
`Saved phase path "${path.connection}" must start at its PCB port on an available layer`
|
|
18982
|
+
);
|
|
18983
|
+
}
|
|
18984
|
+
const endIndex = remainingPoints.findIndex(
|
|
18985
|
+
(point6, index) => index !== startIndex && touchesEndpoint(point6, { ...last, layer: lastLayer })
|
|
18986
|
+
);
|
|
18987
|
+
if (!input.allowViaInPad && (first.route_type === "via" || last.route_type === "via" && endIndex >= 0)) {
|
|
18988
|
+
throw new Error(
|
|
18989
|
+
`Saved phase path "${path.connection}" has a via at a pad; enable allowViaInPad`
|
|
18990
|
+
);
|
|
18991
|
+
}
|
|
18992
|
+
const pcbTraceId = `saved_phase_${group.pcb_group_id}_${phaseIndex ?? "default"}_${pathIndex}`;
|
|
18993
|
+
if (endIndex < 0 && !isFanout) {
|
|
18994
|
+
throw new Error(
|
|
18995
|
+
`Saved phase path "${path.connection}" must end at another connection endpoint; use autorouter="fanout" for saved escapes`
|
|
18996
|
+
);
|
|
18997
|
+
}
|
|
18998
|
+
if (endIndex >= 0) {
|
|
18999
|
+
remainingPoints.splice(startIndex, 1);
|
|
19000
|
+
} else {
|
|
19001
|
+
remainingPoints[startIndex] = {
|
|
19002
|
+
x: last.x,
|
|
19003
|
+
y: last.y,
|
|
19004
|
+
layer: lastLayer,
|
|
19005
|
+
pointId: `${pcbTraceId}_exit`
|
|
19006
|
+
};
|
|
19007
|
+
}
|
|
19008
|
+
const width = route.find((point6) => point6.route_type === "wire")?.width ?? input.minTraceWidth;
|
|
19009
|
+
const routeWithViaContacts = route.flatMap(
|
|
19010
|
+
(point6) => point6.route_type === "via" ? [
|
|
19011
|
+
{
|
|
19012
|
+
route_type: "wire",
|
|
19013
|
+
x: point6.x,
|
|
19014
|
+
y: point6.y,
|
|
19015
|
+
layer: point6.from_layer,
|
|
19016
|
+
width
|
|
19017
|
+
},
|
|
19018
|
+
point6,
|
|
19019
|
+
{
|
|
19020
|
+
route_type: "wire",
|
|
19021
|
+
x: point6.x,
|
|
19022
|
+
y: point6.y,
|
|
19023
|
+
layer: point6.to_layer,
|
|
19024
|
+
width
|
|
19025
|
+
}
|
|
19026
|
+
] : [point6]
|
|
19027
|
+
);
|
|
19028
|
+
if (last.route_type === "via") {
|
|
19029
|
+
routeWithViaContacts.push({
|
|
19030
|
+
route_type: "wire",
|
|
19031
|
+
x: last.x,
|
|
19032
|
+
y: last.y,
|
|
19033
|
+
layer: last.to_layer,
|
|
19034
|
+
width
|
|
19035
|
+
});
|
|
19036
|
+
}
|
|
19037
|
+
coveredConnections.add(connection);
|
|
19038
|
+
traces.push({
|
|
19039
|
+
type: "pcb_trace",
|
|
19040
|
+
pcb_trace_id: pcbTraceId,
|
|
19041
|
+
connection_name: connection.name,
|
|
19042
|
+
connectsTo: [
|
|
19043
|
+
connection.source_trace_id,
|
|
19044
|
+
...connection.pointsToConnect.map((point6) => point6.pointId)
|
|
19045
|
+
].filter((id) => Boolean(id)),
|
|
19046
|
+
route: routeWithViaContacts
|
|
19047
|
+
});
|
|
19048
|
+
}
|
|
19049
|
+
for (const connection of input.connections) {
|
|
19050
|
+
if (!coveredConnections.has(connection)) {
|
|
19051
|
+
throw new Error(
|
|
19052
|
+
`pcbTracePaths must cover every connection in the phase; missing: ${connection.name}`
|
|
19053
|
+
);
|
|
19054
|
+
}
|
|
19055
|
+
if (!isFanout && remainingPointsByConnection.get(connection).length > 1) {
|
|
19056
|
+
throw new Error(
|
|
19057
|
+
`Saved phase paths for "${connection.name}" must connect every endpoint; use autorouter="fanout" for saved escapes`
|
|
19058
|
+
);
|
|
19059
|
+
}
|
|
19060
|
+
}
|
|
19061
|
+
const remainingConnections = input.connections.flatMap((connection) => {
|
|
19062
|
+
const pointsToConnect = remainingPointsByConnection.get(connection);
|
|
19063
|
+
return pointsToConnect.length > 1 ? [{ ...connection, pointsToConnect }] : [];
|
|
19064
|
+
});
|
|
19065
|
+
const remainingConnectionNames = new Set(
|
|
19066
|
+
remainingConnections.map((connection) => connection.name)
|
|
19067
|
+
);
|
|
19068
|
+
return {
|
|
19069
|
+
traces,
|
|
19070
|
+
outputSimpleRouteJson: isFanout ? {
|
|
19071
|
+
...input,
|
|
19072
|
+
connections: remainingConnections,
|
|
19073
|
+
buses: input.buses?.map((bus) => ({
|
|
19074
|
+
...bus,
|
|
19075
|
+
connectionNames: bus.connectionNames.filter(
|
|
19076
|
+
(name) => remainingConnectionNames.has(name)
|
|
19077
|
+
)
|
|
19078
|
+
})).filter((bus) => bus.connectionNames.length > 0),
|
|
19079
|
+
differentialPairs: input.differentialPairs?.filter(
|
|
19080
|
+
(pair) => pair.connectionNames.every(
|
|
19081
|
+
(name) => remainingConnectionNames.has(name)
|
|
19082
|
+
)
|
|
19083
|
+
),
|
|
19084
|
+
traces: [...input.traces ?? [], ...traces]
|
|
19085
|
+
} : void 0
|
|
19086
|
+
};
|
|
19087
|
+
}
|
|
19088
|
+
|
|
19089
|
+
// lib/components/primitive-components/Group/get-autorouting-phase-pcb-trace-paths.ts
|
|
19090
|
+
var touches = (point6, terminal, end = false) => Math.hypot(point6.x - terminal.x, point6.y - terminal.y) < 1e-4 && (point6.route_type === "wire" ? point6.layer : end ? point6.to_layer : point6.from_layer) === terminal.layer;
|
|
19091
|
+
function getAutoroutingPhasePcbTracePaths({
|
|
19092
|
+
group,
|
|
19093
|
+
subcircuit,
|
|
19094
|
+
input,
|
|
19095
|
+
traces,
|
|
19096
|
+
isFanout
|
|
19097
|
+
}) {
|
|
19098
|
+
try {
|
|
19099
|
+
const portsByPcbPortId = new Map(
|
|
19100
|
+
subcircuit.selectAll("port").filter((port) => port.pcb_port_id).map((port) => [port.pcb_port_id, port])
|
|
19101
|
+
);
|
|
19102
|
+
const terminals = input.connections.flatMap(
|
|
19103
|
+
(connection) => connection.pointsToConnect
|
|
19104
|
+
);
|
|
19105
|
+
const routes = traces.map((trace) => {
|
|
19106
|
+
if (trace.route.length < 2 || trace.route.some(
|
|
19107
|
+
(point6) => point6.route_type !== "wire" && point6.route_type !== "via"
|
|
19108
|
+
)) {
|
|
19109
|
+
throw new Error("Only port-anchored wire/via routes can be saved");
|
|
19110
|
+
}
|
|
19111
|
+
return trace.route;
|
|
19112
|
+
});
|
|
19113
|
+
const endpoints = routes.map((route) => [
|
|
19114
|
+
terminals.filter((terminal) => touches(route[0], terminal)),
|
|
19115
|
+
terminals.filter((terminal) => touches(route.at(-1), terminal, true))
|
|
19116
|
+
]);
|
|
19117
|
+
const degreeByTerminal = /* @__PURE__ */ new Map();
|
|
19118
|
+
for (const routeEndpoints of endpoints) {
|
|
19119
|
+
for (const terminal of new Set(routeEndpoints.flat())) {
|
|
19120
|
+
degreeByTerminal.set(
|
|
19121
|
+
terminal,
|
|
19122
|
+
(degreeByTerminal.get(terminal) ?? 0) + 1
|
|
19123
|
+
);
|
|
19124
|
+
}
|
|
19125
|
+
}
|
|
19126
|
+
const paths = [];
|
|
19127
|
+
const usedPorts = /* @__PURE__ */ new Set();
|
|
19128
|
+
const remainingRoutes = new Set(routes.keys());
|
|
19129
|
+
while (remainingRoutes.size) {
|
|
19130
|
+
let exported = false;
|
|
19131
|
+
for (const routeIndex of remainingRoutes) {
|
|
19132
|
+
for (const reverse of [false, true]) {
|
|
19133
|
+
const candidates = endpoints[routeIndex][reverse ? 1 : 0];
|
|
19134
|
+
if (candidates.length !== 1) continue;
|
|
19135
|
+
const terminal = candidates[0];
|
|
19136
|
+
if (!terminal.pcb_port_id || degreeByTerminal.get(terminal) !== 1)
|
|
19137
|
+
continue;
|
|
19138
|
+
const port = portsByPcbPortId.get(terminal.pcb_port_id);
|
|
19139
|
+
if (!port || usedPorts.has(port)) continue;
|
|
19140
|
+
const selector = terminal.port_selector ?? port.getPortSelector();
|
|
19141
|
+
if (subcircuit.selectOne(selector, { type: "port" }) !== port) {
|
|
19142
|
+
throw new Error(`PCB port selector is not unique: ${selector}`);
|
|
19143
|
+
}
|
|
19144
|
+
const route = reverse ? routes[routeIndex].toReversed().map(
|
|
19145
|
+
(point6) => point6.route_type === "via" ? {
|
|
19146
|
+
...point6,
|
|
19147
|
+
from_layer: point6.to_layer,
|
|
19148
|
+
to_layer: point6.from_layer
|
|
19149
|
+
} : point6
|
|
19150
|
+
) : routes[routeIndex];
|
|
19151
|
+
const transform = inverse2(getSavedPcbTracePathTransform(group, port));
|
|
19152
|
+
paths.push(
|
|
19153
|
+
fanoutTracePath2.parse({
|
|
19154
|
+
connection: selector,
|
|
19155
|
+
route: route.map((point6) => ({
|
|
19156
|
+
...point6,
|
|
19157
|
+
...applyToPoint28(transform, point6)
|
|
19158
|
+
}))
|
|
19159
|
+
})
|
|
19160
|
+
);
|
|
19161
|
+
usedPorts.add(port);
|
|
19162
|
+
remainingRoutes.delete(routeIndex);
|
|
19163
|
+
for (const endpoint of new Set(endpoints[routeIndex].flat())) {
|
|
19164
|
+
degreeByTerminal.set(endpoint, degreeByTerminal.get(endpoint) - 1);
|
|
19165
|
+
}
|
|
19166
|
+
exported = true;
|
|
19167
|
+
break;
|
|
19168
|
+
}
|
|
19169
|
+
}
|
|
19170
|
+
if (!exported)
|
|
19171
|
+
throw new Error(
|
|
19172
|
+
"Routes contain a junction or endpoint that cannot select a unique PCB port"
|
|
19173
|
+
);
|
|
19174
|
+
}
|
|
19175
|
+
getSavedAutoroutingPhaseTracesFromPaths({
|
|
19176
|
+
group,
|
|
19177
|
+
subcircuit,
|
|
19178
|
+
paths,
|
|
19179
|
+
input,
|
|
19180
|
+
isFanout
|
|
19181
|
+
});
|
|
19182
|
+
return { pcbTracePaths: paths };
|
|
19183
|
+
} catch (error) {
|
|
19184
|
+
return {
|
|
19185
|
+
pcbTracePathsUnavailableReason: error instanceof Error ? error.message : String(error)
|
|
19186
|
+
};
|
|
19187
|
+
}
|
|
19188
|
+
}
|
|
19189
|
+
|
|
18878
19190
|
// lib/components/primitive-components/Group/Group.ts
|
|
18879
19191
|
import {
|
|
18880
19192
|
convertSrjToGraphicsObject,
|
|
@@ -51071,7 +51383,7 @@ import {
|
|
|
51071
51383
|
midpoint,
|
|
51072
51384
|
pointToSegmentClosestPoint as pointToSegmentClosestPoint2
|
|
51073
51385
|
} from "@tscircuit/math-utils";
|
|
51074
|
-
import { applyToPoint as
|
|
51386
|
+
import { applyToPoint as applyToPoint30, compose as compose11, scale as scale2, translate as translate9 } from "transformation-matrix";
|
|
51075
51387
|
|
|
51076
51388
|
// node_modules/@tscircuit/implicit-copper-pour-solver/lib/geometry.ts
|
|
51077
51389
|
import {
|
|
@@ -51087,10 +51399,10 @@ import {
|
|
|
51087
51399
|
segmentToSegmentMinDistance
|
|
51088
51400
|
} from "@tscircuit/math-utils";
|
|
51089
51401
|
import {
|
|
51090
|
-
applyToPoint as
|
|
51091
|
-
compose as
|
|
51402
|
+
applyToPoint as applyToPoint29,
|
|
51403
|
+
compose as compose10,
|
|
51092
51404
|
rotateDEG,
|
|
51093
|
-
translate as
|
|
51405
|
+
translate as translate8
|
|
51094
51406
|
} from "transformation-matrix";
|
|
51095
51407
|
var rectTransforms = /* @__PURE__ */ new WeakMap();
|
|
51096
51408
|
var getRectTransforms = (primitive) => {
|
|
@@ -51099,13 +51411,13 @@ var getRectTransforms = (primitive) => {
|
|
|
51099
51411
|
const transforms = {
|
|
51100
51412
|
// compose applies the rightmost operation first: move the world point to
|
|
51101
51413
|
// the rectangle origin, then undo its counter-clockwise rotation.
|
|
51102
|
-
toLocal:
|
|
51414
|
+
toLocal: compose10(
|
|
51103
51415
|
rotateDEG(-primitive.rotation),
|
|
51104
|
-
|
|
51416
|
+
translate8(-primitive.x, -primitive.y)
|
|
51105
51417
|
),
|
|
51106
51418
|
// Rotate a rectangle-local point before translating it into board space.
|
|
51107
|
-
toWorld:
|
|
51108
|
-
|
|
51419
|
+
toWorld: compose10(
|
|
51420
|
+
translate8(primitive.x, primitive.y),
|
|
51109
51421
|
rotateDEG(primitive.rotation)
|
|
51110
51422
|
)
|
|
51111
51423
|
};
|
|
@@ -51141,7 +51453,7 @@ var distanceToPrimitive = (primitive, px, py) => {
|
|
|
51141
51453
|
return distanceToPolygon(point6, primitive.points);
|
|
51142
51454
|
}
|
|
51143
51455
|
const { toLocal } = getRectTransforms(primitive);
|
|
51144
|
-
return pointToBoxDistance(
|
|
51456
|
+
return pointToBoxDistance(applyToPoint29(toLocal, point6), {
|
|
51145
51457
|
center: { x: 0, y: 0 },
|
|
51146
51458
|
width: primitive.halfWidth * 2,
|
|
51147
51459
|
height: primitive.halfHeight * 2
|
|
@@ -51185,8 +51497,8 @@ var getClosestPointOnPrimitive = (primitive, point6) => {
|
|
|
51185
51497
|
return closestPoint;
|
|
51186
51498
|
}
|
|
51187
51499
|
const { toLocal, toWorld } = getRectTransforms(primitive);
|
|
51188
|
-
const localPoint =
|
|
51189
|
-
return
|
|
51500
|
+
const localPoint = applyToPoint29(toLocal, point6);
|
|
51501
|
+
return applyToPoint29(toWorld, {
|
|
51190
51502
|
x: clamp(localPoint.x, -primitive.halfWidth, primitive.halfWidth),
|
|
51191
51503
|
y: clamp(localPoint.y, -primitive.halfHeight, primitive.halfHeight)
|
|
51192
51504
|
});
|
|
@@ -51777,8 +52089,8 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
51777
52089
|
1,
|
|
51778
52090
|
Math.round(problem.minRegionArea / problem.gridPitch ** 2)
|
|
51779
52091
|
);
|
|
51780
|
-
const gridVertexToWorld =
|
|
51781
|
-
|
|
52092
|
+
const gridVertexToWorld = compose11(
|
|
52093
|
+
translate9(problem.bounds.minX, problem.bounds.minY),
|
|
51782
52094
|
scale2(problem.gridPitch)
|
|
51783
52095
|
);
|
|
51784
52096
|
for (const labeledLayer of problem.labeledLayers) {
|
|
@@ -51797,7 +52109,7 @@ var buildPowerPourPolygons = (problem) => {
|
|
|
51797
52109
|
}
|
|
51798
52110
|
const loop = loops[0];
|
|
51799
52111
|
const points = loop.map(([i, j]) => {
|
|
51800
|
-
const point6 =
|
|
52112
|
+
const point6 = applyToPoint30(gridVertexToWorld, { x: i, y: j });
|
|
51801
52113
|
return {
|
|
51802
52114
|
x: clamp2(point6.x, problem.bounds.minX, problem.bounds.maxX),
|
|
51803
52115
|
y: clamp2(point6.y, problem.bounds.minY, problem.bounds.maxY)
|
|
@@ -51833,9 +52145,9 @@ import {
|
|
|
51833
52145
|
} from "circuit-json-to-connectivity-map";
|
|
51834
52146
|
import {
|
|
51835
52147
|
applyToPoints,
|
|
51836
|
-
compose as
|
|
52148
|
+
compose as compose12,
|
|
51837
52149
|
rotateDEG as rotateDEG2,
|
|
51838
|
-
translate as
|
|
52150
|
+
translate as translate10
|
|
51839
52151
|
} from "transformation-matrix";
|
|
51840
52152
|
var DEFAULT_GRID_PITCH = 0.25;
|
|
51841
52153
|
var DEFAULT_TRACE_CLEARANCE = 0.2;
|
|
@@ -51863,8 +52175,8 @@ var addPillPrimitive = (primitives, params) => {
|
|
|
51863
52175
|
const radius = Math.min(width, height) / 2;
|
|
51864
52176
|
const axisLength = Math.max(width, height) - radius * 2;
|
|
51865
52177
|
const halfAxis = axisLength / 2;
|
|
51866
|
-
const axisToWorld =
|
|
51867
|
-
|
|
52178
|
+
const axisToWorld = compose12(
|
|
52179
|
+
translate10(x, y),
|
|
51868
52180
|
rotateDEG2(rotation5 + (height > width ? 90 : 0))
|
|
51869
52181
|
);
|
|
51870
52182
|
const [start, end] = applyToPoints(axisToWorld, [
|
|
@@ -54003,7 +54315,7 @@ var applyEditEventsToManualEditsFile = ({
|
|
|
54003
54315
|
|
|
54004
54316
|
// lib/utils/edit-events/apply-edit-events-to-circuit-json.ts
|
|
54005
54317
|
import { transformPCBElement } from "@tscircuit/circuit-json-util";
|
|
54006
|
-
import { translate as
|
|
54318
|
+
import { translate as translate11 } from "transformation-matrix";
|
|
54007
54319
|
|
|
54008
54320
|
// lib/utils/edit-events/apply-trace-hint-edit-event.ts
|
|
54009
54321
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
@@ -54048,7 +54360,7 @@ var applyEditEvents = ({
|
|
|
54048
54360
|
);
|
|
54049
54361
|
const needsMovement = !component || component.center.x !== editEvent.new_center.x || component.center.y !== editEvent.new_center.y;
|
|
54050
54362
|
if (needsMovement && editEvent.original_center) {
|
|
54051
|
-
const mat =
|
|
54363
|
+
const mat = translate11(
|
|
54052
54364
|
editEvent.new_center.x - editEvent.original_center.x,
|
|
54053
54365
|
editEvent.new_center.y - editEvent.original_center.y
|
|
54054
54366
|
);
|
|
@@ -55553,7 +55865,7 @@ import "zod";
|
|
|
55553
55865
|
|
|
55554
55866
|
// lib/components/primitive-components/TraceHint.ts
|
|
55555
55867
|
import { traceHintProps } from "@tscircuit/props";
|
|
55556
|
-
import { applyToPoint as
|
|
55868
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
55557
55869
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
55558
55870
|
matchedPort = null;
|
|
55559
55871
|
get config() {
|
|
@@ -55593,7 +55905,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
55593
55905
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
55594
55906
|
return offsets.map(
|
|
55595
55907
|
(offset) => ({
|
|
55596
|
-
...
|
|
55908
|
+
...applyToPoint31(globalTransform, offset),
|
|
55597
55909
|
via: offset.via,
|
|
55598
55910
|
to_layer: offset.to_layer,
|
|
55599
55911
|
trace_width: offset.trace_width
|
|
@@ -57106,7 +57418,7 @@ import {
|
|
|
57106
57418
|
transformPCBElements as transformPCBElements2
|
|
57107
57419
|
} from "@tscircuit/circuit-json-util";
|
|
57108
57420
|
import { normalizeDegrees as normalizeDegrees7 } from "@tscircuit/math-utils";
|
|
57109
|
-
import { compose as
|
|
57421
|
+
import { compose as compose13, rotate as rotate6, translate as translate12 } from "transformation-matrix";
|
|
57110
57422
|
var updateCadRotation = ({
|
|
57111
57423
|
db,
|
|
57112
57424
|
pcbComponentId,
|
|
@@ -57158,11 +57470,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
57158
57470
|
const member = db.pcb_component.get(memberId);
|
|
57159
57471
|
if (!member) continue;
|
|
57160
57472
|
const originalCenter2 = member.center;
|
|
57161
|
-
const transformMatrix2 =
|
|
57473
|
+
const transformMatrix2 = compose13(
|
|
57162
57474
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
57163
|
-
|
|
57475
|
+
translate12(center.x + rotatedRel.x, center.y + rotatedRel.y),
|
|
57164
57476
|
rotate6(angleRad),
|
|
57165
|
-
|
|
57477
|
+
translate12(-originalCenter2.x, -originalCenter2.y)
|
|
57166
57478
|
);
|
|
57167
57479
|
const related = db.toArray().filter(
|
|
57168
57480
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === memberId
|
|
@@ -57192,11 +57504,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
57192
57504
|
}
|
|
57193
57505
|
const originalCenter2 = pcbComponent.center;
|
|
57194
57506
|
const rotationDegrees2 = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
57195
|
-
const transformMatrix2 =
|
|
57507
|
+
const transformMatrix2 = compose13(
|
|
57196
57508
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
57197
|
-
|
|
57509
|
+
translate12(center.x, center.y),
|
|
57198
57510
|
rotate6(rotationDegrees2 * Math.PI / 180),
|
|
57199
|
-
|
|
57511
|
+
translate12(-originalCenter2.x, -originalCenter2.y)
|
|
57200
57512
|
);
|
|
57201
57513
|
const related = db.toArray().filter(
|
|
57202
57514
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
@@ -57217,11 +57529,11 @@ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
|
|
|
57217
57529
|
);
|
|
57218
57530
|
const originalCenter = initialPackedComponent?.center ?? pcbGroup.center;
|
|
57219
57531
|
const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
|
|
57220
|
-
const transformMatrix =
|
|
57532
|
+
const transformMatrix = compose13(
|
|
57221
57533
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
57222
|
-
|
|
57534
|
+
translate12(center.x, center.y),
|
|
57223
57535
|
rotate6(rotationDegrees * Math.PI / 180),
|
|
57224
|
-
|
|
57536
|
+
translate12(-originalCenter.x, -originalCenter.y)
|
|
57225
57537
|
);
|
|
57226
57538
|
const relatedElements = db.toArray().filter((elm) => {
|
|
57227
57539
|
if ("source_group_id" in elm && elm.source_group_id) {
|
|
@@ -59599,9 +59911,9 @@ import Debug13 from "debug";
|
|
|
59599
59911
|
// lib/components/primitive-components/NetLabel.ts
|
|
59600
59912
|
import { netLabelProps } from "@tscircuit/props";
|
|
59601
59913
|
import {
|
|
59602
|
-
applyToPoint as
|
|
59914
|
+
applyToPoint as applyToPoint32,
|
|
59603
59915
|
identity as identity7,
|
|
59604
|
-
translate as
|
|
59916
|
+
translate as translate13
|
|
59605
59917
|
} from "transformation-matrix";
|
|
59606
59918
|
import { calculateElbow as calculateElbow2 } from "calculate-elbow";
|
|
59607
59919
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
@@ -59664,11 +59976,11 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
59664
59976
|
const connectedPorts = this._getConnectedPorts();
|
|
59665
59977
|
if (connectedPorts.length > 0) {
|
|
59666
59978
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
59667
|
-
const parentCenter =
|
|
59979
|
+
const parentCenter = applyToPoint32(
|
|
59668
59980
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity7(),
|
|
59669
59981
|
{ x: 0, y: 0 }
|
|
59670
59982
|
);
|
|
59671
|
-
return
|
|
59983
|
+
return translate13(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
59672
59984
|
}
|
|
59673
59985
|
}
|
|
59674
59986
|
return super.computeSchematicPropsTransform();
|
|
@@ -63205,190 +63517,8 @@ var Group_getFanoutPourNetMap = (group, routingPhasePlans) => {
|
|
|
63205
63517
|
// lib/components/primitive-components/Group/Group_getRoutingPhasePlans.ts
|
|
63206
63518
|
import { getBoundsFromPoints as getBoundsFromPoints8 } from "@tscircuit/math-utils";
|
|
63207
63519
|
|
|
63208
|
-
// lib/components/primitive-components/Group/get-saved-autorouting-phase-traces.ts
|
|
63209
|
-
import { applyToPoint as applyToPoint31, compose as compose13, translate as translate13 } from "transformation-matrix";
|
|
63210
|
-
var touchesEndpoint = (point6, endpoint) => Math.hypot(point6.x - endpoint.x, point6.y - endpoint.y) < 1e-4 && point6.layer === endpoint.layer;
|
|
63211
|
-
function getSavedAutoroutingPhaseTraces(phase, input, isFanout) {
|
|
63212
|
-
const group = phase.getGroup();
|
|
63213
|
-
const transformBeforeLayout = group._computePcbGlobalTransformBeforeLayout();
|
|
63214
|
-
const boardLayers = getViaBoardLayers(input.layerCount);
|
|
63215
|
-
const remainingPointsByConnection = new Map(
|
|
63216
|
-
input.connections.map((connection) => [
|
|
63217
|
-
connection,
|
|
63218
|
-
[...connection.pointsToConnect]
|
|
63219
|
-
])
|
|
63220
|
-
);
|
|
63221
|
-
const coveredConnections = /* @__PURE__ */ new Set();
|
|
63222
|
-
const savedPorts = /* @__PURE__ */ new Set();
|
|
63223
|
-
const traces = [];
|
|
63224
|
-
for (const [pathIndex, path] of (phase._parsedProps.pcbTracePaths ?? []).entries()) {
|
|
63225
|
-
const port = phase.getSubcircuit().selectOne(path.connection, { type: "port" });
|
|
63226
|
-
if (!port)
|
|
63227
|
-
throw new Error(
|
|
63228
|
-
`Saved phase path "${path.connection}" must select a PCB port`
|
|
63229
|
-
);
|
|
63230
|
-
if (savedPorts.has(port))
|
|
63231
|
-
throw new Error(`Duplicate saved phase path for "${path.connection}"`);
|
|
63232
|
-
savedPorts.add(port);
|
|
63233
|
-
const connections = input.connections.filter(
|
|
63234
|
-
(connection2) => connection2.pointsToConnect.some(
|
|
63235
|
-
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
63236
|
-
)
|
|
63237
|
-
);
|
|
63238
|
-
if (connections.length !== 1) {
|
|
63239
|
-
throw new Error(
|
|
63240
|
-
`Saved phase path "${path.connection}" must select exactly one connection in this phase`
|
|
63241
|
-
);
|
|
63242
|
-
}
|
|
63243
|
-
const connection = connections[0];
|
|
63244
|
-
const remainingPoints = remainingPointsByConnection.get(connection);
|
|
63245
|
-
const startIndex = remainingPoints.findIndex(
|
|
63246
|
-
(point6) => point6.pcb_port_id === port.pcb_port_id
|
|
63247
|
-
);
|
|
63248
|
-
if (startIndex < 0)
|
|
63249
|
-
throw new Error(
|
|
63250
|
-
`Saved phase path "${path.connection}" starts at an endpoint already joined by another path`
|
|
63251
|
-
);
|
|
63252
|
-
const portBeforeLayout = port._getGlobalPcbPositionBeforeLayout();
|
|
63253
|
-
const portAfterLayout = port._getGlobalPcbPositionAfterLayout();
|
|
63254
|
-
const transform = compose13(
|
|
63255
|
-
translate13(
|
|
63256
|
-
portAfterLayout.x - portBeforeLayout.x,
|
|
63257
|
-
portAfterLayout.y - portBeforeLayout.y
|
|
63258
|
-
),
|
|
63259
|
-
transformBeforeLayout
|
|
63260
|
-
);
|
|
63261
|
-
const route = path.route.map((point6) => ({
|
|
63262
|
-
...point6,
|
|
63263
|
-
...applyToPoint31(transform, point6)
|
|
63264
|
-
}));
|
|
63265
|
-
for (const point6 of route) {
|
|
63266
|
-
const layers = point6.route_type === "wire" ? [point6.layer] : [point6.from_layer, point6.to_layer];
|
|
63267
|
-
if (layers.some((layer) => !boardLayers.includes(layer))) {
|
|
63268
|
-
throw new Error(
|
|
63269
|
-
`Saved phase path "${path.connection}" uses a layer unavailable on this board`
|
|
63270
|
-
);
|
|
63271
|
-
}
|
|
63272
|
-
}
|
|
63273
|
-
const first = route[0];
|
|
63274
|
-
const last = route.at(-1);
|
|
63275
|
-
const firstLayer = first.route_type === "wire" ? first.layer : first.from_layer;
|
|
63276
|
-
const lastLayer = last.route_type === "wire" ? last.layer : last.to_layer;
|
|
63277
|
-
if (!touchesEndpoint(remainingPoints[startIndex], {
|
|
63278
|
-
...first,
|
|
63279
|
-
layer: firstLayer
|
|
63280
|
-
})) {
|
|
63281
|
-
throw new Error(
|
|
63282
|
-
`Saved phase path "${path.connection}" must start at its PCB port on an available layer`
|
|
63283
|
-
);
|
|
63284
|
-
}
|
|
63285
|
-
const endIndex = remainingPoints.findIndex(
|
|
63286
|
-
(point6, index) => index !== startIndex && touchesEndpoint(point6, { ...last, layer: lastLayer })
|
|
63287
|
-
);
|
|
63288
|
-
if (!input.allowViaInPad && (first.route_type === "via" || last.route_type === "via" && endIndex >= 0)) {
|
|
63289
|
-
throw new Error(
|
|
63290
|
-
`Saved phase path "${path.connection}" has a via at a pad; enable allowViaInPad`
|
|
63291
|
-
);
|
|
63292
|
-
}
|
|
63293
|
-
const pcbTraceId = `saved_phase_${group.pcb_group_id}_${phase._parsedProps.phaseIndex ?? "default"}_${pathIndex}`;
|
|
63294
|
-
if (endIndex < 0 && !isFanout) {
|
|
63295
|
-
throw new Error(
|
|
63296
|
-
`Saved phase path "${path.connection}" must end at another connection endpoint; use autorouter="fanout" for saved escapes`
|
|
63297
|
-
);
|
|
63298
|
-
}
|
|
63299
|
-
if (endIndex >= 0) {
|
|
63300
|
-
remainingPoints.splice(startIndex, 1);
|
|
63301
|
-
} else {
|
|
63302
|
-
remainingPoints[startIndex] = {
|
|
63303
|
-
x: last.x,
|
|
63304
|
-
y: last.y,
|
|
63305
|
-
layer: lastLayer,
|
|
63306
|
-
pointId: `${pcbTraceId}_exit`
|
|
63307
|
-
};
|
|
63308
|
-
}
|
|
63309
|
-
const width = route.find((point6) => point6.route_type === "wire")?.width ?? input.minTraceWidth;
|
|
63310
|
-
const routeWithViaContacts = route.flatMap(
|
|
63311
|
-
(point6) => point6.route_type === "via" ? [
|
|
63312
|
-
{
|
|
63313
|
-
route_type: "wire",
|
|
63314
|
-
x: point6.x,
|
|
63315
|
-
y: point6.y,
|
|
63316
|
-
layer: point6.from_layer,
|
|
63317
|
-
width
|
|
63318
|
-
},
|
|
63319
|
-
point6,
|
|
63320
|
-
{
|
|
63321
|
-
route_type: "wire",
|
|
63322
|
-
x: point6.x,
|
|
63323
|
-
y: point6.y,
|
|
63324
|
-
layer: point6.to_layer,
|
|
63325
|
-
width
|
|
63326
|
-
}
|
|
63327
|
-
] : [point6]
|
|
63328
|
-
);
|
|
63329
|
-
if (last.route_type === "via") {
|
|
63330
|
-
routeWithViaContacts.push({
|
|
63331
|
-
route_type: "wire",
|
|
63332
|
-
x: last.x,
|
|
63333
|
-
y: last.y,
|
|
63334
|
-
layer: last.to_layer,
|
|
63335
|
-
width
|
|
63336
|
-
});
|
|
63337
|
-
}
|
|
63338
|
-
coveredConnections.add(connection);
|
|
63339
|
-
traces.push({
|
|
63340
|
-
type: "pcb_trace",
|
|
63341
|
-
pcb_trace_id: pcbTraceId,
|
|
63342
|
-
connection_name: connection.name,
|
|
63343
|
-
connectsTo: [
|
|
63344
|
-
connection.source_trace_id,
|
|
63345
|
-
...connection.pointsToConnect.map((point6) => point6.pointId)
|
|
63346
|
-
].filter((id) => Boolean(id)),
|
|
63347
|
-
route: routeWithViaContacts
|
|
63348
|
-
});
|
|
63349
|
-
}
|
|
63350
|
-
for (const connection of input.connections) {
|
|
63351
|
-
if (!coveredConnections.has(connection)) {
|
|
63352
|
-
throw new Error(
|
|
63353
|
-
`pcbTracePaths must cover every connection in the phase; missing: ${connection.name}`
|
|
63354
|
-
);
|
|
63355
|
-
}
|
|
63356
|
-
if (!isFanout && remainingPointsByConnection.get(connection).length > 1) {
|
|
63357
|
-
throw new Error(
|
|
63358
|
-
`Saved phase paths for "${connection.name}" must connect every endpoint; use autorouter="fanout" for saved escapes`
|
|
63359
|
-
);
|
|
63360
|
-
}
|
|
63361
|
-
}
|
|
63362
|
-
const remainingConnections = input.connections.flatMap((connection) => {
|
|
63363
|
-
const pointsToConnect = remainingPointsByConnection.get(connection);
|
|
63364
|
-
return pointsToConnect.length > 1 ? [{ ...connection, pointsToConnect }] : [];
|
|
63365
|
-
});
|
|
63366
|
-
const remainingConnectionNames = new Set(
|
|
63367
|
-
remainingConnections.map((connection) => connection.name)
|
|
63368
|
-
);
|
|
63369
|
-
return {
|
|
63370
|
-
traces,
|
|
63371
|
-
outputSimpleRouteJson: isFanout ? {
|
|
63372
|
-
...input,
|
|
63373
|
-
connections: remainingConnections,
|
|
63374
|
-
buses: input.buses?.map((bus) => ({
|
|
63375
|
-
...bus,
|
|
63376
|
-
connectionNames: bus.connectionNames.filter(
|
|
63377
|
-
(name) => remainingConnectionNames.has(name)
|
|
63378
|
-
)
|
|
63379
|
-
})).filter((bus) => bus.connectionNames.length > 0),
|
|
63380
|
-
differentialPairs: input.differentialPairs?.filter(
|
|
63381
|
-
(pair) => pair.connectionNames.every(
|
|
63382
|
-
(name) => remainingConnectionNames.has(name)
|
|
63383
|
-
)
|
|
63384
|
-
),
|
|
63385
|
-
traces: [...input.traces ?? [], ...traces]
|
|
63386
|
-
} : void 0
|
|
63387
|
-
};
|
|
63388
|
-
}
|
|
63389
|
-
|
|
63390
63520
|
// lib/components/primitive-components/Breakout/get-saved-fanout-traces.ts
|
|
63391
|
-
import { applyToPoint as
|
|
63521
|
+
import { applyToPoint as applyToPoint33, compose as compose14, translate as translate14 } from "transformation-matrix";
|
|
63392
63522
|
|
|
63393
63523
|
// lib/components/primitive-components/BreakoutPoint.ts
|
|
63394
63524
|
import { breakoutPointProps } from "@tscircuit/props";
|
|
@@ -63556,9 +63686,9 @@ function getSavedFanoutTraces(breakout, input) {
|
|
|
63556
63686
|
exit._computePcbGlobalTransformBeforeLayout(),
|
|
63557
63687
|
translate14(-localExit.x, -localExit.y)
|
|
63558
63688
|
);
|
|
63559
|
-
const originalExit =
|
|
63689
|
+
const originalExit = applyToPoint33(transform, localExit);
|
|
63560
63690
|
const route = path.route.map((point6) => {
|
|
63561
|
-
const position =
|
|
63691
|
+
const position = applyToPoint33(transform, point6);
|
|
63562
63692
|
return {
|
|
63563
63693
|
...point6,
|
|
63564
63694
|
x: position.x + pcbExit.x - originalExit.x,
|
|
@@ -63908,9 +64038,10 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
63908
64038
|
for (const phase of group.selectAll(
|
|
63909
64039
|
"autoroutingphase"
|
|
63910
64040
|
)) {
|
|
63911
|
-
if (phase._parsedProps.pcbTracePaths === void 0) continue;
|
|
63912
64041
|
const plan = plansByPhaseIndex.get(phase._parsedProps.phaseIndex ?? null);
|
|
63913
64042
|
if (!plan) continue;
|
|
64043
|
+
plan.autoroutingPhase = phase;
|
|
64044
|
+
if (phase._parsedProps.pcbTracePaths === void 0) continue;
|
|
63914
64045
|
const config = plan.autorouter !== void 0 ? getPresetAutoroutingConfig(plan.autorouter, group.root?.platform) : group._getAutorouterConfig();
|
|
63915
64046
|
const isFanout = ["fanout", "single_layer_fanout"].includes(
|
|
63916
64047
|
config.preset ?? ""
|
|
@@ -64031,7 +64162,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
64031
64162
|
var package_default = {
|
|
64032
64163
|
name: "@tscircuit/core",
|
|
64033
64164
|
type: "module",
|
|
64034
|
-
version: "0.0.
|
|
64165
|
+
version: "0.0.2000",
|
|
64035
64166
|
types: "dist/index.d.ts",
|
|
64036
64167
|
main: "dist/index.js",
|
|
64037
64168
|
module: "dist/index.js",
|
|
@@ -66446,7 +66577,17 @@ var Group5 = class extends NormalComponent {
|
|
|
66446
66577
|
}
|
|
66447
66578
|
});
|
|
66448
66579
|
}
|
|
66580
|
+
const savedPhasePaths = getAutoroutingPhasePcbTracePaths({
|
|
66581
|
+
group: routingPhasePlan.autoroutingPhase?.getGroup() ?? this,
|
|
66582
|
+
subcircuit: this,
|
|
66583
|
+
input: simpleRouteJson,
|
|
66584
|
+
traces,
|
|
66585
|
+
isFanout: ["fanout", "single_layer_fanout"].includes(
|
|
66586
|
+
phaseAutorouterConfig.preset ?? ""
|
|
66587
|
+
)
|
|
66588
|
+
});
|
|
66449
66589
|
this.root?.emit("autorouting:end", {
|
|
66590
|
+
...savedPhasePaths,
|
|
66450
66591
|
type: "autorouting:end",
|
|
66451
66592
|
subcircuit_id: this.subcircuit_id,
|
|
66452
66593
|
componentDisplayName: this.getString(),
|
|
@@ -67335,7 +67476,7 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
|
|
|
67335
67476
|
import { ledProps } from "@tscircuit/props";
|
|
67336
67477
|
|
|
67337
67478
|
// lib/components/normal-components/Led_addPolarityFabricationSymbol.ts
|
|
67338
|
-
import { applyToPoint as
|
|
67479
|
+
import { applyToPoint as applyToPoint34, compose as compose15, rotate as rotate7, translate as translate15 } from "transformation-matrix";
|
|
67339
67480
|
var generatedNotes = /* @__PURE__ */ new WeakMap();
|
|
67340
67481
|
var getPolarity2 = (port) => {
|
|
67341
67482
|
const hints = [port.name, ...port.port_hints ?? []].map(
|
|
@@ -67380,7 +67521,7 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
67380
67521
|
translate15((a.x + k.x) / 2, (a.y + k.y) / 2),
|
|
67381
67522
|
rotate7(angle)
|
|
67382
67523
|
);
|
|
67383
|
-
const point6 = (x, y) =>
|
|
67524
|
+
const point6 = (x, y) => applyToPoint34(frame, { x, y });
|
|
67384
67525
|
const common = {
|
|
67385
67526
|
pcb_component_id: pcb.pcb_component_id,
|
|
67386
67527
|
subcircuit_id: led.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
@@ -72493,7 +72634,7 @@ var AutoroutingPhase = class extends PrimitiveComponent2 {
|
|
|
72493
72634
|
|
|
72494
72635
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
72495
72636
|
import { fabricationNoteDimensionProps } from "@tscircuit/props";
|
|
72496
|
-
import { applyToPoint as
|
|
72637
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
72497
72638
|
var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
72498
72639
|
fabrication_note_dimension_id = null;
|
|
72499
72640
|
isPcbPrimitive = true;
|
|
@@ -72512,13 +72653,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72512
72653
|
this.renderError(
|
|
72513
72654
|
`FabricationNoteDimension could not find selector "${input}"`
|
|
72514
72655
|
);
|
|
72515
|
-
return
|
|
72656
|
+
return applyToPoint35(transform, { x: 0, y: 0 });
|
|
72516
72657
|
}
|
|
72517
72658
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
72518
72659
|
}
|
|
72519
72660
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
72520
72661
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
72521
|
-
return
|
|
72662
|
+
return applyToPoint35(transform, { x: numericX, y: numericY });
|
|
72522
72663
|
}
|
|
72523
72664
|
doInitialPcbPrimitiveRender() {
|
|
72524
72665
|
if (this.root?.pcbDisabled) return;
|
|
@@ -72613,7 +72754,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72613
72754
|
|
|
72614
72755
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
72615
72756
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
72616
|
-
import { applyToPoint as
|
|
72757
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
72617
72758
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
72618
72759
|
pcb_note_dimension_id = null;
|
|
72619
72760
|
isPcbPrimitive = true;
|
|
@@ -72630,7 +72771,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72630
72771
|
);
|
|
72631
72772
|
if (!target) {
|
|
72632
72773
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
72633
|
-
return
|
|
72774
|
+
return applyToPoint36(transform, { x: 0, y: 0 });
|
|
72634
72775
|
}
|
|
72635
72776
|
const targetPcbComponentId = target.pcb_component_id;
|
|
72636
72777
|
const root = this.root;
|
|
@@ -72647,7 +72788,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
72647
72788
|
}
|
|
72648
72789
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
72649
72790
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
72650
|
-
return
|
|
72791
|
+
return applyToPoint36(transform, { x: numericX, y: numericY });
|
|
72651
72792
|
}
|
|
72652
72793
|
doInitialPcbPrimitiveRender() {
|
|
72653
72794
|
if (this.root?.pcbDisabled) return;
|
|
@@ -75398,7 +75539,7 @@ import {
|
|
|
75398
75539
|
getTransformedSvgPathRoutes,
|
|
75399
75540
|
loadImageSource
|
|
75400
75541
|
} from "@tscircuit/image-utils";
|
|
75401
|
-
import { applyToPoint as
|
|
75542
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
75402
75543
|
var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
75403
75544
|
pcb_silkscreen_graphic_id = null;
|
|
75404
75545
|
pcb_silkscreen_graphic_ids = [];
|
|
@@ -75500,7 +75641,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
75500
75641
|
{ x: halfWidth, y: -halfHeight },
|
|
75501
75642
|
{ x: -halfWidth, y: -halfHeight }
|
|
75502
75643
|
]).map(
|
|
75503
|
-
(point6) =>
|
|
75644
|
+
(point6) => applyToPoint37(transform, point6)
|
|
75504
75645
|
)
|
|
75505
75646
|
},
|
|
75506
75647
|
inner_rings: []
|
|
@@ -78444,7 +78585,7 @@ var SpiceModel = class extends PrimitiveComponent2 {
|
|
|
78444
78585
|
|
|
78445
78586
|
// lib/components/primitive-components/PcbBend.ts
|
|
78446
78587
|
import { pcbBendProps } from "@tscircuit/props";
|
|
78447
|
-
import { applyToPoint as
|
|
78588
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
78448
78589
|
|
|
78449
78590
|
// lib/components/primitive-components/getPcbFlexBoardTransform.ts
|
|
78450
78591
|
import { compose as compose18, translate as translate18 } from "transformation-matrix";
|
|
@@ -78477,8 +78618,8 @@ var PcbBend = class extends PrimitiveComponent2 {
|
|
|
78477
78618
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
78478
78619
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
78479
78620
|
name: props.name,
|
|
78480
|
-
start:
|
|
78481
|
-
end:
|
|
78621
|
+
start: applyToPoint38(transform, { x: props.x1, y: props.y1 }),
|
|
78622
|
+
end: applyToPoint38(transform, { x: props.x2, y: props.y2 }),
|
|
78482
78623
|
bend_angle: props.bendAngle,
|
|
78483
78624
|
bend_radius: props.bendRadius,
|
|
78484
78625
|
bend_side: props.bendSide
|
|
@@ -78493,7 +78634,7 @@ var PcbBend = class extends PrimitiveComponent2 {
|
|
|
78493
78634
|
|
|
78494
78635
|
// lib/components/primitive-components/PcbStiffener.ts
|
|
78495
78636
|
import { pcbStiffenerProps } from "@tscircuit/props";
|
|
78496
|
-
import { applyToPoint as
|
|
78637
|
+
import { applyToPoint as applyToPoint39, decomposeTSR as decomposeTSR10 } from "transformation-matrix";
|
|
78497
78638
|
var PcbStiffener = class extends PrimitiveComponent2 {
|
|
78498
78639
|
pcb_stiffener_id = null;
|
|
78499
78640
|
get config() {
|
|
@@ -78516,14 +78657,14 @@ var PcbStiffener = class extends PrimitiveComponent2 {
|
|
|
78516
78657
|
};
|
|
78517
78658
|
const geometry = props.shape === "rect" ? {
|
|
78518
78659
|
shape: "rect",
|
|
78519
|
-
center:
|
|
78660
|
+
center: applyToPoint39(transform, { x: 0, y: 0 }),
|
|
78520
78661
|
rotation: decomposeTSR10(transform).rotation.angle * 180 / Math.PI,
|
|
78521
78662
|
width: props.width,
|
|
78522
78663
|
height: props.height
|
|
78523
78664
|
} : {
|
|
78524
78665
|
shape: "polygon",
|
|
78525
78666
|
outline: props.outline.map(
|
|
78526
|
-
(point6) =>
|
|
78667
|
+
(point6) => applyToPoint39(transform, point6)
|
|
78527
78668
|
)
|
|
78528
78669
|
};
|
|
78529
78670
|
this.pcb_stiffener_id = db.pcb_stiffener.insert({
|
|
@@ -78825,7 +78966,7 @@ extendCatalogue({
|
|
|
78825
78966
|
});
|
|
78826
78967
|
|
|
78827
78968
|
// lib/index.ts
|
|
78828
|
-
import { fanoutTracePath } from "@tscircuit/props";
|
|
78969
|
+
import { fanoutTracePath as fanoutTracePath3 } from "@tscircuit/props";
|
|
78829
78970
|
export {
|
|
78830
78971
|
Ammeter,
|
|
78831
78972
|
AnalogAcSweepSimulation,
|
|
@@ -78955,7 +79096,7 @@ export {
|
|
|
78955
79096
|
createElement2 as createElement,
|
|
78956
79097
|
createUseComponent,
|
|
78957
79098
|
enclosure,
|
|
78958
|
-
fanoutTracePath,
|
|
79099
|
+
fanoutTracePath3 as fanoutTracePath,
|
|
78959
79100
|
getPhaseTimingsFromRenderEvents,
|
|
78960
79101
|
getSimpleRouteJsonFromCircuitJson,
|
|
78961
79102
|
kicadFootprintStrings,
|