@tscircuit/core 0.0.1262 → 0.0.1264

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -17489,6 +17489,7 @@ import Debug11 from "debug";
17489
17489
 
17490
17490
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
17491
17491
  import "@tscircuit/schematic-trace-solver";
17492
+ var DEFAULT_MAX_MSP_PAIR_DISTANCE = 2.4;
17492
17493
  function createSchematicTraceSolverInputProblem(group) {
17493
17494
  const { db } = group.root;
17494
17495
  const connKeyToSourceNet = /* @__PURE__ */ new Map();
@@ -17613,9 +17614,28 @@ function createSchematicTraceSolverInputProblem(group) {
17613
17614
  if (st.subcircuit_connectivity_map_key) {
17614
17615
  userNetIdToConnKey.set(userNetId, st.subcircuit_connectivity_map_key);
17615
17616
  }
17617
+ const portA = db.schematic_port.get(a);
17618
+ const portB = db.schematic_port.get(b);
17619
+ let portDistance = 0;
17620
+ if (portA && portB) {
17621
+ portDistance = Math.sqrt(
17622
+ (portA.center.x - portB.center.x) ** 2 + (portA.center.y - portB.center.y) ** 2
17623
+ );
17624
+ }
17625
+ const maxMspDist = group._parsedProps.schMaxTraceDistance ?? DEFAULT_MAX_MSP_PAIR_DISTANCE;
17626
+ let netLabelWidth;
17627
+ if (st.display_name && !st.display_name.startsWith(".") && portDistance > maxMspDist) {
17628
+ netLabelWidth = Number(
17629
+ getSchematicNetLabelTextWidth({
17630
+ text: String(st.display_name),
17631
+ font_size: 0.14
17632
+ }).toFixed(2)
17633
+ );
17634
+ }
17616
17635
  directConnections.push({
17617
17636
  pinIds: [a, b].map((id) => schematicPortIdToPinId.get(id)),
17618
- netId: userNetId
17637
+ netId: userNetId,
17638
+ netLabelWidth
17619
17639
  });
17620
17640
  }
17621
17641
  }
@@ -17678,7 +17698,7 @@ function createSchematicTraceSolverInputProblem(group) {
17678
17698
  directConnections,
17679
17699
  netConnections,
17680
17700
  availableNetLabelOrientations,
17681
- maxMspPairDistance: group._parsedProps.schMaxTraceDistance ?? 2.4
17701
+ maxMspPairDistance: group._parsedProps.schMaxTraceDistance ?? DEFAULT_MAX_MSP_PAIR_DISTANCE
17682
17702
  };
17683
17703
  return {
17684
17704
  inputProblem,
@@ -20360,9 +20380,20 @@ var Group5 = class extends NormalComponent3 {
20360
20380
  const { traces: routedTraces } = this._asyncAutoroutingResult.output_simple_route_json;
20361
20381
  if (!routedTraces) return;
20362
20382
  for (const routedTrace of routedTraces) {
20383
+ const cjRoute = routedTrace.route.map((point6) => {
20384
+ if (point6.route_type !== "through_obstacle") return point6;
20385
+ return {
20386
+ route_type: "through_pad",
20387
+ start: point6.start,
20388
+ end: point6.end,
20389
+ start_layer: point6.from_layer,
20390
+ end_layer: point6.to_layer,
20391
+ width: point6.width
20392
+ };
20393
+ });
20363
20394
  const pcb_trace = db.pcb_trace.insert({
20364
20395
  subcircuit_id: this.subcircuit_id,
20365
- route: routedTrace.route
20396
+ route: cjRoute
20366
20397
  // source_trace_id: circuitTrace.source_trace_id!,
20367
20398
  });
20368
20399
  }
@@ -20410,9 +20441,20 @@ var Group5 = class extends NormalComponent3 {
20410
20441
  delete pcb_trace.source_trace_id;
20411
20442
  }
20412
20443
  pcb_trace.subcircuit_id ??= (sourceTraceId ? db.source_trace.get(sourceTraceId)?.subcircuit_id ?? db.source_net.get(sourceTraceId)?.subcircuit_id : void 0) ?? this.subcircuit_id;
20413
- let segments = splitPcbTracesOnJumperSegments(pcb_trace.route);
20444
+ const cjRoute = pcb_trace.route.map((point6) => {
20445
+ if (point6.route_type !== "through_obstacle") return point6;
20446
+ return {
20447
+ route_type: "through_pad",
20448
+ start: point6.start,
20449
+ end: point6.end,
20450
+ start_layer: point6.from_layer,
20451
+ end_layer: point6.to_layer,
20452
+ width: point6.width
20453
+ };
20454
+ });
20455
+ let segments = splitPcbTracesOnJumperSegments(cjRoute);
20414
20456
  if (segments === null) {
20415
- segments = [pcb_trace.route];
20457
+ segments = [cjRoute];
20416
20458
  }
20417
20459
  const processedSegments = addPortIdsToTracesAtJumperPads(segments, db);
20418
20460
  for (const segment2 of processedSegments) {
@@ -21508,7 +21550,7 @@ import { identity as identity5 } from "transformation-matrix";
21508
21550
  var package_default = {
21509
21551
  name: "@tscircuit/core",
21510
21552
  type: "module",
21511
- version: "0.0.1261",
21553
+ version: "0.0.1263",
21512
21554
  types: "dist/index.d.ts",
21513
21555
  main: "dist/index.js",
21514
21556
  module: "dist/index.js",
@@ -21557,7 +21599,7 @@ var package_default = {
21557
21599
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
21558
21600
  "@tscircuit/props": "^0.0.536",
21559
21601
  "@tscircuit/schematic-match-adapt": "^0.0.16",
21560
- "@tscircuit/schematic-trace-solver": "^0.0.57",
21602
+ "@tscircuit/schematic-trace-solver": "^0.0.60",
21561
21603
  "@tscircuit/solver-utils": "^0.0.3",
21562
21604
  "@tscircuit/soup-util": "^0.0.41",
21563
21605
  "@types/bun": "^1.2.16",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1262",
4
+ "version": "0.0.1264",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
51
51
  "@tscircuit/props": "^0.0.536",
52
52
  "@tscircuit/schematic-match-adapt": "^0.0.16",
53
- "@tscircuit/schematic-trace-solver": "^0.0.57",
53
+ "@tscircuit/schematic-trace-solver": "^0.0.60",
54
54
  "@tscircuit/solver-utils": "^0.0.3",
55
55
  "@tscircuit/soup-util": "^0.0.41",
56
56
  "@types/bun": "^1.2.16",