@tscircuit/core 0.0.1808 → 0.0.1809
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 +253 -59
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38452,7 +38452,13 @@ var debug8 = Debug10("Group_doInitialSchematicTraceRender");
|
|
|
38452
38452
|
var INLINE_NET_LABEL_COLOR = "rgb(132, 0, 0)";
|
|
38453
38453
|
var VERTICAL_INLINE_NET_LABEL_ROTATION = -90;
|
|
38454
38454
|
function applyInlineNetLabelPlacements(args) {
|
|
38455
|
-
const {
|
|
38455
|
+
const {
|
|
38456
|
+
group,
|
|
38457
|
+
solver,
|
|
38458
|
+
userNetIdToConnKey,
|
|
38459
|
+
sourceTraceIdByPinPairKey,
|
|
38460
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId
|
|
38461
|
+
} = args;
|
|
38456
38462
|
const { db } = group.root;
|
|
38457
38463
|
const inlineNetLabelPlacements = solver.inlineNetLabelSolver?.getOutput().inlineNetLabelPlacements ?? [];
|
|
38458
38464
|
if (inlineNetLabelPlacements.length === 0) return;
|
|
@@ -38461,17 +38467,18 @@ function applyInlineNetLabelPlacements(args) {
|
|
|
38461
38467
|
for (const placement of inlineNetLabelPlacements) {
|
|
38462
38468
|
const schematicPortIds = placement.pinIds.map(asSchematicPortId);
|
|
38463
38469
|
const placementUserNetId = globalConnMap.getIdsConnectedToNet(placement.globalConnNetId).find((id) => userNetIdToConnKey.has(id));
|
|
38464
|
-
const
|
|
38465
|
-
const
|
|
38470
|
+
const crossScopeSourceTraceId = schematicPortIds.length === 1 ? crossScopeSourceTraceIdBySchematicPortIdAndNetId.get(schematicPortIds[0])?.get(placement.netId ?? placement.globalConnNetId) : void 0;
|
|
38471
|
+
const connKey = (crossScopeSourceTraceId ? db.source_trace.get(crossScopeSourceTraceId)?.subcircuit_connectivity_map_key : void 0) ?? (placementUserNetId ? userNetIdToConnKey.get(placementUserNetId) : void 0);
|
|
38472
|
+
const text = placement.netLabelText ?? (connKey ? resolveCanonicalNetLabelText({
|
|
38473
|
+
subcircuitConnectivityMapKey: connKey
|
|
38474
|
+
}).name : placement.netId ?? placement.globalConnNetId);
|
|
38466
38475
|
if (!text) {
|
|
38467
38476
|
debug8(
|
|
38468
38477
|
`skipping inline net label for "${placement.netId}" REASON:no resolvable text`
|
|
38469
38478
|
);
|
|
38470
38479
|
continue;
|
|
38471
38480
|
}
|
|
38472
|
-
let sourceTraceId = sourceTraceIdByPinPairKey.get(
|
|
38473
|
-
[...schematicPortIds].sort().join("::")
|
|
38474
|
-
);
|
|
38481
|
+
let sourceTraceId = crossScopeSourceTraceId ?? sourceTraceIdByPinPairKey.get([...schematicPortIds].sort().join("::"));
|
|
38475
38482
|
if (!sourceTraceId && connKey) {
|
|
38476
38483
|
const sourcePortIds = schematicPortIds.flatMap((schematicPortId) => {
|
|
38477
38484
|
const sourcePortId = db.schematic_port.get(schematicPortId)?.source_port_id;
|
|
@@ -38640,7 +38647,7 @@ function applyNetLabelPlacements(args) {
|
|
|
38640
38647
|
solver,
|
|
38641
38648
|
connKeyToSourceNet,
|
|
38642
38649
|
userNetIdToConnKey,
|
|
38643
|
-
|
|
38650
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId,
|
|
38644
38651
|
sourceTraceIdByPortOnlyLabelSchematicPortId,
|
|
38645
38652
|
connKeysWithExplicitPortNetTraces,
|
|
38646
38653
|
schematicPortIdsWithPreExistingNetLabels,
|
|
@@ -38696,8 +38703,8 @@ function applyNetLabelPlacements(args) {
|
|
|
38696
38703
|
for (const placement of dedupedNetLabelPlacements) {
|
|
38697
38704
|
debug9(`processing placement: ${placement.netId}`);
|
|
38698
38705
|
const schPortIds = placement.pinIds.map(asSchematicPortId);
|
|
38699
|
-
const
|
|
38700
|
-
const placementSourceTraceId =
|
|
38706
|
+
const crossScopeSourceTraceId = schPortIds.length === 1 ? crossScopeSourceTraceIdBySchematicPortIdAndNetId.get(schPortIds[0])?.get(placement.netId ?? placement.globalConnNetId) : void 0;
|
|
38707
|
+
const placementSourceTraceId = crossScopeSourceTraceId ?? (schPortIds.length === 1 ? sourceTraceIdByPortOnlyLabelSchematicPortId.get(schPortIds[0]) : void 0);
|
|
38701
38708
|
const placementSourceTrace = placementSourceTraceId ? db.source_trace.get(placementSourceTraceId) : void 0;
|
|
38702
38709
|
const placementUserNetId = globalConnMap.getIdsConnectedToNet(placement.globalConnNetId).find((id) => userNetIdToConnKey.get(id));
|
|
38703
38710
|
const placementConnKey = placementSourceTrace?.subcircuit_connectivity_map_key ?? userNetIdToConnKey.get(placementUserNetId);
|
|
@@ -38707,15 +38714,16 @@ function applyNetLabelPlacements(args) {
|
|
|
38707
38714
|
if (placementConnKey) {
|
|
38708
38715
|
sourceNet = connKeyToSourceNet.get(placementConnKey);
|
|
38709
38716
|
}
|
|
38710
|
-
const
|
|
38711
|
-
name: crossSubcircuitTraceLabel.text,
|
|
38712
|
-
wasAssignedDisplayLabel: false
|
|
38713
|
-
} : resolveCanonicalNetLabelText({
|
|
38717
|
+
const resolvedCanonicalNetLabel = placementConnKey ? resolveCanonicalNetLabelText({
|
|
38714
38718
|
subcircuitConnectivityMapKey: placementConnKey
|
|
38715
38719
|
}) : {
|
|
38716
38720
|
name: placement.netId ?? placement.globalConnNetId,
|
|
38717
38721
|
wasAssignedDisplayLabel: false
|
|
38718
38722
|
};
|
|
38723
|
+
const canonicalNetLabel = placement.netLabelText ? {
|
|
38724
|
+
name: placement.netLabelText,
|
|
38725
|
+
wasAssignedDisplayLabel: true
|
|
38726
|
+
} : resolvedCanonicalNetLabel;
|
|
38719
38727
|
let schematicSheetId = group._resolveSchematicSheetId();
|
|
38720
38728
|
const schematicPort = db.schematic_port.get(schPortIds[0]);
|
|
38721
38729
|
if (schematicPort?.schematic_sheet_id) {
|
|
@@ -39572,9 +39580,23 @@ import {
|
|
|
39572
39580
|
getBoundsCenter as getBoundsCenter2
|
|
39573
39581
|
} from "@tscircuit/math-utils";
|
|
39574
39582
|
import "@tscircuit/schematic-trace-solver";
|
|
39583
|
+
import { getSourcePortConnectivityMapFromCircuitJson as getSourcePortConnectivityMapFromCircuitJson2 } from "circuit-json-to-connectivity-map";
|
|
39575
39584
|
|
|
39576
39585
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyInlineNetLabelEligibility.ts
|
|
39577
39586
|
var INLINE_NET_LABEL_FONT_SIZE = 0.12;
|
|
39587
|
+
var markConnectionEligibleForInlineNetLabel = (connection, name) => {
|
|
39588
|
+
connection.anchoredNetLabelWidth ??= Number(
|
|
39589
|
+
getSchematicNetLabelTextWidth({ text: name }).toFixed(2)
|
|
39590
|
+
);
|
|
39591
|
+
connection.allowInlineNetLabel = true;
|
|
39592
|
+
connection.inlineNetLabelHeight = INLINE_NET_LABEL_FONT_SIZE;
|
|
39593
|
+
connection.inlineNetLabelWidth = Number(
|
|
39594
|
+
getSchematicNetLabelTextWidth({
|
|
39595
|
+
text: name,
|
|
39596
|
+
font_size: INLINE_NET_LABEL_FONT_SIZE
|
|
39597
|
+
}).toFixed(2)
|
|
39598
|
+
);
|
|
39599
|
+
};
|
|
39578
39600
|
var applyInlineNetLabelEligibility = ({
|
|
39579
39601
|
directConnections,
|
|
39580
39602
|
netConnections,
|
|
@@ -39586,19 +39608,6 @@ var applyInlineNetLabelEligibility = ({
|
|
|
39586
39608
|
areSchematicPortsOnDifferentComponents,
|
|
39587
39609
|
resolveCanonicalNetLabelText
|
|
39588
39610
|
}) => {
|
|
39589
|
-
const markEligible = (connection, name) => {
|
|
39590
|
-
connection.anchoredNetLabelWidth ??= Number(
|
|
39591
|
-
getSchematicNetLabelTextWidth({ text: name }).toFixed(2)
|
|
39592
|
-
);
|
|
39593
|
-
connection.allowInlineNetLabel = true;
|
|
39594
|
-
connection.inlineNetLabelHeight = INLINE_NET_LABEL_FONT_SIZE;
|
|
39595
|
-
connection.inlineNetLabelWidth = Number(
|
|
39596
|
-
getSchematicNetLabelTextWidth({
|
|
39597
|
-
text: name,
|
|
39598
|
-
font_size: INLINE_NET_LABEL_FONT_SIZE
|
|
39599
|
-
}).toFixed(2)
|
|
39600
|
-
);
|
|
39601
|
-
};
|
|
39602
39611
|
for (const directConnection of directConnections) {
|
|
39603
39612
|
const { connKey } = directConnection;
|
|
39604
39613
|
if (!connKey) continue;
|
|
@@ -39610,10 +39619,11 @@ var applyInlineNetLabelEligibility = ({
|
|
|
39610
39619
|
subcircuitConnectivityMapKey: connKey
|
|
39611
39620
|
});
|
|
39612
39621
|
if (!name || !wasAssignedDisplayLabel) continue;
|
|
39613
|
-
|
|
39622
|
+
markConnectionEligibleForInlineNetLabel(directConnection, name);
|
|
39614
39623
|
}
|
|
39615
39624
|
for (const netConnection of netConnections) {
|
|
39616
39625
|
const { schematicPortIds } = netConnection;
|
|
39626
|
+
const { isSameSheetCrossSectionConnection } = netConnection;
|
|
39617
39627
|
const hasInlineNetLabel = schematicPortIds.some(
|
|
39618
39628
|
(schematicPortId) => schematicPortIdsWithInlineNetLabels.has(schematicPortId)
|
|
39619
39629
|
);
|
|
@@ -39625,7 +39635,7 @@ var applyInlineNetLabelEligibility = ({
|
|
|
39625
39635
|
otherSchematicPortId
|
|
39626
39636
|
])
|
|
39627
39637
|
);
|
|
39628
|
-
if (!hasInlineNetLabel && !isSinglePort && !hasPortsOnDifferentComponents) {
|
|
39638
|
+
if (!hasInlineNetLabel && !isSameSheetCrossSectionConnection && !isSinglePort && !hasPortsOnDifferentComponents) {
|
|
39629
39639
|
continue;
|
|
39630
39640
|
}
|
|
39631
39641
|
if (!hasInlineNetLabel && schematicPortIds.some(
|
|
@@ -39633,17 +39643,25 @@ var applyInlineNetLabelEligibility = ({
|
|
|
39633
39643
|
))
|
|
39634
39644
|
continue;
|
|
39635
39645
|
const { connKey } = netConnection;
|
|
39636
|
-
if (!connKey) continue;
|
|
39637
|
-
if (!connKeysWithExplicitPortNetTraces.has(connKey))
|
|
39638
|
-
|
|
39639
|
-
|
|
39646
|
+
if (!connKey && !isSameSheetCrossSectionConnection) continue;
|
|
39647
|
+
if (connKey && !isSameSheetCrossSectionConnection && !connKeysWithExplicitPortNetTraces.has(connKey))
|
|
39648
|
+
continue;
|
|
39649
|
+
const sourceNet = connKey ? connKeyToSourceNet.get(connKey) : void 0;
|
|
39650
|
+
if (!hasInlineNetLabel && (netConnection.isPowerOrGroundConnection || sourceNet?.is_power || sourceNet?.is_ground)) {
|
|
39640
39651
|
continue;
|
|
39641
39652
|
}
|
|
39642
|
-
|
|
39643
|
-
|
|
39644
|
-
|
|
39653
|
+
let name = netConnection.netLabelText ?? "";
|
|
39654
|
+
let wasAssignedDisplayLabel = Boolean(name);
|
|
39655
|
+
if (!isSameSheetCrossSectionConnection) {
|
|
39656
|
+
if (!connKey) continue;
|
|
39657
|
+
const resolvedLabel = resolveCanonicalNetLabelText({
|
|
39658
|
+
subcircuitConnectivityMapKey: connKey
|
|
39659
|
+
});
|
|
39660
|
+
name = resolvedLabel.name;
|
|
39661
|
+
wasAssignedDisplayLabel = resolvedLabel.wasAssignedDisplayLabel;
|
|
39662
|
+
}
|
|
39645
39663
|
if (!name || !hasInlineNetLabel && !wasAssignedDisplayLabel) continue;
|
|
39646
|
-
|
|
39664
|
+
markConnectionEligibleForInlineNetLabel(netConnection, name);
|
|
39647
39665
|
}
|
|
39648
39666
|
};
|
|
39649
39667
|
|
|
@@ -39829,6 +39847,36 @@ var DEFAULT_MAX_MSP_PAIR_DISTANCE = 2.4;
|
|
|
39829
39847
|
var SCHEMATIC_RAIL_NET_LABEL_HEIGHT = 0.42;
|
|
39830
39848
|
function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
39831
39849
|
const { db } = group.root;
|
|
39850
|
+
const sourcePortConnectivityMap = getSourcePortConnectivityMapFromCircuitJson2(
|
|
39851
|
+
db.toArray()
|
|
39852
|
+
);
|
|
39853
|
+
const getStableSourceConnectivityNetId = (connectivityNetId) => {
|
|
39854
|
+
const canonicalSourceId = [
|
|
39855
|
+
...sourcePortConnectivityMap.getIdsConnectedToNet(connectivityNetId)
|
|
39856
|
+
].sort()[0];
|
|
39857
|
+
return canonicalSourceId ? `source_connectivity_${canonicalSourceId}` : `source_${connectivityNetId}`;
|
|
39858
|
+
};
|
|
39859
|
+
const getSourceConnectivityNetId = (sourceTrace) => {
|
|
39860
|
+
const connectivityNetId = [
|
|
39861
|
+
...sourceTrace.connected_source_port_ids,
|
|
39862
|
+
...sourceTrace.connected_source_net_ids
|
|
39863
|
+
].map(
|
|
39864
|
+
(sourceId) => sourcePortConnectivityMap.getNetConnectedToId(sourceId)
|
|
39865
|
+
).find((netId) => Boolean(netId));
|
|
39866
|
+
return connectivityNetId ? getStableSourceConnectivityNetId(connectivityNetId) : sourceTrace.subcircuit_connectivity_map_key ?? sourceTrace.source_trace_id;
|
|
39867
|
+
};
|
|
39868
|
+
const powerOrGroundSourceConnectivityNetIds = /* @__PURE__ */ new Set();
|
|
39869
|
+
for (const sourceNet of db.source_net.list()) {
|
|
39870
|
+
if (!sourceNet.is_power && !sourceNet.is_ground) continue;
|
|
39871
|
+
const connectivityNetId = sourcePortConnectivityMap.getNetConnectedToId(
|
|
39872
|
+
sourceNet.source_net_id
|
|
39873
|
+
);
|
|
39874
|
+
if (connectivityNetId) {
|
|
39875
|
+
powerOrGroundSourceConnectivityNetIds.add(
|
|
39876
|
+
getStableSourceConnectivityNetId(connectivityNetId)
|
|
39877
|
+
);
|
|
39878
|
+
}
|
|
39879
|
+
}
|
|
39832
39880
|
const connKeyToSourceNet = /* @__PURE__ */ new Map();
|
|
39833
39881
|
const childGroups = [];
|
|
39834
39882
|
const componentsToVisit = [...group.children].reverse();
|
|
@@ -39877,7 +39925,8 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
39877
39925
|
});
|
|
39878
39926
|
}).filter((textBox) => Boolean(textBox));
|
|
39879
39927
|
const sectionIdBySchematicComponentId = /* @__PURE__ */ new Map();
|
|
39880
|
-
|
|
39928
|
+
const boardDescendants = group._getBoard()?.getDescendants() ?? [];
|
|
39929
|
+
for (const component of boardDescendants) {
|
|
39881
39930
|
const schematicComponentId = component.schematic_component_id;
|
|
39882
39931
|
const sectionId = component.getSchematicSectionName();
|
|
39883
39932
|
if (schematicComponentId && sectionId) {
|
|
@@ -40023,9 +40072,67 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40023
40072
|
}
|
|
40024
40073
|
}
|
|
40025
40074
|
const directConnections = [];
|
|
40026
|
-
const
|
|
40075
|
+
const boundaryTraceNetConnections = [];
|
|
40027
40076
|
const connectedPairKeys = /* @__PURE__ */ new Set();
|
|
40028
|
-
const
|
|
40077
|
+
const crossScopeSourceTraceIdBySchematicPortIdAndNetId = /* @__PURE__ */ new Map();
|
|
40078
|
+
const crossSectionNetConnectionByKey = /* @__PURE__ */ new Map();
|
|
40079
|
+
const setCrossScopeSourceTraceId = ({
|
|
40080
|
+
schematicPortId,
|
|
40081
|
+
netId,
|
|
40082
|
+
sourceTraceId,
|
|
40083
|
+
replaceExisting = false
|
|
40084
|
+
}) => {
|
|
40085
|
+
const sourceTraceIdByNetId = crossScopeSourceTraceIdBySchematicPortIdAndNetId.get(schematicPortId) ?? /* @__PURE__ */ new Map();
|
|
40086
|
+
if (sourceTraceIdByNetId.has(netId) && !replaceExisting) return false;
|
|
40087
|
+
sourceTraceIdByNetId.set(netId, sourceTraceId);
|
|
40088
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId.set(
|
|
40089
|
+
schematicPortId,
|
|
40090
|
+
sourceTraceIdByNetId
|
|
40091
|
+
);
|
|
40092
|
+
return true;
|
|
40093
|
+
};
|
|
40094
|
+
const addPortToCrossSectionInlineNetConnection = ({
|
|
40095
|
+
sourceConnectivityNetId,
|
|
40096
|
+
schematicPortId,
|
|
40097
|
+
text,
|
|
40098
|
+
sourceTraceId,
|
|
40099
|
+
connKey,
|
|
40100
|
+
preferInScopeTraceMetadata = false
|
|
40101
|
+
}) => {
|
|
40102
|
+
const netId = sourceConnectivityNetId;
|
|
40103
|
+
setCrossScopeSourceTraceId({
|
|
40104
|
+
schematicPortId,
|
|
40105
|
+
netId,
|
|
40106
|
+
sourceTraceId,
|
|
40107
|
+
replaceExisting: preferInScopeTraceMetadata
|
|
40108
|
+
});
|
|
40109
|
+
if (schematicPortIdsWithExplicitNetLabels.has(schematicPortId)) return;
|
|
40110
|
+
let connection = crossSectionNetConnectionByKey.get(sourceConnectivityNetId);
|
|
40111
|
+
if (!connection) {
|
|
40112
|
+
connection = {
|
|
40113
|
+
netId,
|
|
40114
|
+
netLabelText: text,
|
|
40115
|
+
schematicPortIds: [],
|
|
40116
|
+
netLabelWidth: Number(
|
|
40117
|
+
getSchematicNetLabelTextWidth({ text }).toFixed(2)
|
|
40118
|
+
),
|
|
40119
|
+
connKey,
|
|
40120
|
+
isSameSheetCrossSectionConnection: true,
|
|
40121
|
+
isPowerOrGroundConnection: powerOrGroundSourceConnectivityNetIds.has(netId)
|
|
40122
|
+
};
|
|
40123
|
+
crossSectionNetConnectionByKey.set(sourceConnectivityNetId, connection);
|
|
40124
|
+
boundaryTraceNetConnections.push(connection);
|
|
40125
|
+
} else if (preferInScopeTraceMetadata) {
|
|
40126
|
+
connection.netLabelText = text;
|
|
40127
|
+
connection.netLabelWidth = Number(
|
|
40128
|
+
getSchematicNetLabelTextWidth({ text }).toFixed(2)
|
|
40129
|
+
);
|
|
40130
|
+
connection.connKey = connKey ?? connection.connKey;
|
|
40131
|
+
}
|
|
40132
|
+
if (!connection.schematicPortIds.includes(schematicPortId)) {
|
|
40133
|
+
connection.schematicPortIds.push(schematicPortId);
|
|
40134
|
+
}
|
|
40135
|
+
};
|
|
40029
40136
|
const sourceTraceIdsByPortOnlyLabelSchematicPortId = /* @__PURE__ */ new Map();
|
|
40030
40137
|
const sourceTraceIdByPinPairKey = /* @__PURE__ */ new Map();
|
|
40031
40138
|
const connKeysWithExplicitPortNetTraces = /* @__PURE__ */ new Set();
|
|
@@ -40036,6 +40143,30 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40036
40143
|
);
|
|
40037
40144
|
}
|
|
40038
40145
|
}
|
|
40146
|
+
const areSchematicPortsInDifferentSectionsOnSameSheet = (firstSchematicPortId, secondSchematicPortId) => {
|
|
40147
|
+
const firstSchematicPort = db.schematic_port.get(firstSchematicPortId);
|
|
40148
|
+
const secondSchematicPort = db.schematic_port.get(secondSchematicPortId);
|
|
40149
|
+
if (!firstSchematicPort || !secondSchematicPort) return false;
|
|
40150
|
+
const sharesSheet = firstSchematicPort.schematic_sheet_id === secondSchematicPort.schematic_sheet_id;
|
|
40151
|
+
if (!sharesSheet) return false;
|
|
40152
|
+
const firstSectionId = firstSchematicPort.schematic_component_id ? sectionIdBySchematicComponentId.get(
|
|
40153
|
+
firstSchematicPort.schematic_component_id
|
|
40154
|
+
) : void 0;
|
|
40155
|
+
const secondSectionId = secondSchematicPort.schematic_component_id ? sectionIdBySchematicComponentId.get(
|
|
40156
|
+
secondSchematicPort.schematic_component_id
|
|
40157
|
+
) : void 0;
|
|
40158
|
+
const crossesSection = firstSectionId !== secondSectionId && (firstSectionId !== void 0 || secondSectionId !== void 0);
|
|
40159
|
+
return crossesSection;
|
|
40160
|
+
};
|
|
40161
|
+
const doesSourcePortCrossSectionOnSameSheet = ({
|
|
40162
|
+
schematicPortId,
|
|
40163
|
+
otherSourcePortId
|
|
40164
|
+
}) => db.schematic_port.list({ source_port_id: otherSourcePortId }).some(
|
|
40165
|
+
(otherSchematicPort) => areSchematicPortsInDifferentSectionsOnSameSheet(
|
|
40166
|
+
schematicPortId,
|
|
40167
|
+
asSchematicPortId(otherSchematicPort.schematic_port_id)
|
|
40168
|
+
)
|
|
40169
|
+
);
|
|
40039
40170
|
for (const st of tracesInScope) {
|
|
40040
40171
|
const connected = (st.connected_source_port_ids ?? []).map(
|
|
40041
40172
|
(sourcePortId) => sourcePortIdToSchPortId.get(asSourcePortId(sourcePortId))
|
|
@@ -40055,11 +40186,25 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40055
40186
|
schematicSheetId: opts.schematicSheetId
|
|
40056
40187
|
})
|
|
40057
40188
|
);
|
|
40189
|
+
const crossesSchematicSectionOnSameSheet = Boolean(
|
|
40190
|
+
connected.length === 1 && otherSourcePortId && doesSourcePortCrossSectionOnSameSheet({
|
|
40191
|
+
schematicPortId: connected[0],
|
|
40192
|
+
otherSourcePortId
|
|
40193
|
+
})
|
|
40194
|
+
);
|
|
40058
40195
|
if (connected.length === 1 && st.connected_source_port_ids.length === 2 && crossesSchematicScopeBoundary && st.connected_source_net_ids.length === 0 && st.subcircuit_connectivity_map_key) {
|
|
40059
40196
|
const schematicPortId = connected[0];
|
|
40060
40197
|
const sourcePortId = schPortIdToSourcePortId.get(schematicPortId);
|
|
40061
40198
|
if (sourcePortId) {
|
|
40062
40199
|
const connKey = st.subcircuit_connectivity_map_key;
|
|
40200
|
+
const sourcePortConnKey = db.source_port.get(sourcePortId)?.subcircuit_connectivity_map_key;
|
|
40201
|
+
const sourceNetInCurrentSubcircuit = db.source_net.list().find(
|
|
40202
|
+
(sourceNet) => sourceNet.subcircuit_id === group.subcircuit_id && sourcePortConnectivityMap.areIdsConnected(
|
|
40203
|
+
sourceNet.source_net_id,
|
|
40204
|
+
sourcePortId
|
|
40205
|
+
)
|
|
40206
|
+
);
|
|
40207
|
+
const sourceNetForLabel = connKeyToSourceNet.get(connKey) ?? (sourcePortConnKey ? connKeyToSourceNet.get(sourcePortConnKey) : void 0) ?? sourceNetInCurrentSubcircuit;
|
|
40063
40208
|
const connectedSourcePortIdsForKey = Array.from(schematicPortIdsInScope).map((portId) => schPortIdToSourcePortId.get(portId)).filter((sourcePortId2) => {
|
|
40064
40209
|
if (!sourcePortId2) return false;
|
|
40065
40210
|
return db.source_port.get(sourcePortId2)?.subcircuit_connectivity_map_key === connKey;
|
|
@@ -40071,21 +40216,36 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40071
40216
|
sourcePortIdsInSchematicScope,
|
|
40072
40217
|
schematicSheetId: opts.schematicSheetId,
|
|
40073
40218
|
connKey,
|
|
40074
|
-
sourceNet:
|
|
40219
|
+
sourceNet: sourceNetForLabel
|
|
40075
40220
|
});
|
|
40076
|
-
if (text
|
|
40077
|
-
|
|
40078
|
-
|
|
40221
|
+
if (text) {
|
|
40222
|
+
const sourceConnectivityNetId = getSourceConnectivityNetId(st);
|
|
40223
|
+
if (!userNetIdToConnKey.has(sourceConnectivityNetId)) {
|
|
40224
|
+
userNetIdToConnKey.set(sourceConnectivityNetId, connKey);
|
|
40225
|
+
}
|
|
40226
|
+
if (crossesSchematicSectionOnSameSheet) {
|
|
40227
|
+
addPortToCrossSectionInlineNetConnection({
|
|
40228
|
+
sourceConnectivityNetId,
|
|
40229
|
+
schematicPortId,
|
|
40230
|
+
text,
|
|
40231
|
+
sourceTraceId: st.source_trace_id,
|
|
40232
|
+
connKey
|
|
40233
|
+
});
|
|
40234
|
+
} else if (setCrossScopeSourceTraceId({
|
|
40235
|
+
schematicPortId,
|
|
40236
|
+
netId: sourceConnectivityNetId,
|
|
40079
40237
|
sourceTraceId: st.source_trace_id
|
|
40080
|
-
})
|
|
40081
|
-
|
|
40082
|
-
|
|
40083
|
-
|
|
40084
|
-
|
|
40085
|
-
|
|
40086
|
-
|
|
40087
|
-
|
|
40088
|
-
|
|
40238
|
+
})) {
|
|
40239
|
+
boundaryTraceNetConnections.push({
|
|
40240
|
+
netId: sourceConnectivityNetId,
|
|
40241
|
+
netLabelText: text,
|
|
40242
|
+
schematicPortIds: [schematicPortId],
|
|
40243
|
+
netLabelWidth: Number(
|
|
40244
|
+
getSchematicNetLabelTextWidth({ text }).toFixed(2)
|
|
40245
|
+
),
|
|
40246
|
+
connKey
|
|
40247
|
+
});
|
|
40248
|
+
}
|
|
40089
40249
|
}
|
|
40090
40250
|
}
|
|
40091
40251
|
} else if (connected.length >= 2) {
|
|
@@ -40123,12 +40283,39 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40123
40283
|
text: renderedNetLabelText
|
|
40124
40284
|
}).toFixed(2)
|
|
40125
40285
|
) : void 0;
|
|
40286
|
+
const crossSectionNetLabelText = renderedNetLabelText;
|
|
40126
40287
|
for (let i = 0; i < connected.length - 1; i++) {
|
|
40127
40288
|
const a = connected[i];
|
|
40128
40289
|
const b = connected[i + 1];
|
|
40129
40290
|
const pairKey = [a, b].sort().join("::");
|
|
40130
40291
|
if (connectedPairKeys.has(pairKey)) continue;
|
|
40131
40292
|
connectedPairKeys.add(pairKey);
|
|
40293
|
+
if (crossSectionNetLabelText && areSchematicPortsInDifferentSectionsOnSameSheet(a, b)) {
|
|
40294
|
+
const sourceConnectivityNetId = getSourceConnectivityNetId(st);
|
|
40295
|
+
if (st.subcircuit_connectivity_map_key) {
|
|
40296
|
+
userNetIdToConnKey.set(
|
|
40297
|
+
sourceConnectivityNetId,
|
|
40298
|
+
st.subcircuit_connectivity_map_key
|
|
40299
|
+
);
|
|
40300
|
+
}
|
|
40301
|
+
addPortToCrossSectionInlineNetConnection({
|
|
40302
|
+
sourceConnectivityNetId,
|
|
40303
|
+
schematicPortId: a,
|
|
40304
|
+
text: crossSectionNetLabelText,
|
|
40305
|
+
sourceTraceId: st.source_trace_id,
|
|
40306
|
+
connKey: st.subcircuit_connectivity_map_key,
|
|
40307
|
+
preferInScopeTraceMetadata: true
|
|
40308
|
+
});
|
|
40309
|
+
addPortToCrossSectionInlineNetConnection({
|
|
40310
|
+
sourceConnectivityNetId,
|
|
40311
|
+
schematicPortId: b,
|
|
40312
|
+
text: crossSectionNetLabelText,
|
|
40313
|
+
sourceTraceId: st.source_trace_id,
|
|
40314
|
+
connKey: st.subcircuit_connectivity_map_key,
|
|
40315
|
+
preferInScopeTraceMetadata: true
|
|
40316
|
+
});
|
|
40317
|
+
continue;
|
|
40318
|
+
}
|
|
40132
40319
|
sourceTraceIdByPinPairKey.set(pairKey, st.source_trace_id);
|
|
40133
40320
|
directConnections.push({
|
|
40134
40321
|
schematicPortIds: [a, b],
|
|
@@ -40139,7 +40326,7 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40139
40326
|
}
|
|
40140
40327
|
}
|
|
40141
40328
|
}
|
|
40142
|
-
const netConnections = [...
|
|
40329
|
+
const netConnections = [...boundaryTraceNetConnections];
|
|
40143
40330
|
const connKeyToSchematicPortIds = /* @__PURE__ */ new Map();
|
|
40144
40331
|
for (const [schId, srcPortId] of schPortIdToSourcePortId) {
|
|
40145
40332
|
if (schematicPortIdsWithExternallyRoutedRepresentations.has(schId)) continue;
|
|
@@ -40224,7 +40411,7 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40224
40411
|
netToAllowedOrientations[net.name] = ["x-", "x+"];
|
|
40225
40412
|
}
|
|
40226
40413
|
}
|
|
40227
|
-
for (const { netId } of
|
|
40414
|
+
for (const { netId } of boundaryTraceNetConnections) {
|
|
40228
40415
|
netToAllowedOrientations[netId] ??= ["x-", "x+"];
|
|
40229
40416
|
}
|
|
40230
40417
|
return netToAllowedOrientations;
|
|
@@ -40238,7 +40425,13 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40238
40425
|
})
|
|
40239
40426
|
),
|
|
40240
40427
|
netConnections: netConnections.map(
|
|
40241
|
-
({
|
|
40428
|
+
({
|
|
40429
|
+
schematicPortIds,
|
|
40430
|
+
connKey,
|
|
40431
|
+
isSameSheetCrossSectionConnection,
|
|
40432
|
+
isPowerOrGroundConnection,
|
|
40433
|
+
...connection
|
|
40434
|
+
}) => ({
|
|
40242
40435
|
...connection,
|
|
40243
40436
|
pinIds: schematicPortIds
|
|
40244
40437
|
})
|
|
@@ -40259,7 +40452,7 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
|
|
|
40259
40452
|
inputProblem,
|
|
40260
40453
|
connKeyToSourceNet,
|
|
40261
40454
|
userNetIdToConnKey,
|
|
40262
|
-
|
|
40455
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId,
|
|
40263
40456
|
sourceTraceIdByPortOnlyLabelSchematicPortId,
|
|
40264
40457
|
connKeysWithExplicitPortNetTraces,
|
|
40265
40458
|
schematicPortIdsInScope,
|
|
@@ -40532,7 +40725,7 @@ var renderSchematicTracesForSheet = ({
|
|
|
40532
40725
|
schematicPortIdsWithExternallyRoutedRepresentations,
|
|
40533
40726
|
schPortIdToSourcePortId,
|
|
40534
40727
|
userNetIdToConnKey,
|
|
40535
|
-
|
|
40728
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId,
|
|
40536
40729
|
sourceTraceIdByPortOnlyLabelSchematicPortId,
|
|
40537
40730
|
connKeysWithExplicitPortNetTraces,
|
|
40538
40731
|
netLabelsInScope,
|
|
@@ -40587,7 +40780,7 @@ var renderSchematicTracesForSheet = ({
|
|
|
40587
40780
|
solver,
|
|
40588
40781
|
connKeyToSourceNet,
|
|
40589
40782
|
userNetIdToConnKey,
|
|
40590
|
-
|
|
40783
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId,
|
|
40591
40784
|
sourceTraceIdByPortOnlyLabelSchematicPortId,
|
|
40592
40785
|
connKeysWithExplicitPortNetTraces,
|
|
40593
40786
|
schematicPortIdsWithPreExistingNetLabels,
|
|
@@ -40598,7 +40791,8 @@ var renderSchematicTracesForSheet = ({
|
|
|
40598
40791
|
group,
|
|
40599
40792
|
solver,
|
|
40600
40793
|
userNetIdToConnKey,
|
|
40601
|
-
sourceTraceIdByPinPairKey
|
|
40794
|
+
sourceTraceIdByPinPairKey,
|
|
40795
|
+
crossScopeSourceTraceIdBySchematicPortIdAndNetId
|
|
40602
40796
|
});
|
|
40603
40797
|
insertNetLabelsForPortsMissingTrace({
|
|
40604
40798
|
group,
|