@tscircuit/cli 0.1.2047 → 0.1.2048
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/cli/main.js +1861 -342
- package/dist/lib/index.js +2 -2
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -153243,7 +153243,7 @@ var import_perfect_cli = __toESM3(require_dist3(), 1);
|
|
|
153243
153243
|
// lib/getVersion.ts
|
|
153244
153244
|
import { createRequire as createRequire2 } from "node:module";
|
|
153245
153245
|
// package.json
|
|
153246
|
-
var version = "0.1.
|
|
153246
|
+
var version = "0.1.2047";
|
|
153247
153247
|
var package_default = {
|
|
153248
153248
|
name: "@tscircuit/cli",
|
|
153249
153249
|
version,
|
|
@@ -153262,7 +153262,7 @@ var package_default = {
|
|
|
153262
153262
|
"@tscircuit/check-shorts": "https://jscdn.tscircuit.com/@tscircuit/check-shorts/0.0.19.tgz",
|
|
153263
153263
|
"@tscircuit/circuit-json-placement-analysis": "^0.0.9",
|
|
153264
153264
|
"@tscircuit/circuit-json-routing-analysis": "^0.0.8",
|
|
153265
|
-
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#
|
|
153265
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#cb6059c8e2561967afad591b30251a915cab42e5",
|
|
153266
153266
|
"@tscircuit/circuit-json-util": "^0.0.113",
|
|
153267
153267
|
"@tscircuit/eval": "^0.0.1016",
|
|
153268
153268
|
"@tscircuit/fake-snippets": "^0.0.182",
|
|
@@ -319215,10 +319215,154 @@ var escapeAttr2 = (value) => value.replaceAll("&", "&").replaceAll('"', "&qu
|
|
|
319215
319215
|
var addAttr = (attrs, key, value, options) => {
|
|
319216
319216
|
if (value === undefined)
|
|
319217
319217
|
return;
|
|
319218
|
-
const stringValue = typeof value === "number" ? options?.formatDelta ? fmtDelta(value) : fmtNumber4(value) :
|
|
319218
|
+
const stringValue = typeof value === "number" ? options?.formatDelta ? fmtDelta(value) : fmtNumber4(value) : escapeAttr2(value);
|
|
319219
319219
|
attrs.push(`${key}="${stringValue}"`);
|
|
319220
319220
|
};
|
|
319221
319221
|
|
|
319222
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/source-connectivity.ts
|
|
319223
|
+
function getSourceConnectivity(circuitJson) {
|
|
319224
|
+
const parent = new Map;
|
|
319225
|
+
const find = (id) => {
|
|
319226
|
+
const next = parent.get(id);
|
|
319227
|
+
if (next === undefined || next === id)
|
|
319228
|
+
return id;
|
|
319229
|
+
const root = find(next);
|
|
319230
|
+
parent.set(id, root);
|
|
319231
|
+
return root;
|
|
319232
|
+
};
|
|
319233
|
+
const join = (ids) => {
|
|
319234
|
+
const first = ids[0];
|
|
319235
|
+
if (!first)
|
|
319236
|
+
return;
|
|
319237
|
+
const root = find(first);
|
|
319238
|
+
for (const id of ids.slice(1))
|
|
319239
|
+
parent.set(find(id), root);
|
|
319240
|
+
};
|
|
319241
|
+
for (const element of circuitJson) {
|
|
319242
|
+
if (element.type === "source_port" || element.type === "source_net") {
|
|
319243
|
+
const id = element.type === "source_port" ? element.source_port_id : element.source_net_id;
|
|
319244
|
+
if (element.subcircuit_connectivity_map_key)
|
|
319245
|
+
join([id, `connectivity:${element.subcircuit_connectivity_map_key}`]);
|
|
319246
|
+
}
|
|
319247
|
+
if (element.type === "source_trace") {
|
|
319248
|
+
join([
|
|
319249
|
+
...element.connected_source_port_ids,
|
|
319250
|
+
...element.connected_source_net_ids,
|
|
319251
|
+
...element.subcircuit_connectivity_map_key ? [`connectivity:${element.subcircuit_connectivity_map_key}`] : []
|
|
319252
|
+
]);
|
|
319253
|
+
}
|
|
319254
|
+
if (element.type === "source_component_internal_connection")
|
|
319255
|
+
join(element.source_port_ids);
|
|
319256
|
+
if (element.type === "source_component") {
|
|
319257
|
+
for (const ids of element.internally_connected_source_port_ids ?? [])
|
|
319258
|
+
join(ids);
|
|
319259
|
+
}
|
|
319260
|
+
}
|
|
319261
|
+
return find;
|
|
319262
|
+
}
|
|
319263
|
+
|
|
319264
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/placement-network-index.ts
|
|
319265
|
+
class PlacementNetworkIndex {
|
|
319266
|
+
connected;
|
|
319267
|
+
components = new Map;
|
|
319268
|
+
portsByComponent = new Map;
|
|
319269
|
+
portsByNet = new Map;
|
|
319270
|
+
powerNets = new Set;
|
|
319271
|
+
groundNets = new Set;
|
|
319272
|
+
placements = new Map;
|
|
319273
|
+
schematicComponents = new Map;
|
|
319274
|
+
schematicPorts = new Map;
|
|
319275
|
+
constructor(ctx) {
|
|
319276
|
+
this.connected = getSourceConnectivity(ctx.circuitJson);
|
|
319277
|
+
for (const placement of ctx.componentPlacements) {
|
|
319278
|
+
if (placement.sourceComponentId)
|
|
319279
|
+
append2(this.placements, placement.sourceComponentId, placement);
|
|
319280
|
+
}
|
|
319281
|
+
for (const element of ctx.circuitJson) {
|
|
319282
|
+
if (element.type === "source_component")
|
|
319283
|
+
this.components.set(element.source_component_id, element);
|
|
319284
|
+
if (element.type === "source_port" && element.source_component_id) {
|
|
319285
|
+
append2(this.portsByComponent, element.source_component_id, element);
|
|
319286
|
+
append2(this.portsByNet, this.connected(element.source_port_id), element);
|
|
319287
|
+
}
|
|
319288
|
+
if (element.type === "source_net") {
|
|
319289
|
+
const net = this.connected(element.source_net_id);
|
|
319290
|
+
if (element.is_power || element.is_positive_voltage_source)
|
|
319291
|
+
this.powerNets.add(net);
|
|
319292
|
+
if (element.is_ground)
|
|
319293
|
+
this.groundNets.add(net);
|
|
319294
|
+
}
|
|
319295
|
+
if (element.type === "schematic_component")
|
|
319296
|
+
this.schematicComponents.set(element.schematic_component_id, element);
|
|
319297
|
+
if (element.type === "schematic_port" && element.source_port_id)
|
|
319298
|
+
append2(this.schematicPorts, element.source_port_id, element);
|
|
319299
|
+
}
|
|
319300
|
+
}
|
|
319301
|
+
placement(componentId) {
|
|
319302
|
+
const placements = this.placements.get(componentId);
|
|
319303
|
+
return placements?.length === 1 ? placements[0] : undefined;
|
|
319304
|
+
}
|
|
319305
|
+
port(sourcePort) {
|
|
319306
|
+
const placement = this.placement(sourcePort.source_component_id);
|
|
319307
|
+
const ports = this.schematicPorts.get(sourcePort.source_port_id)?.filter((port) => port.schematic_component_id === placement?.schematicComponentId);
|
|
319308
|
+
return ports?.length === 1 ? ports[0] : undefined;
|
|
319309
|
+
}
|
|
319310
|
+
namedPort(componentId, name) {
|
|
319311
|
+
const ports = this.portsByComponent.get(componentId)?.filter((port) => port.name === name || port.port_hints?.includes(name));
|
|
319312
|
+
return ports?.length === 1 ? ports[0] : undefined;
|
|
319313
|
+
}
|
|
319314
|
+
twoTerminalNets(componentId) {
|
|
319315
|
+
const ports = this.portsByComponent.get(componentId);
|
|
319316
|
+
if (ports?.length !== 2)
|
|
319317
|
+
return;
|
|
319318
|
+
const first = this.connected(ports[0].source_port_id);
|
|
319319
|
+
const second = this.connected(ports[1].source_port_id);
|
|
319320
|
+
if (first !== second)
|
|
319321
|
+
return [first, second];
|
|
319322
|
+
}
|
|
319323
|
+
isRail(net) {
|
|
319324
|
+
return this.powerNets.has(net) || this.groundNets.has(net);
|
|
319325
|
+
}
|
|
319326
|
+
isDirectOpAmpFeedback(componentId) {
|
|
319327
|
+
const nets = this.twoTerminalNets(componentId);
|
|
319328
|
+
if (!nets || nets.some((net) => this.isRail(net)))
|
|
319329
|
+
return false;
|
|
319330
|
+
return nets.some((net) => (this.portsByNet.get(net) ?? []).some((port) => {
|
|
319331
|
+
const hostId = port.source_component_id;
|
|
319332
|
+
if (this.components.get(hostId)?.ftype !== "simple_op_amp")
|
|
319333
|
+
return false;
|
|
319334
|
+
const output = this.namedPort(hostId, "output");
|
|
319335
|
+
if (output?.source_port_id !== port.source_port_id)
|
|
319336
|
+
return false;
|
|
319337
|
+
return ["inverting_input", "non_inverting_input"].some((name) => {
|
|
319338
|
+
const input = this.namedPort(hostId, name);
|
|
319339
|
+
if (!input)
|
|
319340
|
+
return false;
|
|
319341
|
+
const inputNet = this.connected(input.source_port_id);
|
|
319342
|
+
return inputNet !== net && nets.includes(inputNet);
|
|
319343
|
+
});
|
|
319344
|
+
}));
|
|
319345
|
+
}
|
|
319346
|
+
sameLocalScope(first, second) {
|
|
319347
|
+
if (first.schematicSheetId !== second.schematicSheetId || first.subcircuitId !== second.subcircuitId)
|
|
319348
|
+
return false;
|
|
319349
|
+
const a = this.schematicComponents.get(first.schematicComponentId ?? "");
|
|
319350
|
+
const b = this.schematicComponents.get(second.schematicComponentId ?? "");
|
|
319351
|
+
if (!a || !b || a.schematic_group_id !== b.schematic_group_id)
|
|
319352
|
+
return false;
|
|
319353
|
+
const firstSource = this.components.get(first.sourceComponentId ?? "");
|
|
319354
|
+
const secondSource = this.components.get(second.sourceComponentId ?? "");
|
|
319355
|
+
return firstSource?.source_group_id === secondSource?.source_group_id && firstSource?.subcircuit_id === secondSource?.subcircuit_id;
|
|
319356
|
+
}
|
|
319357
|
+
}
|
|
319358
|
+
function append2(map, key, value) {
|
|
319359
|
+
const values = map.get(key);
|
|
319360
|
+
if (values)
|
|
319361
|
+
values.push(value);
|
|
319362
|
+
else
|
|
319363
|
+
map.set(key, [value]);
|
|
319364
|
+
}
|
|
319365
|
+
|
|
319222
319366
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/graphics.ts
|
|
319223
319367
|
import { mergeGraphics as mergeGraphics2 } from "graphics-debug";
|
|
319224
319368
|
function mergeGraphicsObjects2(objects) {
|
|
@@ -319259,6 +319403,7 @@ class CapacitorOrientationSolver extends BaseSolver5 {
|
|
|
319259
319403
|
schematicComponentById;
|
|
319260
319404
|
sourceComponentById;
|
|
319261
319405
|
capacitorPlacements;
|
|
319406
|
+
feedbackCapacitorIds;
|
|
319262
319407
|
currentPlacementIndex = 0;
|
|
319263
319408
|
horizontalSymbolNames = new Set([
|
|
319264
319409
|
"capacitor_left",
|
|
@@ -319274,6 +319419,8 @@ class CapacitorOrientationSolver extends BaseSolver5 {
|
|
|
319274
319419
|
this.schematicComponentById = this.buildSchematicComponentById(ctx.circuitJson);
|
|
319275
319420
|
this.sourceComponentById = this.buildSourceComponentById(ctx.circuitJson);
|
|
319276
319421
|
this.capacitorPlacements = this.getCapacitorPlacements();
|
|
319422
|
+
const networks = new PlacementNetworkIndex(ctx);
|
|
319423
|
+
this.feedbackCapacitorIds = new Set(this.capacitorPlacements.flatMap((capacitor) => capacitor.sourceComponentId && networks.isDirectOpAmpFeedback(capacitor.sourceComponentId) ? [capacitor.sourceComponentId] : []));
|
|
319277
319424
|
this.solved = this.capacitorPlacements.length === 0;
|
|
319278
319425
|
}
|
|
319279
319426
|
getCapacitorPlacements() {
|
|
@@ -319352,6 +319499,8 @@ class CapacitorOrientationSolver extends BaseSolver5 {
|
|
|
319352
319499
|
return;
|
|
319353
319500
|
if (!this.horizontalSymbolNames.has(schematicComponent.symbol_name ?? ""))
|
|
319354
319501
|
return;
|
|
319502
|
+
if (this.feedbackCapacitorIds.has(placement.sourceComponentId))
|
|
319503
|
+
return;
|
|
319355
319504
|
return {
|
|
319356
319505
|
lineItemType: "CapacitorSymbolHorizontal",
|
|
319357
319506
|
schematicBox: this.createIssuePlacement(placement),
|
|
@@ -319365,13 +319514,111 @@ class CapacitorOrientationSolver extends BaseSolver5 {
|
|
|
319365
319514
|
addAttr(attrs, "schY", issue.schematicBox.schY);
|
|
319366
319515
|
addAttr(attrs, "width", issue.schematicBox.width);
|
|
319367
319516
|
addAttr(attrs, "height", issue.schematicBox.height);
|
|
319368
|
-
addAttr(attrs, "message", issue.message
|
|
319517
|
+
addAttr(attrs, "message", issue.message);
|
|
319369
319518
|
return `<CapacitorSymbolHorizontal ${attrs.join(" ")} />`;
|
|
319370
319519
|
}
|
|
319371
319520
|
}
|
|
319372
319521
|
|
|
319373
|
-
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/
|
|
319522
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/DecouplingCapacitorGroupingSolver/DecouplingCapacitorGroupingSolver.ts
|
|
319374
319523
|
import { BaseSolver as BaseSolver6 } from "@tscircuit/solver-utils";
|
|
319524
|
+
class DecouplingCapacitorGroupingSolver extends BaseSolver6 {
|
|
319525
|
+
params;
|
|
319526
|
+
static MIN_BODY_GAP = 4;
|
|
319527
|
+
banks = [];
|
|
319528
|
+
netNames = new Map;
|
|
319529
|
+
bankIndex = 0;
|
|
319530
|
+
constructor(params2) {
|
|
319531
|
+
super();
|
|
319532
|
+
this.params = params2;
|
|
319533
|
+
const index = new PlacementNetworkIndex(params2.ctx);
|
|
319534
|
+
const powerNets = new Set(index.powerNets);
|
|
319535
|
+
const groundNets = new Set(index.groundNets);
|
|
319536
|
+
for (const element of params2.ctx.circuitJson) {
|
|
319537
|
+
if (element.type === "source_net") {
|
|
319538
|
+
const net = index.connected(element.source_net_id);
|
|
319539
|
+
if (!this.netNames.has(net))
|
|
319540
|
+
this.netNames.set(net, element.name);
|
|
319541
|
+
}
|
|
319542
|
+
}
|
|
319543
|
+
for (const ports of index.portsByComponent.values()) {
|
|
319544
|
+
for (const port of ports) {
|
|
319545
|
+
if (port.do_not_connect)
|
|
319546
|
+
continue;
|
|
319547
|
+
const net = index.connected(port.source_port_id);
|
|
319548
|
+
if (port.provides_power || port.requires_power)
|
|
319549
|
+
powerNets.add(net);
|
|
319550
|
+
if (port.provides_ground || port.requires_ground)
|
|
319551
|
+
groundNets.add(net);
|
|
319552
|
+
if ((powerNets.has(net) || groundNets.has(net)) && !this.netNames.has(net))
|
|
319553
|
+
this.netNames.set(net, port.name);
|
|
319554
|
+
}
|
|
319555
|
+
}
|
|
319556
|
+
for (const component of index.components.values()) {
|
|
319557
|
+
if (component.ftype !== "simple_capacitor")
|
|
319558
|
+
continue;
|
|
319559
|
+
const id = component.source_component_id;
|
|
319560
|
+
const placement = index.placement(id);
|
|
319561
|
+
const nets = index.twoTerminalNets(id);
|
|
319562
|
+
const ports = index.portsByComponent.get(id);
|
|
319563
|
+
if (!placement || !nets || !ports || ports.some((port) => {
|
|
319564
|
+
const schematicPort = index.port(port);
|
|
319565
|
+
return port.do_not_connect || !schematicPort || schematicPort.schematic_sheet_id !== placement.schematicSheetId;
|
|
319566
|
+
}))
|
|
319567
|
+
continue;
|
|
319568
|
+
const power = nets.find((net) => powerNets.has(net) && !groundNets.has(net));
|
|
319569
|
+
const ground = nets.find((net) => groundNets.has(net) && !powerNets.has(net));
|
|
319570
|
+
if (!power || !ground)
|
|
319571
|
+
continue;
|
|
319572
|
+
const bank = this.banks.find((candidate) => candidate.power === power && candidate.ground === ground && index.sameLocalScope(candidate.capacitors[0], placement));
|
|
319573
|
+
if (bank)
|
|
319574
|
+
bank.capacitors.push(placement);
|
|
319575
|
+
else
|
|
319576
|
+
this.banks.push({ power, ground, capacitors: [placement] });
|
|
319577
|
+
}
|
|
319578
|
+
this.solved = this.banks.length === 0;
|
|
319579
|
+
}
|
|
319580
|
+
_step() {
|
|
319581
|
+
const bank = this.banks[this.bankIndex++];
|
|
319582
|
+
this.solved = this.bankIndex >= this.banks.length;
|
|
319583
|
+
if (bank.capacitors.length < 2)
|
|
319584
|
+
return;
|
|
319585
|
+
const maxRecommendedBodyGap = Math.max(DecouplingCapacitorGroupingSolver.MIN_BODY_GAP, ...bank.capacitors.map((box) => 3 * Math.max(box.width, box.height)));
|
|
319586
|
+
let maxBodyGap = 0;
|
|
319587
|
+
for (let i = 0;i < bank.capacitors.length; i++) {
|
|
319588
|
+
for (const b of bank.capacitors.slice(i + 1)) {
|
|
319589
|
+
const a = bank.capacitors[i];
|
|
319590
|
+
const gap = Math.hypot(Math.max(0, Math.abs(a.schX - b.schX) - (a.width + b.width) / 2), Math.max(0, Math.abs(a.schY - b.schY) - (a.height + b.height) / 2));
|
|
319591
|
+
maxBodyGap = Math.max(maxBodyGap, gap);
|
|
319592
|
+
}
|
|
319593
|
+
}
|
|
319594
|
+
if (maxBodyGap <= maxRecommendedBodyGap + 0.000001)
|
|
319595
|
+
return;
|
|
319596
|
+
const railName = this.netNames.get(bank.power) ?? bank.power;
|
|
319597
|
+
const groundName = this.netNames.get(bank.ground) ?? bank.ground;
|
|
319598
|
+
this.params.issues.push({
|
|
319599
|
+
lineItemType: "DecouplingCapacitorsNotCloseTogether",
|
|
319600
|
+
railName,
|
|
319601
|
+
groundName,
|
|
319602
|
+
capacitorSchematicBoxes: bank.capacitors,
|
|
319603
|
+
maxBodyGap,
|
|
319604
|
+
maxRecommendedBodyGap,
|
|
319605
|
+
message: `Group the decoupling capacitors between ${railName} and ${groundName} closer together in this schematic block. Preserve their net connections.`
|
|
319606
|
+
});
|
|
319607
|
+
}
|
|
319608
|
+
static issueToString(issue) {
|
|
319609
|
+
const attrs = [];
|
|
319610
|
+
addAttr(attrs, "rail", issue.railName);
|
|
319611
|
+
addAttr(attrs, "ground", issue.groundName);
|
|
319612
|
+
addAttr(attrs, "capacitorNames", issue.capacitorSchematicBoxes.map((box) => box.sourceComponentName ?? box.schematicComponentId).join(", "));
|
|
319613
|
+
addAttr(attrs, "maxBodyGap", issue.maxBodyGap);
|
|
319614
|
+
addAttr(attrs, "maxRecommendedBodyGap", issue.maxRecommendedBodyGap);
|
|
319615
|
+
addAttr(attrs, "message", issue.message);
|
|
319616
|
+
return `<DecouplingCapacitorsNotCloseTogether ${attrs.join(" ")} />`;
|
|
319617
|
+
}
|
|
319618
|
+
}
|
|
319619
|
+
|
|
319620
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ComponentNetLabelCollisionSolver/ComponentNetLabelCollisionSolver.ts
|
|
319621
|
+
import { BaseSolver as BaseSolver7 } from "@tscircuit/solver-utils";
|
|
319375
319622
|
|
|
319376
319623
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/geometry.ts
|
|
319377
319624
|
function centeredRect(cx, cy, w, h) {
|
|
@@ -319389,7 +319636,7 @@ function rectOverlap(a, b) {
|
|
|
319389
319636
|
}
|
|
319390
319637
|
|
|
319391
319638
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ComponentNetLabelCollisionSolver/ComponentNetLabelCollisionSolver.ts
|
|
319392
|
-
class ComponentNetLabelCollisionSolver extends
|
|
319639
|
+
class ComponentNetLabelCollisionSolver extends BaseSolver7 {
|
|
319393
319640
|
params;
|
|
319394
319641
|
LABEL_HALF_HEIGHT = 0.1;
|
|
319395
319642
|
LABEL_BOUNDS_SLACK = 0.1;
|
|
@@ -319451,6 +319698,12 @@ class ComponentNetLabelCollisionSolver extends BaseSolver6 {
|
|
|
319451
319698
|
if (rectOverlap(leftBounds, rightBounds)) {
|
|
319452
319699
|
hits.push({
|
|
319453
319700
|
type: "label-label",
|
|
319701
|
+
bounds: {
|
|
319702
|
+
left: Math.max(leftBounds.left, rightBounds.left),
|
|
319703
|
+
right: Math.min(leftBounds.right, rightBounds.right),
|
|
319704
|
+
top: Math.min(leftBounds.top, rightBounds.top),
|
|
319705
|
+
bottom: Math.max(leftBounds.bottom, rightBounds.bottom)
|
|
319706
|
+
},
|
|
319454
319707
|
leftComp,
|
|
319455
319708
|
rightComp,
|
|
319456
319709
|
leftId,
|
|
@@ -319485,6 +319738,12 @@ class ComponentNetLabelCollisionSolver extends BaseSolver6 {
|
|
|
319485
319738
|
}
|
|
319486
319739
|
hits.push({
|
|
319487
319740
|
type: "box-label",
|
|
319741
|
+
bounds: {
|
|
319742
|
+
left: Math.max(boxBounds.left, labelBounds.left),
|
|
319743
|
+
right: Math.min(boxBounds.right, labelBounds.right),
|
|
319744
|
+
top: Math.min(boxBounds.top, labelBounds.top),
|
|
319745
|
+
bottom: Math.max(boxBounds.bottom, labelBounds.bottom)
|
|
319746
|
+
},
|
|
319488
319747
|
boxComp,
|
|
319489
319748
|
labelComp,
|
|
319490
319749
|
boxId,
|
|
@@ -319540,6 +319799,7 @@ class ComponentNetLabelCollisionSolver extends BaseSolver6 {
|
|
|
319540
319799
|
schematicSheetId: firstPlacement.schematicSheetId,
|
|
319541
319800
|
schematicSheetName: firstPlacement.schematicSheetName,
|
|
319542
319801
|
pairs,
|
|
319802
|
+
collisionBounds: collisions.map((collision) => collision.bounds),
|
|
319543
319803
|
moves: Array.from(globalFixes.values())
|
|
319544
319804
|
});
|
|
319545
319805
|
}
|
|
@@ -319736,8 +319996,8 @@ class ComponentNetLabelCollisionSolver extends BaseSolver6 {
|
|
|
319736
319996
|
}
|
|
319737
319997
|
|
|
319738
319998
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ComponentPinAlignmentSolver/ComponentPinAlignmentSolver.ts
|
|
319739
|
-
import { BaseSolver as
|
|
319740
|
-
class ComponentPinAlignmentSolver extends
|
|
319999
|
+
import { BaseSolver as BaseSolver8 } from "@tscircuit/solver-utils";
|
|
320000
|
+
class ComponentPinAlignmentSolver extends BaseSolver8 {
|
|
319741
320001
|
static ALIGNMENT_EPSILON = 0.01;
|
|
319742
320002
|
ctx;
|
|
319743
320003
|
out;
|
|
@@ -319870,9 +320130,170 @@ class ComponentPinAlignmentSolver extends BaseSolver7 {
|
|
|
319870
320130
|
}
|
|
319871
320131
|
}
|
|
319872
320132
|
|
|
320133
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/CrystalLoadCapacitorPlacementSolver/CrystalLoadCapacitorPlacementSolver.ts
|
|
320134
|
+
import { BaseSolver as BaseSolver9 } from "@tscircuit/solver-utils";
|
|
320135
|
+
class CrystalLoadCapacitorPlacementSolver extends BaseSolver9 {
|
|
320136
|
+
static ALIGNMENT_TOLERANCE = 0.1;
|
|
320137
|
+
issues;
|
|
320138
|
+
networks;
|
|
320139
|
+
currentNetworkIndex = 0;
|
|
320140
|
+
constructor({
|
|
320141
|
+
ctx,
|
|
320142
|
+
issues
|
|
320143
|
+
}) {
|
|
320144
|
+
super();
|
|
320145
|
+
this.issues = issues;
|
|
320146
|
+
this.networks = this.findCrystalLoadNetworks(ctx);
|
|
320147
|
+
this.solved = this.networks.length === 0;
|
|
320148
|
+
}
|
|
320149
|
+
_step() {
|
|
320150
|
+
const network = this.networks[this.currentNetworkIndex];
|
|
320151
|
+
if (!network) {
|
|
320152
|
+
this.solved = true;
|
|
320153
|
+
return;
|
|
320154
|
+
}
|
|
320155
|
+
this.currentNetworkIndex += 1;
|
|
320156
|
+
this.solved = this.currentNetworkIndex >= this.networks.length;
|
|
320157
|
+
const deltaSchX = round(network.newSchX - network.crystal.schX);
|
|
320158
|
+
const deltaSchY = round(network.newSchY - network.crystal.schY);
|
|
320159
|
+
if (Math.abs(deltaSchX) <= CrystalLoadCapacitorPlacementSolver.ALIGNMENT_TOLERANCE && Math.abs(deltaSchY) <= CrystalLoadCapacitorPlacementSolver.ALIGNMENT_TOLERANCE) {
|
|
320160
|
+
return;
|
|
320161
|
+
}
|
|
320162
|
+
const crystalName = network.crystal.sourceComponentName ?? "the crystal";
|
|
320163
|
+
const firstCapacitorName = network.firstLoadCapacitor.sourceComponentName ?? "the first load capacitor";
|
|
320164
|
+
const secondCapacitorName = network.secondLoadCapacitor.sourceComponentName ?? "the second load capacitor";
|
|
320165
|
+
this.issues.push({
|
|
320166
|
+
lineItemType: "CrystalNotCenteredOverLoadCapacitors",
|
|
320167
|
+
crystalSchematicBox: network.crystal,
|
|
320168
|
+
firstLoadCapacitorSchematicBox: network.firstLoadCapacitor,
|
|
320169
|
+
secondLoadCapacitorSchematicBox: network.secondLoadCapacitor,
|
|
320170
|
+
deltaSchX,
|
|
320171
|
+
deltaSchY,
|
|
320172
|
+
newSchX: network.newSchX,
|
|
320173
|
+
newSchY: network.newSchY,
|
|
320174
|
+
message: `move ${crystalName} to schX=${network.newSchX}, schY=${network.newSchY} so it is centered between ${firstCapacitorName} and ${secondCapacitorName} and aligned with their load-side pins`
|
|
320175
|
+
});
|
|
320176
|
+
}
|
|
320177
|
+
findCrystalLoadNetworks(ctx) {
|
|
320178
|
+
const sourceComponents = new Map;
|
|
320179
|
+
const sourcePortsByComponentId = new Map;
|
|
320180
|
+
const schematicPortsBySourcePortId = new Map;
|
|
320181
|
+
const placementBySourceComponentId = new Map(ctx.componentPlacements.flatMap((placement) => placement.sourceComponentId ? [[placement.sourceComponentId, placement]] : []));
|
|
320182
|
+
for (const element of ctx.circuitJson) {
|
|
320183
|
+
if (element.type === "source_component") {
|
|
320184
|
+
sourceComponents.set(element.source_component_id, {
|
|
320185
|
+
sourceComponentId: element.source_component_id,
|
|
320186
|
+
ftype: "ftype" in element && typeof element.ftype === "string" ? element.ftype : undefined
|
|
320187
|
+
});
|
|
320188
|
+
}
|
|
320189
|
+
if (element.type === "source_port" && typeof element.source_component_id === "string" && typeof element.subcircuit_connectivity_map_key === "string") {
|
|
320190
|
+
const sourcePort = {
|
|
320191
|
+
sourcePortId: element.source_port_id,
|
|
320192
|
+
sourceComponentId: element.source_component_id,
|
|
320193
|
+
connectivityKey: element.subcircuit_connectivity_map_key
|
|
320194
|
+
};
|
|
320195
|
+
const componentPorts = sourcePortsByComponentId.get(element.source_component_id) ?? [];
|
|
320196
|
+
componentPorts.push(sourcePort);
|
|
320197
|
+
sourcePortsByComponentId.set(element.source_component_id, componentPorts);
|
|
320198
|
+
}
|
|
320199
|
+
if (element.type === "schematic_port" && element.source_port_id) {
|
|
320200
|
+
schematicPortsBySourcePortId.set(element.source_port_id, element);
|
|
320201
|
+
}
|
|
320202
|
+
}
|
|
320203
|
+
const capacitorConnectionsByConnectivityKey = new Map;
|
|
320204
|
+
for (const sourceComponent of sourceComponents.values()) {
|
|
320205
|
+
if (sourceComponent.ftype !== "simple_capacitor")
|
|
320206
|
+
continue;
|
|
320207
|
+
const capacitorPorts = sourcePortsByComponentId.get(sourceComponent.sourceComponentId) ?? [];
|
|
320208
|
+
if (capacitorPorts.length !== 2)
|
|
320209
|
+
continue;
|
|
320210
|
+
const firstCapacitorPort = capacitorPorts[0];
|
|
320211
|
+
const secondCapacitorPort = capacitorPorts[1];
|
|
320212
|
+
const capacitorPlacement = placementBySourceComponentId.get(sourceComponent.sourceComponentId);
|
|
320213
|
+
if (!capacitorPlacement)
|
|
320214
|
+
continue;
|
|
320215
|
+
for (const [loadPort, returnPort] of [
|
|
320216
|
+
[firstCapacitorPort, secondCapacitorPort],
|
|
320217
|
+
[secondCapacitorPort, firstCapacitorPort]
|
|
320218
|
+
]) {
|
|
320219
|
+
const schematicLoadPort = schematicPortsBySourcePortId.get(loadPort.sourcePortId);
|
|
320220
|
+
if (!schematicLoadPort)
|
|
320221
|
+
continue;
|
|
320222
|
+
const connections = capacitorConnectionsByConnectivityKey.get(loadPort.connectivityKey) ?? [];
|
|
320223
|
+
connections.push({
|
|
320224
|
+
capacitor: capacitorPlacement,
|
|
320225
|
+
loadPort: schematicLoadPort,
|
|
320226
|
+
returnConnectivityKey: returnPort.connectivityKey
|
|
320227
|
+
});
|
|
320228
|
+
capacitorConnectionsByConnectivityKey.set(loadPort.connectivityKey, connections);
|
|
320229
|
+
}
|
|
320230
|
+
}
|
|
320231
|
+
const networks = [];
|
|
320232
|
+
for (const sourceComponent of sourceComponents.values()) {
|
|
320233
|
+
if (sourceComponent.ftype !== "simple_crystal" && sourceComponent.ftype !== "simple_chip") {
|
|
320234
|
+
continue;
|
|
320235
|
+
}
|
|
320236
|
+
const crystalPorts = sourcePortsByComponentId.get(sourceComponent.sourceComponentId) ?? [];
|
|
320237
|
+
if (crystalPorts.length !== 2 || crystalPorts[0].connectivityKey === crystalPorts[1].connectivityKey) {
|
|
320238
|
+
continue;
|
|
320239
|
+
}
|
|
320240
|
+
const firstCrystalConnectivityKey = crystalPorts[0].connectivityKey;
|
|
320241
|
+
const secondCrystalConnectivityKey = crystalPorts[1].connectivityKey;
|
|
320242
|
+
const hasOscillatorHost = [...sourcePortsByComponentId.entries()].some(([sourceComponentId, sourcePorts]) => sourceComponentId !== sourceComponent.sourceComponentId && sourcePorts.length > 2 && sourcePorts.some((port) => port.connectivityKey === firstCrystalConnectivityKey) && sourcePorts.some((port) => port.connectivityKey === secondCrystalConnectivityKey));
|
|
320243
|
+
if (!hasOscillatorHost)
|
|
320244
|
+
continue;
|
|
320245
|
+
const crystalPlacement = placementBySourceComponentId.get(sourceComponent.sourceComponentId);
|
|
320246
|
+
if (!crystalPlacement)
|
|
320247
|
+
continue;
|
|
320248
|
+
const firstConnections = capacitorConnectionsByConnectivityKey.get(crystalPorts[0].connectivityKey) ?? [];
|
|
320249
|
+
const secondConnections = capacitorConnectionsByConnectivityKey.get(crystalPorts[1].connectivityKey) ?? [];
|
|
320250
|
+
const candidatePairs = firstConnections.flatMap((firstConnection) => secondConnections.flatMap((secondConnection) => {
|
|
320251
|
+
if (firstConnection.capacitor.sourceComponentId === secondConnection.capacitor.sourceComponentId || firstConnection.returnConnectivityKey !== secondConnection.returnConnectivityKey || firstConnection.returnConnectivityKey === firstCrystalConnectivityKey || firstConnection.returnConnectivityKey === secondCrystalConnectivityKey || firstConnection.capacitor.schematicSheetId !== crystalPlacement.schematicSheetId || secondConnection.capacitor.schematicSheetId !== crystalPlacement.schematicSheetId) {
|
|
320252
|
+
return [];
|
|
320253
|
+
}
|
|
320254
|
+
return [{ firstConnection, secondConnection }];
|
|
320255
|
+
}));
|
|
320256
|
+
if (candidatePairs.length === 0)
|
|
320257
|
+
continue;
|
|
320258
|
+
const bestPair = candidatePairs.toSorted((a, b) => pairDistance(a, crystalPlacement) - pairDistance(b, crystalPlacement))[0];
|
|
320259
|
+
const loadPorts = [
|
|
320260
|
+
bestPair.firstConnection.loadPort,
|
|
320261
|
+
bestPair.secondConnection.loadPort
|
|
320262
|
+
];
|
|
320263
|
+
const capacitors = [
|
|
320264
|
+
bestPair.firstConnection.capacitor,
|
|
320265
|
+
bestPair.secondConnection.capacitor
|
|
320266
|
+
].toSorted((a, b) => a.schX - b.schX);
|
|
320267
|
+
networks.push({
|
|
320268
|
+
crystal: crystalPlacement,
|
|
320269
|
+
firstLoadCapacitor: capacitors[0],
|
|
320270
|
+
secondLoadCapacitor: capacitors[1],
|
|
320271
|
+
newSchX: round((loadPorts[0].center.x + loadPorts[1].center.x) / 2),
|
|
320272
|
+
newSchY: round((loadPorts[0].center.y + loadPorts[1].center.y) / 2)
|
|
320273
|
+
});
|
|
320274
|
+
}
|
|
320275
|
+
return networks;
|
|
320276
|
+
}
|
|
320277
|
+
static issueToString(issue) {
|
|
320278
|
+
const attrs = [];
|
|
320279
|
+
addAttr(attrs, "crystalName", issue.crystalSchematicBox.sourceComponentName);
|
|
320280
|
+
addAttr(attrs, "firstLoadCapacitorName", issue.firstLoadCapacitorSchematicBox.sourceComponentName);
|
|
320281
|
+
addAttr(attrs, "secondLoadCapacitorName", issue.secondLoadCapacitorSchematicBox.sourceComponentName);
|
|
320282
|
+
addAttr(attrs, "newSchX", issue.newSchX);
|
|
320283
|
+
addAttr(attrs, "newSchY", issue.newSchY);
|
|
320284
|
+
addAttr(attrs, "deltaSchX", issue.deltaSchX, { formatDelta: true });
|
|
320285
|
+
addAttr(attrs, "deltaSchY", issue.deltaSchY, { formatDelta: true });
|
|
320286
|
+
addAttr(attrs, "message", issue.message);
|
|
320287
|
+
return `<CrystalNotCenteredOverLoadCapacitors ${attrs.join(" ")} />`;
|
|
320288
|
+
}
|
|
320289
|
+
}
|
|
320290
|
+
var pairDistance = (pair, crystal) => distance49(pair.firstConnection.capacitor, crystal) + distance49(pair.secondConnection.capacitor, crystal);
|
|
320291
|
+
var distance49 = (first, second) => Math.hypot(first.schX - second.schX, first.schY - second.schY);
|
|
320292
|
+
var round = (value) => Math.round(value * 100) / 100;
|
|
320293
|
+
|
|
319873
320294
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/DiodeResistorAlignmentSolver/DiodeResistorAlignmentSolver.ts
|
|
319874
|
-
import { BaseSolver as
|
|
319875
|
-
class DiodeResistorAlignmentSolver extends
|
|
320295
|
+
import { BaseSolver as BaseSolver10 } from "@tscircuit/solver-utils";
|
|
320296
|
+
class DiodeResistorAlignmentSolver extends BaseSolver10 {
|
|
319876
320297
|
static DIODE_FTYPES = new Set(["simple_led", "simple_diode"]);
|
|
319877
320298
|
ctx;
|
|
319878
320299
|
out;
|
|
@@ -320033,9 +320454,277 @@ class DiodeResistorAlignmentSolver extends BaseSolver8 {
|
|
|
320033
320454
|
}
|
|
320034
320455
|
}
|
|
320035
320456
|
|
|
320457
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/FeedbackNetworkPlacementSolver/FeedbackNetworkPlacementSolver.ts
|
|
320458
|
+
import { BaseSolver as BaseSolver11 } from "@tscircuit/solver-utils";
|
|
320459
|
+
class FeedbackNetworkPlacementSolver extends BaseSolver11 {
|
|
320460
|
+
static MIN_BODY_GAP = 4;
|
|
320461
|
+
index;
|
|
320462
|
+
amplifierIds;
|
|
320463
|
+
issues;
|
|
320464
|
+
currentIndex = 0;
|
|
320465
|
+
constructor({
|
|
320466
|
+
ctx,
|
|
320467
|
+
issues
|
|
320468
|
+
}) {
|
|
320469
|
+
super();
|
|
320470
|
+
this.issues = issues;
|
|
320471
|
+
this.index = new PlacementNetworkIndex(ctx);
|
|
320472
|
+
this.amplifierIds = [...this.index.components.values()].filter((component) => component.ftype === "simple_op_amp").map((component) => component.source_component_id);
|
|
320473
|
+
this.solved = this.amplifierIds.length === 0;
|
|
320474
|
+
}
|
|
320475
|
+
_step() {
|
|
320476
|
+
const id = this.amplifierIds[this.currentIndex++];
|
|
320477
|
+
this.solved = this.currentIndex >= this.amplifierIds.length;
|
|
320478
|
+
if (!id)
|
|
320479
|
+
return;
|
|
320480
|
+
const index = this.index;
|
|
320481
|
+
const amplifier = index.placement(id);
|
|
320482
|
+
const output = index.namedPort(id, "output");
|
|
320483
|
+
const input = index.namedPort(id, "inverting_input");
|
|
320484
|
+
if (!amplifier || !output || !input || !index.port(output) || !index.port(input))
|
|
320485
|
+
return;
|
|
320486
|
+
const outputNet = index.connected(output.source_port_id);
|
|
320487
|
+
const inputNet = index.connected(input.source_port_id);
|
|
320488
|
+
if (outputNet === inputNet || index.isRail(outputNet) || index.isRail(inputNet))
|
|
320489
|
+
return;
|
|
320490
|
+
if ((index.portsByNet.get(inputNet) ?? []).some((port) => port.source_component_id !== id && index.components.get(port.source_component_id)?.ftype === "simple_op_amp"))
|
|
320491
|
+
return;
|
|
320492
|
+
const feedbackComponents = [];
|
|
320493
|
+
const seen = new Set;
|
|
320494
|
+
for (const port of index.portsByNet.get(outputNet) ?? []) {
|
|
320495
|
+
const componentId = port.source_component_id;
|
|
320496
|
+
if (seen.has(componentId))
|
|
320497
|
+
continue;
|
|
320498
|
+
seen.add(componentId);
|
|
320499
|
+
const component = index.components.get(componentId);
|
|
320500
|
+
if (component?.ftype !== "simple_resistor" && component?.ftype !== "simple_capacitor")
|
|
320501
|
+
continue;
|
|
320502
|
+
if (component.ftype === "simple_resistor" && !(component.resistance > 0))
|
|
320503
|
+
continue;
|
|
320504
|
+
const nets = index.twoTerminalNets(componentId);
|
|
320505
|
+
if (!nets?.includes(inputNet) || !nets.includes(outputNet))
|
|
320506
|
+
continue;
|
|
320507
|
+
const placement = index.placement(componentId);
|
|
320508
|
+
if (!placement || !index.sameLocalScope(amplifier, placement))
|
|
320509
|
+
return;
|
|
320510
|
+
feedbackComponents.push(placement);
|
|
320511
|
+
}
|
|
320512
|
+
const distantComponents = feedbackComponents.flatMap((schematicBox) => {
|
|
320513
|
+
const bodyGap = distanceBetweenBoxes(amplifier, schematicBox);
|
|
320514
|
+
const maxRecommendedBodyGap = Math.max(FeedbackNetworkPlacementSolver.MIN_BODY_GAP, 3 * Math.max(schematicBox.width, schematicBox.height));
|
|
320515
|
+
return bodyGap > maxRecommendedBodyGap ? [{ schematicBox, bodyGap, maxRecommendedBodyGap }] : [];
|
|
320516
|
+
});
|
|
320517
|
+
if (distantComponents.length === 0)
|
|
320518
|
+
return;
|
|
320519
|
+
const names = distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName ?? schematicBox.sourceComponentId).join(", ");
|
|
320520
|
+
this.issues.push({
|
|
320521
|
+
lineItemType: "FeedbackNetworkNotCompact",
|
|
320522
|
+
amplifierSchematicBox: amplifier,
|
|
320523
|
+
feedbackComponents,
|
|
320524
|
+
distantComponents,
|
|
320525
|
+
outputSourcePortId: output.source_port_id,
|
|
320526
|
+
invertingInputSourcePortId: input.source_port_id,
|
|
320527
|
+
message: `consider grouping ${names} closer to ${amplifier.sourceComponentName ?? id}, with a compact feedback return path above or below the amplifier`
|
|
320528
|
+
});
|
|
320529
|
+
}
|
|
320530
|
+
static issueToString(issue) {
|
|
320531
|
+
const attrs = [];
|
|
320532
|
+
addAttr(attrs, "amplifierName", issue.amplifierSchematicBox.sourceComponentName);
|
|
320533
|
+
addAttr(attrs, "feedbackComponentNames", issue.feedbackComponents.map((box) => box.sourceComponentName ?? box.sourceComponentId).join(", "));
|
|
320534
|
+
addAttr(attrs, "distantComponentNames", issue.distantComponents.map(({ schematicBox }) => schematicBox.sourceComponentName ?? schematicBox.sourceComponentId).join(", "));
|
|
320535
|
+
addAttr(attrs, "message", issue.message);
|
|
320536
|
+
return `<FeedbackNetworkNotCompact ${attrs.join(" ")} />`;
|
|
320537
|
+
}
|
|
320538
|
+
}
|
|
320539
|
+
function distanceBetweenBoxes(a, b) {
|
|
320540
|
+
return Math.hypot(Math.max(0, Math.abs(a.schX - b.schX) - (a.width + b.width) / 2), Math.max(0, Math.abs(a.schY - b.schY) - (a.height + b.height) / 2));
|
|
320541
|
+
}
|
|
320542
|
+
|
|
320543
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/PullResistorPlacementSolver/PullResistorPlacementSolver.ts
|
|
320544
|
+
import { BaseSolver as BaseSolver12 } from "@tscircuit/solver-utils";
|
|
320545
|
+
class PullResistorPlacementSolver extends BaseSolver12 {
|
|
320546
|
+
static MIN_WRONG_SIDE_GAP = 1.5;
|
|
320547
|
+
index;
|
|
320548
|
+
resistorIds;
|
|
320549
|
+
issues;
|
|
320550
|
+
currentIndex = 0;
|
|
320551
|
+
constructor({
|
|
320552
|
+
ctx,
|
|
320553
|
+
issues
|
|
320554
|
+
}) {
|
|
320555
|
+
super();
|
|
320556
|
+
this.issues = issues;
|
|
320557
|
+
this.index = new PlacementNetworkIndex(ctx);
|
|
320558
|
+
this.resistorIds = [...this.index.components.values()].filter((component) => component.ftype === "simple_resistor" && component.resistance > 0).map((component) => component.source_component_id);
|
|
320559
|
+
this.solved = this.resistorIds.length === 0;
|
|
320560
|
+
}
|
|
320561
|
+
_step() {
|
|
320562
|
+
const id = this.resistorIds[this.currentIndex++];
|
|
320563
|
+
this.solved = this.currentIndex >= this.resistorIds.length;
|
|
320564
|
+
if (!id)
|
|
320565
|
+
return;
|
|
320566
|
+
const index = this.index;
|
|
320567
|
+
const resistor = index.placement(id);
|
|
320568
|
+
const nets = index.twoTerminalNets(id);
|
|
320569
|
+
if (!resistor || !nets)
|
|
320570
|
+
return;
|
|
320571
|
+
const rails = nets.filter((net) => index.isRail(net));
|
|
320572
|
+
if (rails.length !== 1)
|
|
320573
|
+
return;
|
|
320574
|
+
const rail = rails[0];
|
|
320575
|
+
if (index.powerNets.has(rail) && index.groundNets.has(rail))
|
|
320576
|
+
return;
|
|
320577
|
+
const pullDirection = index.groundNets.has(rail) ? "down" : "up";
|
|
320578
|
+
const signal = nets.find((net) => net !== rail);
|
|
320579
|
+
const signalPorts = index.portsByNet.get(signal) ?? [];
|
|
320580
|
+
const requiringPorts = signalPorts.filter((port) => port.needs_external_pullup || port.needs_external_pulldown);
|
|
320581
|
+
if (requiringPorts.length !== 1)
|
|
320582
|
+
return;
|
|
320583
|
+
const signalPort = requiringPorts[0];
|
|
320584
|
+
if (signalPort.needs_external_pullup && signalPort.needs_external_pulldown)
|
|
320585
|
+
return;
|
|
320586
|
+
if (pullDirection === "up" ? !signalPort.needs_external_pullup : !signalPort.needs_external_pulldown)
|
|
320587
|
+
return;
|
|
320588
|
+
const host = index.placement(signalPort.source_component_id);
|
|
320589
|
+
const schematicPin = index.port(signalPort);
|
|
320590
|
+
if (!host || !schematicPin || !index.sameLocalScope(host, resistor))
|
|
320591
|
+
return;
|
|
320592
|
+
if (signalPorts.some((port) => {
|
|
320593
|
+
const otherId = port.source_component_id;
|
|
320594
|
+
if (otherId === id || otherId === signalPort.source_component_id)
|
|
320595
|
+
return false;
|
|
320596
|
+
const type = index.components.get(otherId)?.ftype;
|
|
320597
|
+
if (type !== "simple_capacitor")
|
|
320598
|
+
return true;
|
|
320599
|
+
const capacitorNets = index.twoTerminalNets(otherId);
|
|
320600
|
+
const returnNet = capacitorNets?.find((net) => net !== signal);
|
|
320601
|
+
if (!returnNet || !index.groundNets.has(returnNet) || index.powerNets.has(returnNet))
|
|
320602
|
+
return true;
|
|
320603
|
+
const capacitor = index.placement(otherId);
|
|
320604
|
+
return !capacitor || !index.sameLocalScope(host, capacitor);
|
|
320605
|
+
}))
|
|
320606
|
+
return;
|
|
320607
|
+
const signalSchY = schematicPin.center.y;
|
|
320608
|
+
const wrongSideGap = pullDirection === "up" ? signalSchY - (resistor.schY + resistor.height / 2) : resistor.schY - resistor.height / 2 - signalSchY;
|
|
320609
|
+
if (wrongSideGap <= PullResistorPlacementSolver.MIN_WRONG_SIDE_GAP)
|
|
320610
|
+
return;
|
|
320611
|
+
const preferredSide = pullDirection === "up" ? "above" : "below";
|
|
320612
|
+
this.issues.push({
|
|
320613
|
+
lineItemType: "PullResistorOnWrongSide",
|
|
320614
|
+
resistorSchematicBox: resistor,
|
|
320615
|
+
hostSchematicBox: host,
|
|
320616
|
+
signalSourcePortId: signalPort.source_port_id,
|
|
320617
|
+
signalPinName: signalPort.name,
|
|
320618
|
+
signalSchY,
|
|
320619
|
+
pullDirection,
|
|
320620
|
+
preferredSide,
|
|
320621
|
+
wrongSideGap,
|
|
320622
|
+
maxRecommendedWrongSideGap: PullResistorPlacementSolver.MIN_WRONG_SIDE_GAP,
|
|
320623
|
+
message: `consider placing ${resistor.sourceComponentName ?? id} ${preferredSide} ${host.sourceComponentName ?? signalPort.source_component_id}.${signalPort.name} so the pull-${pullDirection} branch reads toward ${pullDirection === "up" ? "power" : "ground"}`
|
|
320624
|
+
});
|
|
320625
|
+
}
|
|
320626
|
+
static issueToString(issue) {
|
|
320627
|
+
const attrs = [];
|
|
320628
|
+
addAttr(attrs, "resistorName", issue.resistorSchematicBox.sourceComponentName);
|
|
320629
|
+
addAttr(attrs, "hostName", issue.hostSchematicBox.sourceComponentName);
|
|
320630
|
+
addAttr(attrs, "signalPin", issue.signalPinName);
|
|
320631
|
+
addAttr(attrs, "pullDirection", issue.pullDirection);
|
|
320632
|
+
addAttr(attrs, "preferredSide", issue.preferredSide);
|
|
320633
|
+
addAttr(attrs, "signalSchY", issue.signalSchY);
|
|
320634
|
+
addAttr(attrs, "wrongSideGap", issue.wrongSideGap);
|
|
320635
|
+
addAttr(attrs, "message", issue.message);
|
|
320636
|
+
return `<PullResistorOnWrongSide ${attrs.join(" ")} />`;
|
|
320637
|
+
}
|
|
320638
|
+
}
|
|
320639
|
+
|
|
320640
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentRailOrientationSolver/TwoPinComponentRailOrientationSolver.ts
|
|
320641
|
+
import { BaseSolver as BaseSolver13 } from "@tscircuit/solver-utils";
|
|
320642
|
+
class TwoPinComponentRailOrientationSolver extends BaseSolver13 {
|
|
320643
|
+
static EPSILON = 0.01;
|
|
320644
|
+
index;
|
|
320645
|
+
powerNets;
|
|
320646
|
+
groundNets;
|
|
320647
|
+
componentIds;
|
|
320648
|
+
issues;
|
|
320649
|
+
currentIndex = 0;
|
|
320650
|
+
constructor({
|
|
320651
|
+
ctx,
|
|
320652
|
+
issues
|
|
320653
|
+
}) {
|
|
320654
|
+
super();
|
|
320655
|
+
this.issues = issues;
|
|
320656
|
+
this.index = new PlacementNetworkIndex(ctx);
|
|
320657
|
+
this.powerNets = new Set(this.index.powerNets);
|
|
320658
|
+
this.groundNets = new Set(this.index.groundNets);
|
|
320659
|
+
for (const element of ctx.circuitJson) {
|
|
320660
|
+
if (element.type !== "source_port")
|
|
320661
|
+
continue;
|
|
320662
|
+
const net = this.index.connected(element.source_port_id);
|
|
320663
|
+
if (element.provides_power || element.requires_power)
|
|
320664
|
+
this.powerNets.add(net);
|
|
320665
|
+
if (element.provides_ground || element.requires_ground)
|
|
320666
|
+
this.groundNets.add(net);
|
|
320667
|
+
}
|
|
320668
|
+
this.componentIds = [...this.index.components.keys()].filter((id) => this.index.portsByComponent.get(id)?.length === 2);
|
|
320669
|
+
this.solved = this.componentIds.length === 0;
|
|
320670
|
+
}
|
|
320671
|
+
_step() {
|
|
320672
|
+
const id = this.componentIds[this.currentIndex++];
|
|
320673
|
+
this.solved = this.currentIndex >= this.componentIds.length;
|
|
320674
|
+
if (!id)
|
|
320675
|
+
return;
|
|
320676
|
+
const index = this.index;
|
|
320677
|
+
const component = index.placement(id);
|
|
320678
|
+
const nets = index.twoTerminalNets(id);
|
|
320679
|
+
if (!component || !nets)
|
|
320680
|
+
return;
|
|
320681
|
+
if (nets.some((net) => this.powerNets.has(net) && this.groundNets.has(net)))
|
|
320682
|
+
return;
|
|
320683
|
+
const railTypes = nets.map((net) => this.powerNets.has(net) ? "power" : this.groundNets.has(net) ? "ground" : undefined);
|
|
320684
|
+
if (railTypes.every((type) => type === undefined))
|
|
320685
|
+
return;
|
|
320686
|
+
const railType = railTypes.includes("power") ? "power" : "ground";
|
|
320687
|
+
const candidates = nets.flatMap((net, i) => railTypes[i] === railType ? [{ net, index: i }] : []);
|
|
320688
|
+
const railIndex = (candidates.find(({ net }) => index.portsByNet.get(net)?.some((port) => railType === "power" ? port.provides_power : port.provides_ground)) ?? candidates.find(({ net }) => (railType === "power" ? index.powerNets : index.groundNets).has(net)) ?? candidates[0]).index;
|
|
320689
|
+
const rail = nets[railIndex];
|
|
320690
|
+
const sourcePorts = index.portsByComponent.get(id);
|
|
320691
|
+
const railSourcePort = sourcePorts.find((port) => index.connected(port.source_port_id) === rail);
|
|
320692
|
+
const otherSourcePort = sourcePorts.find((port) => port !== railSourcePort);
|
|
320693
|
+
const railPort = index.port(railSourcePort);
|
|
320694
|
+
const otherPort = index.port(otherSourcePort);
|
|
320695
|
+
if (!railPort || !otherPort)
|
|
320696
|
+
return;
|
|
320697
|
+
const horizontal = Math.abs(railPort.center.y - otherPort.center.y) <= TwoPinComponentRailOrientationSolver.EPSILON && Math.abs(railPort.center.x - otherPort.center.x) > TwoPinComponentRailOrientationSolver.EPSILON && (railPort.facing_direction === "left" && otherPort.facing_direction === "right" || railPort.facing_direction === "right" && otherPort.facing_direction === "left");
|
|
320698
|
+
if (!horizontal)
|
|
320699
|
+
return;
|
|
320700
|
+
const suggestedRailFacingDirection = railType === "power" ? "up" : "down";
|
|
320701
|
+
const deltaSchRotation = railPort.facing_direction === "left" === (railType === "power") ? -90 : 90;
|
|
320702
|
+
this.issues.push({
|
|
320703
|
+
lineItemType: "TwoPinComponentShouldBeVertical",
|
|
320704
|
+
schematicBox: component,
|
|
320705
|
+
railSourcePortId: railSourcePort.source_port_id,
|
|
320706
|
+
railPinName: railSourcePort.name,
|
|
320707
|
+
railType,
|
|
320708
|
+
deltaSchRotation,
|
|
320709
|
+
suggestedRailFacingDirection,
|
|
320710
|
+
message: `rotate ${component.sourceComponentName ?? id} by ${deltaSchRotation}° so its ${railType}-connected pin faces ${suggestedRailFacingDirection} and the component is vertical`
|
|
320711
|
+
});
|
|
320712
|
+
}
|
|
320713
|
+
static issueToString(issue) {
|
|
320714
|
+
const attrs = [];
|
|
320715
|
+
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
320716
|
+
addAttr(attrs, "railPin", issue.railPinName);
|
|
320717
|
+
addAttr(attrs, "railType", issue.railType);
|
|
320718
|
+
addAttr(attrs, "deltaSchRotation", issue.deltaSchRotation);
|
|
320719
|
+
addAttr(attrs, "suggestedRailFacingDirection", issue.suggestedRailFacingDirection);
|
|
320720
|
+
addAttr(attrs, "message", issue.message);
|
|
320721
|
+
return `<TwoPinComponentShouldBeVertical ${attrs.join(" ")} />`;
|
|
320722
|
+
}
|
|
320723
|
+
}
|
|
320724
|
+
|
|
320036
320725
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxInnerLabelCollisionSolver/SchematicBoxInnerLabelCollisionSolver.ts
|
|
320037
|
-
import { BaseSolver as
|
|
320038
|
-
class SchematicBoxInnerLabelCollisionSolver extends
|
|
320726
|
+
import { BaseSolver as BaseSolver14 } from "@tscircuit/solver-utils";
|
|
320727
|
+
class SchematicBoxInnerLabelCollisionSolver extends BaseSolver14 {
|
|
320039
320728
|
params;
|
|
320040
320729
|
MESSAGE = "Inner labels are colliding. Increase the schWidth or schHeight.";
|
|
320041
320730
|
PIN_LABEL_EDGE_PADDING = 0.1;
|
|
@@ -320086,7 +320775,7 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver9 {
|
|
|
320086
320775
|
}
|
|
320087
320776
|
static issueToString(issue) {
|
|
320088
320777
|
const attrs = [];
|
|
320089
|
-
addAttr(attrs, "message", issue.message
|
|
320778
|
+
addAttr(attrs, "message", issue.message);
|
|
320090
320779
|
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
320091
320780
|
addAttr(attrs, "currentSchWidth", issue.schematicBox.width);
|
|
320092
320781
|
addAttr(attrs, "currentSchHeight", issue.schematicBox.height);
|
|
@@ -320233,8 +320922,8 @@ class SchematicBoxInnerLabelCollisionSolver extends BaseSolver9 {
|
|
|
320233
320922
|
}
|
|
320234
320923
|
|
|
320235
320924
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxOverlapSolver/SchematicBoxOverlapSolver.ts
|
|
320236
|
-
import { BaseSolver as
|
|
320237
|
-
class SchematicBoxOverlapSolver extends
|
|
320925
|
+
import { BaseSolver as BaseSolver15 } from "@tscircuit/solver-utils";
|
|
320926
|
+
class SchematicBoxOverlapSolver extends BaseSolver15 {
|
|
320238
320927
|
params;
|
|
320239
320928
|
placements;
|
|
320240
320929
|
firstIndex = 0;
|
|
@@ -320353,8 +321042,8 @@ class SchematicBoxOverlapSolver extends BaseSolver10 {
|
|
|
320353
321042
|
}
|
|
320354
321043
|
|
|
320355
321044
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicBoxTooWideSolver/SchematicBoxTooWideSolver.ts
|
|
320356
|
-
import { BaseSolver as
|
|
320357
|
-
class SchematicBoxTooWideSolver extends
|
|
321045
|
+
import { BaseSolver as BaseSolver16 } from "@tscircuit/solver-utils";
|
|
321046
|
+
class SchematicBoxTooWideSolver extends BaseSolver16 {
|
|
320358
321047
|
params;
|
|
320359
321048
|
SCHEMATIC_BOX_TOO_WIDE_MESSAGE = "Shrink schematic box width";
|
|
320360
321049
|
PIN_HEADER_MAX_ALLOWED_GAP = 0.1;
|
|
@@ -320433,7 +321122,7 @@ class SchematicBoxTooWideSolver extends BaseSolver11 {
|
|
|
320433
321122
|
}
|
|
320434
321123
|
static issueToString(issue) {
|
|
320435
321124
|
const attrs = [];
|
|
320436
|
-
addAttr(attrs, "message", issue.message
|
|
321125
|
+
addAttr(attrs, "message", issue.message);
|
|
320437
321126
|
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
320438
321127
|
addAttr(attrs, "currentSchWidth", issue.schematicBox.width);
|
|
320439
321128
|
addAttr(attrs, "measuredInnerLabelHorizontalEmptySpace", issue.measuredInnerLabelHorizontalEmptySpace);
|
|
@@ -320529,8 +321218,8 @@ class SchematicBoxTooWideSolver extends BaseSolver11 {
|
|
|
320529
321218
|
}
|
|
320530
321219
|
|
|
320531
321220
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicPinPaddingToEdgeSolver/SchematicPinPaddingToEdgeSolver.ts
|
|
320532
|
-
import { BaseSolver as
|
|
320533
|
-
class SchematicPinPaddingToEdgeSolver extends
|
|
321221
|
+
import { BaseSolver as BaseSolver17 } from "@tscircuit/solver-utils";
|
|
321222
|
+
class SchematicPinPaddingToEdgeSolver extends BaseSolver17 {
|
|
320534
321223
|
params;
|
|
320535
321224
|
MESSAGE = "Move schematic pins closer to the box edge or change the schematic box";
|
|
320536
321225
|
PIN_NAME_CHARACTER_WIDTH = 0.095;
|
|
@@ -320597,7 +321286,7 @@ class SchematicPinPaddingToEdgeSolver extends BaseSolver12 {
|
|
|
320597
321286
|
}
|
|
320598
321287
|
static issueToString(issue) {
|
|
320599
321288
|
const attrs = [];
|
|
320600
|
-
addAttr(attrs, "message", issue.message
|
|
321289
|
+
addAttr(attrs, "message", issue.message);
|
|
320601
321290
|
addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
|
|
320602
321291
|
addAttr(attrs, "pinSide", issue.pinSide);
|
|
320603
321292
|
addAttr(attrs, "edgeSide", issue.edgeSide);
|
|
@@ -320868,8 +321557,8 @@ var buildSolverContext = (circuitJson) => {
|
|
|
320868
321557
|
};
|
|
320869
321558
|
|
|
320870
321559
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TraceSimplificationSolver/TraceSimplificationSolver.ts
|
|
320871
|
-
import { BaseSolver as
|
|
320872
|
-
class TraceSimplificationSolver extends
|
|
321560
|
+
import { BaseSolver as BaseSolver18 } from "@tscircuit/solver-utils";
|
|
321561
|
+
class TraceSimplificationSolver extends BaseSolver18 {
|
|
320873
321562
|
static EPSILON = 0.01;
|
|
320874
321563
|
ctx;
|
|
320875
321564
|
out;
|
|
@@ -321098,9 +321787,293 @@ class TraceSimplificationSolver extends BaseSolver13 {
|
|
|
321098
321787
|
}
|
|
321099
321788
|
}
|
|
321100
321789
|
|
|
321790
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/TwoPinComponentOrientationSolver.ts
|
|
321791
|
+
import { BaseSolver as BaseSolver19 } from "@tscircuit/solver-utils";
|
|
321792
|
+
|
|
321793
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/getPowerOrGroundConnectionIds.ts
|
|
321794
|
+
import {
|
|
321795
|
+
findConnectedNetworks as findConnectedNetworks3,
|
|
321796
|
+
getSourcePortConnectivityMapFromCircuitJson as getSourcePortConnectivityMapFromCircuitJson2
|
|
321797
|
+
} from "circuit-json-to-connectivity-map";
|
|
321798
|
+
function getPowerOrGroundConnectionIds(circuitJson) {
|
|
321799
|
+
const powerOrGroundIds = new Set;
|
|
321800
|
+
const idsByConnectivityKey = new Map;
|
|
321801
|
+
for (const element of circuitJson) {
|
|
321802
|
+
if (element.type !== "source_net" && element.type !== "source_port")
|
|
321803
|
+
continue;
|
|
321804
|
+
const id = element.type === "source_net" ? element.source_net_id : element.source_port_id;
|
|
321805
|
+
const isPowerOrGround = element.type === "source_net" ? element.is_power || element.is_ground || element.is_positive_voltage_source : element.provides_power || element.requires_power || element.provides_ground || element.requires_ground;
|
|
321806
|
+
if (isPowerOrGround)
|
|
321807
|
+
powerOrGroundIds.add(id);
|
|
321808
|
+
const key = element.subcircuit_connectivity_map_key;
|
|
321809
|
+
if (key !== undefined) {
|
|
321810
|
+
const ids = idsByConnectivityKey.get(key) ?? [];
|
|
321811
|
+
ids.push(id);
|
|
321812
|
+
idsByConnectivityKey.set(key, ids);
|
|
321813
|
+
}
|
|
321814
|
+
}
|
|
321815
|
+
const sourceConnectivity = getSourcePortConnectivityMapFromCircuitJson2(circuitJson);
|
|
321816
|
+
const networks = findConnectedNetworks3([
|
|
321817
|
+
...Object.values(sourceConnectivity.netMap),
|
|
321818
|
+
...idsByConnectivityKey.values()
|
|
321819
|
+
]);
|
|
321820
|
+
for (const ids of Object.values(networks)) {
|
|
321821
|
+
if (ids.some((id) => powerOrGroundIds.has(id))) {
|
|
321822
|
+
for (const id of ids)
|
|
321823
|
+
powerOrGroundIds.add(id);
|
|
321824
|
+
}
|
|
321825
|
+
}
|
|
321826
|
+
return powerOrGroundIds;
|
|
321827
|
+
}
|
|
321828
|
+
|
|
321829
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/TwoPinComponentOrientationSolver/TwoPinComponentOrientationSolver.ts
|
|
321830
|
+
class TwoPinComponentOrientationSolver extends BaseSolver19 {
|
|
321831
|
+
static EPSILON = 0.01;
|
|
321832
|
+
ctx;
|
|
321833
|
+
out;
|
|
321834
|
+
powerOrGroundConnectionIds;
|
|
321835
|
+
constructor({
|
|
321836
|
+
ctx,
|
|
321837
|
+
issues
|
|
321838
|
+
}) {
|
|
321839
|
+
super();
|
|
321840
|
+
this.ctx = ctx;
|
|
321841
|
+
this.out = issues;
|
|
321842
|
+
this.powerOrGroundConnectionIds = getPowerOrGroundConnectionIds(ctx.circuitJson);
|
|
321843
|
+
}
|
|
321844
|
+
_step() {
|
|
321845
|
+
const ports = this.ctx.circuitJson.filter((element) => element.type === "schematic_port");
|
|
321846
|
+
const portsById = new Map(ports.map((port) => [port.schematic_port_id, port]));
|
|
321847
|
+
const portsByComponentId = new Map;
|
|
321848
|
+
for (const port of ports) {
|
|
321849
|
+
if (!port.schematic_component_id)
|
|
321850
|
+
continue;
|
|
321851
|
+
const componentPorts = portsByComponentId.get(port.schematic_component_id) ?? [];
|
|
321852
|
+
componentPorts.push(port);
|
|
321853
|
+
portsByComponentId.set(port.schematic_component_id, componentPorts);
|
|
321854
|
+
}
|
|
321855
|
+
const placementsByComponentId = new Map(this.ctx.componentPlacements.flatMap((placement) => placement.schematicComponentId ? [[placement.schematicComponentId, placement]] : []));
|
|
321856
|
+
const bestCandidateByComponentId = new Map;
|
|
321857
|
+
for (const trace of this.ctx.circuitJson.filter((element) => element.type === "schematic_trace")) {
|
|
321858
|
+
const points = this.getTracePoints(trace);
|
|
321859
|
+
const currentTurnCount = this.countTurns(points);
|
|
321860
|
+
if (currentTurnCount === undefined || currentTurnCount < 2)
|
|
321861
|
+
continue;
|
|
321862
|
+
const endpoints = this.getTraceEndpoints(trace, points, ports, portsById);
|
|
321863
|
+
if (!endpoints)
|
|
321864
|
+
continue;
|
|
321865
|
+
for (const [targetEndpoint, connectedEndpoint] of [
|
|
321866
|
+
endpoints,
|
|
321867
|
+
[endpoints[1], endpoints[0]]
|
|
321868
|
+
]) {
|
|
321869
|
+
const candidate = this.getFlipCandidate({
|
|
321870
|
+
trace,
|
|
321871
|
+
targetEndpoint,
|
|
321872
|
+
connectedEndpoint,
|
|
321873
|
+
currentTurnCount,
|
|
321874
|
+
portsByComponentId,
|
|
321875
|
+
placementsByComponentId
|
|
321876
|
+
});
|
|
321877
|
+
if (!candidate)
|
|
321878
|
+
continue;
|
|
321879
|
+
const componentId = candidate.targetPort.schematic_component_id;
|
|
321880
|
+
const existing = bestCandidateByComponentId.get(componentId);
|
|
321881
|
+
if (!existing || this.isBetterCandidate(candidate, existing)) {
|
|
321882
|
+
bestCandidateByComponentId.set(componentId, candidate);
|
|
321883
|
+
}
|
|
321884
|
+
}
|
|
321885
|
+
}
|
|
321886
|
+
for (const candidate of bestCandidateByComponentId.values()) {
|
|
321887
|
+
this.out.push(this.makeIssue(candidate));
|
|
321888
|
+
}
|
|
321889
|
+
this.solved = true;
|
|
321890
|
+
}
|
|
321891
|
+
getFlipCandidate({
|
|
321892
|
+
trace,
|
|
321893
|
+
targetEndpoint,
|
|
321894
|
+
connectedEndpoint,
|
|
321895
|
+
currentTurnCount,
|
|
321896
|
+
portsByComponentId,
|
|
321897
|
+
placementsByComponentId
|
|
321898
|
+
}) {
|
|
321899
|
+
const targetPort = targetEndpoint.port;
|
|
321900
|
+
const connectedPort = connectedEndpoint.port;
|
|
321901
|
+
const targetComponentId = targetPort.schematic_component_id;
|
|
321902
|
+
const connectedComponentId = connectedPort.schematic_component_id;
|
|
321903
|
+
if (!targetComponentId || !connectedComponentId || targetComponentId === connectedComponentId || targetPort.schematic_sheet_id !== connectedPort.schematic_sheet_id) {
|
|
321904
|
+
return;
|
|
321905
|
+
}
|
|
321906
|
+
const componentPorts = portsByComponentId.get(targetComponentId);
|
|
321907
|
+
if (componentPorts?.length !== 2)
|
|
321908
|
+
return;
|
|
321909
|
+
if (componentPorts.some((port) => port.source_port_id && this.powerOrGroundConnectionIds.has(port.source_port_id))) {
|
|
321910
|
+
return;
|
|
321911
|
+
}
|
|
321912
|
+
const connectedComponentPorts = portsByComponentId.get(connectedComponentId) ?? [];
|
|
321913
|
+
if (connectedComponentPorts.length <= 2)
|
|
321914
|
+
return;
|
|
321915
|
+
const otherPort = componentPorts.find((port) => port.schematic_port_id !== targetPort.schematic_port_id);
|
|
321916
|
+
if (!otherPort || !this.areOppositePorts(targetPort, otherPort))
|
|
321917
|
+
return;
|
|
321918
|
+
const currentFacingDirection = targetPort.facing_direction;
|
|
321919
|
+
const suggestedFacingDirection = otherPort.facing_direction;
|
|
321920
|
+
if (!currentFacingDirection || !suggestedFacingDirection)
|
|
321921
|
+
return;
|
|
321922
|
+
if (!this.traceLeavesPortInFacingDirection(targetEndpoint))
|
|
321923
|
+
return;
|
|
321924
|
+
const connectedPoint = connectedPort.center;
|
|
321925
|
+
if (this.isPointInFacingDirection(targetPort.center, connectedPoint, currentFacingDirection) || !this.isPointInFacingDirection(otherPort.center, connectedPoint, suggestedFacingDirection) || !connectedPort.facing_direction || !this.isPointInFacingDirection(connectedPoint, otherPort.center, connectedPort.facing_direction)) {
|
|
321926
|
+
return;
|
|
321927
|
+
}
|
|
321928
|
+
const suggestedTurnCount = this.getMinimumTurnCount(otherPort.center, connectedPoint, suggestedFacingDirection);
|
|
321929
|
+
if (suggestedTurnCount >= currentTurnCount)
|
|
321930
|
+
return;
|
|
321931
|
+
const targetPlacement = placementsByComponentId.get(targetComponentId);
|
|
321932
|
+
const connectedPlacement = placementsByComponentId.get(connectedComponentId);
|
|
321933
|
+
if (!targetPlacement || !connectedPlacement)
|
|
321934
|
+
return;
|
|
321935
|
+
return {
|
|
321936
|
+
trace,
|
|
321937
|
+
targetPort,
|
|
321938
|
+
targetPlacement,
|
|
321939
|
+
connectedPlacement,
|
|
321940
|
+
suggestedFacingDirection,
|
|
321941
|
+
currentTurnCount,
|
|
321942
|
+
suggestedTurnCount,
|
|
321943
|
+
traceLength: this.getTraceLength(targetEndpoint.pointsFromEndpoint)
|
|
321944
|
+
};
|
|
321945
|
+
}
|
|
321946
|
+
getTraceEndpoints(trace, points, ports, portsById) {
|
|
321947
|
+
const firstEdge = trace.edges[0];
|
|
321948
|
+
const lastEdge = trace.edges.at(-1);
|
|
321949
|
+
if (!firstEdge || !lastEdge || points.length < 2)
|
|
321950
|
+
return;
|
|
321951
|
+
const startPort = firstEdge.from_schematic_port_id ? portsById.get(firstEdge.from_schematic_port_id) : this.findPortAtPoint(ports, points[0], trace.schematic_sheet_id);
|
|
321952
|
+
const endPort = lastEdge.to_schematic_port_id ? portsById.get(lastEdge.to_schematic_port_id) : this.findPortAtPoint(ports, points.at(-1), trace.schematic_sheet_id);
|
|
321953
|
+
if (!startPort || !endPort)
|
|
321954
|
+
return;
|
|
321955
|
+
return [
|
|
321956
|
+
{ port: startPort, pointsFromEndpoint: points },
|
|
321957
|
+
{ port: endPort, pointsFromEndpoint: [...points].reverse() }
|
|
321958
|
+
];
|
|
321959
|
+
}
|
|
321960
|
+
getTracePoints(trace) {
|
|
321961
|
+
const firstEdge = trace.edges[0];
|
|
321962
|
+
if (!firstEdge)
|
|
321963
|
+
return [];
|
|
321964
|
+
const points = [firstEdge.from];
|
|
321965
|
+
for (const edge of trace.edges) {
|
|
321966
|
+
if (!this.pointsEqual(points.at(-1), edge.from))
|
|
321967
|
+
return [];
|
|
321968
|
+
points.push(edge.to);
|
|
321969
|
+
}
|
|
321970
|
+
return points;
|
|
321971
|
+
}
|
|
321972
|
+
countTurns(points) {
|
|
321973
|
+
const axes = [];
|
|
321974
|
+
for (const [index, point] of points.slice(1).entries()) {
|
|
321975
|
+
const previousPoint = points[index];
|
|
321976
|
+
if (this.pointsEqual(previousPoint, point))
|
|
321977
|
+
continue;
|
|
321978
|
+
const axis = this.getAxis(previousPoint, point);
|
|
321979
|
+
if (!axis)
|
|
321980
|
+
return;
|
|
321981
|
+
if (axes.at(-1) !== axis)
|
|
321982
|
+
axes.push(axis);
|
|
321983
|
+
}
|
|
321984
|
+
return Math.max(0, axes.length - 1);
|
|
321985
|
+
}
|
|
321986
|
+
traceLeavesPortInFacingDirection(endpoint) {
|
|
321987
|
+
const nextPoint = endpoint.pointsFromEndpoint.find((point) => !this.pointsEqual(point, endpoint.port.center));
|
|
321988
|
+
return Boolean(nextPoint && endpoint.port.facing_direction && this.isPointInFacingDirection(endpoint.port.center, nextPoint, endpoint.port.facing_direction));
|
|
321989
|
+
}
|
|
321990
|
+
areOppositePorts(a, b) {
|
|
321991
|
+
const horizontal = (a.facing_direction === "left" && b.facing_direction === "right" || a.facing_direction === "right" && b.facing_direction === "left") && Math.abs(a.center.y - b.center.y) <= TwoPinComponentOrientationSolver.EPSILON;
|
|
321992
|
+
const vertical = (a.facing_direction === "up" && b.facing_direction === "down" || a.facing_direction === "down" && b.facing_direction === "up") && Math.abs(a.center.x - b.center.x) <= TwoPinComponentOrientationSolver.EPSILON;
|
|
321993
|
+
return horizontal || vertical;
|
|
321994
|
+
}
|
|
321995
|
+
getMinimumTurnCount(from, to, facingDirection) {
|
|
321996
|
+
const alignedWithFacingAxis = facingDirection === "left" || facingDirection === "right" ? Math.abs(from.y - to.y) <= TwoPinComponentOrientationSolver.EPSILON : Math.abs(from.x - to.x) <= TwoPinComponentOrientationSolver.EPSILON;
|
|
321997
|
+
return alignedWithFacingAxis ? 0 : 1;
|
|
321998
|
+
}
|
|
321999
|
+
isPointInFacingDirection(origin, point, facingDirection) {
|
|
322000
|
+
const { EPSILON } = TwoPinComponentOrientationSolver;
|
|
322001
|
+
switch (facingDirection) {
|
|
322002
|
+
case "left":
|
|
322003
|
+
return point.x < origin.x - EPSILON;
|
|
322004
|
+
case "right":
|
|
322005
|
+
return point.x > origin.x + EPSILON;
|
|
322006
|
+
case "up":
|
|
322007
|
+
return point.y > origin.y + EPSILON;
|
|
322008
|
+
case "down":
|
|
322009
|
+
return point.y < origin.y - EPSILON;
|
|
322010
|
+
}
|
|
322011
|
+
}
|
|
322012
|
+
getAxis(a, b) {
|
|
322013
|
+
const dx = Math.abs(a.x - b.x);
|
|
322014
|
+
const dy = Math.abs(a.y - b.y);
|
|
322015
|
+
const { EPSILON } = TwoPinComponentOrientationSolver;
|
|
322016
|
+
if (dx <= EPSILON && dy > EPSILON)
|
|
322017
|
+
return "vertical";
|
|
322018
|
+
if (dy <= EPSILON && dx > EPSILON)
|
|
322019
|
+
return "horizontal";
|
|
322020
|
+
return;
|
|
322021
|
+
}
|
|
322022
|
+
pointsEqual(a, b) {
|
|
322023
|
+
const { EPSILON } = TwoPinComponentOrientationSolver;
|
|
322024
|
+
return Math.abs(a.x - b.x) <= EPSILON && Math.abs(a.y - b.y) <= EPSILON;
|
|
322025
|
+
}
|
|
322026
|
+
findPortAtPoint(ports, point, schematicSheetId) {
|
|
322027
|
+
return ports.find((port) => port.schematic_sheet_id === schematicSheetId && this.pointsEqual(port.center, point));
|
|
322028
|
+
}
|
|
322029
|
+
getTraceLength(points) {
|
|
322030
|
+
return points.slice(1).reduce((length, point, index) => {
|
|
322031
|
+
const previousPoint = points[index];
|
|
322032
|
+
return length + Math.abs(point.x - previousPoint.x) + Math.abs(point.y - previousPoint.y);
|
|
322033
|
+
}, 0);
|
|
322034
|
+
}
|
|
322035
|
+
isBetterCandidate(candidate, existing) {
|
|
322036
|
+
const improvement = candidate.currentTurnCount - candidate.suggestedTurnCount;
|
|
322037
|
+
const existingImprovement = existing.currentTurnCount - existing.suggestedTurnCount;
|
|
322038
|
+
return improvement > existingImprovement || improvement === existingImprovement && candidate.traceLength > existing.traceLength;
|
|
322039
|
+
}
|
|
322040
|
+
makeIssue(candidate) {
|
|
322041
|
+
const targetName = candidate.targetPlacement.sourceComponentName ?? candidate.targetPlacement.schematicComponentId ?? "component";
|
|
322042
|
+
const connectedName = candidate.connectedPlacement.sourceComponentName ?? candidate.connectedPlacement.schematicComponentId ?? "connected component";
|
|
322043
|
+
const targetPin = candidate.targetPort.pin_number ? `pin${candidate.targetPort.pin_number}` : candidate.targetPort.display_pin_label;
|
|
322044
|
+
return {
|
|
322045
|
+
lineItemType: "TwoPinComponentCouldBeFlipped",
|
|
322046
|
+
schematicTraceId: candidate.trace.schematic_trace_id,
|
|
322047
|
+
targetComponent: candidate.targetPlacement,
|
|
322048
|
+
connectedComponent: candidate.connectedPlacement,
|
|
322049
|
+
targetPin,
|
|
322050
|
+
currentFacingDirection: candidate.targetPort.facing_direction,
|
|
322051
|
+
suggestedFacingDirection: candidate.suggestedFacingDirection,
|
|
322052
|
+
deltaSchRotation: 180,
|
|
322053
|
+
currentTurnCount: candidate.currentTurnCount,
|
|
322054
|
+
suggestedTurnCount: candidate.suggestedTurnCount,
|
|
322055
|
+
message: `rotate ${targetName} by 180° so ${targetPin ?? "its connected pin"} faces ${connectedName} and reduce this trace from ${candidate.currentTurnCount} turns to ${candidate.suggestedTurnCount}`
|
|
322056
|
+
};
|
|
322057
|
+
}
|
|
322058
|
+
static issueToString(issue) {
|
|
322059
|
+
const attrs = [];
|
|
322060
|
+
addAttr(attrs, "schematicTraceId", issue.schematicTraceId);
|
|
322061
|
+
addAttr(attrs, "targetComponentName", issue.targetComponent.sourceComponentName);
|
|
322062
|
+
addAttr(attrs, "connectedComponentName", issue.connectedComponent.sourceComponentName);
|
|
322063
|
+
addAttr(attrs, "targetPin", issue.targetPin);
|
|
322064
|
+
addAttr(attrs, "currentFacingDirection", issue.currentFacingDirection);
|
|
322065
|
+
addAttr(attrs, "suggestedFacingDirection", issue.suggestedFacingDirection);
|
|
322066
|
+
addAttr(attrs, "deltaSchRotation", issue.deltaSchRotation);
|
|
322067
|
+
addAttr(attrs, "currentTurnCount", issue.currentTurnCount);
|
|
322068
|
+
addAttr(attrs, "suggestedTurnCount", issue.suggestedTurnCount);
|
|
322069
|
+
addAttr(attrs, "message", issue.message);
|
|
322070
|
+
return `<TwoPinComponentCouldBeFlipped ${attrs.join(" ")} />`;
|
|
322071
|
+
}
|
|
322072
|
+
}
|
|
322073
|
+
|
|
321101
322074
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/VerboseNetLabelSolver/VerboseNetLabelSolver.ts
|
|
321102
|
-
import { BaseSolver as
|
|
321103
|
-
class VerboseNetLabelSolver extends
|
|
322075
|
+
import { BaseSolver as BaseSolver20 } from "@tscircuit/solver-utils";
|
|
322076
|
+
class VerboseNetLabelSolver extends BaseSolver20 {
|
|
321104
322077
|
params;
|
|
321105
322078
|
VERBOSE_NET_LABEL_MESSAGE = "Create trace with schDisplayLabel";
|
|
321106
322079
|
netLabels;
|
|
@@ -321148,7 +322121,7 @@ class VerboseNetLabelSolver extends BaseSolver14 {
|
|
|
321148
322121
|
}
|
|
321149
322122
|
static issueToString(issue) {
|
|
321150
322123
|
const attrs = [];
|
|
321151
|
-
addAttr(attrs, "message", issue.message
|
|
322124
|
+
addAttr(attrs, "message", issue.message);
|
|
321152
322125
|
addAttr(attrs, "text", issue.text);
|
|
321153
322126
|
addAttr(attrs, "involvedPins", issue.involvedPins.join(","));
|
|
321154
322127
|
addAttr(attrs, "schSheetName", issue.schematicSheetName);
|
|
@@ -321208,11 +322181,446 @@ class VerboseNetLabelSolver extends BaseSolver14 {
|
|
|
321208
322181
|
}
|
|
321209
322182
|
}
|
|
321210
322183
|
|
|
322184
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicTextClearanceSolver/SchematicTextClearanceSolver.ts
|
|
322185
|
+
import { BaseSolver as BaseSolver21 } from "@tscircuit/solver-utils";
|
|
322186
|
+
|
|
322187
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/utils/schematic-text-geometry.ts
|
|
322188
|
+
var rectPolygon = (bounds) => [
|
|
322189
|
+
{ x: bounds.left, y: bounds.bottom },
|
|
322190
|
+
{ x: bounds.right, y: bounds.bottom },
|
|
322191
|
+
{ x: bounds.right, y: bounds.top },
|
|
322192
|
+
{ x: bounds.left, y: bounds.top }
|
|
322193
|
+
];
|
|
322194
|
+
var advance = (character) => {
|
|
322195
|
+
if (/\s/.test(character))
|
|
322196
|
+
return 0.28;
|
|
322197
|
+
if (/[ilI.,:;!'|]/.test(character))
|
|
322198
|
+
return 0.25;
|
|
322199
|
+
if (/[MW@%]/.test(character))
|
|
322200
|
+
return 0.9;
|
|
322201
|
+
if (/[mw]/.test(character))
|
|
322202
|
+
return 0.8;
|
|
322203
|
+
if (/[A-Z]/.test(character))
|
|
322204
|
+
return 0.67;
|
|
322205
|
+
return 0.56;
|
|
322206
|
+
};
|
|
322207
|
+
var widthInEm = (text) => Array.from(text).reduce((width, character) => width + advance(character), 0);
|
|
322208
|
+
function getSchematicTextPolygons(text) {
|
|
322209
|
+
const size = text.font_size;
|
|
322210
|
+
if (!Number.isFinite(size) || size <= 0 || !Number.isFinite(text.rotation) || !Number.isFinite(text.position.x) || !Number.isFinite(text.position.y))
|
|
322211
|
+
return [];
|
|
322212
|
+
const anchor = text.anchor;
|
|
322213
|
+
const horizontal = anchor.includes("left") ? 0 : anchor.includes("right") ? 1 : 0.5;
|
|
322214
|
+
const top = anchor.includes("top") ? 0 : anchor.includes("bottom") ? size : size / 2;
|
|
322215
|
+
const radians = -text.rotation * Math.PI / 180;
|
|
322216
|
+
const cos = Math.cos(radians);
|
|
322217
|
+
const sin = Math.sin(radians);
|
|
322218
|
+
return text.text.split(`
|
|
322219
|
+
`).flatMap((line, index) => {
|
|
322220
|
+
const visible = line.trim();
|
|
322221
|
+
if (!visible)
|
|
322222
|
+
return [];
|
|
322223
|
+
const leading = line.length - line.trimStart().length;
|
|
322224
|
+
const left = (widthInEm(line.slice(0, leading)) - widthInEm(line) * horizontal) * size;
|
|
322225
|
+
const polygon = rectPolygon({
|
|
322226
|
+
left,
|
|
322227
|
+
right: left + widthInEm(visible) * size,
|
|
322228
|
+
top: top - index * size - size * 0.05,
|
|
322229
|
+
bottom: top - (index + 1) * size + size * 0.05
|
|
322230
|
+
});
|
|
322231
|
+
return [
|
|
322232
|
+
polygon.map(({ x, y }) => ({
|
|
322233
|
+
x: text.position.x + x * cos - y * sin,
|
|
322234
|
+
y: text.position.y + x * sin + y * cos
|
|
322235
|
+
}))
|
|
322236
|
+
];
|
|
322237
|
+
});
|
|
322238
|
+
}
|
|
322239
|
+
function polygonsOverlap(a, b) {
|
|
322240
|
+
for (const polygon of [a, b]) {
|
|
322241
|
+
for (let i = 0;i < polygon.length; i++) {
|
|
322242
|
+
const p = polygon[i];
|
|
322243
|
+
const q = polygon[(i + 1) % polygon.length];
|
|
322244
|
+
const length = Math.hypot(q.x - p.x, q.y - p.y);
|
|
322245
|
+
if (length < 0.000000001)
|
|
322246
|
+
continue;
|
|
322247
|
+
const nx = -(q.y - p.y) / length;
|
|
322248
|
+
const ny = (q.x - p.x) / length;
|
|
322249
|
+
const project = (points) => points.map(({ x, y }) => x * nx + y * ny);
|
|
322250
|
+
const pa = project(a);
|
|
322251
|
+
const pb = project(b);
|
|
322252
|
+
if (Math.min(Math.max(...pa), Math.max(...pb)) - Math.max(Math.min(...pa), Math.min(...pb)) <= 0.000001)
|
|
322253
|
+
return false;
|
|
322254
|
+
}
|
|
322255
|
+
}
|
|
322256
|
+
return true;
|
|
322257
|
+
}
|
|
322258
|
+
function traceSegmentPolygon(from, to) {
|
|
322259
|
+
const length = Math.hypot(to.x - from.x, to.y - from.y);
|
|
322260
|
+
if (length < 0.000000001)
|
|
322261
|
+
return;
|
|
322262
|
+
const dx = -(to.y - from.y) / length * 0.01;
|
|
322263
|
+
const dy = (to.x - from.x) / length * 0.01;
|
|
322264
|
+
return [
|
|
322265
|
+
{ x: from.x + dx, y: from.y + dy },
|
|
322266
|
+
{ x: to.x + dx, y: to.y + dy },
|
|
322267
|
+
{ x: to.x - dx, y: to.y - dy },
|
|
322268
|
+
{ x: from.x - dx, y: from.y - dy }
|
|
322269
|
+
];
|
|
322270
|
+
}
|
|
322271
|
+
function segmentCrossesPolygon(from, to, polygon) {
|
|
322272
|
+
if (Math.hypot(to.x - from.x, to.y - from.y) < 0.000000001)
|
|
322273
|
+
return false;
|
|
322274
|
+
let low = 0;
|
|
322275
|
+
let high = 1;
|
|
322276
|
+
for (let i = 0;i < polygon.length; i++) {
|
|
322277
|
+
const p = polygon[i];
|
|
322278
|
+
const q = polygon[(i + 1) % polygon.length];
|
|
322279
|
+
const length = Math.hypot(q.x - p.x, q.y - p.y);
|
|
322280
|
+
if (length < 0.000000001)
|
|
322281
|
+
continue;
|
|
322282
|
+
const nx = -(q.y - p.y) / length;
|
|
322283
|
+
const ny = (q.x - p.x) / length;
|
|
322284
|
+
const start = (from.x - p.x) * nx + (from.y - p.y) * ny - 0.000001;
|
|
322285
|
+
const end = (to.x - p.x) * nx + (to.y - p.y) * ny - 0.000001;
|
|
322286
|
+
if (start <= 0 && end <= 0)
|
|
322287
|
+
return false;
|
|
322288
|
+
if (start <= 0)
|
|
322289
|
+
low = Math.max(low, -start / (end - start));
|
|
322290
|
+
if (end <= 0)
|
|
322291
|
+
high = Math.min(high, -start / (end - start));
|
|
322292
|
+
if (high <= low)
|
|
322293
|
+
return false;
|
|
322294
|
+
}
|
|
322295
|
+
return high > low;
|
|
322296
|
+
}
|
|
322297
|
+
var polygonBounds = (polygons) => {
|
|
322298
|
+
const points = polygons.flat();
|
|
322299
|
+
return {
|
|
322300
|
+
left: Math.min(...points.map((p) => p.x)),
|
|
322301
|
+
right: Math.max(...points.map((p) => p.x)),
|
|
322302
|
+
top: Math.max(...points.map((p) => p.y)),
|
|
322303
|
+
bottom: Math.min(...points.map((p) => p.y))
|
|
322304
|
+
};
|
|
322305
|
+
};
|
|
322306
|
+
|
|
322307
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicTextClearanceSolver/SchematicTextClearanceSolver.ts
|
|
322308
|
+
class SchematicTextClearanceSolver extends BaseSolver21 {
|
|
322309
|
+
params;
|
|
322310
|
+
texts;
|
|
322311
|
+
obstacles;
|
|
322312
|
+
sheetNames;
|
|
322313
|
+
index = 0;
|
|
322314
|
+
constructor(params2) {
|
|
322315
|
+
super();
|
|
322316
|
+
this.params = params2;
|
|
322317
|
+
const { ctx } = params2;
|
|
322318
|
+
this.sheetNames = getSchematicSheetNamesById(ctx.circuitJson);
|
|
322319
|
+
const customSymbolIds = new Set(ctx.circuitJson.flatMap((element) => element.type === "schematic_component" && element.is_box_with_pins === false && !element.symbol_name ? [element.schematic_component_id] : []));
|
|
322320
|
+
const seenText = new Set;
|
|
322321
|
+
this.texts = ctx.circuitJson.flatMap((element) => {
|
|
322322
|
+
if (element.type !== "schematic_text")
|
|
322323
|
+
return [];
|
|
322324
|
+
if (element.schematic_component_id || element.schematic_symbol_id || "source_trace_id" in element && element.source_trace_id)
|
|
322325
|
+
return [];
|
|
322326
|
+
const polygons = getSchematicTextPolygons(element);
|
|
322327
|
+
if (!polygons.length)
|
|
322328
|
+
return [];
|
|
322329
|
+
const sheetId = element.schematic_sheet_id;
|
|
322330
|
+
const fingerprint = JSON.stringify([
|
|
322331
|
+
sheetId,
|
|
322332
|
+
element.text,
|
|
322333
|
+
element.position.x,
|
|
322334
|
+
element.position.y,
|
|
322335
|
+
element.font_size,
|
|
322336
|
+
element.anchor,
|
|
322337
|
+
element.rotation,
|
|
322338
|
+
element.color
|
|
322339
|
+
]);
|
|
322340
|
+
if (seenText.has(fingerprint))
|
|
322341
|
+
return [];
|
|
322342
|
+
seenText.add(fingerprint);
|
|
322343
|
+
return [
|
|
322344
|
+
{
|
|
322345
|
+
text: element,
|
|
322346
|
+
polygons,
|
|
322347
|
+
sheetId,
|
|
322348
|
+
object: {
|
|
322349
|
+
type: "text",
|
|
322350
|
+
id: element.schematic_text_id,
|
|
322351
|
+
text: element.text
|
|
322352
|
+
}
|
|
322353
|
+
}
|
|
322354
|
+
];
|
|
322355
|
+
});
|
|
322356
|
+
this.obstacles = [
|
|
322357
|
+
...ctx.componentPlacements.flatMap((p) => p.schematicComponentId && !customSymbolIds.has(p.schematicComponentId) ? [
|
|
322358
|
+
{
|
|
322359
|
+
object: {
|
|
322360
|
+
type: "component",
|
|
322361
|
+
id: p.schematicComponentId,
|
|
322362
|
+
componentName: p.sourceComponentName,
|
|
322363
|
+
schematicComponentId: p.schematicComponentId
|
|
322364
|
+
},
|
|
322365
|
+
polygons: [
|
|
322366
|
+
rectPolygon(centeredRect(p.schX, p.schY, p.width, p.height))
|
|
322367
|
+
],
|
|
322368
|
+
sheetId: p.schematicSheetId
|
|
322369
|
+
}
|
|
322370
|
+
] : []),
|
|
322371
|
+
...ctx.circuitJson.flatMap((element) => element.type === "schematic_trace" ? [
|
|
322372
|
+
{
|
|
322373
|
+
object: {
|
|
322374
|
+
type: "trace",
|
|
322375
|
+
id: element.schematic_trace_id
|
|
322376
|
+
},
|
|
322377
|
+
sheetId: element.schematic_sheet_id,
|
|
322378
|
+
segments: element.edges,
|
|
322379
|
+
polygons: element.edges.flatMap((edge) => {
|
|
322380
|
+
const polygon = traceSegmentPolygon(edge.from, edge.to);
|
|
322381
|
+
return polygon ? [polygon] : [];
|
|
322382
|
+
})
|
|
322383
|
+
}
|
|
322384
|
+
] : [])
|
|
322385
|
+
];
|
|
322386
|
+
this.solved = this.texts.length === 0;
|
|
322387
|
+
}
|
|
322388
|
+
_step() {
|
|
322389
|
+
const text = this.texts[this.index];
|
|
322390
|
+
const targets = [...this.obstacles, ...this.texts.slice(this.index + 1)];
|
|
322391
|
+
const collisions = targets.filter((target) => this.collides(text, target));
|
|
322392
|
+
if (collisions.length) {
|
|
322393
|
+
const suggestedMove = this.findClearPosition(text);
|
|
322394
|
+
for (const target of collisions) {
|
|
322395
|
+
this.params.issues.push({
|
|
322396
|
+
lineItemType: "SchematicTextCollision",
|
|
322397
|
+
schematicSheetId: text.sheetId,
|
|
322398
|
+
schematicSheetName: text.sheetId ? this.sheetNames.get(text.sheetId) : undefined,
|
|
322399
|
+
schematicTextId: text.text.schematic_text_id,
|
|
322400
|
+
text: text.text.text,
|
|
322401
|
+
collidingObject: target.object,
|
|
322402
|
+
textBounds: polygonBounds(text.polygons),
|
|
322403
|
+
collidingObjectBounds: polygonBounds(target.polygons),
|
|
322404
|
+
suggestedMove,
|
|
322405
|
+
message: `Text "${text.text.text}" overlaps ${target.object.type} ${target.object.componentName ?? target.object.id}; reposition the text to leave its visible area clear.`
|
|
322406
|
+
});
|
|
322407
|
+
}
|
|
322408
|
+
}
|
|
322409
|
+
this.index++;
|
|
322410
|
+
this.solved = this.index >= this.texts.length;
|
|
322411
|
+
}
|
|
322412
|
+
collides(text, obstacle) {
|
|
322413
|
+
if (text.sheetId !== obstacle.sheetId)
|
|
322414
|
+
return false;
|
|
322415
|
+
return text.polygons.some((a) => obstacle.segments ? obstacle.segments.some((edge) => segmentCrossesPolygon(edge.from, edge.to, a)) : obstacle.polygons.some((b) => polygonsOverlap(a, b)));
|
|
322416
|
+
}
|
|
322417
|
+
findClearPosition(text) {
|
|
322418
|
+
const obstacles = [
|
|
322419
|
+
...this.obstacles,
|
|
322420
|
+
...this.texts.filter((t) => t !== text)
|
|
322421
|
+
];
|
|
322422
|
+
const step = Math.max(0.1, text.text.font_size / 2);
|
|
322423
|
+
for (let distance = step;distance <= Math.max(4, text.text.font_size * 8); distance += step) {
|
|
322424
|
+
for (const [dx, dy] of [
|
|
322425
|
+
[0, distance],
|
|
322426
|
+
[0, -distance],
|
|
322427
|
+
[-distance, 0],
|
|
322428
|
+
[distance, 0]
|
|
322429
|
+
]) {
|
|
322430
|
+
const newSchX = Math.round((text.text.position.x + dx) * 1000) / 1000;
|
|
322431
|
+
const newSchY = Math.round((text.text.position.y + dy) * 1000) / 1000;
|
|
322432
|
+
const moved = {
|
|
322433
|
+
...text,
|
|
322434
|
+
polygons: getSchematicTextPolygons({
|
|
322435
|
+
...text.text,
|
|
322436
|
+
position: { x: newSchX, y: newSchY }
|
|
322437
|
+
})
|
|
322438
|
+
};
|
|
322439
|
+
if (obstacles.every((obstacle) => !this.collides(moved, obstacle)))
|
|
322440
|
+
return { newSchX, newSchY };
|
|
322441
|
+
}
|
|
322442
|
+
}
|
|
322443
|
+
return;
|
|
322444
|
+
}
|
|
322445
|
+
static issueToString(issue) {
|
|
322446
|
+
const attrs = [];
|
|
322447
|
+
addAttr(attrs, "schematicTextId", issue.schematicTextId);
|
|
322448
|
+
addAttr(attrs, "text", issue.text);
|
|
322449
|
+
addAttr(attrs, "collidingObjectType", issue.collidingObject.type);
|
|
322450
|
+
addAttr(attrs, "collidingObjectId", issue.collidingObject.id);
|
|
322451
|
+
addAttr(attrs, "newSchX", issue.suggestedMove?.newSchX);
|
|
322452
|
+
addAttr(attrs, "newSchY", issue.suggestedMove?.newSchY);
|
|
322453
|
+
addAttr(attrs, "message", issue.message);
|
|
322454
|
+
return `<SchematicTextCollision ${attrs.join(" ")} />`;
|
|
322455
|
+
}
|
|
322456
|
+
}
|
|
322457
|
+
|
|
322458
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/ResetNetworkGroupingSolver/ResetNetworkGroupingSolver.ts
|
|
322459
|
+
import { BaseSolver as BaseSolver22 } from "@tscircuit/solver-utils";
|
|
322460
|
+
class ResetNetworkGroupingSolver extends BaseSolver22 {
|
|
322461
|
+
params;
|
|
322462
|
+
static MIN_DISTANCE = 6;
|
|
322463
|
+
networks;
|
|
322464
|
+
index = 0;
|
|
322465
|
+
constructor(params2) {
|
|
322466
|
+
super();
|
|
322467
|
+
this.params = params2;
|
|
322468
|
+
this.networks = this.findNetworks(params2.ctx);
|
|
322469
|
+
this.solved = this.networks.length === 0;
|
|
322470
|
+
}
|
|
322471
|
+
_step() {
|
|
322472
|
+
const network = this.networks[this.index];
|
|
322473
|
+
const rcMembers = network.members.slice(0, 2);
|
|
322474
|
+
const threshold = Math.max(ResetNetworkGroupingSolver.MIN_DISTANCE, ...rcMembers.map((p) => 3 * Math.max(p.width, p.height)));
|
|
322475
|
+
const distances = rcMembers.map((p) => Math.hypot(Math.max(0, Math.abs(p.schX - network.pinPosition.x) - p.width / 2), Math.max(0, Math.abs(p.schY - network.pinPosition.y) - p.height / 2)));
|
|
322476
|
+
if (distances.some((distance) => distance > threshold)) {
|
|
322477
|
+
const hostName = network.host.sourceComponentName ?? network.host.schematicComponentId;
|
|
322478
|
+
const resetPin = resetPinName(network.pin);
|
|
322479
|
+
const memberNames = rcMembers.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(", ");
|
|
322480
|
+
this.params.issues.push({
|
|
322481
|
+
lineItemType: "ResetNetworkNotGrouped",
|
|
322482
|
+
hostSchematicBox: network.host,
|
|
322483
|
+
resetSourcePortId: network.pin.source_port_id,
|
|
322484
|
+
resetPinName: resetPin,
|
|
322485
|
+
supportNetworkComponents: network.members,
|
|
322486
|
+
maxDistanceFromResetPin: Math.round(Math.max(...distances) * 100) / 100,
|
|
322487
|
+
maxRecommendedDistance: threshold,
|
|
322488
|
+
message: `Group ${memberNames} near ${hostName}.${resetPin} so the reset pull-up and capacitor can be read together. Preserve all net connections; associated test points may remain in a debug area.`
|
|
322489
|
+
});
|
|
322490
|
+
}
|
|
322491
|
+
this.index++;
|
|
322492
|
+
this.solved = this.index >= this.networks.length;
|
|
322493
|
+
}
|
|
322494
|
+
findNetworks(ctx) {
|
|
322495
|
+
const root = getSourceConnectivity(ctx.circuitJson);
|
|
322496
|
+
const sources = ctx.circuitJson.filter((e) => e.type === "source_component");
|
|
322497
|
+
const sourceById = new Map(sources.map((e) => [e.source_component_id, e]));
|
|
322498
|
+
const ports = ctx.circuitJson.filter((e) => e.type === "source_port");
|
|
322499
|
+
const portsByComponent = new Map;
|
|
322500
|
+
const portsByNet = new Map;
|
|
322501
|
+
const power = new Set;
|
|
322502
|
+
const ground = new Set;
|
|
322503
|
+
for (const port of ports) {
|
|
322504
|
+
if (!port.source_component_id)
|
|
322505
|
+
continue;
|
|
322506
|
+
const componentPorts = portsByComponent.get(port.source_component_id) ?? [];
|
|
322507
|
+
componentPorts.push(port);
|
|
322508
|
+
portsByComponent.set(port.source_component_id, componentPorts);
|
|
322509
|
+
const net = root(port.source_port_id);
|
|
322510
|
+
const netPorts = portsByNet.get(net) ?? [];
|
|
322511
|
+
netPorts.push(port);
|
|
322512
|
+
portsByNet.set(net, netPorts);
|
|
322513
|
+
if (port.provides_power || port.requires_power)
|
|
322514
|
+
power.add(net);
|
|
322515
|
+
if (port.provides_ground || port.requires_ground)
|
|
322516
|
+
ground.add(net);
|
|
322517
|
+
}
|
|
322518
|
+
for (const element of ctx.circuitJson) {
|
|
322519
|
+
if (element.type !== "source_net")
|
|
322520
|
+
continue;
|
|
322521
|
+
if (element.is_power || element.is_positive_voltage_source)
|
|
322522
|
+
power.add(root(element.source_net_id));
|
|
322523
|
+
if (element.is_ground)
|
|
322524
|
+
ground.add(root(element.source_net_id));
|
|
322525
|
+
}
|
|
322526
|
+
const placementBySource = new Map(ctx.componentPlacements.flatMap((p) => p.sourceComponentId ? [[p.sourceComponentId, p]] : []));
|
|
322527
|
+
const schematicPorts = ctx.circuitJson.filter((e) => e.type === "schematic_port");
|
|
322528
|
+
const schematicComponents = new Map(ctx.circuitJson.filter((e) => e.type === "schematic_component").map((e) => [e.schematic_component_id, e]));
|
|
322529
|
+
const networks = [];
|
|
322530
|
+
const seen = new Set;
|
|
322531
|
+
for (const pin of ports) {
|
|
322532
|
+
if (!pin.source_component_id || !resetPinName(pin) || pin.do_not_connect)
|
|
322533
|
+
continue;
|
|
322534
|
+
if (sourceById.get(pin.source_component_id)?.ftype !== "simple_chip")
|
|
322535
|
+
continue;
|
|
322536
|
+
const net = root(pin.source_port_id);
|
|
322537
|
+
if (seen.has(net) || power.has(net) || ground.has(net))
|
|
322538
|
+
continue;
|
|
322539
|
+
seen.add(net);
|
|
322540
|
+
const peers = portsByNet.get(net) ?? [];
|
|
322541
|
+
const chips = new Set(peers.filter((p) => p.source_component_id && sourceById.get(p.source_component_id)?.ftype === "simple_chip").map((p) => p.source_component_id));
|
|
322542
|
+
if (chips.size !== 1)
|
|
322543
|
+
continue;
|
|
322544
|
+
const host = placementBySource.get(pin.source_component_id);
|
|
322545
|
+
const schematicPin = schematicPorts.find((p) => p.source_port_id === pin.source_port_id && p.schematic_component_id === host?.schematicComponentId);
|
|
322546
|
+
if (!host || !schematicPin || schematicPin.schematic_sheet_id !== host.schematicSheetId)
|
|
322547
|
+
continue;
|
|
322548
|
+
const pullups = [];
|
|
322549
|
+
const capacitors = [];
|
|
322550
|
+
const testpoints = [];
|
|
322551
|
+
let unsupported = false;
|
|
322552
|
+
for (const id of new Set(peers.map((p) => p.source_component_id))) {
|
|
322553
|
+
if (!id || id === pin.source_component_id)
|
|
322554
|
+
continue;
|
|
322555
|
+
const type = sourceById.get(id)?.ftype;
|
|
322556
|
+
const componentPorts = portsByComponent.get(id) ?? [];
|
|
322557
|
+
const placement = placementBySource.get(id);
|
|
322558
|
+
if (type === "simple_connector" || type === "simple_pin_header")
|
|
322559
|
+
continue;
|
|
322560
|
+
if (!placement) {
|
|
322561
|
+
unsupported = true;
|
|
322562
|
+
break;
|
|
322563
|
+
}
|
|
322564
|
+
if (type === "simple_test_point" && componentPorts.length === 1) {
|
|
322565
|
+
testpoints.push(placement);
|
|
322566
|
+
continue;
|
|
322567
|
+
}
|
|
322568
|
+
if (componentPorts.length !== 2) {
|
|
322569
|
+
unsupported = true;
|
|
322570
|
+
break;
|
|
322571
|
+
}
|
|
322572
|
+
const other = componentPorts.find((p) => root(p.source_port_id) !== net);
|
|
322573
|
+
if (!other) {
|
|
322574
|
+
unsupported = true;
|
|
322575
|
+
break;
|
|
322576
|
+
}
|
|
322577
|
+
const otherNet = root(other.source_port_id);
|
|
322578
|
+
if (type === "simple_resistor" && power.has(otherNet) && !ground.has(otherNet))
|
|
322579
|
+
pullups.push(placement);
|
|
322580
|
+
else if (type === "simple_capacitor" && ground.has(otherNet) && !power.has(otherNet))
|
|
322581
|
+
capacitors.push(placement);
|
|
322582
|
+
else {
|
|
322583
|
+
unsupported = true;
|
|
322584
|
+
break;
|
|
322585
|
+
}
|
|
322586
|
+
}
|
|
322587
|
+
if (unsupported || pullups.length !== 1 || capacitors.length !== 1)
|
|
322588
|
+
continue;
|
|
322589
|
+
const members = [...pullups, ...capacitors, ...testpoints];
|
|
322590
|
+
const hostGroup = host.schematicComponentId ? schematicComponents.get(host.schematicComponentId)?.schematic_group_id : undefined;
|
|
322591
|
+
if (members.some((member) => {
|
|
322592
|
+
const group = member.schematicComponentId ? schematicComponents.get(member.schematicComponentId)?.schematic_group_id : undefined;
|
|
322593
|
+
return member.schematicSheetId !== host.schematicSheetId || member.subcircuitId !== host.subcircuitId || group !== hostGroup;
|
|
322594
|
+
}))
|
|
322595
|
+
continue;
|
|
322596
|
+
networks.push({ host, pin, pinPosition: schematicPin.center, members });
|
|
322597
|
+
}
|
|
322598
|
+
return networks;
|
|
322599
|
+
}
|
|
322600
|
+
static issueToString(issue) {
|
|
322601
|
+
const attrs = [];
|
|
322602
|
+
addAttr(attrs, "hostComponentName", issue.hostSchematicBox.sourceComponentName);
|
|
322603
|
+
addAttr(attrs, "resetPin", issue.resetPinName);
|
|
322604
|
+
addAttr(attrs, "supportNetworkComponents", issue.supportNetworkComponents.map((p) => p.sourceComponentName ?? p.schematicComponentId).join(","));
|
|
322605
|
+
addAttr(attrs, "maxDistanceFromResetPin", issue.maxDistanceFromResetPin);
|
|
322606
|
+
addAttr(attrs, "maxRecommendedDistance", issue.maxRecommendedDistance);
|
|
322607
|
+
addAttr(attrs, "message", issue.message);
|
|
322608
|
+
return `<ResetNetworkNotGrouped ${attrs.join(" ")} />`;
|
|
322609
|
+
}
|
|
322610
|
+
}
|
|
322611
|
+
var resetPinName = (port) => [port.name, ...port.port_hints ?? []].find((name) => /^N?(RESET|RST)(N|B)?$/.test(name.toUpperCase().replace(/[_\-!~#/]/g, "")));
|
|
322612
|
+
|
|
321211
322613
|
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/solvers/SchematicPlacementPipeline/SchematicPlacementPipeline.ts
|
|
321212
322614
|
class SchematicPlacementPipeline extends BasePipelineSolver2 {
|
|
321213
322615
|
ctx;
|
|
321214
322616
|
issues = [];
|
|
321215
322617
|
pipelineDef = [
|
|
322618
|
+
definePipelineStep3("SchematicTextClearanceSolver", SchematicTextClearanceSolver, (p) => [
|
|
322619
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322620
|
+
]),
|
|
322621
|
+
definePipelineStep3("ResetNetworkGroupingSolver", ResetNetworkGroupingSolver, (p) => [
|
|
322622
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322623
|
+
]),
|
|
321216
322624
|
definePipelineStep3("SchematicBoxOverlapSolver", SchematicBoxOverlapSolver, (p) => [
|
|
321217
322625
|
{ ctx: p.ctx, issues: p.issues }
|
|
321218
322626
|
]),
|
|
@@ -321240,16 +322648,35 @@ class SchematicPlacementPipeline extends BasePipelineSolver2 {
|
|
|
321240
322648
|
definePipelineStep3("TraceSimplificationSolver", TraceSimplificationSolver, (p) => [
|
|
321241
322649
|
{ ctx: p.ctx, issues: p.issues }
|
|
321242
322650
|
]),
|
|
322651
|
+
definePipelineStep3("CrystalLoadCapacitorPlacementSolver", CrystalLoadCapacitorPlacementSolver, (p) => [
|
|
322652
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322653
|
+
]),
|
|
322654
|
+
definePipelineStep3("TwoPinComponentOrientationSolver", TwoPinComponentOrientationSolver, (p) => [
|
|
322655
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322656
|
+
]),
|
|
322657
|
+
definePipelineStep3("FeedbackNetworkPlacementSolver", FeedbackNetworkPlacementSolver, (p) => [
|
|
322658
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322659
|
+
]),
|
|
322660
|
+
definePipelineStep3("TwoPinComponentRailOrientationSolver", TwoPinComponentRailOrientationSolver, (p) => [
|
|
322661
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322662
|
+
]),
|
|
322663
|
+
definePipelineStep3("PullResistorPlacementSolver", PullResistorPlacementSolver, (p) => [
|
|
322664
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
322665
|
+
]),
|
|
321243
322666
|
definePipelineStep3("ComponentNetLabelCollisionSolver", ComponentNetLabelCollisionSolver, (p) => [
|
|
321244
322667
|
{ ctx: p.ctx, issues: p.issues }
|
|
322668
|
+
]),
|
|
322669
|
+
definePipelineStep3("DecouplingCapacitorGroupingSolver", DecouplingCapacitorGroupingSolver, (p) => [
|
|
322670
|
+
{ ctx: p.ctx, issues: p.issues }
|
|
321245
322671
|
])
|
|
321246
322672
|
];
|
|
321247
322673
|
_setup() {
|
|
321248
322674
|
this.ctx = buildSolverContext(this.inputProblem);
|
|
321249
322675
|
}
|
|
321250
322676
|
getOutput() {
|
|
322677
|
+
const railOrientationComponentIds = new Set(this.issues.flatMap((issue) => issue.lineItemType === "TwoPinComponentShouldBeVertical" && issue.schematicBox.schematicComponentId ? [issue.schematicBox.schematicComponentId] : []));
|
|
321251
322678
|
return {
|
|
321252
|
-
issues: this.issues,
|
|
322679
|
+
issues: this.issues.filter((issue) => issue.lineItemType !== "CapacitorSymbolHorizontal" || !railOrientationComponentIds.has(issue.schematicBox.schematicComponentId ?? "")),
|
|
321253
322680
|
componentPlacements: this.ctx.componentPlacements
|
|
321254
322681
|
};
|
|
321255
322682
|
}
|
|
@@ -321292,6 +322719,27 @@ var getRelevantPlacementsForIssues = ({
|
|
|
321292
322719
|
};
|
|
321293
322720
|
for (const issue of issues) {
|
|
321294
322721
|
switch (issue.lineItemType) {
|
|
322722
|
+
case "DecouplingCapacitorsNotCloseTogether":
|
|
322723
|
+
for (const placement of issue.capacitorSchematicBoxes)
|
|
322724
|
+
addPlacement(placement);
|
|
322725
|
+
break;
|
|
322726
|
+
case "ResetNetworkNotGrouped":
|
|
322727
|
+
addPlacement(issue.hostSchematicBox);
|
|
322728
|
+
for (const placement of issue.supportNetworkComponents)
|
|
322729
|
+
addPlacement(placement);
|
|
322730
|
+
break;
|
|
322731
|
+
case "SchematicTextCollision":
|
|
322732
|
+
if (issue.collidingObject.schematicComponentId)
|
|
322733
|
+
addPlacement(placementByComponentId.get(issue.collidingObject.schematicComponentId));
|
|
322734
|
+
if (issue.collidingObject.type === "trace") {
|
|
322735
|
+
for (const placement of getTraceEndpointPlacements({
|
|
322736
|
+
schematicTraceId: issue.collidingObject.id,
|
|
322737
|
+
circuitJson,
|
|
322738
|
+
placementByComponentId
|
|
322739
|
+
}))
|
|
322740
|
+
addPlacement(placement);
|
|
322741
|
+
}
|
|
322742
|
+
break;
|
|
321295
322743
|
case "ComponentOverlap":
|
|
321296
322744
|
addPlacement(issue.firstComponent);
|
|
321297
322745
|
addPlacement(issue.secondComponent);
|
|
@@ -321328,6 +322776,27 @@ var getRelevantPlacementsForIssues = ({
|
|
|
321328
322776
|
relevantPlacements.add(placement);
|
|
321329
322777
|
}
|
|
321330
322778
|
break;
|
|
322779
|
+
case "CrystalNotCenteredOverLoadCapacitors":
|
|
322780
|
+
addPlacement(issue.crystalSchematicBox);
|
|
322781
|
+
addPlacement(issue.firstLoadCapacitorSchematicBox);
|
|
322782
|
+
addPlacement(issue.secondLoadCapacitorSchematicBox);
|
|
322783
|
+
break;
|
|
322784
|
+
case "TwoPinComponentCouldBeFlipped":
|
|
322785
|
+
addPlacement(issue.targetComponent);
|
|
322786
|
+
addPlacement(issue.connectedComponent);
|
|
322787
|
+
break;
|
|
322788
|
+
case "FeedbackNetworkNotCompact":
|
|
322789
|
+
addPlacement(issue.amplifierSchematicBox);
|
|
322790
|
+
for (const component of issue.feedbackComponents)
|
|
322791
|
+
addPlacement(component);
|
|
322792
|
+
break;
|
|
322793
|
+
case "TwoPinComponentShouldBeVertical":
|
|
322794
|
+
addPlacement(issue.schematicBox);
|
|
322795
|
+
break;
|
|
322796
|
+
case "PullResistorOnWrongSide":
|
|
322797
|
+
addPlacement(issue.resistorSchematicBox);
|
|
322798
|
+
addPlacement(issue.hostSchematicBox);
|
|
322799
|
+
break;
|
|
321331
322800
|
case "ComponentNetLabelCollision":
|
|
321332
322801
|
addPlacement(issue.firstComponent);
|
|
321333
322802
|
addPlacement(issue.secondComponent);
|
|
@@ -321357,7 +322826,7 @@ var getIssueSchematicSheetContext = (issue) => {
|
|
|
321357
322826
|
return { schematicSheetId, schematicSheetName };
|
|
321358
322827
|
}
|
|
321359
322828
|
}
|
|
321360
|
-
for (const value of Object.values(issue)) {
|
|
322829
|
+
for (const value of Object.values(issue).flat()) {
|
|
321361
322830
|
if (isSchematicBoxPlacement(value)) {
|
|
321362
322831
|
return {
|
|
321363
322832
|
schematicSheetId: value.schematicSheetId,
|
|
@@ -321406,6 +322875,38 @@ class SchematicPlacementAnalysis {
|
|
|
321406
322875
|
getLineItems() {
|
|
321407
322876
|
return this.lineItems;
|
|
321408
322877
|
}
|
|
322878
|
+
getIssues(filter = {}) {
|
|
322879
|
+
return this.lineItems.flatMap((item) => item.lineItemType === "SchematicPlacementIssues" ? item.issues : []).filter((issue) => (filter.issueTypes === undefined || filter.issueTypes.includes(issue.lineItemType)) && (filter.schematicSheetId === undefined || (getIssueSchematicSheetContext(issue).schematicSheetId ?? "") === filter.schematicSheetId));
|
|
322880
|
+
}
|
|
322881
|
+
getIssueCounts(filter = {}) {
|
|
322882
|
+
const counts = {
|
|
322883
|
+
ComponentOverlap: 0,
|
|
322884
|
+
SchematicBoxHasALotOfSurroundingWhitespace: 0,
|
|
322885
|
+
CapacitorSymbolHorizontal: 0,
|
|
322886
|
+
VerboseSchematicNetLabel: 0,
|
|
322887
|
+
PinHeaderSchematicBoxTooWide: 0,
|
|
322888
|
+
GenericSchematicBoxTooWide: 0,
|
|
322889
|
+
SchematicBoxInnerLabelCollision: 0,
|
|
322890
|
+
SchematicPinPaddingToEdgeTooLarge: 0,
|
|
322891
|
+
DiodeResistorNotAligned: 0,
|
|
322892
|
+
ComponentPinsWouldAlignWithVerticalShift: 0,
|
|
322893
|
+
TraceCanBeSimplifiedByMovingComponent: 0,
|
|
322894
|
+
CrystalNotCenteredOverLoadCapacitors: 0,
|
|
322895
|
+
ComponentNetLabelCollision: 0,
|
|
322896
|
+
ComponentBoxNetLabelCollision: 0,
|
|
322897
|
+
NetLabelCollision: 0,
|
|
322898
|
+
FeedbackNetworkNotCompact: 0,
|
|
322899
|
+
PullResistorOnWrongSide: 0,
|
|
322900
|
+
SchematicTextCollision: 0,
|
|
322901
|
+
ResetNetworkNotGrouped: 0,
|
|
322902
|
+
TwoPinComponentCouldBeFlipped: 0,
|
|
322903
|
+
TwoPinComponentShouldBeVertical: 0,
|
|
322904
|
+
DecouplingCapacitorsNotCloseTogether: 0
|
|
322905
|
+
};
|
|
322906
|
+
for (const issue of this.getIssues(filter))
|
|
322907
|
+
counts[issue.lineItemType]++;
|
|
322908
|
+
return counts;
|
|
322909
|
+
}
|
|
321409
322910
|
getString() {
|
|
321410
322911
|
return this.toString();
|
|
321411
322912
|
}
|
|
@@ -321425,6 +322926,8 @@ class SchematicPlacementAnalysis {
|
|
|
321425
322926
|
return SchematicBoxOverlapSolver.issueToString(issue);
|
|
321426
322927
|
case "CapacitorSymbolHorizontal":
|
|
321427
322928
|
return CapacitorOrientationSolver.issueToString(issue);
|
|
322929
|
+
case "DecouplingCapacitorsNotCloseTogether":
|
|
322930
|
+
return DecouplingCapacitorGroupingSolver.issueToString(issue);
|
|
321428
322931
|
case "VerboseSchematicNetLabel":
|
|
321429
322932
|
return VerboseNetLabelSolver.issueToString(issue);
|
|
321430
322933
|
case "PinHeaderSchematicBoxTooWide":
|
|
@@ -321440,8 +322943,22 @@ class SchematicPlacementAnalysis {
|
|
|
321440
322943
|
return ComponentPinAlignmentSolver.issueToString(issue);
|
|
321441
322944
|
case "TraceCanBeSimplifiedByMovingComponent":
|
|
321442
322945
|
return TraceSimplificationSolver.issueToString(issue);
|
|
322946
|
+
case "CrystalNotCenteredOverLoadCapacitors":
|
|
322947
|
+
return CrystalLoadCapacitorPlacementSolver.issueToString(issue);
|
|
322948
|
+
case "TwoPinComponentCouldBeFlipped":
|
|
322949
|
+
return TwoPinComponentOrientationSolver.issueToString(issue);
|
|
322950
|
+
case "FeedbackNetworkNotCompact":
|
|
322951
|
+
return FeedbackNetworkPlacementSolver.issueToString(issue);
|
|
322952
|
+
case "TwoPinComponentShouldBeVertical":
|
|
322953
|
+
return TwoPinComponentRailOrientationSolver.issueToString(issue);
|
|
322954
|
+
case "PullResistorOnWrongSide":
|
|
322955
|
+
return PullResistorPlacementSolver.issueToString(issue);
|
|
321443
322956
|
case "NetLabelCollision":
|
|
321444
322957
|
return ComponentNetLabelCollisionSolver.netLabelCollisionToString(issue);
|
|
322958
|
+
case "SchematicTextCollision":
|
|
322959
|
+
return SchematicTextClearanceSolver.issueToString(issue);
|
|
322960
|
+
case "ResetNetworkNotGrouped":
|
|
322961
|
+
return ResetNetworkGroupingSolver.issueToString(issue);
|
|
321445
322962
|
default:
|
|
321446
322963
|
return "";
|
|
321447
322964
|
}
|
|
@@ -321515,6 +323032,8 @@ var analyzeSchematicPlacement = (circuitJson) => {
|
|
|
321515
323032
|
const schematicSheetIds = new Set(circuitJson.flatMap((element) => ("schematic_sheet_id" in element) && typeof element.schematic_sheet_id === "string" ? [element.schematic_sheet_id] : []));
|
|
321516
323033
|
return new SchematicPlacementAnalysis(lineItems, schematicSheetIds.size > 1);
|
|
321517
323034
|
};
|
|
323035
|
+
// node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/svg/create-issue-overlay-svg.ts
|
|
323036
|
+
import { convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg4 } from "circuit-to-svg";
|
|
321518
323037
|
// cli/check/schematic-placement/register.ts
|
|
321519
323038
|
var checkSchematicPlacement = async (file) => {
|
|
321520
323039
|
const resolvedInputFilePath = await resolveCheckInputFilePath(file);
|
|
@@ -338902,7 +340421,7 @@ var import_jszip5 = __toESM3(require_lib4(), 1);
|
|
|
338902
340421
|
|
|
338903
340422
|
// lib/shared/convert-circuit-json-to-schematic-pdf.ts
|
|
338904
340423
|
var import_pdf_lib = __toESM3(require_cjs(), 1);
|
|
338905
|
-
import { convertCircuitJsonToSchematicSvg as
|
|
340424
|
+
import { convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg5 } from "circuit-to-svg";
|
|
338906
340425
|
var A4_LANDSCAPE_WIDTH = 841.89;
|
|
338907
340426
|
var A4_LANDSCAPE_HEIGHT = 595.28;
|
|
338908
340427
|
var RENDER_SCALE = 2;
|
|
@@ -338912,7 +340431,7 @@ var convertCircuitJsonToSchematicPdf = async (circuitJson) => {
|
|
|
338912
340431
|
const schematicSheets = getSchematicSheets(circuitJson);
|
|
338913
340432
|
const pages = schematicSheets.length > 0 ? schematicSheets : [undefined];
|
|
338914
340433
|
for (const schematicSheet of pages) {
|
|
338915
|
-
const schematicSvg =
|
|
340434
|
+
const schematicSvg = convertCircuitJsonToSchematicSvg5(circuitJson, {
|
|
338916
340435
|
width: Math.round(A4_LANDSCAPE_WIDTH * RENDER_SCALE),
|
|
338917
340436
|
height: Math.round(A4_LANDSCAPE_HEIGHT * RENDER_SCALE),
|
|
338918
340437
|
schematicSheetId: schematicSheet?.schematic_sheet_id
|
|
@@ -340778,7 +342297,7 @@ __export5(dist_exports, {
|
|
|
340778
342297
|
capacitance: () => capacitance4,
|
|
340779
342298
|
circuit_json_footprint_load_error: () => circuit_json_footprint_load_error2,
|
|
340780
342299
|
current: () => current2,
|
|
340781
|
-
distance: () =>
|
|
342300
|
+
distance: () => distance50,
|
|
340782
342301
|
duration_ms: () => duration_ms,
|
|
340783
342302
|
experiment_type: () => experiment_type,
|
|
340784
342303
|
external_footprint_load_error: () => external_footprint_load_error2,
|
|
@@ -345245,7 +346764,7 @@ var inductance2 = external_exports2.string().or(external_exports2.number()).tran
|
|
|
345245
346764
|
var voltage5 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "V").value);
|
|
345246
346765
|
var length67 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
345247
346766
|
var frequency7 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "Hz").value);
|
|
345248
|
-
var
|
|
346767
|
+
var distance50 = length67;
|
|
345249
346768
|
var current2 = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v, "A").value);
|
|
345250
346769
|
var duration_ms = external_exports2.string().or(external_exports2.number()).transform((v) => parseAndConvertSiUnit(v).value);
|
|
345251
346770
|
var time = duration_ms;
|
|
@@ -345286,16 +346805,16 @@ expectStringUnionsMatch('T2 has extra: "c"');
|
|
|
345286
346805
|
expectStringUnionsMatch('T1 has extra: "d", T2 has extra: "c"');
|
|
345287
346806
|
expectStringUnionsMatch(true);
|
|
345288
346807
|
var point9 = external_exports2.object({
|
|
345289
|
-
x:
|
|
345290
|
-
y:
|
|
346808
|
+
x: distance50,
|
|
346809
|
+
y: distance50
|
|
345291
346810
|
});
|
|
345292
346811
|
var position = point9;
|
|
345293
346812
|
expectTypesMatch2(true);
|
|
345294
346813
|
expectTypesMatch2(true);
|
|
345295
346814
|
var point33 = external_exports2.object({
|
|
345296
|
-
x:
|
|
345297
|
-
y:
|
|
345298
|
-
z:
|
|
346815
|
+
x: distance50,
|
|
346816
|
+
y: distance50,
|
|
346817
|
+
z: distance50
|
|
345299
346818
|
});
|
|
345300
346819
|
var position3 = point33;
|
|
345301
346820
|
expectTypesMatch2(true);
|
|
@@ -345360,7 +346879,7 @@ var kicadAt2 = point9.extend({
|
|
|
345360
346879
|
expectTypesMatch2(true);
|
|
345361
346880
|
var kicadFont2 = external_exports2.object({
|
|
345362
346881
|
size: point9.optional(),
|
|
345363
|
-
thickness:
|
|
346882
|
+
thickness: distance50.optional()
|
|
345364
346883
|
});
|
|
345365
346884
|
expectTypesMatch2(true);
|
|
345366
346885
|
var kicadEffects2 = external_exports2.object({
|
|
@@ -345396,7 +346915,7 @@ var kicadFootprintPad2 = external_exports2.object({
|
|
|
345396
346915
|
shape: external_exports2.string().optional(),
|
|
345397
346916
|
at: kicadAt2.optional(),
|
|
345398
346917
|
size: point9.optional(),
|
|
345399
|
-
drill:
|
|
346918
|
+
drill: distance50.optional(),
|
|
345400
346919
|
layers: external_exports2.array(external_exports2.string()).optional(),
|
|
345401
346920
|
removeUnusedLayers: external_exports2.boolean().optional(),
|
|
345402
346921
|
uuid: external_exports2.string().optional()
|
|
@@ -345427,7 +346946,7 @@ var kicadSymbolPinNumbers2 = external_exports2.object({
|
|
|
345427
346946
|
});
|
|
345428
346947
|
expectTypesMatch2(true);
|
|
345429
346948
|
var kicadSymbolPinNames2 = external_exports2.object({
|
|
345430
|
-
offset:
|
|
346949
|
+
offset: distance50.optional(),
|
|
345431
346950
|
hide: external_exports2.boolean().optional()
|
|
345432
346951
|
});
|
|
345433
346952
|
expectTypesMatch2(true);
|
|
@@ -345501,7 +347020,7 @@ var source_simple_capacitor = source_component_base.extend({
|
|
|
345501
347020
|
capacitance: capacitance4,
|
|
345502
347021
|
max_voltage_rating: voltage5.optional(),
|
|
345503
347022
|
display_capacitance: external_exports2.string().optional(),
|
|
345504
|
-
max_decoupling_trace_length:
|
|
347023
|
+
max_decoupling_trace_length: distance50.optional()
|
|
345505
347024
|
});
|
|
345506
347025
|
expectTypesMatch2(true);
|
|
345507
347026
|
var source_simple_resistor = source_component_base.extend({
|
|
@@ -346059,11 +347578,11 @@ var schematic_box = external_exports2.object({
|
|
|
346059
347578
|
schematic_sheet_id: external_exports2.string().optional(),
|
|
346060
347579
|
schematic_component_id: external_exports2.string().optional(),
|
|
346061
347580
|
schematic_symbol_id: external_exports2.string().optional(),
|
|
346062
|
-
width:
|
|
346063
|
-
height:
|
|
347581
|
+
width: distance50,
|
|
347582
|
+
height: distance50,
|
|
346064
347583
|
is_dashed: external_exports2.boolean().default(false),
|
|
346065
|
-
x:
|
|
346066
|
-
y:
|
|
347584
|
+
x: distance50,
|
|
347585
|
+
y: distance50,
|
|
346067
347586
|
subcircuit_id: external_exports2.string().optional()
|
|
346068
347587
|
}).describe("Draws a box on the schematic");
|
|
346069
347588
|
expectTypesMatch2(true);
|
|
@@ -346076,10 +347595,10 @@ var schematic_path = external_exports2.object({
|
|
|
346076
347595
|
fill_color: external_exports2.string().optional(),
|
|
346077
347596
|
is_filled: external_exports2.boolean().optional(),
|
|
346078
347597
|
is_dashed: external_exports2.boolean().default(false),
|
|
346079
|
-
stroke_width:
|
|
347598
|
+
stroke_width: distance50.nullable().optional(),
|
|
346080
347599
|
stroke_color: external_exports2.string().optional(),
|
|
346081
|
-
dash_length:
|
|
346082
|
-
dash_gap:
|
|
347600
|
+
dash_length: distance50.optional(),
|
|
347601
|
+
dash_gap: distance50.optional(),
|
|
346083
347602
|
points: external_exports2.array(point9),
|
|
346084
347603
|
subcircuit_id: external_exports2.string().optional()
|
|
346085
347604
|
});
|
|
@@ -346158,15 +347677,15 @@ var schematic_line = external_exports2.object({
|
|
|
346158
347677
|
schematic_sheet_id: external_exports2.string().optional(),
|
|
346159
347678
|
schematic_component_id: external_exports2.string().optional(),
|
|
346160
347679
|
schematic_symbol_id: external_exports2.string().optional(),
|
|
346161
|
-
x1:
|
|
346162
|
-
y1:
|
|
346163
|
-
x2:
|
|
346164
|
-
y2:
|
|
346165
|
-
stroke_width:
|
|
347680
|
+
x1: distance50,
|
|
347681
|
+
y1: distance50,
|
|
347682
|
+
x2: distance50,
|
|
347683
|
+
y2: distance50,
|
|
347684
|
+
stroke_width: distance50.nullable().optional(),
|
|
346166
347685
|
color: external_exports2.string().default("#000000"),
|
|
346167
347686
|
is_dashed: external_exports2.boolean().default(false),
|
|
346168
|
-
dash_length:
|
|
346169
|
-
dash_gap:
|
|
347687
|
+
dash_length: distance50.optional(),
|
|
347688
|
+
dash_gap: distance50.optional(),
|
|
346170
347689
|
subcircuit_id: external_exports2.string().optional()
|
|
346171
347690
|
}).describe("Draws a styled line on the schematic");
|
|
346172
347691
|
expectTypesMatch2(true);
|
|
@@ -346177,10 +347696,10 @@ var schematic_rect = external_exports2.object({
|
|
|
346177
347696
|
schematic_component_id: external_exports2.string().optional(),
|
|
346178
347697
|
schematic_symbol_id: external_exports2.string().optional(),
|
|
346179
347698
|
center: point9,
|
|
346180
|
-
width:
|
|
346181
|
-
height:
|
|
347699
|
+
width: distance50,
|
|
347700
|
+
height: distance50,
|
|
346182
347701
|
rotation: rotation11.default(0),
|
|
346183
|
-
stroke_width:
|
|
347702
|
+
stroke_width: distance50.nullable().optional(),
|
|
346184
347703
|
color: external_exports2.string().default("#000000"),
|
|
346185
347704
|
is_filled: external_exports2.boolean().default(false),
|
|
346186
347705
|
fill_color: external_exports2.string().optional(),
|
|
@@ -346195,8 +347714,8 @@ var schematic_circle = external_exports2.object({
|
|
|
346195
347714
|
schematic_component_id: external_exports2.string().optional(),
|
|
346196
347715
|
schematic_symbol_id: external_exports2.string().optional(),
|
|
346197
347716
|
center: point9,
|
|
346198
|
-
radius:
|
|
346199
|
-
stroke_width:
|
|
347717
|
+
radius: distance50,
|
|
347718
|
+
stroke_width: distance50.nullable().optional(),
|
|
346200
347719
|
color: external_exports2.string().default("#000000"),
|
|
346201
347720
|
is_filled: external_exports2.boolean().default(false),
|
|
346202
347721
|
fill_color: external_exports2.string().optional(),
|
|
@@ -346211,11 +347730,11 @@ var schematic_arc = external_exports2.object({
|
|
|
346211
347730
|
schematic_component_id: external_exports2.string().optional(),
|
|
346212
347731
|
schematic_symbol_id: external_exports2.string().optional(),
|
|
346213
347732
|
center: point9,
|
|
346214
|
-
radius:
|
|
347733
|
+
radius: distance50,
|
|
346215
347734
|
start_angle_degrees: rotation11,
|
|
346216
347735
|
end_angle_degrees: rotation11,
|
|
346217
347736
|
direction: external_exports2.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
|
|
346218
|
-
stroke_width:
|
|
347737
|
+
stroke_width: distance50.nullable().optional(),
|
|
346219
347738
|
color: external_exports2.string().default("#000000"),
|
|
346220
347739
|
is_dashed: external_exports2.boolean().default(false),
|
|
346221
347740
|
subcircuit_id: external_exports2.string().optional()
|
|
@@ -346265,8 +347784,8 @@ var schematic_text = external_exports2.object({
|
|
|
346265
347784
|
text: external_exports2.string(),
|
|
346266
347785
|
font_size: external_exports2.number().default(0.18),
|
|
346267
347786
|
position: external_exports2.object({
|
|
346268
|
-
x:
|
|
346269
|
-
y:
|
|
347787
|
+
x: distance50,
|
|
347788
|
+
y: distance50
|
|
346270
347789
|
}),
|
|
346271
347790
|
rotation: external_exports2.number().default(0),
|
|
346272
347791
|
anchor: external_exports2.union([fivePointAnchor2.describe("legacy"), ninePointAnchor2]).default("center"),
|
|
@@ -346436,10 +347955,10 @@ var schematic_table = external_exports2.object({
|
|
|
346436
347955
|
schematic_table_id: getZodPrefixedIdWithDefault("schematic_table"),
|
|
346437
347956
|
schematic_sheet_id: external_exports2.string().optional(),
|
|
346438
347957
|
anchor_position: point9,
|
|
346439
|
-
column_widths: external_exports2.array(
|
|
346440
|
-
row_heights: external_exports2.array(
|
|
346441
|
-
cell_padding:
|
|
346442
|
-
border_width:
|
|
347958
|
+
column_widths: external_exports2.array(distance50),
|
|
347959
|
+
row_heights: external_exports2.array(distance50),
|
|
347960
|
+
cell_padding: distance50.optional(),
|
|
347961
|
+
border_width: distance50.optional(),
|
|
346443
347962
|
subcircuit_id: external_exports2.string().optional(),
|
|
346444
347963
|
schematic_component_id: external_exports2.string().optional(),
|
|
346445
347964
|
anchor: ninePointAnchor2.optional()
|
|
@@ -346456,11 +347975,11 @@ var schematic_table_cell = external_exports2.object({
|
|
|
346456
347975
|
end_column_index: external_exports2.number(),
|
|
346457
347976
|
text: external_exports2.string().optional(),
|
|
346458
347977
|
center: point9,
|
|
346459
|
-
width:
|
|
346460
|
-
height:
|
|
347978
|
+
width: distance50,
|
|
347979
|
+
height: distance50,
|
|
346461
347980
|
horizontal_align: external_exports2.enum(["left", "center", "right"]).optional(),
|
|
346462
347981
|
vertical_align: external_exports2.enum(["top", "middle", "bottom"]).optional(),
|
|
346463
|
-
font_size:
|
|
347982
|
+
font_size: distance50.optional(),
|
|
346464
347983
|
subcircuit_id: external_exports2.string().optional()
|
|
346465
347984
|
}).describe("Defines a cell within a schematic_table");
|
|
346466
347985
|
expectTypesMatch2(true);
|
|
@@ -346474,8 +347993,8 @@ var schematic_sheet = external_exports2.object({
|
|
|
346474
347993
|
}).describe("Defines a schematic sheet or page that components can be placed on");
|
|
346475
347994
|
expectTypesMatch2(true);
|
|
346476
347995
|
var point_with_bulge = external_exports2.object({
|
|
346477
|
-
x:
|
|
346478
|
-
y:
|
|
347996
|
+
x: distance50,
|
|
347997
|
+
y: distance50,
|
|
346479
347998
|
bulge: external_exports2.number().optional()
|
|
346480
347999
|
});
|
|
346481
348000
|
expectTypesMatch2(true);
|
|
@@ -346566,8 +348085,8 @@ var getRotationBetweenPcbPin1Locations2 = (from, to) => {
|
|
|
346566
348085
|
return null;
|
|
346567
348086
|
};
|
|
346568
348087
|
var pcb_route_hint = external_exports2.object({
|
|
346569
|
-
x:
|
|
346570
|
-
y:
|
|
348088
|
+
x: distance50,
|
|
348089
|
+
y: distance50,
|
|
346571
348090
|
via: external_exports2.boolean().optional(),
|
|
346572
348091
|
via_to_layer: layer_ref2.optional()
|
|
346573
348092
|
});
|
|
@@ -346575,11 +348094,11 @@ var pcb_route_hints = external_exports2.array(pcb_route_hint);
|
|
|
346575
348094
|
expectTypesMatch2(true);
|
|
346576
348095
|
expectTypesMatch2(true);
|
|
346577
348096
|
var route_hint_point8 = external_exports2.object({
|
|
346578
|
-
x:
|
|
346579
|
-
y:
|
|
348097
|
+
x: distance50,
|
|
348098
|
+
y: distance50,
|
|
346580
348099
|
via: external_exports2.boolean().optional(),
|
|
346581
348100
|
to_layer: layer_ref2.optional(),
|
|
346582
|
-
trace_width:
|
|
348101
|
+
trace_width: distance50.optional()
|
|
346583
348102
|
});
|
|
346584
348103
|
expectTypesMatch2(true);
|
|
346585
348104
|
var manufacturing_drc_properties = external_exports2.object({
|
|
@@ -346664,8 +348183,8 @@ var pcb_hole_circle = external_exports2.object({
|
|
|
346664
348183
|
pcb_component_id: external_exports2.string().optional(),
|
|
346665
348184
|
hole_shape: external_exports2.literal("circle"),
|
|
346666
348185
|
hole_diameter: external_exports2.number(),
|
|
346667
|
-
x:
|
|
346668
|
-
y:
|
|
348186
|
+
x: distance50,
|
|
348187
|
+
y: distance50,
|
|
346669
348188
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346670
348189
|
soldermask_margin: external_exports2.number().optional()
|
|
346671
348190
|
});
|
|
@@ -346680,8 +348199,8 @@ var pcb_hole_rect = external_exports2.object({
|
|
|
346680
348199
|
hole_shape: external_exports2.literal("rect"),
|
|
346681
348200
|
hole_width: external_exports2.number(),
|
|
346682
348201
|
hole_height: external_exports2.number(),
|
|
346683
|
-
x:
|
|
346684
|
-
y:
|
|
348202
|
+
x: distance50,
|
|
348203
|
+
y: distance50,
|
|
346685
348204
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346686
348205
|
soldermask_margin: external_exports2.number().optional()
|
|
346687
348206
|
});
|
|
@@ -346695,8 +348214,8 @@ var pcb_hole_circle_or_square = external_exports2.object({
|
|
|
346695
348214
|
pcb_component_id: external_exports2.string().optional(),
|
|
346696
348215
|
hole_shape: external_exports2.enum(["circle", "square"]),
|
|
346697
348216
|
hole_diameter: external_exports2.number(),
|
|
346698
|
-
x:
|
|
346699
|
-
y:
|
|
348217
|
+
x: distance50,
|
|
348218
|
+
y: distance50,
|
|
346700
348219
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346701
348220
|
soldermask_margin: external_exports2.number().optional()
|
|
346702
348221
|
});
|
|
@@ -346711,8 +348230,8 @@ var pcb_hole_oval = external_exports2.object({
|
|
|
346711
348230
|
hole_shape: external_exports2.literal("oval"),
|
|
346712
348231
|
hole_width: external_exports2.number(),
|
|
346713
348232
|
hole_height: external_exports2.number(),
|
|
346714
|
-
x:
|
|
346715
|
-
y:
|
|
348233
|
+
x: distance50,
|
|
348234
|
+
y: distance50,
|
|
346716
348235
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346717
348236
|
soldermask_margin: external_exports2.number().optional()
|
|
346718
348237
|
});
|
|
@@ -346727,8 +348246,8 @@ var pcb_hole_pill = external_exports2.object({
|
|
|
346727
348246
|
hole_shape: external_exports2.literal("pill"),
|
|
346728
348247
|
hole_width: external_exports2.number(),
|
|
346729
348248
|
hole_height: external_exports2.number(),
|
|
346730
|
-
x:
|
|
346731
|
-
y:
|
|
348249
|
+
x: distance50,
|
|
348250
|
+
y: distance50,
|
|
346732
348251
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346733
348252
|
soldermask_margin: external_exports2.number().optional()
|
|
346734
348253
|
});
|
|
@@ -346743,8 +348262,8 @@ var pcb_hole_rotated_pill = external_exports2.object({
|
|
|
346743
348262
|
hole_shape: external_exports2.literal("rotated_pill"),
|
|
346744
348263
|
hole_width: external_exports2.number(),
|
|
346745
348264
|
hole_height: external_exports2.number(),
|
|
346746
|
-
x:
|
|
346747
|
-
y:
|
|
348265
|
+
x: distance50,
|
|
348266
|
+
y: distance50,
|
|
346748
348267
|
ccw_rotation: rotation11,
|
|
346749
348268
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346750
348269
|
soldermask_margin: external_exports2.number().optional()
|
|
@@ -346760,8 +348279,8 @@ var pcb_plated_hole_circle = external_exports2.object({
|
|
|
346760
348279
|
outer_diameter: external_exports2.number(),
|
|
346761
348280
|
hole_diameter: external_exports2.number(),
|
|
346762
348281
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346763
|
-
x:
|
|
346764
|
-
y:
|
|
348282
|
+
x: distance50,
|
|
348283
|
+
y: distance50,
|
|
346765
348284
|
layers: external_exports2.array(layer_ref2),
|
|
346766
348285
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
346767
348286
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -346779,8 +348298,8 @@ var pcb_plated_hole_oval = external_exports2.object({
|
|
|
346779
348298
|
hole_width: external_exports2.number(),
|
|
346780
348299
|
hole_height: external_exports2.number(),
|
|
346781
348300
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346782
|
-
x:
|
|
346783
|
-
y:
|
|
348301
|
+
x: distance50,
|
|
348302
|
+
y: distance50,
|
|
346784
348303
|
ccw_rotation: rotation11,
|
|
346785
348304
|
layers: external_exports2.array(layer_ref2),
|
|
346786
348305
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
@@ -346800,11 +348319,11 @@ var pcb_circular_hole_with_rect_pad = external_exports2.object({
|
|
|
346800
348319
|
rect_pad_width: external_exports2.number(),
|
|
346801
348320
|
rect_pad_height: external_exports2.number(),
|
|
346802
348321
|
rect_border_radius: external_exports2.number().optional(),
|
|
346803
|
-
hole_offset_x:
|
|
346804
|
-
hole_offset_y:
|
|
348322
|
+
hole_offset_x: distance50.default(0),
|
|
348323
|
+
hole_offset_y: distance50.default(0),
|
|
346805
348324
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346806
|
-
x:
|
|
346807
|
-
y:
|
|
348325
|
+
x: distance50,
|
|
348326
|
+
y: distance50,
|
|
346808
348327
|
layers: external_exports2.array(layer_ref2),
|
|
346809
348328
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
346810
348329
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -346825,11 +348344,11 @@ var pcb_pill_hole_with_rect_pad = external_exports2.object({
|
|
|
346825
348344
|
rect_pad_width: external_exports2.number(),
|
|
346826
348345
|
rect_pad_height: external_exports2.number(),
|
|
346827
348346
|
rect_border_radius: external_exports2.number().optional(),
|
|
346828
|
-
hole_offset_x:
|
|
346829
|
-
hole_offset_y:
|
|
348347
|
+
hole_offset_x: distance50.default(0),
|
|
348348
|
+
hole_offset_y: distance50.default(0),
|
|
346830
348349
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346831
|
-
x:
|
|
346832
|
-
y:
|
|
348350
|
+
x: distance50,
|
|
348351
|
+
y: distance50,
|
|
346833
348352
|
layers: external_exports2.array(layer_ref2),
|
|
346834
348353
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
346835
348354
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -346851,11 +348370,11 @@ var pcb_rotated_pill_hole_with_rect_pad = external_exports2.object({
|
|
|
346851
348370
|
rect_pad_height: external_exports2.number(),
|
|
346852
348371
|
rect_border_radius: external_exports2.number().optional(),
|
|
346853
348372
|
rect_ccw_rotation: rotation11,
|
|
346854
|
-
hole_offset_x:
|
|
346855
|
-
hole_offset_y:
|
|
348373
|
+
hole_offset_x: distance50.default(0),
|
|
348374
|
+
hole_offset_y: distance50.default(0),
|
|
346856
348375
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346857
|
-
x:
|
|
346858
|
-
y:
|
|
348376
|
+
x: distance50,
|
|
348377
|
+
y: distance50,
|
|
346859
348378
|
layers: external_exports2.array(layer_ref2),
|
|
346860
348379
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
346861
348380
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -346873,14 +348392,14 @@ var pcb_hole_with_polygon_pad = external_exports2.object({
|
|
|
346873
348392
|
hole_width: external_exports2.number().optional(),
|
|
346874
348393
|
hole_height: external_exports2.number().optional(),
|
|
346875
348394
|
pad_outline: external_exports2.array(external_exports2.object({
|
|
346876
|
-
x:
|
|
346877
|
-
y:
|
|
348395
|
+
x: distance50,
|
|
348396
|
+
y: distance50
|
|
346878
348397
|
})).min(3),
|
|
346879
|
-
hole_offset_x:
|
|
346880
|
-
hole_offset_y:
|
|
348398
|
+
hole_offset_x: distance50.default(0),
|
|
348399
|
+
hole_offset_y: distance50.default(0),
|
|
346881
348400
|
is_covered_with_solder_mask: external_exports2.boolean().optional(),
|
|
346882
|
-
x:
|
|
346883
|
-
y:
|
|
348401
|
+
x: distance50,
|
|
348402
|
+
y: distance50,
|
|
346884
348403
|
layers: external_exports2.array(layer_ref2),
|
|
346885
348404
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
346886
348405
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -346910,8 +348429,8 @@ var pcb_port = external_exports2.object({
|
|
|
346910
348429
|
subcircuit_id: external_exports2.string().optional(),
|
|
346911
348430
|
source_port_id: external_exports2.string(),
|
|
346912
348431
|
pcb_component_id: external_exports2.string().optional(),
|
|
346913
|
-
x:
|
|
346914
|
-
y:
|
|
348432
|
+
x: distance50,
|
|
348433
|
+
y: distance50,
|
|
346915
348434
|
layers: external_exports2.array(layer_ref2),
|
|
346916
348435
|
is_board_pinout: external_exports2.boolean().optional()
|
|
346917
348436
|
}).describe("Defines a port on the PCB");
|
|
@@ -346922,8 +348441,8 @@ var pcb_smtpad_circle = external_exports2.object({
|
|
|
346922
348441
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
346923
348442
|
pcb_group_id: external_exports2.string().optional(),
|
|
346924
348443
|
subcircuit_id: external_exports2.string().optional(),
|
|
346925
|
-
x:
|
|
346926
|
-
y:
|
|
348444
|
+
x: distance50,
|
|
348445
|
+
y: distance50,
|
|
346927
348446
|
radius: external_exports2.number(),
|
|
346928
348447
|
layer: layer_ref2,
|
|
346929
348448
|
port_hints: external_exports2.array(external_exports2.string()).optional(),
|
|
@@ -346939,8 +348458,8 @@ var pcb_smtpad_rect = external_exports2.object({
|
|
|
346939
348458
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
346940
348459
|
pcb_group_id: external_exports2.string().optional(),
|
|
346941
348460
|
subcircuit_id: external_exports2.string().optional(),
|
|
346942
|
-
x:
|
|
346943
|
-
y:
|
|
348461
|
+
x: distance50,
|
|
348462
|
+
y: distance50,
|
|
346944
348463
|
width: external_exports2.number(),
|
|
346945
348464
|
height: external_exports2.number(),
|
|
346946
348465
|
rect_border_radius: external_exports2.number().optional(),
|
|
@@ -346963,8 +348482,8 @@ var pcb_smtpad_rotated_rect = external_exports2.object({
|
|
|
346963
348482
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
346964
348483
|
pcb_group_id: external_exports2.string().optional(),
|
|
346965
348484
|
subcircuit_id: external_exports2.string().optional(),
|
|
346966
|
-
x:
|
|
346967
|
-
y:
|
|
348485
|
+
x: distance50,
|
|
348486
|
+
y: distance50,
|
|
346968
348487
|
width: external_exports2.number(),
|
|
346969
348488
|
height: external_exports2.number(),
|
|
346970
348489
|
rect_border_radius: external_exports2.number().optional(),
|
|
@@ -346988,8 +348507,8 @@ var pcb_smtpad_pill = external_exports2.object({
|
|
|
346988
348507
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
346989
348508
|
pcb_group_id: external_exports2.string().optional(),
|
|
346990
348509
|
subcircuit_id: external_exports2.string().optional(),
|
|
346991
|
-
x:
|
|
346992
|
-
y:
|
|
348510
|
+
x: distance50,
|
|
348511
|
+
y: distance50,
|
|
346993
348512
|
width: external_exports2.number(),
|
|
346994
348513
|
height: external_exports2.number(),
|
|
346995
348514
|
radius: external_exports2.number(),
|
|
@@ -347007,8 +348526,8 @@ var pcb_smtpad_rotated_pill = external_exports2.object({
|
|
|
347007
348526
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
347008
348527
|
pcb_group_id: external_exports2.string().optional(),
|
|
347009
348528
|
subcircuit_id: external_exports2.string().optional(),
|
|
347010
|
-
x:
|
|
347011
|
-
y:
|
|
348529
|
+
x: distance50,
|
|
348530
|
+
y: distance50,
|
|
347012
348531
|
width: external_exports2.number(),
|
|
347013
348532
|
height: external_exports2.number(),
|
|
347014
348533
|
radius: external_exports2.number(),
|
|
@@ -347056,8 +348575,8 @@ var pcb_solder_paste_circle = external_exports2.object({
|
|
|
347056
348575
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347057
348576
|
pcb_group_id: external_exports2.string().optional(),
|
|
347058
348577
|
subcircuit_id: external_exports2.string().optional(),
|
|
347059
|
-
x:
|
|
347060
|
-
y:
|
|
348578
|
+
x: distance50,
|
|
348579
|
+
y: distance50,
|
|
347061
348580
|
radius: external_exports2.number(),
|
|
347062
348581
|
layer: layer_ref2,
|
|
347063
348582
|
pcb_component_id: external_exports2.string().optional(),
|
|
@@ -347069,8 +348588,8 @@ var pcb_solder_paste_rect = external_exports2.object({
|
|
|
347069
348588
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347070
348589
|
pcb_group_id: external_exports2.string().optional(),
|
|
347071
348590
|
subcircuit_id: external_exports2.string().optional(),
|
|
347072
|
-
x:
|
|
347073
|
-
y:
|
|
348591
|
+
x: distance50,
|
|
348592
|
+
y: distance50,
|
|
347074
348593
|
width: external_exports2.number(),
|
|
347075
348594
|
height: external_exports2.number(),
|
|
347076
348595
|
layer: layer_ref2,
|
|
@@ -347083,8 +348602,8 @@ var pcb_solder_paste_pill = external_exports2.object({
|
|
|
347083
348602
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347084
348603
|
pcb_group_id: external_exports2.string().optional(),
|
|
347085
348604
|
subcircuit_id: external_exports2.string().optional(),
|
|
347086
|
-
x:
|
|
347087
|
-
y:
|
|
348605
|
+
x: distance50,
|
|
348606
|
+
y: distance50,
|
|
347088
348607
|
width: external_exports2.number(),
|
|
347089
348608
|
height: external_exports2.number(),
|
|
347090
348609
|
radius: external_exports2.number(),
|
|
@@ -347098,11 +348617,11 @@ var pcb_solder_paste_rotated_rect = external_exports2.object({
|
|
|
347098
348617
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347099
348618
|
pcb_group_id: external_exports2.string().optional(),
|
|
347100
348619
|
subcircuit_id: external_exports2.string().optional(),
|
|
347101
|
-
x:
|
|
347102
|
-
y:
|
|
348620
|
+
x: distance50,
|
|
348621
|
+
y: distance50,
|
|
347103
348622
|
width: external_exports2.number(),
|
|
347104
348623
|
height: external_exports2.number(),
|
|
347105
|
-
ccw_rotation:
|
|
348624
|
+
ccw_rotation: distance50,
|
|
347106
348625
|
layer: layer_ref2,
|
|
347107
348626
|
pcb_component_id: external_exports2.string().optional(),
|
|
347108
348627
|
pcb_smtpad_id: external_exports2.string().optional()
|
|
@@ -347113,8 +348632,8 @@ var pcb_solder_paste_rotated_pill = external_exports2.object({
|
|
|
347113
348632
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347114
348633
|
pcb_group_id: external_exports2.string().optional(),
|
|
347115
348634
|
subcircuit_id: external_exports2.string().optional(),
|
|
347116
|
-
x:
|
|
347117
|
-
y:
|
|
348635
|
+
x: distance50,
|
|
348636
|
+
y: distance50,
|
|
347118
348637
|
width: external_exports2.number(),
|
|
347119
348638
|
height: external_exports2.number(),
|
|
347120
348639
|
radius: external_exports2.number(),
|
|
@@ -347129,8 +348648,8 @@ var pcb_solder_paste_oval = external_exports2.object({
|
|
|
347129
348648
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
347130
348649
|
pcb_group_id: external_exports2.string().optional(),
|
|
347131
348650
|
subcircuit_id: external_exports2.string().optional(),
|
|
347132
|
-
x:
|
|
347133
|
-
y:
|
|
348651
|
+
x: distance50,
|
|
348652
|
+
y: distance50,
|
|
347134
348653
|
width: external_exports2.number(),
|
|
347135
348654
|
height: external_exports2.number(),
|
|
347136
348655
|
layer: layer_ref2,
|
|
@@ -347167,9 +348686,9 @@ var pcb_text = external_exports2.object({
|
|
|
347167
348686
|
expectTypesMatch2(true);
|
|
347168
348687
|
var pcb_trace_route_point_wire = external_exports2.object({
|
|
347169
348688
|
route_type: external_exports2.literal("wire"),
|
|
347170
|
-
x:
|
|
347171
|
-
y:
|
|
347172
|
-
width:
|
|
348689
|
+
x: distance50,
|
|
348690
|
+
y: distance50,
|
|
348691
|
+
width: distance50,
|
|
347173
348692
|
copper_pour_id: external_exports2.string().optional(),
|
|
347174
348693
|
is_inside_copper_pour: external_exports2.boolean().optional(),
|
|
347175
348694
|
start_pcb_port_id: external_exports2.string().optional(),
|
|
@@ -347178,12 +348697,12 @@ var pcb_trace_route_point_wire = external_exports2.object({
|
|
|
347178
348697
|
});
|
|
347179
348698
|
var pcb_trace_route_point_via = external_exports2.object({
|
|
347180
348699
|
route_type: external_exports2.literal("via"),
|
|
347181
|
-
x:
|
|
347182
|
-
y:
|
|
348700
|
+
x: distance50,
|
|
348701
|
+
y: distance50,
|
|
347183
348702
|
copper_pour_id: external_exports2.string().optional(),
|
|
347184
348703
|
is_inside_copper_pour: external_exports2.boolean().optional(),
|
|
347185
|
-
hole_diameter:
|
|
347186
|
-
outer_diameter:
|
|
348704
|
+
hole_diameter: distance50.optional(),
|
|
348705
|
+
outer_diameter: distance50.optional(),
|
|
347187
348706
|
from_layer: layer_ref2,
|
|
347188
348707
|
to_layer: layer_ref2
|
|
347189
348708
|
});
|
|
@@ -347191,7 +348710,7 @@ var pcb_trace_route_point_through_pad = external_exports2.object({
|
|
|
347191
348710
|
route_type: external_exports2.literal("through_pad"),
|
|
347192
348711
|
start: point9,
|
|
347193
348712
|
end: point9,
|
|
347194
|
-
width:
|
|
348713
|
+
width: distance50,
|
|
347195
348714
|
start_layer: layer_ref2,
|
|
347196
348715
|
end_layer: layer_ref2,
|
|
347197
348716
|
pcb_smtpad_id: external_exports2.string().optional(),
|
|
@@ -347239,8 +348758,8 @@ var pcb_trace_too_long_warning = external_exports2.object({
|
|
|
347239
348758
|
pcb_trace_id: external_exports2.string(),
|
|
347240
348759
|
source_net_id: external_exports2.string().optional(),
|
|
347241
348760
|
source_trace_id: external_exports2.string().optional(),
|
|
347242
|
-
actual_trace_length:
|
|
347243
|
-
maximum_trace_length:
|
|
348761
|
+
actual_trace_length: distance50,
|
|
348762
|
+
maximum_trace_length: distance50,
|
|
347244
348763
|
subcircuit_id: external_exports2.string().optional()
|
|
347245
348764
|
}).describe("Warning emitted when a PCB trace is longer than its maximum allowed length");
|
|
347246
348765
|
expectTypesMatch2(true);
|
|
@@ -347310,10 +348829,10 @@ var pcb_via = external_exports2.object({
|
|
|
347310
348829
|
pcb_group_id: external_exports2.string().optional(),
|
|
347311
348830
|
subcircuit_id: external_exports2.string().optional(),
|
|
347312
348831
|
subcircuit_connectivity_map_key: external_exports2.string().optional(),
|
|
347313
|
-
x:
|
|
347314
|
-
y:
|
|
347315
|
-
outer_diameter:
|
|
347316
|
-
hole_diameter:
|
|
348832
|
+
x: distance50,
|
|
348833
|
+
y: distance50,
|
|
348834
|
+
outer_diameter: distance50.default("0.6mm"),
|
|
348835
|
+
hole_diameter: distance50.default("0.25mm"),
|
|
347317
348836
|
from_layer: layer_ref2.optional(),
|
|
347318
348837
|
to_layer: layer_ref2.optional(),
|
|
347319
348838
|
layers: external_exports2.array(layer_ref2),
|
|
@@ -347401,11 +348920,11 @@ var pcb_silkscreen_line = external_exports2.object({
|
|
|
347401
348920
|
pcb_component_id: external_exports2.string(),
|
|
347402
348921
|
pcb_group_id: external_exports2.string().optional(),
|
|
347403
348922
|
subcircuit_id: external_exports2.string().optional(),
|
|
347404
|
-
stroke_width:
|
|
347405
|
-
x1:
|
|
347406
|
-
y1:
|
|
347407
|
-
x2:
|
|
347408
|
-
y2:
|
|
348923
|
+
stroke_width: distance50.default("0.1mm"),
|
|
348924
|
+
x1: distance50,
|
|
348925
|
+
y1: distance50,
|
|
348926
|
+
x2: distance50,
|
|
348927
|
+
y2: distance50,
|
|
347409
348928
|
layer: visible_layer
|
|
347410
348929
|
}).describe("Defines a silkscreen line on the PCB");
|
|
347411
348930
|
expectTypesMatch2(true);
|
|
@@ -347426,7 +348945,7 @@ var pcb_silkscreen_text = external_exports2.object({
|
|
|
347426
348945
|
pcb_group_id: external_exports2.string().optional(),
|
|
347427
348946
|
subcircuit_id: external_exports2.string().optional(),
|
|
347428
348947
|
font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
|
|
347429
|
-
font_size:
|
|
348948
|
+
font_size: distance50.default("0.2mm"),
|
|
347430
348949
|
pcb_component_id: external_exports2.string(),
|
|
347431
348950
|
text: external_exports2.string(),
|
|
347432
348951
|
is_knockout: external_exports2.boolean().default(false).optional(),
|
|
@@ -347454,7 +348973,7 @@ var pcb_copper_text = external_exports2.object({
|
|
|
347454
348973
|
pcb_group_id: external_exports2.string().optional(),
|
|
347455
348974
|
subcircuit_id: external_exports2.string().optional(),
|
|
347456
348975
|
font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
|
|
347457
|
-
font_size:
|
|
348976
|
+
font_size: distance50.default("0.2mm"),
|
|
347458
348977
|
pcb_component_id: external_exports2.string(),
|
|
347459
348978
|
text: external_exports2.string(),
|
|
347460
348979
|
is_knockout: external_exports2.boolean().default(false).optional(),
|
|
@@ -347514,8 +349033,8 @@ var pcb_silkscreen_oval = external_exports2.object({
|
|
|
347514
349033
|
pcb_group_id: external_exports2.string().optional(),
|
|
347515
349034
|
subcircuit_id: external_exports2.string().optional(),
|
|
347516
349035
|
center: point9,
|
|
347517
|
-
radius_x:
|
|
347518
|
-
radius_y:
|
|
349036
|
+
radius_x: distance50,
|
|
349037
|
+
radius_y: distance50,
|
|
347519
349038
|
layer: visible_layer,
|
|
347520
349039
|
ccw_rotation: rotation11.optional()
|
|
347521
349040
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
@@ -347555,7 +349074,7 @@ var pcb_fabrication_note_text2 = external_exports2.object({
|
|
|
347555
349074
|
subcircuit_id: external_exports2.string().optional(),
|
|
347556
349075
|
pcb_group_id: external_exports2.string().optional(),
|
|
347557
349076
|
font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
|
|
347558
|
-
font_size:
|
|
349077
|
+
font_size: distance50.default("1mm"),
|
|
347559
349078
|
pcb_component_id: external_exports2.string(),
|
|
347560
349079
|
text: external_exports2.string(),
|
|
347561
349080
|
ccw_rotation: external_exports2.number().optional(),
|
|
@@ -347625,7 +349144,7 @@ var pcb_note_text2 = external_exports2.object({
|
|
|
347625
349144
|
subcircuit_id: external_exports2.string().optional(),
|
|
347626
349145
|
name: external_exports2.string().optional(),
|
|
347627
349146
|
font: external_exports2.literal("tscircuit2024").default("tscircuit2024"),
|
|
347628
|
-
font_size:
|
|
349147
|
+
font_size: distance50.default("1mm"),
|
|
347629
349148
|
text: external_exports2.string().optional(),
|
|
347630
349149
|
anchor_position: point9.default({ x: 0, y: 0 }),
|
|
347631
349150
|
anchor_alignment: external_exports2.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
@@ -347676,12 +349195,12 @@ var pcb_note_line2 = external_exports2.object({
|
|
|
347676
349195
|
subcircuit_id: external_exports2.string().optional(),
|
|
347677
349196
|
name: external_exports2.string().optional(),
|
|
347678
349197
|
text: external_exports2.string().optional(),
|
|
347679
|
-
x1:
|
|
347680
|
-
y1:
|
|
347681
|
-
x2:
|
|
347682
|
-
y2:
|
|
349198
|
+
x1: distance50,
|
|
349199
|
+
y1: distance50,
|
|
349200
|
+
x2: distance50,
|
|
349201
|
+
y2: distance50,
|
|
347683
349202
|
layer: visible_layer.default("top"),
|
|
347684
|
-
stroke_width:
|
|
349203
|
+
stroke_width: distance50.default("0.1mm"),
|
|
347685
349204
|
color: external_exports2.string().optional(),
|
|
347686
349205
|
is_dashed: external_exports2.boolean().optional()
|
|
347687
349206
|
}).describe("Defines a straight documentation note line on the PCB");
|
|
@@ -347732,8 +349251,8 @@ var pcb_keepout2 = external_exports2.object({
|
|
|
347732
349251
|
pcb_group_id: external_exports2.string().optional(),
|
|
347733
349252
|
subcircuit_id: external_exports2.string().optional(),
|
|
347734
349253
|
center: point9,
|
|
347735
|
-
width:
|
|
347736
|
-
height:
|
|
349254
|
+
width: distance50,
|
|
349255
|
+
height: distance50,
|
|
347737
349256
|
pcb_keepout_id: external_exports2.string(),
|
|
347738
349257
|
layers: external_exports2.array(external_exports2.string()),
|
|
347739
349258
|
description: external_exports2.string().optional(),
|
|
@@ -347744,7 +349263,7 @@ var pcb_keepout2 = external_exports2.object({
|
|
|
347744
349263
|
pcb_group_id: external_exports2.string().optional(),
|
|
347745
349264
|
subcircuit_id: external_exports2.string().optional(),
|
|
347746
349265
|
center: point9,
|
|
347747
|
-
radius:
|
|
349266
|
+
radius: distance50,
|
|
347748
349267
|
pcb_keepout_id: external_exports2.string(),
|
|
347749
349268
|
layers: external_exports2.array(external_exports2.string()),
|
|
347750
349269
|
description: external_exports2.string().optional(),
|
|
@@ -347920,8 +349439,8 @@ var pcb_breakout_point = external_exports2.object({
|
|
|
347920
349439
|
source_port_id: external_exports2.string().optional(),
|
|
347921
349440
|
source_net_id: external_exports2.string().optional(),
|
|
347922
349441
|
layer: layer_ref2.optional(),
|
|
347923
|
-
x:
|
|
347924
|
-
y:
|
|
349442
|
+
x: distance50,
|
|
349443
|
+
y: distance50
|
|
347925
349444
|
}).describe("Defines a routing target within a pcb_group for a source_trace or source_net");
|
|
347926
349445
|
expectTypesMatch2(true);
|
|
347927
349446
|
var pcb_ground_plane = external_exports2.object({
|
|
@@ -347949,9 +349468,9 @@ var pcb_thermal_spoke = external_exports2.object({
|
|
|
347949
349468
|
pcb_ground_plane_id: external_exports2.string(),
|
|
347950
349469
|
shape: external_exports2.string(),
|
|
347951
349470
|
spoke_count: external_exports2.number(),
|
|
347952
|
-
spoke_thickness:
|
|
347953
|
-
spoke_inner_diameter:
|
|
347954
|
-
spoke_outer_diameter:
|
|
349471
|
+
spoke_thickness: distance50,
|
|
349472
|
+
spoke_inner_diameter: distance50,
|
|
349473
|
+
spoke_outer_diameter: distance50,
|
|
347955
349474
|
pcb_plated_hole_id: external_exports2.string().optional(),
|
|
347956
349475
|
subcircuit_id: external_exports2.string().optional()
|
|
347957
349476
|
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
@@ -348033,8 +349552,8 @@ var pcb_via_clearance_error = base_circuit_json_error.extend({
|
|
|
348033
349552
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
348034
349553
|
error_type: external_exports2.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
|
|
348035
349554
|
pcb_via_ids: external_exports2.array(external_exports2.string()).min(2),
|
|
348036
|
-
minimum_clearance:
|
|
348037
|
-
actual_clearance:
|
|
349555
|
+
minimum_clearance: distance50.optional(),
|
|
349556
|
+
actual_clearance: distance50.optional(),
|
|
348038
349557
|
pcb_center: external_exports2.object({
|
|
348039
349558
|
x: external_exports2.number().optional(),
|
|
348040
349559
|
y: external_exports2.number().optional()
|
|
@@ -348048,8 +349567,8 @@ var pcb_via_trace_clearance_error = base_circuit_json_error.extend({
|
|
|
348048
349567
|
error_type: external_exports2.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
|
|
348049
349568
|
pcb_via_id: external_exports2.string(),
|
|
348050
349569
|
pcb_trace_id: external_exports2.string(),
|
|
348051
|
-
minimum_clearance:
|
|
348052
|
-
actual_clearance:
|
|
349570
|
+
minimum_clearance: distance50.optional(),
|
|
349571
|
+
actual_clearance: distance50.optional(),
|
|
348053
349572
|
center: external_exports2.object({
|
|
348054
349573
|
x: external_exports2.number().optional(),
|
|
348055
349574
|
y: external_exports2.number().optional()
|
|
@@ -348062,8 +349581,8 @@ var pcb_pad_pad_clearance_error = base_circuit_json_error.extend({
|
|
|
348062
349581
|
pcb_pad_pad_clearance_error_id: getZodPrefixedIdWithDefault("pcb_pad_pad_clearance_error"),
|
|
348063
349582
|
error_type: external_exports2.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
|
|
348064
349583
|
pcb_pad_ids: external_exports2.array(external_exports2.string()).min(2),
|
|
348065
|
-
minimum_clearance:
|
|
348066
|
-
actual_clearance:
|
|
349584
|
+
minimum_clearance: distance50.optional(),
|
|
349585
|
+
actual_clearance: distance50.optional(),
|
|
348067
349586
|
center: external_exports2.object({
|
|
348068
349587
|
x: external_exports2.number().optional(),
|
|
348069
349588
|
y: external_exports2.number().optional()
|
|
@@ -348077,8 +349596,8 @@ var pcb_pad_trace_clearance_error = base_circuit_json_error.extend({
|
|
|
348077
349596
|
error_type: external_exports2.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
|
|
348078
349597
|
pcb_pad_id: external_exports2.string(),
|
|
348079
349598
|
pcb_trace_id: external_exports2.string(),
|
|
348080
|
-
minimum_clearance:
|
|
348081
|
-
actual_clearance:
|
|
349599
|
+
minimum_clearance: distance50.optional(),
|
|
349600
|
+
actual_clearance: distance50.optional(),
|
|
348082
349601
|
center: external_exports2.object({
|
|
348083
349602
|
x: external_exports2.number().optional(),
|
|
348084
349603
|
y: external_exports2.number().optional()
|
|
@@ -352284,14 +353803,14 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
|
|
|
352284
353803
|
placementCache.set(cacheKey, placementPromise);
|
|
352285
353804
|
return placementPromise;
|
|
352286
353805
|
};
|
|
352287
|
-
var
|
|
353806
|
+
var round2 = (value) => Number(value.toFixed(6));
|
|
352288
353807
|
var EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT = 0.02;
|
|
352289
|
-
var toSchematicUnits = (value) =>
|
|
353808
|
+
var toSchematicUnits = (value) => round2(value * EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT);
|
|
352290
353809
|
var getPointTransformer = (origin) => (point2) => ({
|
|
352291
353810
|
x: toSchematicUnits(point2.x - origin.x),
|
|
352292
353811
|
y: toSchematicUnits(origin.y - point2.y)
|
|
352293
353812
|
});
|
|
352294
|
-
var formatNumber7 = (value) => String(
|
|
353813
|
+
var formatNumber7 = (value) => String(round2(value));
|
|
352295
353814
|
var SVG_PATH_COMMAND_PARAMETER_COUNTS = {
|
|
352296
353815
|
A: 7,
|
|
352297
353816
|
C: 6,
|
|
@@ -352441,8 +353960,8 @@ var alignPortToDrawing = ({
|
|
|
352441
353960
|
if (!nearestEndpoint)
|
|
352442
353961
|
return position2;
|
|
352443
353962
|
return {
|
|
352444
|
-
x:
|
|
352445
|
-
y:
|
|
353963
|
+
x: round2(nearestEndpoint.x + outwardDirection.x * stemLength),
|
|
353964
|
+
y: round2(nearestEndpoint.y + outwardDirection.y * stemLength)
|
|
352446
353965
|
};
|
|
352447
353966
|
};
|
|
352448
353967
|
var getTextFontSize = (fontSize) => {
|
|
@@ -352560,7 +354079,7 @@ var generateShapeTsx = ({
|
|
|
352560
354079
|
if (shape.visibility !== "1")
|
|
352561
354080
|
return;
|
|
352562
354081
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|
|
352563
|
-
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${getTextFontSize(shape.fontSize)}} anchor=${JSON.stringify(getTextAnchor(shape.alignment))} color=${JSON.stringify(shape.fontColor)} schRotation={${
|
|
354082
|
+
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${getTextFontSize(shape.fontSize)}} anchor=${JSON.stringify(getTextAnchor(shape.alignment))} color=${JSON.stringify(shape.fontColor)} schRotation={${round2(-shape.rotation)}} />`;
|
|
352564
354083
|
}
|
|
352565
354084
|
if (shape.type === "PIN" && portMetadata) {
|
|
352566
354085
|
if (shape.visibility !== "show")
|
|
@@ -353808,7 +355327,7 @@ __export6(dist_exports2, {
|
|
|
353808
355327
|
capacitance: () => capacitance5,
|
|
353809
355328
|
circuit_json_footprint_load_error: () => circuit_json_footprint_load_error3,
|
|
353810
355329
|
current: () => current3,
|
|
353811
|
-
distance: () =>
|
|
355330
|
+
distance: () => distance51,
|
|
353812
355331
|
duration_ms: () => duration_ms2,
|
|
353813
355332
|
experiment_type: () => experiment_type2,
|
|
353814
355333
|
external_footprint_load_error: () => external_footprint_load_error3,
|
|
@@ -354353,7 +355872,7 @@ var inductance3 = z56.string().or(z56.number()).transform((v) => parseAndConvert
|
|
|
354353
355872
|
var voltage6 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "V").value);
|
|
354354
355873
|
var length68 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v).value);
|
|
354355
355874
|
var frequency8 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "Hz").value);
|
|
354356
|
-
var
|
|
355875
|
+
var distance51 = length68;
|
|
354357
355876
|
var current3 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v, "A").value);
|
|
354358
355877
|
var duration_ms2 = z56.string().or(z56.number()).transform((v) => parseAndConvertSiUnit2(v).value);
|
|
354359
355878
|
var time2 = duration_ms2;
|
|
@@ -354394,16 +355913,16 @@ expectStringUnionsMatch2('T2 has extra: "c"');
|
|
|
354394
355913
|
expectStringUnionsMatch2('T1 has extra: "d", T2 has extra: "c"');
|
|
354395
355914
|
expectStringUnionsMatch2(true);
|
|
354396
355915
|
var point10 = z211.object({
|
|
354397
|
-
x:
|
|
354398
|
-
y:
|
|
355916
|
+
x: distance51,
|
|
355917
|
+
y: distance51
|
|
354399
355918
|
});
|
|
354400
355919
|
var position2 = point10;
|
|
354401
355920
|
expectTypesMatch3(true);
|
|
354402
355921
|
expectTypesMatch3(true);
|
|
354403
355922
|
var point34 = z311.object({
|
|
354404
|
-
x:
|
|
354405
|
-
y:
|
|
354406
|
-
z:
|
|
355923
|
+
x: distance51,
|
|
355924
|
+
y: distance51,
|
|
355925
|
+
z: distance51
|
|
354407
355926
|
});
|
|
354408
355927
|
var position32 = point34;
|
|
354409
355928
|
expectTypesMatch3(true);
|
|
@@ -354468,7 +355987,7 @@ var kicadAt3 = point10.extend({
|
|
|
354468
355987
|
expectTypesMatch3(true);
|
|
354469
355988
|
var kicadFont3 = z94.object({
|
|
354470
355989
|
size: point10.optional(),
|
|
354471
|
-
thickness:
|
|
355990
|
+
thickness: distance51.optional()
|
|
354472
355991
|
});
|
|
354473
355992
|
expectTypesMatch3(true);
|
|
354474
355993
|
var kicadEffects3 = z94.object({
|
|
@@ -354504,7 +356023,7 @@ var kicadFootprintPad3 = z94.object({
|
|
|
354504
356023
|
shape: z94.string().optional(),
|
|
354505
356024
|
at: kicadAt3.optional(),
|
|
354506
356025
|
size: point10.optional(),
|
|
354507
|
-
drill:
|
|
356026
|
+
drill: distance51.optional(),
|
|
354508
356027
|
layers: z94.array(z94.string()).optional(),
|
|
354509
356028
|
removeUnusedLayers: z94.boolean().optional(),
|
|
354510
356029
|
uuid: z94.string().optional()
|
|
@@ -354535,7 +356054,7 @@ var kicadSymbolPinNumbers3 = z103.object({
|
|
|
354535
356054
|
});
|
|
354536
356055
|
expectTypesMatch3(true);
|
|
354537
356056
|
var kicadSymbolPinNames3 = z103.object({
|
|
354538
|
-
offset:
|
|
356057
|
+
offset: distance51.optional(),
|
|
354539
356058
|
hide: z103.boolean().optional()
|
|
354540
356059
|
});
|
|
354541
356060
|
expectTypesMatch3(true);
|
|
@@ -354609,7 +356128,7 @@ var source_simple_capacitor2 = source_component_base2.extend({
|
|
|
354609
356128
|
capacitance: capacitance5,
|
|
354610
356129
|
max_voltage_rating: voltage6.optional(),
|
|
354611
356130
|
display_capacitance: z143.string().optional(),
|
|
354612
|
-
max_decoupling_trace_length:
|
|
356131
|
+
max_decoupling_trace_length: distance51.optional()
|
|
354613
356132
|
});
|
|
354614
356133
|
expectTypesMatch3(true);
|
|
354615
356134
|
var source_simple_resistor2 = source_component_base2.extend({
|
|
@@ -355167,11 +356686,11 @@ var schematic_box2 = z722.object({
|
|
|
355167
356686
|
schematic_sheet_id: z722.string().optional(),
|
|
355168
356687
|
schematic_component_id: z722.string().optional(),
|
|
355169
356688
|
schematic_symbol_id: z722.string().optional(),
|
|
355170
|
-
width:
|
|
355171
|
-
height:
|
|
356689
|
+
width: distance51,
|
|
356690
|
+
height: distance51,
|
|
355172
356691
|
is_dashed: z722.boolean().default(false),
|
|
355173
|
-
x:
|
|
355174
|
-
y:
|
|
356692
|
+
x: distance51,
|
|
356693
|
+
y: distance51,
|
|
355175
356694
|
subcircuit_id: z722.string().optional()
|
|
355176
356695
|
}).describe("Draws a box on the schematic");
|
|
355177
356696
|
expectTypesMatch3(true);
|
|
@@ -355184,10 +356703,10 @@ var schematic_path2 = z732.object({
|
|
|
355184
356703
|
fill_color: z732.string().optional(),
|
|
355185
356704
|
is_filled: z732.boolean().optional(),
|
|
355186
356705
|
is_dashed: z732.boolean().default(false),
|
|
355187
|
-
stroke_width:
|
|
356706
|
+
stroke_width: distance51.nullable().optional(),
|
|
355188
356707
|
stroke_color: z732.string().optional(),
|
|
355189
|
-
dash_length:
|
|
355190
|
-
dash_gap:
|
|
356708
|
+
dash_length: distance51.optional(),
|
|
356709
|
+
dash_gap: distance51.optional(),
|
|
355191
356710
|
points: z732.array(point10),
|
|
355192
356711
|
subcircuit_id: z732.string().optional()
|
|
355193
356712
|
});
|
|
@@ -355266,15 +356785,15 @@ var schematic_line2 = z76.object({
|
|
|
355266
356785
|
schematic_sheet_id: z76.string().optional(),
|
|
355267
356786
|
schematic_component_id: z76.string().optional(),
|
|
355268
356787
|
schematic_symbol_id: z76.string().optional(),
|
|
355269
|
-
x1:
|
|
355270
|
-
y1:
|
|
355271
|
-
x2:
|
|
355272
|
-
y2:
|
|
355273
|
-
stroke_width:
|
|
356788
|
+
x1: distance51,
|
|
356789
|
+
y1: distance51,
|
|
356790
|
+
x2: distance51,
|
|
356791
|
+
y2: distance51,
|
|
356792
|
+
stroke_width: distance51.nullable().optional(),
|
|
355274
356793
|
color: z76.string().default("#000000"),
|
|
355275
356794
|
is_dashed: z76.boolean().default(false),
|
|
355276
|
-
dash_length:
|
|
355277
|
-
dash_gap:
|
|
356795
|
+
dash_length: distance51.optional(),
|
|
356796
|
+
dash_gap: distance51.optional(),
|
|
355278
356797
|
subcircuit_id: z76.string().optional()
|
|
355279
356798
|
}).describe("Draws a styled line on the schematic");
|
|
355280
356799
|
expectTypesMatch3(true);
|
|
@@ -355285,10 +356804,10 @@ var schematic_rect2 = z77.object({
|
|
|
355285
356804
|
schematic_component_id: z77.string().optional(),
|
|
355286
356805
|
schematic_symbol_id: z77.string().optional(),
|
|
355287
356806
|
center: point10,
|
|
355288
|
-
width:
|
|
355289
|
-
height:
|
|
356807
|
+
width: distance51,
|
|
356808
|
+
height: distance51,
|
|
355290
356809
|
rotation: rotation12.default(0),
|
|
355291
|
-
stroke_width:
|
|
356810
|
+
stroke_width: distance51.nullable().optional(),
|
|
355292
356811
|
color: z77.string().default("#000000"),
|
|
355293
356812
|
is_filled: z77.boolean().default(false),
|
|
355294
356813
|
fill_color: z77.string().optional(),
|
|
@@ -355303,8 +356822,8 @@ var schematic_circle2 = z78.object({
|
|
|
355303
356822
|
schematic_component_id: z78.string().optional(),
|
|
355304
356823
|
schematic_symbol_id: z78.string().optional(),
|
|
355305
356824
|
center: point10,
|
|
355306
|
-
radius:
|
|
355307
|
-
stroke_width:
|
|
356825
|
+
radius: distance51,
|
|
356826
|
+
stroke_width: distance51.nullable().optional(),
|
|
355308
356827
|
color: z78.string().default("#000000"),
|
|
355309
356828
|
is_filled: z78.boolean().default(false),
|
|
355310
356829
|
fill_color: z78.string().optional(),
|
|
@@ -355319,11 +356838,11 @@ var schematic_arc2 = z79.object({
|
|
|
355319
356838
|
schematic_component_id: z79.string().optional(),
|
|
355320
356839
|
schematic_symbol_id: z79.string().optional(),
|
|
355321
356840
|
center: point10,
|
|
355322
|
-
radius:
|
|
356841
|
+
radius: distance51,
|
|
355323
356842
|
start_angle_degrees: rotation12,
|
|
355324
356843
|
end_angle_degrees: rotation12,
|
|
355325
356844
|
direction: z79.enum(["clockwise", "counterclockwise"]).default("counterclockwise"),
|
|
355326
|
-
stroke_width:
|
|
356845
|
+
stroke_width: distance51.nullable().optional(),
|
|
355327
356846
|
color: z79.string().default("#000000"),
|
|
355328
356847
|
is_dashed: z79.boolean().default(false),
|
|
355329
356848
|
subcircuit_id: z79.string().optional()
|
|
@@ -355373,8 +356892,8 @@ var schematic_text2 = z822.object({
|
|
|
355373
356892
|
text: z822.string(),
|
|
355374
356893
|
font_size: z822.number().default(0.18),
|
|
355375
356894
|
position: z822.object({
|
|
355376
|
-
x:
|
|
355377
|
-
y:
|
|
356895
|
+
x: distance51,
|
|
356896
|
+
y: distance51
|
|
355378
356897
|
}),
|
|
355379
356898
|
rotation: z822.number().default(0),
|
|
355380
356899
|
anchor: z822.union([fivePointAnchor3.describe("legacy"), ninePointAnchor3]).default("center"),
|
|
@@ -355544,10 +357063,10 @@ var schematic_table2 = z942.object({
|
|
|
355544
357063
|
schematic_table_id: getZodPrefixedIdWithDefault2("schematic_table"),
|
|
355545
357064
|
schematic_sheet_id: z942.string().optional(),
|
|
355546
357065
|
anchor_position: point10,
|
|
355547
|
-
column_widths: z942.array(
|
|
355548
|
-
row_heights: z942.array(
|
|
355549
|
-
cell_padding:
|
|
355550
|
-
border_width:
|
|
357066
|
+
column_widths: z942.array(distance51),
|
|
357067
|
+
row_heights: z942.array(distance51),
|
|
357068
|
+
cell_padding: distance51.optional(),
|
|
357069
|
+
border_width: distance51.optional(),
|
|
355551
357070
|
subcircuit_id: z942.string().optional(),
|
|
355552
357071
|
schematic_component_id: z942.string().optional(),
|
|
355553
357072
|
anchor: ninePointAnchor3.optional()
|
|
@@ -355564,11 +357083,11 @@ var schematic_table_cell2 = z95.object({
|
|
|
355564
357083
|
end_column_index: z95.number(),
|
|
355565
357084
|
text: z95.string().optional(),
|
|
355566
357085
|
center: point10,
|
|
355567
|
-
width:
|
|
355568
|
-
height:
|
|
357086
|
+
width: distance51,
|
|
357087
|
+
height: distance51,
|
|
355569
357088
|
horizontal_align: z95.enum(["left", "center", "right"]).optional(),
|
|
355570
357089
|
vertical_align: z95.enum(["top", "middle", "bottom"]).optional(),
|
|
355571
|
-
font_size:
|
|
357090
|
+
font_size: distance51.optional(),
|
|
355572
357091
|
subcircuit_id: z95.string().optional()
|
|
355573
357092
|
}).describe("Defines a cell within a schematic_table");
|
|
355574
357093
|
expectTypesMatch3(true);
|
|
@@ -355582,8 +357101,8 @@ var schematic_sheet2 = z96.object({
|
|
|
355582
357101
|
}).describe("Defines a schematic sheet or page that components can be placed on");
|
|
355583
357102
|
expectTypesMatch3(true);
|
|
355584
357103
|
var point_with_bulge2 = z97.object({
|
|
355585
|
-
x:
|
|
355586
|
-
y:
|
|
357104
|
+
x: distance51,
|
|
357105
|
+
y: distance51,
|
|
355587
357106
|
bulge: z97.number().optional()
|
|
355588
357107
|
});
|
|
355589
357108
|
expectTypesMatch3(true);
|
|
@@ -355674,8 +357193,8 @@ var getRotationBetweenPcbPin1Locations3 = (from, to) => {
|
|
|
355674
357193
|
return null;
|
|
355675
357194
|
};
|
|
355676
357195
|
var pcb_route_hint2 = z100.object({
|
|
355677
|
-
x:
|
|
355678
|
-
y:
|
|
357196
|
+
x: distance51,
|
|
357197
|
+
y: distance51,
|
|
355679
357198
|
via: z100.boolean().optional(),
|
|
355680
357199
|
via_to_layer: layer_ref3.optional()
|
|
355681
357200
|
});
|
|
@@ -355683,11 +357202,11 @@ var pcb_route_hints2 = z100.array(pcb_route_hint2);
|
|
|
355683
357202
|
expectTypesMatch3(true);
|
|
355684
357203
|
expectTypesMatch3(true);
|
|
355685
357204
|
var route_hint_point9 = z101.object({
|
|
355686
|
-
x:
|
|
355687
|
-
y:
|
|
357205
|
+
x: distance51,
|
|
357206
|
+
y: distance51,
|
|
355688
357207
|
via: z101.boolean().optional(),
|
|
355689
357208
|
to_layer: layer_ref3.optional(),
|
|
355690
|
-
trace_width:
|
|
357209
|
+
trace_width: distance51.optional()
|
|
355691
357210
|
});
|
|
355692
357211
|
expectTypesMatch3(true);
|
|
355693
357212
|
var manufacturing_drc_properties2 = z1022.object({
|
|
@@ -355772,8 +357291,8 @@ var pcb_hole_circle2 = z105.object({
|
|
|
355772
357291
|
pcb_component_id: z105.string().optional(),
|
|
355773
357292
|
hole_shape: z105.literal("circle"),
|
|
355774
357293
|
hole_diameter: z105.number(),
|
|
355775
|
-
x:
|
|
355776
|
-
y:
|
|
357294
|
+
x: distance51,
|
|
357295
|
+
y: distance51,
|
|
355777
357296
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355778
357297
|
soldermask_margin: z105.number().optional()
|
|
355779
357298
|
});
|
|
@@ -355788,8 +357307,8 @@ var pcb_hole_rect2 = z105.object({
|
|
|
355788
357307
|
hole_shape: z105.literal("rect"),
|
|
355789
357308
|
hole_width: z105.number(),
|
|
355790
357309
|
hole_height: z105.number(),
|
|
355791
|
-
x:
|
|
355792
|
-
y:
|
|
357310
|
+
x: distance51,
|
|
357311
|
+
y: distance51,
|
|
355793
357312
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355794
357313
|
soldermask_margin: z105.number().optional()
|
|
355795
357314
|
});
|
|
@@ -355803,8 +357322,8 @@ var pcb_hole_circle_or_square2 = z105.object({
|
|
|
355803
357322
|
pcb_component_id: z105.string().optional(),
|
|
355804
357323
|
hole_shape: z105.enum(["circle", "square"]),
|
|
355805
357324
|
hole_diameter: z105.number(),
|
|
355806
|
-
x:
|
|
355807
|
-
y:
|
|
357325
|
+
x: distance51,
|
|
357326
|
+
y: distance51,
|
|
355808
357327
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355809
357328
|
soldermask_margin: z105.number().optional()
|
|
355810
357329
|
});
|
|
@@ -355819,8 +357338,8 @@ var pcb_hole_oval2 = z105.object({
|
|
|
355819
357338
|
hole_shape: z105.literal("oval"),
|
|
355820
357339
|
hole_width: z105.number(),
|
|
355821
357340
|
hole_height: z105.number(),
|
|
355822
|
-
x:
|
|
355823
|
-
y:
|
|
357341
|
+
x: distance51,
|
|
357342
|
+
y: distance51,
|
|
355824
357343
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355825
357344
|
soldermask_margin: z105.number().optional()
|
|
355826
357345
|
});
|
|
@@ -355835,8 +357354,8 @@ var pcb_hole_pill2 = z105.object({
|
|
|
355835
357354
|
hole_shape: z105.literal("pill"),
|
|
355836
357355
|
hole_width: z105.number(),
|
|
355837
357356
|
hole_height: z105.number(),
|
|
355838
|
-
x:
|
|
355839
|
-
y:
|
|
357357
|
+
x: distance51,
|
|
357358
|
+
y: distance51,
|
|
355840
357359
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355841
357360
|
soldermask_margin: z105.number().optional()
|
|
355842
357361
|
});
|
|
@@ -355851,8 +357370,8 @@ var pcb_hole_rotated_pill2 = z105.object({
|
|
|
355851
357370
|
hole_shape: z105.literal("rotated_pill"),
|
|
355852
357371
|
hole_width: z105.number(),
|
|
355853
357372
|
hole_height: z105.number(),
|
|
355854
|
-
x:
|
|
355855
|
-
y:
|
|
357373
|
+
x: distance51,
|
|
357374
|
+
y: distance51,
|
|
355856
357375
|
ccw_rotation: rotation12,
|
|
355857
357376
|
is_covered_with_solder_mask: z105.boolean().optional(),
|
|
355858
357377
|
soldermask_margin: z105.number().optional()
|
|
@@ -355868,8 +357387,8 @@ var pcb_plated_hole_circle2 = z106.object({
|
|
|
355868
357387
|
outer_diameter: z106.number(),
|
|
355869
357388
|
hole_diameter: z106.number(),
|
|
355870
357389
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355871
|
-
x:
|
|
355872
|
-
y:
|
|
357390
|
+
x: distance51,
|
|
357391
|
+
y: distance51,
|
|
355873
357392
|
layers: z106.array(layer_ref3),
|
|
355874
357393
|
port_hints: z106.array(z106.string()).optional(),
|
|
355875
357394
|
pcb_component_id: z106.string().optional(),
|
|
@@ -355887,8 +357406,8 @@ var pcb_plated_hole_oval2 = z106.object({
|
|
|
355887
357406
|
hole_width: z106.number(),
|
|
355888
357407
|
hole_height: z106.number(),
|
|
355889
357408
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355890
|
-
x:
|
|
355891
|
-
y:
|
|
357409
|
+
x: distance51,
|
|
357410
|
+
y: distance51,
|
|
355892
357411
|
ccw_rotation: rotation12,
|
|
355893
357412
|
layers: z106.array(layer_ref3),
|
|
355894
357413
|
port_hints: z106.array(z106.string()).optional(),
|
|
@@ -355908,11 +357427,11 @@ var pcb_circular_hole_with_rect_pad2 = z106.object({
|
|
|
355908
357427
|
rect_pad_width: z106.number(),
|
|
355909
357428
|
rect_pad_height: z106.number(),
|
|
355910
357429
|
rect_border_radius: z106.number().optional(),
|
|
355911
|
-
hole_offset_x:
|
|
355912
|
-
hole_offset_y:
|
|
357430
|
+
hole_offset_x: distance51.default(0),
|
|
357431
|
+
hole_offset_y: distance51.default(0),
|
|
355913
357432
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355914
|
-
x:
|
|
355915
|
-
y:
|
|
357433
|
+
x: distance51,
|
|
357434
|
+
y: distance51,
|
|
355916
357435
|
layers: z106.array(layer_ref3),
|
|
355917
357436
|
port_hints: z106.array(z106.string()).optional(),
|
|
355918
357437
|
pcb_component_id: z106.string().optional(),
|
|
@@ -355933,11 +357452,11 @@ var pcb_pill_hole_with_rect_pad2 = z106.object({
|
|
|
355933
357452
|
rect_pad_width: z106.number(),
|
|
355934
357453
|
rect_pad_height: z106.number(),
|
|
355935
357454
|
rect_border_radius: z106.number().optional(),
|
|
355936
|
-
hole_offset_x:
|
|
355937
|
-
hole_offset_y:
|
|
357455
|
+
hole_offset_x: distance51.default(0),
|
|
357456
|
+
hole_offset_y: distance51.default(0),
|
|
355938
357457
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355939
|
-
x:
|
|
355940
|
-
y:
|
|
357458
|
+
x: distance51,
|
|
357459
|
+
y: distance51,
|
|
355941
357460
|
layers: z106.array(layer_ref3),
|
|
355942
357461
|
port_hints: z106.array(z106.string()).optional(),
|
|
355943
357462
|
pcb_component_id: z106.string().optional(),
|
|
@@ -355959,11 +357478,11 @@ var pcb_rotated_pill_hole_with_rect_pad2 = z106.object({
|
|
|
355959
357478
|
rect_pad_height: z106.number(),
|
|
355960
357479
|
rect_border_radius: z106.number().optional(),
|
|
355961
357480
|
rect_ccw_rotation: rotation12,
|
|
355962
|
-
hole_offset_x:
|
|
355963
|
-
hole_offset_y:
|
|
357481
|
+
hole_offset_x: distance51.default(0),
|
|
357482
|
+
hole_offset_y: distance51.default(0),
|
|
355964
357483
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355965
|
-
x:
|
|
355966
|
-
y:
|
|
357484
|
+
x: distance51,
|
|
357485
|
+
y: distance51,
|
|
355967
357486
|
layers: z106.array(layer_ref3),
|
|
355968
357487
|
port_hints: z106.array(z106.string()).optional(),
|
|
355969
357488
|
pcb_component_id: z106.string().optional(),
|
|
@@ -355981,14 +357500,14 @@ var pcb_hole_with_polygon_pad2 = z106.object({
|
|
|
355981
357500
|
hole_width: z106.number().optional(),
|
|
355982
357501
|
hole_height: z106.number().optional(),
|
|
355983
357502
|
pad_outline: z106.array(z106.object({
|
|
355984
|
-
x:
|
|
355985
|
-
y:
|
|
357503
|
+
x: distance51,
|
|
357504
|
+
y: distance51
|
|
355986
357505
|
})).min(3),
|
|
355987
|
-
hole_offset_x:
|
|
355988
|
-
hole_offset_y:
|
|
357506
|
+
hole_offset_x: distance51.default(0),
|
|
357507
|
+
hole_offset_y: distance51.default(0),
|
|
355989
357508
|
is_covered_with_solder_mask: z106.boolean().optional(),
|
|
355990
|
-
x:
|
|
355991
|
-
y:
|
|
357509
|
+
x: distance51,
|
|
357510
|
+
y: distance51,
|
|
355992
357511
|
layers: z106.array(layer_ref3),
|
|
355993
357512
|
port_hints: z106.array(z106.string()).optional(),
|
|
355994
357513
|
pcb_component_id: z106.string().optional(),
|
|
@@ -356018,8 +357537,8 @@ var pcb_port2 = z107.object({
|
|
|
356018
357537
|
subcircuit_id: z107.string().optional(),
|
|
356019
357538
|
source_port_id: z107.string(),
|
|
356020
357539
|
pcb_component_id: z107.string().optional(),
|
|
356021
|
-
x:
|
|
356022
|
-
y:
|
|
357540
|
+
x: distance51,
|
|
357541
|
+
y: distance51,
|
|
356023
357542
|
layers: z107.array(layer_ref3),
|
|
356024
357543
|
is_board_pinout: z107.boolean().optional()
|
|
356025
357544
|
}).describe("Defines a port on the PCB");
|
|
@@ -356030,8 +357549,8 @@ var pcb_smtpad_circle2 = z108.object({
|
|
|
356030
357549
|
pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
|
|
356031
357550
|
pcb_group_id: z108.string().optional(),
|
|
356032
357551
|
subcircuit_id: z108.string().optional(),
|
|
356033
|
-
x:
|
|
356034
|
-
y:
|
|
357552
|
+
x: distance51,
|
|
357553
|
+
y: distance51,
|
|
356035
357554
|
radius: z108.number(),
|
|
356036
357555
|
layer: layer_ref3,
|
|
356037
357556
|
port_hints: z108.array(z108.string()).optional(),
|
|
@@ -356047,8 +357566,8 @@ var pcb_smtpad_rect2 = z108.object({
|
|
|
356047
357566
|
pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
|
|
356048
357567
|
pcb_group_id: z108.string().optional(),
|
|
356049
357568
|
subcircuit_id: z108.string().optional(),
|
|
356050
|
-
x:
|
|
356051
|
-
y:
|
|
357569
|
+
x: distance51,
|
|
357570
|
+
y: distance51,
|
|
356052
357571
|
width: z108.number(),
|
|
356053
357572
|
height: z108.number(),
|
|
356054
357573
|
rect_border_radius: z108.number().optional(),
|
|
@@ -356071,8 +357590,8 @@ var pcb_smtpad_rotated_rect2 = z108.object({
|
|
|
356071
357590
|
pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
|
|
356072
357591
|
pcb_group_id: z108.string().optional(),
|
|
356073
357592
|
subcircuit_id: z108.string().optional(),
|
|
356074
|
-
x:
|
|
356075
|
-
y:
|
|
357593
|
+
x: distance51,
|
|
357594
|
+
y: distance51,
|
|
356076
357595
|
width: z108.number(),
|
|
356077
357596
|
height: z108.number(),
|
|
356078
357597
|
rect_border_radius: z108.number().optional(),
|
|
@@ -356096,8 +357615,8 @@ var pcb_smtpad_pill2 = z108.object({
|
|
|
356096
357615
|
pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
|
|
356097
357616
|
pcb_group_id: z108.string().optional(),
|
|
356098
357617
|
subcircuit_id: z108.string().optional(),
|
|
356099
|
-
x:
|
|
356100
|
-
y:
|
|
357618
|
+
x: distance51,
|
|
357619
|
+
y: distance51,
|
|
356101
357620
|
width: z108.number(),
|
|
356102
357621
|
height: z108.number(),
|
|
356103
357622
|
radius: z108.number(),
|
|
@@ -356115,8 +357634,8 @@ var pcb_smtpad_rotated_pill2 = z108.object({
|
|
|
356115
357634
|
pcb_smtpad_id: getZodPrefixedIdWithDefault2("pcb_smtpad"),
|
|
356116
357635
|
pcb_group_id: z108.string().optional(),
|
|
356117
357636
|
subcircuit_id: z108.string().optional(),
|
|
356118
|
-
x:
|
|
356119
|
-
y:
|
|
357637
|
+
x: distance51,
|
|
357638
|
+
y: distance51,
|
|
356120
357639
|
width: z108.number(),
|
|
356121
357640
|
height: z108.number(),
|
|
356122
357641
|
radius: z108.number(),
|
|
@@ -356164,8 +357683,8 @@ var pcb_solder_paste_circle2 = z109.object({
|
|
|
356164
357683
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356165
357684
|
pcb_group_id: z109.string().optional(),
|
|
356166
357685
|
subcircuit_id: z109.string().optional(),
|
|
356167
|
-
x:
|
|
356168
|
-
y:
|
|
357686
|
+
x: distance51,
|
|
357687
|
+
y: distance51,
|
|
356169
357688
|
radius: z109.number(),
|
|
356170
357689
|
layer: layer_ref3,
|
|
356171
357690
|
pcb_component_id: z109.string().optional(),
|
|
@@ -356177,8 +357696,8 @@ var pcb_solder_paste_rect2 = z109.object({
|
|
|
356177
357696
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356178
357697
|
pcb_group_id: z109.string().optional(),
|
|
356179
357698
|
subcircuit_id: z109.string().optional(),
|
|
356180
|
-
x:
|
|
356181
|
-
y:
|
|
357699
|
+
x: distance51,
|
|
357700
|
+
y: distance51,
|
|
356182
357701
|
width: z109.number(),
|
|
356183
357702
|
height: z109.number(),
|
|
356184
357703
|
layer: layer_ref3,
|
|
@@ -356191,8 +357710,8 @@ var pcb_solder_paste_pill2 = z109.object({
|
|
|
356191
357710
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356192
357711
|
pcb_group_id: z109.string().optional(),
|
|
356193
357712
|
subcircuit_id: z109.string().optional(),
|
|
356194
|
-
x:
|
|
356195
|
-
y:
|
|
357713
|
+
x: distance51,
|
|
357714
|
+
y: distance51,
|
|
356196
357715
|
width: z109.number(),
|
|
356197
357716
|
height: z109.number(),
|
|
356198
357717
|
radius: z109.number(),
|
|
@@ -356206,11 +357725,11 @@ var pcb_solder_paste_rotated_rect2 = z109.object({
|
|
|
356206
357725
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356207
357726
|
pcb_group_id: z109.string().optional(),
|
|
356208
357727
|
subcircuit_id: z109.string().optional(),
|
|
356209
|
-
x:
|
|
356210
|
-
y:
|
|
357728
|
+
x: distance51,
|
|
357729
|
+
y: distance51,
|
|
356211
357730
|
width: z109.number(),
|
|
356212
357731
|
height: z109.number(),
|
|
356213
|
-
ccw_rotation:
|
|
357732
|
+
ccw_rotation: distance51,
|
|
356214
357733
|
layer: layer_ref3,
|
|
356215
357734
|
pcb_component_id: z109.string().optional(),
|
|
356216
357735
|
pcb_smtpad_id: z109.string().optional()
|
|
@@ -356221,8 +357740,8 @@ var pcb_solder_paste_rotated_pill2 = z109.object({
|
|
|
356221
357740
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356222
357741
|
pcb_group_id: z109.string().optional(),
|
|
356223
357742
|
subcircuit_id: z109.string().optional(),
|
|
356224
|
-
x:
|
|
356225
|
-
y:
|
|
357743
|
+
x: distance51,
|
|
357744
|
+
y: distance51,
|
|
356226
357745
|
width: z109.number(),
|
|
356227
357746
|
height: z109.number(),
|
|
356228
357747
|
radius: z109.number(),
|
|
@@ -356237,8 +357756,8 @@ var pcb_solder_paste_oval2 = z109.object({
|
|
|
356237
357756
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault2("pcb_solder_paste"),
|
|
356238
357757
|
pcb_group_id: z109.string().optional(),
|
|
356239
357758
|
subcircuit_id: z109.string().optional(),
|
|
356240
|
-
x:
|
|
356241
|
-
y:
|
|
357759
|
+
x: distance51,
|
|
357760
|
+
y: distance51,
|
|
356242
357761
|
width: z109.number(),
|
|
356243
357762
|
height: z109.number(),
|
|
356244
357763
|
layer: layer_ref3,
|
|
@@ -356275,9 +357794,9 @@ var pcb_text2 = z110.object({
|
|
|
356275
357794
|
expectTypesMatch3(true);
|
|
356276
357795
|
var pcb_trace_route_point_wire2 = z111.object({
|
|
356277
357796
|
route_type: z111.literal("wire"),
|
|
356278
|
-
x:
|
|
356279
|
-
y:
|
|
356280
|
-
width:
|
|
357797
|
+
x: distance51,
|
|
357798
|
+
y: distance51,
|
|
357799
|
+
width: distance51,
|
|
356281
357800
|
copper_pour_id: z111.string().optional(),
|
|
356282
357801
|
is_inside_copper_pour: z111.boolean().optional(),
|
|
356283
357802
|
start_pcb_port_id: z111.string().optional(),
|
|
@@ -356286,12 +357805,12 @@ var pcb_trace_route_point_wire2 = z111.object({
|
|
|
356286
357805
|
});
|
|
356287
357806
|
var pcb_trace_route_point_via2 = z111.object({
|
|
356288
357807
|
route_type: z111.literal("via"),
|
|
356289
|
-
x:
|
|
356290
|
-
y:
|
|
357808
|
+
x: distance51,
|
|
357809
|
+
y: distance51,
|
|
356291
357810
|
copper_pour_id: z111.string().optional(),
|
|
356292
357811
|
is_inside_copper_pour: z111.boolean().optional(),
|
|
356293
|
-
hole_diameter:
|
|
356294
|
-
outer_diameter:
|
|
357812
|
+
hole_diameter: distance51.optional(),
|
|
357813
|
+
outer_diameter: distance51.optional(),
|
|
356295
357814
|
from_layer: layer_ref3,
|
|
356296
357815
|
to_layer: layer_ref3
|
|
356297
357816
|
});
|
|
@@ -356299,7 +357818,7 @@ var pcb_trace_route_point_through_pad2 = z111.object({
|
|
|
356299
357818
|
route_type: z111.literal("through_pad"),
|
|
356300
357819
|
start: point10,
|
|
356301
357820
|
end: point10,
|
|
356302
|
-
width:
|
|
357821
|
+
width: distance51,
|
|
356303
357822
|
start_layer: layer_ref3,
|
|
356304
357823
|
end_layer: layer_ref3,
|
|
356305
357824
|
pcb_smtpad_id: z111.string().optional(),
|
|
@@ -356347,8 +357866,8 @@ var pcb_trace_too_long_warning2 = z1132.object({
|
|
|
356347
357866
|
pcb_trace_id: z1132.string(),
|
|
356348
357867
|
source_net_id: z1132.string().optional(),
|
|
356349
357868
|
source_trace_id: z1132.string().optional(),
|
|
356350
|
-
actual_trace_length:
|
|
356351
|
-
maximum_trace_length:
|
|
357869
|
+
actual_trace_length: distance51,
|
|
357870
|
+
maximum_trace_length: distance51,
|
|
356352
357871
|
subcircuit_id: z1132.string().optional()
|
|
356353
357872
|
}).describe("Warning emitted when a PCB trace is longer than its maximum allowed length");
|
|
356354
357873
|
expectTypesMatch3(true);
|
|
@@ -356418,10 +357937,10 @@ var pcb_via2 = z120.object({
|
|
|
356418
357937
|
pcb_group_id: z120.string().optional(),
|
|
356419
357938
|
subcircuit_id: z120.string().optional(),
|
|
356420
357939
|
subcircuit_connectivity_map_key: z120.string().optional(),
|
|
356421
|
-
x:
|
|
356422
|
-
y:
|
|
356423
|
-
outer_diameter:
|
|
356424
|
-
hole_diameter:
|
|
357940
|
+
x: distance51,
|
|
357941
|
+
y: distance51,
|
|
357942
|
+
outer_diameter: distance51.default("0.6mm"),
|
|
357943
|
+
hole_diameter: distance51.default("0.25mm"),
|
|
356425
357944
|
from_layer: layer_ref3.optional(),
|
|
356426
357945
|
to_layer: layer_ref3.optional(),
|
|
356427
357946
|
layers: z120.array(layer_ref3),
|
|
@@ -356509,11 +358028,11 @@ var pcb_silkscreen_line2 = z127.object({
|
|
|
356509
358028
|
pcb_component_id: z127.string(),
|
|
356510
358029
|
pcb_group_id: z127.string().optional(),
|
|
356511
358030
|
subcircuit_id: z127.string().optional(),
|
|
356512
|
-
stroke_width:
|
|
356513
|
-
x1:
|
|
356514
|
-
y1:
|
|
356515
|
-
x2:
|
|
356516
|
-
y2:
|
|
358031
|
+
stroke_width: distance51.default("0.1mm"),
|
|
358032
|
+
x1: distance51,
|
|
358033
|
+
y1: distance51,
|
|
358034
|
+
x2: distance51,
|
|
358035
|
+
y2: distance51,
|
|
356517
358036
|
layer: visible_layer2
|
|
356518
358037
|
}).describe("Defines a silkscreen line on the PCB");
|
|
356519
358038
|
expectTypesMatch3(true);
|
|
@@ -356534,7 +358053,7 @@ var pcb_silkscreen_text2 = z129.object({
|
|
|
356534
358053
|
pcb_group_id: z129.string().optional(),
|
|
356535
358054
|
subcircuit_id: z129.string().optional(),
|
|
356536
358055
|
font: z129.literal("tscircuit2024").default("tscircuit2024"),
|
|
356537
|
-
font_size:
|
|
358056
|
+
font_size: distance51.default("0.2mm"),
|
|
356538
358057
|
pcb_component_id: z129.string(),
|
|
356539
358058
|
text: z129.string(),
|
|
356540
358059
|
is_knockout: z129.boolean().default(false).optional(),
|
|
@@ -356562,7 +358081,7 @@ var pcb_copper_text2 = z130.object({
|
|
|
356562
358081
|
pcb_group_id: z130.string().optional(),
|
|
356563
358082
|
subcircuit_id: z130.string().optional(),
|
|
356564
358083
|
font: z130.literal("tscircuit2024").default("tscircuit2024"),
|
|
356565
|
-
font_size:
|
|
358084
|
+
font_size: distance51.default("0.2mm"),
|
|
356566
358085
|
pcb_component_id: z130.string(),
|
|
356567
358086
|
text: z130.string(),
|
|
356568
358087
|
is_knockout: z130.boolean().default(false).optional(),
|
|
@@ -356622,8 +358141,8 @@ var pcb_silkscreen_oval2 = z1332.object({
|
|
|
356622
358141
|
pcb_group_id: z1332.string().optional(),
|
|
356623
358142
|
subcircuit_id: z1332.string().optional(),
|
|
356624
358143
|
center: point10,
|
|
356625
|
-
radius_x:
|
|
356626
|
-
radius_y:
|
|
358144
|
+
radius_x: distance51,
|
|
358145
|
+
radius_y: distance51,
|
|
356627
358146
|
layer: visible_layer2,
|
|
356628
358147
|
ccw_rotation: rotation12.optional()
|
|
356629
358148
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
@@ -356663,7 +358182,7 @@ var pcb_fabrication_note_text3 = z136.object({
|
|
|
356663
358182
|
subcircuit_id: z136.string().optional(),
|
|
356664
358183
|
pcb_group_id: z136.string().optional(),
|
|
356665
358184
|
font: z136.literal("tscircuit2024").default("tscircuit2024"),
|
|
356666
|
-
font_size:
|
|
358185
|
+
font_size: distance51.default("1mm"),
|
|
356667
358186
|
pcb_component_id: z136.string(),
|
|
356668
358187
|
text: z136.string(),
|
|
356669
358188
|
ccw_rotation: z136.number().optional(),
|
|
@@ -356733,7 +358252,7 @@ var pcb_note_text3 = z140.object({
|
|
|
356733
358252
|
subcircuit_id: z140.string().optional(),
|
|
356734
358253
|
name: z140.string().optional(),
|
|
356735
358254
|
font: z140.literal("tscircuit2024").default("tscircuit2024"),
|
|
356736
|
-
font_size:
|
|
358255
|
+
font_size: distance51.default("1mm"),
|
|
356737
358256
|
text: z140.string().optional(),
|
|
356738
358257
|
anchor_position: point10.default({ x: 0, y: 0 }),
|
|
356739
358258
|
anchor_alignment: z140.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
@@ -356784,12 +358303,12 @@ var pcb_note_line3 = z1432.object({
|
|
|
356784
358303
|
subcircuit_id: z1432.string().optional(),
|
|
356785
358304
|
name: z1432.string().optional(),
|
|
356786
358305
|
text: z1432.string().optional(),
|
|
356787
|
-
x1:
|
|
356788
|
-
y1:
|
|
356789
|
-
x2:
|
|
356790
|
-
y2:
|
|
358306
|
+
x1: distance51,
|
|
358307
|
+
y1: distance51,
|
|
358308
|
+
x2: distance51,
|
|
358309
|
+
y2: distance51,
|
|
356791
358310
|
layer: visible_layer2.default("top"),
|
|
356792
|
-
stroke_width:
|
|
358311
|
+
stroke_width: distance51.default("0.1mm"),
|
|
356793
358312
|
color: z1432.string().optional(),
|
|
356794
358313
|
is_dashed: z1432.boolean().optional()
|
|
356795
358314
|
}).describe("Defines a straight documentation note line on the PCB");
|
|
@@ -356840,8 +358359,8 @@ var pcb_keepout3 = z147.object({
|
|
|
356840
358359
|
pcb_group_id: z147.string().optional(),
|
|
356841
358360
|
subcircuit_id: z147.string().optional(),
|
|
356842
358361
|
center: point10,
|
|
356843
|
-
width:
|
|
356844
|
-
height:
|
|
358362
|
+
width: distance51,
|
|
358363
|
+
height: distance51,
|
|
356845
358364
|
pcb_keepout_id: z147.string(),
|
|
356846
358365
|
layers: z147.array(z147.string()),
|
|
356847
358366
|
description: z147.string().optional(),
|
|
@@ -356852,7 +358371,7 @@ var pcb_keepout3 = z147.object({
|
|
|
356852
358371
|
pcb_group_id: z147.string().optional(),
|
|
356853
358372
|
subcircuit_id: z147.string().optional(),
|
|
356854
358373
|
center: point10,
|
|
356855
|
-
radius:
|
|
358374
|
+
radius: distance51,
|
|
356856
358375
|
pcb_keepout_id: z147.string(),
|
|
356857
358376
|
layers: z147.array(z147.string()),
|
|
356858
358377
|
description: z147.string().optional(),
|
|
@@ -357028,8 +358547,8 @@ var pcb_breakout_point2 = z158.object({
|
|
|
357028
358547
|
source_port_id: z158.string().optional(),
|
|
357029
358548
|
source_net_id: z158.string().optional(),
|
|
357030
358549
|
layer: layer_ref3.optional(),
|
|
357031
|
-
x:
|
|
357032
|
-
y:
|
|
358550
|
+
x: distance51,
|
|
358551
|
+
y: distance51
|
|
357033
358552
|
}).describe("Defines a routing target within a pcb_group for a source_trace or source_net");
|
|
357034
358553
|
expectTypesMatch3(true);
|
|
357035
358554
|
var pcb_ground_plane2 = z159.object({
|
|
@@ -357057,9 +358576,9 @@ var pcb_thermal_spoke2 = z161.object({
|
|
|
357057
358576
|
pcb_ground_plane_id: z161.string(),
|
|
357058
358577
|
shape: z161.string(),
|
|
357059
358578
|
spoke_count: z161.number(),
|
|
357060
|
-
spoke_thickness:
|
|
357061
|
-
spoke_inner_diameter:
|
|
357062
|
-
spoke_outer_diameter:
|
|
358579
|
+
spoke_thickness: distance51,
|
|
358580
|
+
spoke_inner_diameter: distance51,
|
|
358581
|
+
spoke_outer_diameter: distance51,
|
|
357063
358582
|
pcb_plated_hole_id: z161.string().optional(),
|
|
357064
358583
|
subcircuit_id: z161.string().optional()
|
|
357065
358584
|
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
@@ -357141,8 +358660,8 @@ var pcb_via_clearance_error2 = base_circuit_json_error2.extend({
|
|
|
357141
358660
|
pcb_error_id: getZodPrefixedIdWithDefault2("pcb_error"),
|
|
357142
358661
|
error_type: z166.literal("pcb_via_clearance_error").default("pcb_via_clearance_error"),
|
|
357143
358662
|
pcb_via_ids: z166.array(z166.string()).min(2),
|
|
357144
|
-
minimum_clearance:
|
|
357145
|
-
actual_clearance:
|
|
358663
|
+
minimum_clearance: distance51.optional(),
|
|
358664
|
+
actual_clearance: distance51.optional(),
|
|
357146
358665
|
pcb_center: z166.object({
|
|
357147
358666
|
x: z166.number().optional(),
|
|
357148
358667
|
y: z166.number().optional()
|
|
@@ -357156,8 +358675,8 @@ var pcb_via_trace_clearance_error2 = base_circuit_json_error2.extend({
|
|
|
357156
358675
|
error_type: z167.literal("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),
|
|
357157
358676
|
pcb_via_id: z167.string(),
|
|
357158
358677
|
pcb_trace_id: z167.string(),
|
|
357159
|
-
minimum_clearance:
|
|
357160
|
-
actual_clearance:
|
|
358678
|
+
minimum_clearance: distance51.optional(),
|
|
358679
|
+
actual_clearance: distance51.optional(),
|
|
357161
358680
|
center: z167.object({
|
|
357162
358681
|
x: z167.number().optional(),
|
|
357163
358682
|
y: z167.number().optional()
|
|
@@ -357170,8 +358689,8 @@ var pcb_pad_pad_clearance_error2 = base_circuit_json_error2.extend({
|
|
|
357170
358689
|
pcb_pad_pad_clearance_error_id: getZodPrefixedIdWithDefault2("pcb_pad_pad_clearance_error"),
|
|
357171
358690
|
error_type: z168.literal("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),
|
|
357172
358691
|
pcb_pad_ids: z168.array(z168.string()).min(2),
|
|
357173
|
-
minimum_clearance:
|
|
357174
|
-
actual_clearance:
|
|
358692
|
+
minimum_clearance: distance51.optional(),
|
|
358693
|
+
actual_clearance: distance51.optional(),
|
|
357175
358694
|
center: z168.object({
|
|
357176
358695
|
x: z168.number().optional(),
|
|
357177
358696
|
y: z168.number().optional()
|
|
@@ -357185,8 +358704,8 @@ var pcb_pad_trace_clearance_error2 = base_circuit_json_error2.extend({
|
|
|
357185
358704
|
error_type: z169.literal("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),
|
|
357186
358705
|
pcb_pad_id: z169.string(),
|
|
357187
358706
|
pcb_trace_id: z169.string(),
|
|
357188
|
-
minimum_clearance:
|
|
357189
|
-
actual_clearance:
|
|
358707
|
+
minimum_clearance: distance51.optional(),
|
|
358708
|
+
actual_clearance: distance51.optional(),
|
|
357190
358709
|
center: z169.object({
|
|
357191
358710
|
x: z169.number().optional(),
|
|
357192
358711
|
y: z169.number().optional()
|