@tscircuit/core 0.0.2164 → 0.0.2166
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 +302 -115
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7501,10 +7501,10 @@ function addTraceTeardrops(route, contacts) {
|
|
|
7501
7501
|
result.push(start);
|
|
7502
7502
|
continue;
|
|
7503
7503
|
}
|
|
7504
|
-
const atDistance = (
|
|
7504
|
+
const atDistance = (distance28) => ({
|
|
7505
7505
|
route_type: "wire",
|
|
7506
|
-
x: start.x + (end.x - start.x) *
|
|
7507
|
-
y: start.y + (end.y - start.y) *
|
|
7506
|
+
x: start.x + (end.x - start.x) * distance28 / length8,
|
|
7507
|
+
y: start.y + (end.y - start.y) * distance28 / length8,
|
|
7508
7508
|
width: start.width,
|
|
7509
7509
|
layer: start.layer
|
|
7510
7510
|
});
|
|
@@ -8210,11 +8210,11 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
8210
8210
|
const closestNetBPort = getClosest(netAPort, netBPorts);
|
|
8211
8211
|
const netAPortPosition = netAPort._getGlobalPcbPositionBeforeLayout();
|
|
8212
8212
|
const netBPortPosition = closestNetBPort._getGlobalPcbPositionBeforeLayout();
|
|
8213
|
-
const
|
|
8213
|
+
const distance28 = Math.sqrt(
|
|
8214
8214
|
(netAPortPosition.x - netBPortPosition.x) ** 2 + (netAPortPosition.y - netBPortPosition.y) ** 2
|
|
8215
8215
|
);
|
|
8216
|
-
if (
|
|
8217
|
-
closestDistance =
|
|
8216
|
+
if (distance28 < closestDistance) {
|
|
8217
|
+
closestDistance = distance28;
|
|
8218
8218
|
closestPortPair = [netAPort, closestNetBPort];
|
|
8219
8219
|
}
|
|
8220
8220
|
}
|
|
@@ -14978,7 +14978,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
14978
14978
|
parentSymbol = schematicSymbolsByImportedId.get(schematicSymbolId);
|
|
14979
14979
|
}
|
|
14980
14980
|
if (parentSymbol && schematicComponent?.is_box_with_pins === true && elm.center && elm.side_of_component) {
|
|
14981
|
-
const
|
|
14981
|
+
const distance28 = elm.distance_from_component_edge;
|
|
14982
14982
|
const facingDirection = getFacingDirectionFromSide(
|
|
14983
14983
|
elm.side_of_component
|
|
14984
14984
|
);
|
|
@@ -14989,8 +14989,8 @@ var createComponentsFromCircuitJson = ({
|
|
|
14989
14989
|
stemDirection = 1;
|
|
14990
14990
|
}
|
|
14991
14991
|
const portCenter = {
|
|
14992
|
-
x: elm.center.x + directionVector.x *
|
|
14993
|
-
y: elm.center.y + directionVector.y *
|
|
14992
|
+
x: elm.center.x + directionVector.x * distance28 * stemDirection,
|
|
14993
|
+
y: elm.center.y + directionVector.y * distance28 * stemDirection
|
|
14994
14994
|
};
|
|
14995
14995
|
const sourcePort = sourcePortsByImportedId.get(elm.source_port_id);
|
|
14996
14996
|
const aliases = Array.from(
|
|
@@ -20385,15 +20385,15 @@ var Capacitor_addPolarityFabricationSymbols = (capacitor) => {
|
|
|
20385
20385
|
source_port_id: negatives[0].source_port_id
|
|
20386
20386
|
});
|
|
20387
20387
|
if (!positive || !negative) return;
|
|
20388
|
-
const
|
|
20389
|
-
if (
|
|
20388
|
+
const distance28 = Math.hypot(negative.x - positive.x, negative.y - positive.y);
|
|
20389
|
+
if (distance28 < 1e-6) return;
|
|
20390
20390
|
const frame = compose9(
|
|
20391
20391
|
translate7((positive.x + negative.x) / 2, (positive.y + negative.y) / 2),
|
|
20392
20392
|
rotate4(Math.atan2(negative.y - positive.y, negative.x - positive.x))
|
|
20393
20393
|
);
|
|
20394
20394
|
const point6 = (x2, y2) => applyToPoint31(frame, { x: x2, y: y2 });
|
|
20395
|
-
const offset =
|
|
20396
|
-
const halfSize = Math.min(
|
|
20395
|
+
const offset = distance28 / 4;
|
|
20396
|
+
const halfSize = Math.min(distance28 * 0.12, 0.3);
|
|
20397
20397
|
const routes = [
|
|
20398
20398
|
[point6(-offset - halfSize, 0), point6(-offset + halfSize, 0)],
|
|
20399
20399
|
[point6(-offset, -halfSize), point6(-offset, halfSize)],
|
|
@@ -22219,7 +22219,7 @@ import {
|
|
|
22219
22219
|
groupProps
|
|
22220
22220
|
} from "@tscircuit/props";
|
|
22221
22221
|
import {
|
|
22222
|
-
distance as
|
|
22222
|
+
distance as distance20
|
|
22223
22223
|
} from "circuit-json";
|
|
22224
22224
|
import Debug15 from "debug";
|
|
22225
22225
|
|
|
@@ -41463,9 +41463,9 @@ function getFreeBoundaryTracks(params) {
|
|
|
41463
41463
|
for (const via of vias) {
|
|
41464
41464
|
if (!via.spanLayers.includes(targetLayer2)) continue;
|
|
41465
41465
|
const radius = via.diameter / 2 + traceWidth / 2 + clearance;
|
|
41466
|
-
const
|
|
41467
|
-
if (
|
|
41468
|
-
const extent = Math.sqrt(radius * radius -
|
|
41466
|
+
const distance28 = Math.abs(via.center[across] - edge);
|
|
41467
|
+
if (distance28 >= radius) continue;
|
|
41468
|
+
const extent = Math.sqrt(radius * radius - distance28 * distance28);
|
|
41469
41469
|
blocked.push([via.center[along2] - extent, via.center[along2] + extent]);
|
|
41470
41470
|
}
|
|
41471
41471
|
const gaps = [];
|
|
@@ -115693,9 +115693,8 @@ function computeCrossings(traces, opts = {}) {
|
|
|
115693
115693
|
}
|
|
115694
115694
|
}
|
|
115695
115695
|
}
|
|
115696
|
-
const out = traces.map((
|
|
115697
|
-
|
|
115698
|
-
connectivity_key: t48.connectivity_key,
|
|
115696
|
+
const out = traces.map((trace) => ({
|
|
115697
|
+
...trace,
|
|
115699
115698
|
edges: []
|
|
115700
115699
|
}));
|
|
115701
115700
|
for (let ti = 0; ti < traces.length; ti++) {
|
|
@@ -115996,6 +115995,147 @@ function removeOverlappingSameNetCrossingSegments(traces) {
|
|
|
115996
115995
|
}));
|
|
115997
115996
|
}
|
|
115998
115997
|
|
|
115998
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/remove-redundant-traces-to-net-labels.ts
|
|
115999
|
+
import { distance as distance18, pointToSegmentDistance as pointToSegmentDistance4 } from "@tscircuit/math-utils";
|
|
116000
|
+
var GEOMETRY_TOLERANCE = 1e-6;
|
|
116001
|
+
function removeRedundantTracesToNetLabels({
|
|
116002
|
+
traces,
|
|
116003
|
+
existingTraces,
|
|
116004
|
+
netLabelTerminals,
|
|
116005
|
+
terminals,
|
|
116006
|
+
inlineNetLabelTraces = /* @__PURE__ */ new Set()
|
|
116007
|
+
}) {
|
|
116008
|
+
const retainedEdgesByOriginalEdge = /* @__PURE__ */ new Map();
|
|
116009
|
+
for (const connectivityKey of new Set(
|
|
116010
|
+
netLabelTerminals.map((terminal) => terminal.connectivityKey)
|
|
116011
|
+
)) {
|
|
116012
|
+
const routingNodes = [];
|
|
116013
|
+
const getOrCreateRoutingNode = (position) => {
|
|
116014
|
+
let node = routingNodes.find(
|
|
116015
|
+
(node2) => distance18(node2.position, position) <= GEOMETRY_TOLERANCE
|
|
116016
|
+
);
|
|
116017
|
+
if (!node) {
|
|
116018
|
+
node = { position, segments: [], distanceToLabel: Infinity };
|
|
116019
|
+
routingNodes.push(node);
|
|
116020
|
+
}
|
|
116021
|
+
return node;
|
|
116022
|
+
};
|
|
116023
|
+
const netEdges = [
|
|
116024
|
+
...existingTraces.filter(
|
|
116025
|
+
(trace) => trace.subcircuit_connectivity_map_key === connectivityKey
|
|
116026
|
+
).flatMap(
|
|
116027
|
+
(trace) => trace.edges.map((edge) => ({ edge, isPreserved: true }))
|
|
116028
|
+
),
|
|
116029
|
+
...traces.filter(
|
|
116030
|
+
(trace) => trace.subcircuit_connectivity_map_key === connectivityKey
|
|
116031
|
+
).flatMap(
|
|
116032
|
+
(trace) => trace.edges.map((edge) => ({
|
|
116033
|
+
edge,
|
|
116034
|
+
isPreserved: inlineNetLabelTraces.has(trace)
|
|
116035
|
+
}))
|
|
116036
|
+
)
|
|
116037
|
+
];
|
|
116038
|
+
for (const { edge } of netEdges) {
|
|
116039
|
+
getOrCreateRoutingNode(edge.from);
|
|
116040
|
+
getOrCreateRoutingNode(edge.to);
|
|
116041
|
+
}
|
|
116042
|
+
for (let edgeIndex = 0; edgeIndex < netEdges.length; edgeIndex++) {
|
|
116043
|
+
for (let otherEdgeIndex = edgeIndex + 1; otherEdgeIndex < netEdges.length; otherEdgeIndex++) {
|
|
116044
|
+
const firstEdge = netEdges[edgeIndex].edge;
|
|
116045
|
+
const secondEdge = netEdges[otherEdgeIndex].edge;
|
|
116046
|
+
const contactPoint = segmentIntersection(
|
|
116047
|
+
firstEdge.from,
|
|
116048
|
+
firstEdge.to,
|
|
116049
|
+
secondEdge.from,
|
|
116050
|
+
secondEdge.to,
|
|
116051
|
+
GEOMETRY_TOLERANCE
|
|
116052
|
+
);
|
|
116053
|
+
if (contactPoint) getOrCreateRoutingNode(contactPoint);
|
|
116054
|
+
}
|
|
116055
|
+
}
|
|
116056
|
+
const terminalNodes = terminals.filter((terminal) => terminal.connectivityKey === connectivityKey).map((terminal) => getOrCreateRoutingNode(terminal.position));
|
|
116057
|
+
for (const terminal of netLabelTerminals) {
|
|
116058
|
+
if (terminal.connectivityKey === connectivityKey) {
|
|
116059
|
+
getOrCreateRoutingNode(terminal.position).distanceToLabel = 0;
|
|
116060
|
+
}
|
|
116061
|
+
}
|
|
116062
|
+
const routingSegmentsByOriginalEdge = /* @__PURE__ */ new Map();
|
|
116063
|
+
for (const { edge, isPreserved } of netEdges) {
|
|
116064
|
+
const edgeNodes = routingNodes.filter(
|
|
116065
|
+
(node) => pointToSegmentDistance4(node.position, edge.from, edge.to) <= GEOMETRY_TOLERANCE
|
|
116066
|
+
).sort(
|
|
116067
|
+
(firstNode, secondNode) => distance18(edge.from, firstNode.position) - distance18(edge.from, secondNode.position)
|
|
116068
|
+
);
|
|
116069
|
+
const segments = [];
|
|
116070
|
+
for (let nodeIndex = 1; nodeIndex < edgeNodes.length; nodeIndex++) {
|
|
116071
|
+
const from = edgeNodes[nodeIndex - 1];
|
|
116072
|
+
const to = edgeNodes[nodeIndex];
|
|
116073
|
+
const segment2 = {
|
|
116074
|
+
from,
|
|
116075
|
+
to,
|
|
116076
|
+
cost: isPreserved ? 0 : distance18(from.position, to.position)
|
|
116077
|
+
};
|
|
116078
|
+
from.segments.push(segment2);
|
|
116079
|
+
to.segments.push(segment2);
|
|
116080
|
+
segments.push(segment2);
|
|
116081
|
+
}
|
|
116082
|
+
if (!isPreserved) routingSegmentsByOriginalEdge.set(edge, segments);
|
|
116083
|
+
}
|
|
116084
|
+
const unvisitedNodes = new Set(routingNodes);
|
|
116085
|
+
while (unvisitedNodes.size > 0) {
|
|
116086
|
+
let nearestNode;
|
|
116087
|
+
for (const node of unvisitedNodes) {
|
|
116088
|
+
if (node.distanceToLabel < (nearestNode?.distanceToLabel ?? Infinity)) {
|
|
116089
|
+
nearestNode = node;
|
|
116090
|
+
}
|
|
116091
|
+
}
|
|
116092
|
+
if (!nearestNode) break;
|
|
116093
|
+
unvisitedNodes.delete(nearestNode);
|
|
116094
|
+
for (const segment2 of nearestNode.segments) {
|
|
116095
|
+
const neighborNode = segment2.from === nearestNode ? segment2.to : segment2.from;
|
|
116096
|
+
const candidateDistance = nearestNode.distanceToLabel + segment2.cost;
|
|
116097
|
+
if (unvisitedNodes.has(neighborNode) && candidateDistance < neighborNode.distanceToLabel) {
|
|
116098
|
+
neighborNode.distanceToLabel = candidateDistance;
|
|
116099
|
+
neighborNode.pathToLabel = { node: nearestNode, segment: segment2 };
|
|
116100
|
+
}
|
|
116101
|
+
}
|
|
116102
|
+
}
|
|
116103
|
+
const retainedSegments = /* @__PURE__ */ new Set();
|
|
116104
|
+
for (let node of terminalNodes) {
|
|
116105
|
+
while (node.pathToLabel) {
|
|
116106
|
+
const { segment: segment2, node: nextNodeOnPath } = node.pathToLabel;
|
|
116107
|
+
if (retainedSegments.has(segment2)) break;
|
|
116108
|
+
retainedSegments.add(segment2);
|
|
116109
|
+
node = nextNodeOnPath;
|
|
116110
|
+
}
|
|
116111
|
+
}
|
|
116112
|
+
for (const [edge, segments] of routingSegmentsByOriginalEdge) {
|
|
116113
|
+
const retainedEdgeSegments = [];
|
|
116114
|
+
for (const segment2 of segments) {
|
|
116115
|
+
if (!retainedSegments.has(segment2) && Number.isFinite(segment2.from.distanceToLabel))
|
|
116116
|
+
continue;
|
|
116117
|
+
const previousRetainedEdge = retainedEdgeSegments.at(-1);
|
|
116118
|
+
if (previousRetainedEdge && distance18(previousRetainedEdge.to, segment2.from.position) <= GEOMETRY_TOLERANCE) {
|
|
116119
|
+
previousRetainedEdge.to = segment2.to.position;
|
|
116120
|
+
} else {
|
|
116121
|
+
retainedEdgeSegments.push({
|
|
116122
|
+
...edge,
|
|
116123
|
+
from: segment2.from.position,
|
|
116124
|
+
to: segment2.to.position
|
|
116125
|
+
});
|
|
116126
|
+
}
|
|
116127
|
+
}
|
|
116128
|
+
retainedEdgesByOriginalEdge.set(edge, retainedEdgeSegments);
|
|
116129
|
+
}
|
|
116130
|
+
}
|
|
116131
|
+
return traces.map((trace) => ({
|
|
116132
|
+
...trace,
|
|
116133
|
+
edges: trace.edges.flatMap(
|
|
116134
|
+
(edge) => retainedEdgesByOriginalEdge.get(edge) ?? [edge]
|
|
116135
|
+
)
|
|
116136
|
+
})).filter((trace) => trace.edges.length > 0);
|
|
116137
|
+
}
|
|
116138
|
+
|
|
115999
116139
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyTracesFromSolverOutput.ts
|
|
116000
116140
|
var debug10 = Debug12("Group_doInitialSchematicTraceRender");
|
|
116001
116141
|
var MAX_PIN_SNAP_GAP = 1.5;
|
|
@@ -116054,9 +116194,15 @@ function applyTracesFromSolverOutput(args) {
|
|
|
116054
116194
|
group,
|
|
116055
116195
|
solver,
|
|
116056
116196
|
userNetIdToConnKey,
|
|
116057
|
-
schematicPortIdsWithPreExistingNetLabels
|
|
116197
|
+
schematicPortIdsWithPreExistingNetLabels,
|
|
116198
|
+
schematicSheetId
|
|
116058
116199
|
} = args;
|
|
116059
116200
|
const { db: db2 } = group.root;
|
|
116201
|
+
const routedPinBySchematicPortId = new Map(
|
|
116202
|
+
solver.inputProblem.chips.flatMap(
|
|
116203
|
+
(chip) => chip.pins.map((pin) => [asSchematicPortId(pin.pinId), pin])
|
|
116204
|
+
)
|
|
116205
|
+
);
|
|
116060
116206
|
const customSymbolPortIds = new Set(
|
|
116061
116207
|
group.selectAll("port").filter((port) => {
|
|
116062
116208
|
if (!port._getSymbolAncestor()) return false;
|
|
@@ -116094,19 +116240,12 @@ function applyTracesFromSolverOutput(args) {
|
|
|
116094
116240
|
}
|
|
116095
116241
|
const traces = solver.inlineNetLabelSolver?.getOutput().traces ?? solver.sameNetJunctionAlignmentSolver?.getOutput().traces ?? solver.netLabelTraceCollisionSolver?.getOutput().traces ?? solver.traceCleanupSolver?.getOutput().traces ?? solver.traceLabelOverlapAvoidanceSolver?.getOutput().traces ?? solver.schematicTraceLinesSolver?.solvedTracePaths;
|
|
116096
116242
|
const pendingTraces = [];
|
|
116243
|
+
const terminals = [];
|
|
116244
|
+
const netLabelTerminals = [];
|
|
116097
116245
|
debug10(`Traces inside SchematicTraceSolver output: ${(traces ?? []).length}`);
|
|
116098
116246
|
for (const solvedTracePath of traces ?? []) {
|
|
116099
116247
|
const uniquePinIds = Array.from(new Set(solvedTracePath.pinIds ?? []));
|
|
116100
116248
|
const solvedTraceSchematicPortIds = uniquePinIds.map(asSchematicPortId);
|
|
116101
|
-
const isNetLabelCoveredTrace = solvedTraceSchematicPortIds.length > 0 && solvedTraceSchematicPortIds.every(
|
|
116102
|
-
(id) => schematicPortIdsWithPreExistingNetLabels.has(id)
|
|
116103
|
-
);
|
|
116104
|
-
if (isNetLabelCoveredTrace) {
|
|
116105
|
-
debug10(
|
|
116106
|
-
`Skipping solver netlabel-covered trace ${solvedTracePath?.mspPairId} because all schematic ports already have netlabels`
|
|
116107
|
-
);
|
|
116108
|
-
continue;
|
|
116109
|
-
}
|
|
116110
116249
|
const points = solvedTracePath?.tracePath;
|
|
116111
116250
|
if (!Array.isArray(points) || points.length < 2) {
|
|
116112
116251
|
debug10(
|
|
@@ -116165,6 +116304,27 @@ function applyTracesFromSolverOutput(args) {
|
|
|
116165
116304
|
subcircuit_connectivity_map_key = sourcePortConnKeys[0];
|
|
116166
116305
|
}
|
|
116167
116306
|
}
|
|
116307
|
+
if (subcircuit_connectivity_map_key) {
|
|
116308
|
+
for (const schematicPortId of solvedTraceSchematicPortIds) {
|
|
116309
|
+
const schematicPort = db2.schematic_port.get(schematicPortId);
|
|
116310
|
+
if (!schematicPort) continue;
|
|
116311
|
+
const portTerminal = {
|
|
116312
|
+
position: schematicPort.center,
|
|
116313
|
+
connectivityKey: subcircuit_connectivity_map_key
|
|
116314
|
+
};
|
|
116315
|
+
terminals.push(portTerminal);
|
|
116316
|
+
const routedPin = routedPinBySchematicPortId.get(schematicPortId);
|
|
116317
|
+
if (routedPin) {
|
|
116318
|
+
terminals.push({
|
|
116319
|
+
position: { x: routedPin.x, y: routedPin.y },
|
|
116320
|
+
connectivityKey: subcircuit_connectivity_map_key
|
|
116321
|
+
});
|
|
116322
|
+
}
|
|
116323
|
+
if (schematicPortIdsWithPreExistingNetLabels.has(schematicPortId)) {
|
|
116324
|
+
netLabelTerminals.push(portTerminal);
|
|
116325
|
+
}
|
|
116326
|
+
}
|
|
116327
|
+
}
|
|
116168
116328
|
const endpointSchematicSheetIds = new Set(
|
|
116169
116329
|
solvedTraceSchematicPortIds.map(
|
|
116170
116330
|
(schematicPortId) => db2.schematic_port.get(schematicPortId)?.schematic_sheet_id
|
|
@@ -116186,18 +116346,39 @@ function applyTracesFromSolverOutput(args) {
|
|
|
116186
116346
|
debug10(
|
|
116187
116347
|
`Applying ${pendingTraces.length} traces from SchematicTraceSolver output`
|
|
116188
116348
|
);
|
|
116189
|
-
const
|
|
116190
|
-
|
|
116191
|
-
|
|
116192
|
-
|
|
116193
|
-
|
|
116194
|
-
|
|
116349
|
+
const existingTraces = db2.schematic_trace.list().filter((trace) => trace.schematic_sheet_id === schematicSheetId);
|
|
116350
|
+
const netLabelPlacements = solver.inlineNetLabelSolver?.getOutput().netLabelPlacements ?? solver.netLabelNetLabelCollisionSolver?.getOutput().netLabelPlacements ?? solver.netLabelTraceCollisionSolver?.getOutput().netLabelPlacements ?? solver.netLabelPlacementSolver?.netLabelPlacements ?? solver.traceLabelOverlapAvoidanceSolver?.getOutput().netLabelPlacements ?? [];
|
|
116351
|
+
for (const placement of netLabelPlacements) {
|
|
116352
|
+
if (placement.pinIds.some(
|
|
116353
|
+
(pinId) => schematicPortIdsWithPreExistingNetLabels.has(asSchematicPortId(pinId))
|
|
116354
|
+
))
|
|
116355
|
+
continue;
|
|
116356
|
+
const userNetId = solver.mspConnectionPairSolver.globalConnMap.getIdsConnectedToNet(
|
|
116357
|
+
placement.globalConnNetId
|
|
116358
|
+
).find((netId) => userNetIdToConnKey.has(netId));
|
|
116359
|
+
const connectivityKey = userNetId ? userNetIdToConnKey.get(userNetId) : void 0;
|
|
116360
|
+
if (connectivityKey)
|
|
116361
|
+
terminals.push({ position: placement.anchorPoint, connectivityKey });
|
|
116362
|
+
}
|
|
116363
|
+
const inlineNetLabelTraceIds = new Set(
|
|
116364
|
+
(solver.inlineNetLabelSolver?.getOutput().inlineNetLabelPlacements ?? []).flatMap(
|
|
116365
|
+
(placement) => placement.mspPairId ? [placement.mspPairId] : []
|
|
116366
|
+
)
|
|
116195
116367
|
);
|
|
116368
|
+
const retainedTraces = removeRedundantTracesToNetLabels({
|
|
116369
|
+
traces: pendingTraces,
|
|
116370
|
+
existingTraces,
|
|
116371
|
+
netLabelTerminals,
|
|
116372
|
+
terminals,
|
|
116373
|
+
inlineNetLabelTraces: new Set(
|
|
116374
|
+
pendingTraces.filter(
|
|
116375
|
+
(trace) => inlineNetLabelTraceIds.has(trace.source_trace_id)
|
|
116376
|
+
)
|
|
116377
|
+
)
|
|
116378
|
+
});
|
|
116196
116379
|
const existingTracesForJunctions = [];
|
|
116197
|
-
const
|
|
116198
|
-
for (const t48 of db2.schematic_trace.list()) {
|
|
116380
|
+
for (const t48 of existingTraces) {
|
|
116199
116381
|
if (t48.edges.length === 0) continue;
|
|
116200
|
-
if (t48.schematic_sheet_id !== schematicSheetId) continue;
|
|
116201
116382
|
const sourceTrace = t48.source_trace_id ? db2.source_trace.get(t48.source_trace_id) : void 0;
|
|
116202
116383
|
existingTracesForJunctions.push({
|
|
116203
116384
|
schematic_trace_id: t48.schematic_trace_id,
|
|
@@ -116206,16 +116387,21 @@ function applyTracesFromSolverOutput(args) {
|
|
|
116206
116387
|
connectivity_key: t48.subcircuit_connectivity_map_key ?? sourceTrace?.subcircuit_connectivity_map_key
|
|
116207
116388
|
});
|
|
116208
116389
|
}
|
|
116209
|
-
const
|
|
116210
|
-
...
|
|
116390
|
+
const withCrossings = computeCrossings([
|
|
116391
|
+
...retainedTraces.map((trace) => ({
|
|
116392
|
+
source_trace_id: trace.source_trace_id,
|
|
116393
|
+
edges: trace.edges,
|
|
116394
|
+
connectivity_key: trace.subcircuit_connectivity_map_key
|
|
116395
|
+
})),
|
|
116211
116396
|
...existingTracesForJunctions
|
|
116212
116397
|
]);
|
|
116398
|
+
const tracesWithTrimmedCrossingOverlaps = removeOverlappingSameNetCrossingSegments(withCrossings);
|
|
116213
116399
|
const visibleTraces = tracesWithTrimmedCrossingOverlaps.slice(
|
|
116214
116400
|
0,
|
|
116215
|
-
|
|
116401
|
+
retainedTraces.length
|
|
116216
116402
|
);
|
|
116217
116403
|
const visibleExistingTraces = tracesWithTrimmedCrossingOverlaps.slice(
|
|
116218
|
-
|
|
116404
|
+
retainedTraces.length
|
|
116219
116405
|
);
|
|
116220
116406
|
for (const trace of visibleExistingTraces) {
|
|
116221
116407
|
if (!trace.schematic_trace_id) continue;
|
|
@@ -117607,7 +117793,8 @@ var renderSchematicTracesForSheet = ({
|
|
|
117607
117793
|
group,
|
|
117608
117794
|
solver,
|
|
117609
117795
|
userNetIdToConnKey,
|
|
117610
|
-
schematicPortIdsWithPreExistingNetLabels
|
|
117796
|
+
schematicPortIdsWithPreExistingNetLabels,
|
|
117797
|
+
schematicSheetId
|
|
117611
117798
|
});
|
|
117612
117799
|
applyNetLabelPlacements({
|
|
117613
117800
|
group,
|
|
@@ -119261,7 +119448,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
119261
119448
|
var package_default = {
|
|
119262
119449
|
name: "@tscircuit/core",
|
|
119263
119450
|
type: "module",
|
|
119264
|
-
version: "0.0.
|
|
119451
|
+
version: "0.0.2165",
|
|
119265
119452
|
types: "dist/index.d.ts",
|
|
119266
119453
|
main: "dist/index.js",
|
|
119267
119454
|
module: "dist/index.js",
|
|
@@ -119307,7 +119494,7 @@ var package_default = {
|
|
|
119307
119494
|
"@tscircuit/dogbone-solver": "https://jscdn.tscircuit.com/@tscircuit/dogbone-solver/0.0.1.tgz",
|
|
119308
119495
|
"@tscircuit/fanout-solver": "0.0.78",
|
|
119309
119496
|
"@tscircuit/flex-utils": "https://jscdn.tscircuit.com/@tscircuit/flex-utils/0.0.8.tgz",
|
|
119310
|
-
"@tscircuit/footprinter": "^0.0.
|
|
119497
|
+
"@tscircuit/footprinter": "^0.0.440",
|
|
119311
119498
|
"@tscircuit/image-utils": "^0.0.8",
|
|
119312
119499
|
"@tscircuit/implicit-copper-pour-solver": "github:tscircuit/implicit-copper-pour-solver#a5cbbda0cd65fd4707c5c1af25779837c25aba92",
|
|
119313
119500
|
"@tscircuit/infer-cable-insertion-point": "^0.0.4",
|
|
@@ -120026,7 +120213,7 @@ function getAccumulatedPcbTracesWithStageOutputReplacements({
|
|
|
120026
120213
|
}
|
|
120027
120214
|
|
|
120028
120215
|
// lib/components/primitive-components/Group/get-source-trace-id-for-routed-trace.ts
|
|
120029
|
-
import { distance as
|
|
120216
|
+
import { distance as distance19, pointToSegmentDistance as pointToSegmentDistance5 } from "@tscircuit/math-utils";
|
|
120030
120217
|
import { ConnectivityMap as ConnectivityMap6 } from "circuit-json-to-connectivity-map";
|
|
120031
120218
|
import { applyToPoint as applyToPoint39, rotateDEG as rotateDEG4 } from "transformation-matrix";
|
|
120032
120219
|
var POINT_EPSILON3 = 1e-6;
|
|
@@ -120038,7 +120225,7 @@ function isPointOnWireSegment({
|
|
|
120038
120225
|
if (point6.layer && (segmentStart.layer !== point6.layer || segmentEnd.layer !== point6.layer)) {
|
|
120039
120226
|
return false;
|
|
120040
120227
|
}
|
|
120041
|
-
return
|
|
120228
|
+
return pointToSegmentDistance5(point6, segmentStart, segmentEnd) <= POINT_EPSILON3;
|
|
120042
120229
|
}
|
|
120043
120230
|
function isPointInSmtPad({
|
|
120044
120231
|
point: point6,
|
|
@@ -120050,7 +120237,7 @@ function isPointInSmtPad({
|
|
|
120050
120237
|
return Math.abs(unrotatedPoint.x - pad.x) <= pad.width / 2 + traceWidth / 2 && Math.abs(unrotatedPoint.y - pad.y) <= pad.height / 2 + traceWidth / 2;
|
|
120051
120238
|
}
|
|
120052
120239
|
if (pad.shape === "circle") {
|
|
120053
|
-
return
|
|
120240
|
+
return distance19(point6, pad) <= pad.radius + traceWidth / 2;
|
|
120054
120241
|
}
|
|
120055
120242
|
return false;
|
|
120056
120243
|
}
|
|
@@ -120059,7 +120246,7 @@ function isPointInPlatedHole({
|
|
|
120059
120246
|
hole,
|
|
120060
120247
|
traceWidth = 0
|
|
120061
120248
|
}) {
|
|
120062
|
-
return
|
|
120249
|
+
return distance19(point6, hole) <= (hole.outer_diameter ?? hole.hole_diameter ?? 0) / 2 + traceWidth / 2;
|
|
120063
120250
|
}
|
|
120064
120251
|
function getEndpointSourcePortIdsFromGeometry(db2, trace) {
|
|
120065
120252
|
const sourcePortIds = /* @__PURE__ */ new Set();
|
|
@@ -120073,7 +120260,7 @@ function getEndpointSourcePortIdsFromGeometry(db2, trace) {
|
|
|
120073
120260
|
if (!pcbPort.source_port_id) continue;
|
|
120074
120261
|
if (endpoint.layer && pcbPort.layers && !pcbPort.layers.includes(endpoint.layer))
|
|
120075
120262
|
continue;
|
|
120076
|
-
if (
|
|
120263
|
+
if (distance19(endpoint, pcbPort) <= 0.01) {
|
|
120077
120264
|
exactEndpointSourcePortIds.add(pcbPort.source_port_id);
|
|
120078
120265
|
}
|
|
120079
120266
|
}
|
|
@@ -120762,8 +120949,8 @@ var Group5 = class extends NormalComponent {
|
|
|
120762
120949
|
const groupProps2 = props;
|
|
120763
120950
|
const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
|
|
120764
120951
|
const numericOutline = hasOutline ? groupProps2.outline.map((point6) => ({
|
|
120765
|
-
x:
|
|
120766
|
-
y:
|
|
120952
|
+
x: distance20.parse(point6.x),
|
|
120953
|
+
y: distance20.parse(point6.y)
|
|
120767
120954
|
})) : void 0;
|
|
120768
120955
|
const ctx = this.props;
|
|
120769
120956
|
const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
@@ -120801,8 +120988,8 @@ var Group5 = class extends NormalComponent {
|
|
|
120801
120988
|
const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
|
|
120802
120989
|
if (hasOutline) {
|
|
120803
120990
|
const numericOutline = props.outline.map((point6) => ({
|
|
120804
|
-
x:
|
|
120805
|
-
y:
|
|
120991
|
+
x: distance20.parse(point6.x),
|
|
120992
|
+
y: distance20.parse(point6.y)
|
|
120806
120993
|
}));
|
|
120807
120994
|
const outlineBounds = getBoundsFromPoints12(numericOutline);
|
|
120808
120995
|
if (!outlineBounds) return;
|
|
@@ -122720,8 +122907,8 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
122720
122907
|
const a2 = db2.pcb_port.getWhere({ source_port_id: anode.source_port_id });
|
|
122721
122908
|
const k2 = db2.pcb_port.getWhere({ source_port_id: cathode.source_port_id });
|
|
122722
122909
|
if (!a2 || !k2) return;
|
|
122723
|
-
const
|
|
122724
|
-
if (
|
|
122910
|
+
const distance28 = Math.hypot(k2.x - a2.x, k2.y - a2.y);
|
|
122911
|
+
if (distance28 < 1e-6) return;
|
|
122725
122912
|
const angle = Math.atan2(k2.y - a2.y, k2.x - a2.x);
|
|
122726
122913
|
const frame = compose17(
|
|
122727
122914
|
translate17((a2.x + k2.x) / 2, (a2.y + k2.y) / 2),
|
|
@@ -122735,10 +122922,10 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
122735
122922
|
};
|
|
122736
122923
|
const notes = [];
|
|
122737
122924
|
generatedNotes.set(led, notes);
|
|
122738
|
-
const halfLength = Math.min(
|
|
122925
|
+
const halfLength = Math.min(distance28 * 0.2, 0.4);
|
|
122739
122926
|
const halfHeight = halfLength * 0.75;
|
|
122740
122927
|
const routes = [
|
|
122741
|
-
[point6(-
|
|
122928
|
+
[point6(-distance28 / 2, 0), point6(-halfLength, 0)],
|
|
122742
122929
|
[
|
|
122743
122930
|
point6(-halfLength, -halfHeight),
|
|
122744
122931
|
point6(halfLength, 0),
|
|
@@ -122746,7 +122933,7 @@ var Led_addPolarityFabricationSymbol = (led) => {
|
|
|
122746
122933
|
point6(-halfLength, -halfHeight)
|
|
122747
122934
|
],
|
|
122748
122935
|
[point6(halfLength, -halfHeight), point6(halfLength, halfHeight)],
|
|
122749
|
-
[point6(halfLength, 0), point6(
|
|
122936
|
+
[point6(halfLength, 0), point6(distance28 / 2, 0)]
|
|
122750
122937
|
];
|
|
122751
122938
|
for (const route of routes) {
|
|
122752
122939
|
notes.push(
|
|
@@ -124759,7 +124946,7 @@ var Board_doInitialPcbPlacementDesignRuleChecks = (board) => {
|
|
|
124759
124946
|
|
|
124760
124947
|
// lib/components/normal-components/Board/board-castellated-hole.ts
|
|
124761
124948
|
import {
|
|
124762
|
-
distance as
|
|
124949
|
+
distance as distance21
|
|
124763
124950
|
} from "circuit-json";
|
|
124764
124951
|
var CASTELLATED_HOLE_ENDPOINT_TOLERANCE_MM = 1e-6;
|
|
124765
124952
|
var getConnectionTargets2 = (connectsTo) => {
|
|
@@ -124780,8 +124967,8 @@ var BoardCastellatedHole = class _BoardCastellatedHole extends PlatedHole {
|
|
|
124780
124967
|
constructor(outlinePoint, outlinePointIndex) {
|
|
124781
124968
|
const name = `castellated_hole_${outlinePointIndex + 1}`;
|
|
124782
124969
|
const connectionTargets = getConnectionTargets2(outlinePoint.connectsTo);
|
|
124783
|
-
const holeDiameter =
|
|
124784
|
-
const padDiameter =
|
|
124970
|
+
const holeDiameter = distance21.parse(outlinePoint.holeDiameter);
|
|
124971
|
+
const padDiameter = distance21.parse(outlinePoint.padDiameter);
|
|
124785
124972
|
super({
|
|
124786
124973
|
shape: "circle",
|
|
124787
124974
|
holeDiameter,
|
|
@@ -125563,11 +125750,11 @@ var MountedBoard = class extends Subcircuit {
|
|
|
125563
125750
|
|
|
125564
125751
|
// lib/components/normal-components/Panel.ts
|
|
125565
125752
|
import { panelProps } from "@tscircuit/props";
|
|
125566
|
-
import { distance as
|
|
125753
|
+
import { distance as distance26 } from "circuit-json";
|
|
125567
125754
|
|
|
125568
125755
|
// lib/components/normal-components/Subpanel.ts
|
|
125569
125756
|
import { subpanelProps } from "@tscircuit/props";
|
|
125570
|
-
import { distance as
|
|
125757
|
+
import { distance as distance25 } from "circuit-json";
|
|
125571
125758
|
import { compose as compose19, identity as identity11, translate as translate19 } from "transformation-matrix";
|
|
125572
125759
|
|
|
125573
125760
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
@@ -125831,15 +126018,15 @@ function generatePanelOutlineRoutingCutouts(boards, options) {
|
|
|
125831
126018
|
}
|
|
125832
126019
|
|
|
125833
126020
|
// lib/utils/panels/pack-into-grid.ts
|
|
125834
|
-
import { distance as
|
|
126021
|
+
import { distance as distance24 } from "circuit-json";
|
|
125835
126022
|
|
|
125836
126023
|
// lib/utils/panels/get-board-dimensions-from-props.ts
|
|
125837
126024
|
import { getBoundsFromPoints as getBoundsFromPoints14 } from "@tscircuit/math-utils";
|
|
125838
|
-
import { distance as
|
|
126025
|
+
import { distance as distance23 } from "circuit-json";
|
|
125839
126026
|
var getBoardDimensionsFromProps = (board) => {
|
|
125840
126027
|
const props = board._parsedProps;
|
|
125841
|
-
let width = props.width != null ?
|
|
125842
|
-
let height = props.height != null ?
|
|
126028
|
+
let width = props.width != null ? distance23.parse(props.width) : void 0;
|
|
126029
|
+
let height = props.height != null ? distance23.parse(props.height) : void 0;
|
|
125843
126030
|
if ((width === void 0 || height === void 0) && props.outline?.length) {
|
|
125844
126031
|
const outlineBounds = getBoundsFromPoints14(props.outline);
|
|
125845
126032
|
if (outlineBounds) {
|
|
@@ -125883,8 +126070,8 @@ function packIntoGrid({
|
|
|
125883
126070
|
}
|
|
125884
126071
|
let cols;
|
|
125885
126072
|
let rows;
|
|
125886
|
-
const minCellWidth = cellWidth ?
|
|
125887
|
-
const minCellHeight = cellHeight ?
|
|
126073
|
+
const minCellWidth = cellWidth ? distance24.parse(cellWidth) : 0;
|
|
126074
|
+
const minCellHeight = cellHeight ? distance24.parse(cellHeight) : 0;
|
|
125888
126075
|
if (col !== void 0) {
|
|
125889
126076
|
cols = col;
|
|
125890
126077
|
rows = row ?? Math.ceil(itemsWithDims.length / cols);
|
|
@@ -125983,8 +126170,8 @@ function getItemDimensions(item, db2) {
|
|
|
125983
126170
|
const props = subpanel._parsedProps;
|
|
125984
126171
|
if (props.width !== void 0 && props.height !== void 0) {
|
|
125985
126172
|
return {
|
|
125986
|
-
width:
|
|
125987
|
-
height:
|
|
126173
|
+
width: distance24.parse(props.width),
|
|
126174
|
+
height: distance24.parse(props.height)
|
|
125988
126175
|
};
|
|
125989
126176
|
}
|
|
125990
126177
|
const directBoards = subpanel._getDirectBoardChildren();
|
|
@@ -126011,7 +126198,7 @@ function getItemDimensions(item, db2) {
|
|
|
126011
126198
|
return getBoardDimensionsFromProps(directBoards[0]);
|
|
126012
126199
|
}
|
|
126013
126200
|
if (subpanel._cachedGridWidth > 0 && subpanel._cachedGridHeight > 0) {
|
|
126014
|
-
const edgePadding =
|
|
126201
|
+
const edgePadding = distance24.parse(props.edgePadding ?? 5);
|
|
126015
126202
|
return {
|
|
126016
126203
|
width: subpanel._cachedGridWidth + edgePadding * 2,
|
|
126017
126204
|
height: subpanel._cachedGridHeight + edgePadding * 2
|
|
@@ -126169,17 +126356,17 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
126169
126356
|
edgePaddingTop: edgePaddingTopProp,
|
|
126170
126357
|
edgePaddingBottom: edgePaddingBottomProp
|
|
126171
126358
|
} = this._parsedProps;
|
|
126172
|
-
const edgePadding =
|
|
126173
|
-
const edgePaddingLeft =
|
|
126174
|
-
const edgePaddingRight =
|
|
126359
|
+
const edgePadding = distance25.parse(edgePaddingProp ?? 5);
|
|
126360
|
+
const edgePaddingLeft = distance25.parse(edgePaddingLeftProp ?? edgePadding);
|
|
126361
|
+
const edgePaddingRight = distance25.parse(
|
|
126175
126362
|
edgePaddingRightProp ?? edgePadding
|
|
126176
126363
|
);
|
|
126177
|
-
const edgePaddingTop =
|
|
126178
|
-
const edgePaddingBottom =
|
|
126364
|
+
const edgePaddingTop = distance25.parse(edgePaddingTopProp ?? edgePadding);
|
|
126365
|
+
const edgePaddingBottom = distance25.parse(
|
|
126179
126366
|
edgePaddingBottomProp ?? edgePadding
|
|
126180
126367
|
);
|
|
126181
|
-
const panelWidth =
|
|
126182
|
-
const panelHeight =
|
|
126368
|
+
const panelWidth = distance25.parse(this._parsedProps.width);
|
|
126369
|
+
const panelHeight = distance25.parse(this._parsedProps.height);
|
|
126183
126370
|
availablePanelWidth = panelWidth - edgePaddingLeft - edgePaddingRight;
|
|
126184
126371
|
availablePanelHeight = panelHeight - edgePaddingTop - edgePaddingBottom;
|
|
126185
126372
|
}
|
|
@@ -126254,8 +126441,8 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
126254
126441
|
if (!this.pcb_group_id) return;
|
|
126255
126442
|
if (hasExplicitWidth && hasExplicitHeight) {
|
|
126256
126443
|
db2.pcb_group.update(this.pcb_group_id, {
|
|
126257
|
-
width:
|
|
126258
|
-
height:
|
|
126444
|
+
width: distance25.parse(this._parsedProps.width),
|
|
126445
|
+
height: distance25.parse(this._parsedProps.height)
|
|
126259
126446
|
});
|
|
126260
126447
|
} else if (gridWidth > 0 || gridHeight > 0) {
|
|
126261
126448
|
const {
|
|
@@ -126265,18 +126452,18 @@ var Subpanel = class _Subpanel extends Group5 {
|
|
|
126265
126452
|
edgePaddingTop: edgePaddingTopProp,
|
|
126266
126453
|
edgePaddingBottom: edgePaddingBottomProp
|
|
126267
126454
|
} = this._parsedProps;
|
|
126268
|
-
const edgePadding =
|
|
126269
|
-
const edgePaddingLeft =
|
|
126270
|
-
const edgePaddingRight =
|
|
126455
|
+
const edgePadding = distance25.parse(edgePaddingProp ?? 5);
|
|
126456
|
+
const edgePaddingLeft = distance25.parse(edgePaddingLeftProp ?? edgePadding);
|
|
126457
|
+
const edgePaddingRight = distance25.parse(
|
|
126271
126458
|
edgePaddingRightProp ?? edgePadding
|
|
126272
126459
|
);
|
|
126273
|
-
const edgePaddingTop =
|
|
126274
|
-
const edgePaddingBottom =
|
|
126460
|
+
const edgePaddingTop = distance25.parse(edgePaddingTopProp ?? edgePadding);
|
|
126461
|
+
const edgePaddingBottom = distance25.parse(
|
|
126275
126462
|
edgePaddingBottomProp ?? edgePadding
|
|
126276
126463
|
);
|
|
126277
126464
|
db2.pcb_group.update(this.pcb_group_id, {
|
|
126278
|
-
width: hasExplicitWidth ?
|
|
126279
|
-
height: hasExplicitHeight ?
|
|
126465
|
+
width: hasExplicitWidth ? distance25.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
|
|
126466
|
+
height: hasExplicitHeight ? distance25.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
|
|
126280
126467
|
});
|
|
126281
126468
|
}
|
|
126282
126469
|
}
|
|
@@ -126364,8 +126551,8 @@ var Panel = class extends Subpanel {
|
|
|
126364
126551
|
const { db: db2 } = this.root;
|
|
126365
126552
|
const props = this._parsedProps;
|
|
126366
126553
|
const inserted = db2.pcb_panel.insert({
|
|
126367
|
-
width: props.width !== void 0 ?
|
|
126368
|
-
height: props.height !== void 0 ?
|
|
126554
|
+
width: props.width !== void 0 ? distance26.parse(props.width) : 0,
|
|
126555
|
+
height: props.height !== void 0 ? distance26.parse(props.height) : 0,
|
|
126369
126556
|
thickness: 1.6,
|
|
126370
126557
|
center: this._getGlobalPcbPositionBeforeLayout(),
|
|
126371
126558
|
covered_with_solder_mask: !(props.noSolderMask ?? false)
|
|
@@ -126384,8 +126571,8 @@ var Panel = class extends Subpanel {
|
|
|
126384
126571
|
if (!this.pcb_panel_id) return;
|
|
126385
126572
|
if (hasExplicitWidth && hasExplicitHeight) {
|
|
126386
126573
|
db2.pcb_panel.update(this.pcb_panel_id, {
|
|
126387
|
-
width:
|
|
126388
|
-
height:
|
|
126574
|
+
width: distance26.parse(this._parsedProps.width),
|
|
126575
|
+
height: distance26.parse(this._parsedProps.height)
|
|
126389
126576
|
});
|
|
126390
126577
|
} else if (gridWidth > 0 || gridHeight > 0) {
|
|
126391
126578
|
const {
|
|
@@ -126395,18 +126582,18 @@ var Panel = class extends Subpanel {
|
|
|
126395
126582
|
edgePaddingTop: edgePaddingTopProp,
|
|
126396
126583
|
edgePaddingBottom: edgePaddingBottomProp
|
|
126397
126584
|
} = this._parsedProps;
|
|
126398
|
-
const edgePadding =
|
|
126399
|
-
const edgePaddingLeft =
|
|
126400
|
-
const edgePaddingRight =
|
|
126585
|
+
const edgePadding = distance26.parse(edgePaddingProp ?? 5);
|
|
126586
|
+
const edgePaddingLeft = distance26.parse(edgePaddingLeftProp ?? edgePadding);
|
|
126587
|
+
const edgePaddingRight = distance26.parse(
|
|
126401
126588
|
edgePaddingRightProp ?? edgePadding
|
|
126402
126589
|
);
|
|
126403
|
-
const edgePaddingTop =
|
|
126404
|
-
const edgePaddingBottom =
|
|
126590
|
+
const edgePaddingTop = distance26.parse(edgePaddingTopProp ?? edgePadding);
|
|
126591
|
+
const edgePaddingBottom = distance26.parse(
|
|
126405
126592
|
edgePaddingBottomProp ?? edgePadding
|
|
126406
126593
|
);
|
|
126407
126594
|
db2.pcb_panel.update(this.pcb_panel_id, {
|
|
126408
|
-
width: hasExplicitWidth ?
|
|
126409
|
-
height: hasExplicitHeight ?
|
|
126595
|
+
width: hasExplicitWidth ? distance26.parse(this._parsedProps.width) : gridWidth + edgePaddingLeft + edgePaddingRight,
|
|
126596
|
+
height: hasExplicitHeight ? distance26.parse(this._parsedProps.height) : gridHeight + edgePaddingTop + edgePaddingBottom
|
|
126410
126597
|
});
|
|
126411
126598
|
}
|
|
126412
126599
|
}
|
|
@@ -126417,8 +126604,8 @@ var Panel = class extends Subpanel {
|
|
|
126417
126604
|
const props = this._parsedProps;
|
|
126418
126605
|
const currentPanel = db2.pcb_panel.get(this.pcb_panel_id);
|
|
126419
126606
|
db2.pcb_panel.update(this.pcb_panel_id, {
|
|
126420
|
-
width: props.width !== void 0 ?
|
|
126421
|
-
height: props.height !== void 0 ?
|
|
126607
|
+
width: props.width !== void 0 ? distance26.parse(props.width) : currentPanel?.width,
|
|
126608
|
+
height: props.height !== void 0 ? distance26.parse(props.height) : currentPanel?.height,
|
|
126422
126609
|
center: this._getGlobalPcbPositionBeforeLayout(),
|
|
126423
126610
|
covered_with_solder_mask: !(props.noSolderMask ?? false)
|
|
126424
126611
|
});
|
|
@@ -128024,9 +128211,9 @@ var resolvePcbDimensionOffsetDirection = ({
|
|
|
128024
128211
|
}
|
|
128025
128212
|
const dx2 = to.x - from.x;
|
|
128026
128213
|
const dy2 = to.y - from.y;
|
|
128027
|
-
const
|
|
128028
|
-
if (offset === void 0 ||
|
|
128029
|
-
return { x: -dy2 /
|
|
128214
|
+
const distance28 = Math.hypot(dx2, dy2);
|
|
128215
|
+
if (offset === void 0 || distance28 === 0) return;
|
|
128216
|
+
return { x: -dy2 / distance28, y: dx2 / distance28 };
|
|
128030
128217
|
};
|
|
128031
128218
|
|
|
128032
128219
|
// lib/components/primitive-components/FabricationNoteDimension.ts
|
|
@@ -131121,7 +131308,7 @@ var SilkscreenGraphic = class extends PrimitiveComponent2 {
|
|
|
131121
131308
|
|
|
131122
131309
|
// lib/components/primitive-components/Fiducial.ts
|
|
131123
131310
|
import "zod";
|
|
131124
|
-
import { distance as
|
|
131311
|
+
import { distance as distance27 } from "circuit-json";
|
|
131125
131312
|
import { fiducialProps as fiducialProps2 } from "@tscircuit/props";
|
|
131126
131313
|
var Fiducial = class extends PrimitiveComponent2 {
|
|
131127
131314
|
pcb_smtpad_id = null;
|
|
@@ -131146,15 +131333,15 @@ var Fiducial = class extends PrimitiveComponent2 {
|
|
|
131146
131333
|
shape: "circle",
|
|
131147
131334
|
x: position.x,
|
|
131148
131335
|
y: position.y,
|
|
131149
|
-
radius:
|
|
131150
|
-
soldermask_margin: props.soldermaskPullback ?
|
|
131336
|
+
radius: distance27.parse(props.padDiameter) / 2,
|
|
131337
|
+
soldermask_margin: props.soldermaskPullback ? distance27.parse(props.soldermaskPullback) : distance27.parse(props.padDiameter) / 2,
|
|
131151
131338
|
is_covered_with_solder_mask: true
|
|
131152
131339
|
});
|
|
131153
131340
|
this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
|
|
131154
131341
|
}
|
|
131155
131342
|
getPcbSize() {
|
|
131156
131343
|
const { _parsedProps: props } = this;
|
|
131157
|
-
const d2 =
|
|
131344
|
+
const d2 = distance27.parse(props.padDiameter);
|
|
131158
131345
|
return { width: d2, height: d2 };
|
|
131159
131346
|
}
|
|
131160
131347
|
_setPositionFromLayout(newCenter) {
|
|
@@ -135598,8 +135785,8 @@ function inferAssemblyCablePath({
|
|
|
135598
135785
|
fromDirection,
|
|
135599
135786
|
toDirection
|
|
135600
135787
|
}) {
|
|
135601
|
-
const
|
|
135602
|
-
if (
|
|
135788
|
+
const distance28 = Math.hypot(to.x - from.x, to.y - from.y, to.z - from.z);
|
|
135789
|
+
if (distance28 < 1e-6)
|
|
135603
135790
|
throw new Error("Cable wire exits must be at different positions");
|
|
135604
135791
|
const chord = vec37.fromValues(to.x - from.x, to.y - from.y, to.z - from.z);
|
|
135605
135792
|
const routeNormal = vec37.cross(vec37.create(), chord, [
|
|
@@ -135611,7 +135798,7 @@ function inferAssemblyCablePath({
|
|
|
135611
135798
|
vec37.cross(
|
|
135612
135799
|
routeNormal,
|
|
135613
135800
|
chord,
|
|
135614
|
-
Math.abs(chord[2]) /
|
|
135801
|
+
Math.abs(chord[2]) / distance28 > 0.95 ? [0, 1, 0] : [0, 0, 1]
|
|
135615
135802
|
);
|
|
135616
135803
|
}
|
|
135617
135804
|
const archDirection = vec37.normalize(
|
|
@@ -135621,7 +135808,7 @@ function inferAssemblyCablePath({
|
|
|
135621
135808
|
const archSide = from.z < 0 && to.z < 0 ? -1 : 1;
|
|
135622
135809
|
if (archDirection[2] * archSide < 0)
|
|
135623
135810
|
vec37.scale(archDirection, archDirection, -1);
|
|
135624
|
-
const clearance = Math.min(25, Math.max(8,
|
|
135811
|
+
const clearance = Math.min(25, Math.max(8, distance28 / 3));
|
|
135625
135812
|
const controlA = {
|
|
135626
135813
|
x: from.x + fromDirection.x * clearance,
|
|
135627
135814
|
y: from.y + fromDirection.y * clearance,
|
|
@@ -135642,7 +135829,7 @@ function inferAssemblyCablePath({
|
|
|
135642
135829
|
];
|
|
135643
135830
|
for (let i2 = 1; i2 < 48; i2++) {
|
|
135644
135831
|
const t48 = i2 / 48, u2 = 1 - t48;
|
|
135645
|
-
const arch = Math.sin(Math.PI * t48) ** 2 * Math.min(12,
|
|
135832
|
+
const arch = Math.sin(Math.PI * t48) ** 2 * Math.min(12, distance28 * 0.15);
|
|
135646
135833
|
path.push({
|
|
135647
135834
|
x: u2 ** 3 * from.x + 3 * u2 ** 2 * t48 * controlA.x + 3 * u2 * t48 ** 2 * controlB.x + t48 ** 3 * to.x + archDirection[0] * arch,
|
|
135648
135835
|
y: u2 ** 3 * from.y + 3 * u2 ** 2 * t48 * controlA.y + 3 * u2 * t48 ** 2 * controlB.y + t48 ** 3 * to.y + archDirection[1] * arch,
|
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.2166",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@tscircuit/dogbone-solver": "https://jscdn.tscircuit.com/@tscircuit/dogbone-solver/0.0.1.tgz",
|
|
48
48
|
"@tscircuit/fanout-solver": "0.0.78",
|
|
49
49
|
"@tscircuit/flex-utils": "https://jscdn.tscircuit.com/@tscircuit/flex-utils/0.0.8.tgz",
|
|
50
|
-
"@tscircuit/footprinter": "^0.0.
|
|
50
|
+
"@tscircuit/footprinter": "^0.0.440",
|
|
51
51
|
"@tscircuit/image-utils": "^0.0.8",
|
|
52
52
|
"@tscircuit/implicit-copper-pour-solver": "github:tscircuit/implicit-copper-pour-solver#a5cbbda0cd65fd4707c5c1af25779837c25aba92",
|
|
53
53
|
"@tscircuit/infer-cable-insertion-point": "^0.0.4",
|