@tscircuit/core 0.0.2134 → 0.0.2135
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 +57 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6103,6 +6103,59 @@ function getTraceLength(route) {
|
|
|
6103
6103
|
return totalLength;
|
|
6104
6104
|
}
|
|
6105
6105
|
|
|
6106
|
+
// lib/components/primitive-components/Trace/insert-pcb-path-via-contact-errors.ts
|
|
6107
|
+
var insertPcbPathViaContactErrors = ({
|
|
6108
|
+
trace,
|
|
6109
|
+
pcbTrace,
|
|
6110
|
+
ports,
|
|
6111
|
+
pathIndex
|
|
6112
|
+
}) => {
|
|
6113
|
+
const { db: db2 } = trace.root;
|
|
6114
|
+
const pcbVias = db2.pcb_via.list({ pcb_trace_id: pcbTrace.pcb_trace_id });
|
|
6115
|
+
const connection = db2.source_trace.get(trace.source_trace_id)?.display_name;
|
|
6116
|
+
let traceDescription = "unnamed trace";
|
|
6117
|
+
if (connection && trace._parsedProps.name) {
|
|
6118
|
+
traceDescription = `${trace.getDisplayName()}, ${connection}`;
|
|
6119
|
+
} else if (connection) {
|
|
6120
|
+
traceDescription = connection;
|
|
6121
|
+
} else if (trace._parsedProps.name) {
|
|
6122
|
+
traceDescription = trace.getDisplayName();
|
|
6123
|
+
}
|
|
6124
|
+
let pathName = "pcbPath";
|
|
6125
|
+
if (pathIndex !== void 0) {
|
|
6126
|
+
pathName = `pcbPaths[${pathIndex}]`;
|
|
6127
|
+
}
|
|
6128
|
+
let incomingLayer;
|
|
6129
|
+
let viaNumber = 0;
|
|
6130
|
+
for (const point6 of pcbTrace.route) {
|
|
6131
|
+
if (point6.route_type === "wire") {
|
|
6132
|
+
incomingLayer = point6.layer;
|
|
6133
|
+
continue;
|
|
6134
|
+
}
|
|
6135
|
+
if (point6.route_type !== "via") {
|
|
6136
|
+
continue;
|
|
6137
|
+
}
|
|
6138
|
+
viaNumber += 1;
|
|
6139
|
+
const pcbVia = pcbVias[viaNumber - 1];
|
|
6140
|
+
if (incomingLayer && !pcbVia.layers.includes(incomingLayer)) {
|
|
6141
|
+
const boardX = Number(point6.x.toFixed(4));
|
|
6142
|
+
const boardY = Number(point6.y.toFixed(4));
|
|
6143
|
+
db2.pcb_trace_error.insert({
|
|
6144
|
+
error_type: "pcb_trace_error",
|
|
6145
|
+
source_trace_id: trace.source_trace_id,
|
|
6146
|
+
message: `Invalid ${pathName} (${traceDescription}): via ${viaNumber} (${point6.from_layer} \u2192 ${point6.to_layer}) at board (${boardX}, ${boardY}) mm does not reach incoming ${incomingLayer} copper.`,
|
|
6147
|
+
center: { x: point6.x, y: point6.y },
|
|
6148
|
+
pcb_trace_id: pcbTrace.pcb_trace_id,
|
|
6149
|
+
pcb_component_ids: [],
|
|
6150
|
+
pcb_port_ids: ports.map((port) => port.pcb_port_id).filter(Boolean),
|
|
6151
|
+
subcircuit_id: pcbTrace.subcircuit_id,
|
|
6152
|
+
is_fatal: false
|
|
6153
|
+
});
|
|
6154
|
+
}
|
|
6155
|
+
incomingLayer = point6.to_layer;
|
|
6156
|
+
}
|
|
6157
|
+
};
|
|
6158
|
+
|
|
6106
6159
|
// lib/components/primitive-components/Trace/Trace_doInitialPcbManualTraceRender.ts
|
|
6107
6160
|
import { applyToPoint as applyToPoint5, identity as identity4 } from "transformation-matrix";
|
|
6108
6161
|
|
|
@@ -6429,7 +6482,7 @@ var renderPcbPaths = ({
|
|
|
6429
6482
|
const pcbStyle = trace.getInheritedMergedProperty("pcbStyle");
|
|
6430
6483
|
const { holeDiameter, padDiameter } = getViaDiameterDefaults(pcbStyle);
|
|
6431
6484
|
const connectivityMapKey = trace.subcircuit_connectivity_map_key ?? db2.source_trace.get(trace.source_trace_id)?.subcircuit_connectivity_map_key;
|
|
6432
|
-
for (const path of paths) {
|
|
6485
|
+
for (const [pathIndex, path] of paths.entries()) {
|
|
6433
6486
|
const route = getRouteForPcbPath({ trace, path, anchorPort, width });
|
|
6434
6487
|
if (!route || route.length < 2) continue;
|
|
6435
6488
|
const pcbTrace = db2.pcb_trace.insert({
|
|
@@ -6463,6 +6516,7 @@ var renderPcbPaths = ({
|
|
|
6463
6516
|
subcircuit_connectivity_map_key: connectivityMapKey
|
|
6464
6517
|
});
|
|
6465
6518
|
}
|
|
6519
|
+
insertPcbPathViaContactErrors({ trace, pcbTrace, ports, pathIndex });
|
|
6466
6520
|
trace._insertErrorIfTraceIsOutsideBoard(route, ports);
|
|
6467
6521
|
}
|
|
6468
6522
|
trace._portsRoutedOnPcb = ports;
|
|
@@ -6856,6 +6910,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
6856
6910
|
}
|
|
6857
6911
|
trace._portsRoutedOnPcb = ports;
|
|
6858
6912
|
trace.pcb_trace_id = pcb_trace.pcb_trace_id;
|
|
6913
|
+
insertPcbPathViaContactErrors({ trace, pcbTrace: pcb_trace, ports });
|
|
6859
6914
|
trace._insertErrorIfTraceIsOutsideBoard(route, ports);
|
|
6860
6915
|
}
|
|
6861
6916
|
|
|
@@ -118378,7 +118433,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
118378
118433
|
var package_default = {
|
|
118379
118434
|
name: "@tscircuit/core",
|
|
118380
118435
|
type: "module",
|
|
118381
|
-
version: "0.0.
|
|
118436
|
+
version: "0.0.2134",
|
|
118382
118437
|
types: "dist/index.d.ts",
|
|
118383
118438
|
main: "dist/index.js",
|
|
118384
118439
|
module: "dist/index.js",
|