@tscircuit/cli 0.1.1161 → 0.1.1162

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/lib/index.js CHANGED
@@ -60445,7 +60445,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60445
60445
  }));
60446
60446
  };
60447
60447
  // package.json
60448
- var version = "0.1.1160";
60448
+ var version = "0.1.1161";
60449
60449
  var package_default = {
60450
60450
  name: "@tscircuit/cli",
60451
60451
  version,
@@ -60477,7 +60477,7 @@ var package_default = {
60477
60477
  "bun-match-svg": "^0.0.12",
60478
60478
  chokidar: "4.0.1",
60479
60479
  "circuit-json": "^0.0.403",
60480
- "circuit-json-to-kicad": "^0.0.87",
60480
+ "circuit-json-to-kicad": "^0.0.89",
60481
60481
  "circuit-json-to-readable-netlist": "^0.0.15",
60482
60482
  "circuit-json-to-spice": "^0.0.10",
60483
60483
  "circuit-json-to-tscircuit": "^0.0.9",
@@ -63175,6 +63175,8 @@ import { Segment, SegmentNet } from "kicadts";
63175
63175
  import { applyToPoint as applyToPoint14 } from "transformation-matrix";
63176
63176
  import { Via, ViaNet } from "kicadts";
63177
63177
  import { applyToPoint as applyToPoint15 } from "transformation-matrix";
63178
+ import { Footprint as Footprint4 } from "kicadts";
63179
+ import { applyToPoint as applyToPoint16 } from "transformation-matrix";
63178
63180
  import { GrLine } from "kicadts";
63179
63181
  import {
63180
63182
  At as At2,
@@ -63183,8 +63185,8 @@ import {
63183
63185
  TextEffectsFont as TextEffectsFont10,
63184
63186
  TextEffectsJustify as TextEffectsJustify3
63185
63187
  } from "kicadts";
63186
- import { applyToPoint as applyToPoint16 } from "transformation-matrix";
63187
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
63188
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
63189
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
63188
63190
  import {
63189
63191
  GrText as GrText2,
63190
63192
  TextEffects as TextEffects11,
@@ -63192,7 +63194,7 @@ import {
63192
63194
  TextEffectsJustify as TextEffectsJustify4,
63193
63195
  At as At3
63194
63196
  } from "kicadts";
63195
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
63197
+ import { applyToPoint as applyToPoint18 } from "transformation-matrix";
63196
63198
  import { cju as cju3 } from "@tscircuit/circuit-json-util";
63197
63199
  import { cju as cju4 } from "@tscircuit/circuit-json-util";
63198
63200
  import { parseKicadSexpr as parseKicadSexpr2, KicadSch as KicadSch2 } from "kicadts";
@@ -63200,7 +63202,7 @@ import { KicadSymbolLib } from "kicadts";
63200
63202
  import { parseKicadMod } from "kicadts";
63201
63203
  import {
63202
63204
  parseKicadSexpr as parseKicadSexpr3,
63203
- Footprint as Footprint4,
63205
+ Footprint as Footprint5,
63204
63206
  Property as Property3,
63205
63207
  TextEffects as TextEffects12,
63206
63208
  TextEffectsFont as TextEffectsFont12
@@ -65829,7 +65831,7 @@ var AddFootprintsStage = class extends ConverterStage {
65829
65831
  const pcbPlatedHoles = this.ctx.db.pcb_plated_hole?.list().filter((hole) => hole.pcb_component_id === component.pcb_component_id) || [];
65830
65832
  const { pads: thruHolePads } = convertPlatedHoles(pcbPlatedHoles, component.center, component.rotation || 0, component.pcb_component_id, nextPadNumber, getNetInfo);
65831
65833
  fpPads.push(...thruHolePads);
65832
- const pcbHoles = this.ctx.db.pcb_hole?.list().filter((hole) => hole.subcircuit_id === component.subcircuit_id) || [];
65834
+ const pcbHoles = this.ctx.db.pcb_hole?.list().filter((hole) => hole.pcb_component_id === component.pcb_component_id) || [];
65833
65835
  const npthPads = convertNpthHoles(pcbHoles, component.center, component.rotation || 0);
65834
65836
  fpPads.push(...npthPads);
65835
65837
  footprint.fpPads = fpPads;
@@ -66101,6 +66103,52 @@ var AddViasStage = class extends ConverterStage {
66101
66103
  return this.ctx.kicadPcb;
66102
66104
  }
66103
66105
  };
66106
+ var AddStandalonePcbElements = class extends ConverterStage {
66107
+ holesProcessed = 0;
66108
+ standaloneHoles = [];
66109
+ constructor(input, ctx) {
66110
+ super(input, ctx);
66111
+ this.standaloneHoles = this.ctx.db.pcb_hole.list().filter((hole) => !hole.pcb_component_id);
66112
+ }
66113
+ _step() {
66114
+ const { kicadPcb, c2kMatPcb } = this.ctx;
66115
+ if (!kicadPcb) {
66116
+ throw new Error("KicadPcb instance not initialized in context");
66117
+ }
66118
+ if (!c2kMatPcb) {
66119
+ throw new Error("PCB transformation matrix not initialized in context");
66120
+ }
66121
+ if (this.holesProcessed >= this.standaloneHoles.length) {
66122
+ this.finished = true;
66123
+ return;
66124
+ }
66125
+ const hole = this.standaloneHoles[this.holesProcessed];
66126
+ if (!hole) {
66127
+ this.holesProcessed++;
66128
+ return;
66129
+ }
66130
+ const boardOrigin = applyToPoint16(c2kMatPcb, { x: 0, y: 0 });
66131
+ const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
66132
+ const footprint = new Footprint4({
66133
+ libraryLink: "tscircuit:MountingHole",
66134
+ layer: "F.Cu",
66135
+ at: [boardOrigin.x, boardOrigin.y, 0],
66136
+ uuid: generateDeterministicUuid(footprintSeed)
66137
+ });
66138
+ const ccwRotationDegrees = 0;
66139
+ const npthPads = convertNpthHoles([hole], { x: 0, y: 0 }, ccwRotationDegrees);
66140
+ if (npthPads.length > 0) {
66141
+ footprint.fpPads = npthPads;
66142
+ const footprints = kicadPcb.footprints;
66143
+ footprints.push(footprint);
66144
+ kicadPcb.footprints = footprints;
66145
+ }
66146
+ this.holesProcessed++;
66147
+ }
66148
+ getOutput() {
66149
+ return this.ctx.kicadPcb;
66150
+ }
66151
+ };
66104
66152
  function createFabricationNoteTextFromCircuitJson({
66105
66153
  textElement,
66106
66154
  c2kMatPcb
@@ -66108,7 +66156,7 @@ function createFabricationNoteTextFromCircuitJson({
66108
66156
  if (!textElement.text || !textElement.anchor_position) {
66109
66157
  return null;
66110
66158
  }
66111
- const transformedPos = applyToPoint16(c2kMatPcb, {
66159
+ const transformedPos = applyToPoint17(c2kMatPcb, {
66112
66160
  x: textElement.anchor_position.x,
66113
66161
  y: textElement.anchor_position.y
66114
66162
  });
@@ -66164,7 +66212,7 @@ function createGrTextFromCircuitJson({
66164
66212
  if (!textElement.text || !textElement.anchor_position) {
66165
66213
  return null;
66166
66214
  }
66167
- const transformedPos = applyToPoint17(c2kMatPcb, {
66215
+ const transformedPos = applyToPoint18(c2kMatPcb, {
66168
66216
  x: textElement.anchor_position.x,
66169
66217
  y: textElement.anchor_position.y
66170
66218
  });
@@ -66232,11 +66280,11 @@ var AddGraphicsStage = class extends ConverterStage {
66232
66280
  const endPoint = path7.route[i + 1];
66233
66281
  if (!startPoint || !endPoint)
66234
66282
  continue;
66235
- const transformedStart = applyToPoint18(c2kMatPcb, {
66283
+ const transformedStart = applyToPoint19(c2kMatPcb, {
66236
66284
  x: startPoint.x,
66237
66285
  y: startPoint.y
66238
66286
  });
66239
- const transformedEnd = applyToPoint18(c2kMatPcb, {
66287
+ const transformedEnd = applyToPoint19(c2kMatPcb, {
66240
66288
  x: endPoint.x,
66241
66289
  y: endPoint.y
66242
66290
  });
@@ -66300,7 +66348,7 @@ var AddGraphicsStage = class extends ConverterStage {
66300
66348
  { x: board.center.x - halfWidth, y: board.center.y + halfHeight }
66301
66349
  ];
66302
66350
  }
66303
- const transformedCorners = corners.map((corner) => applyToPoint18(c2kMatPcb, corner));
66351
+ const transformedCorners = corners.map((corner) => applyToPoint19(c2kMatPcb, corner));
66304
66352
  for (let i = 0;i < transformedCorners.length; i++) {
66305
66353
  const start = transformedCorners[i];
66306
66354
  const end = transformedCorners[(i + 1) % transformedCorners.length];
@@ -66354,6 +66402,7 @@ var CircuitJsonToKicadPcbConverter = class {
66354
66402
  }),
66355
66403
  new AddTracesStage(circuitJson, this.ctx),
66356
66404
  new AddViasStage(circuitJson, this.ctx),
66405
+ new AddStandalonePcbElements(circuitJson, this.ctx),
66357
66406
  new AddGraphicsStage(circuitJson, this.ctx)
66358
66407
  ];
66359
66408
  }
@@ -66757,7 +66806,7 @@ function createTextEffects3(metadataEffects) {
66757
66806
  function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
66758
66807
  try {
66759
66808
  const parsed = parseKicadSexpr3(kicadModString);
66760
- const footprint = parsed.find((node) => node instanceof Footprint4);
66809
+ const footprint = parsed.find((node) => node instanceof Footprint5);
66761
66810
  if (!footprint) {
66762
66811
  return kicadModString;
66763
66812
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1161",
3
+ "version": "0.1.1162",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -29,7 +29,7 @@
29
29
  "bun-match-svg": "^0.0.12",
30
30
  "chokidar": "4.0.1",
31
31
  "circuit-json": "^0.0.403",
32
- "circuit-json-to-kicad": "^0.0.87",
32
+ "circuit-json-to-kicad": "^0.0.89",
33
33
  "circuit-json-to-readable-netlist": "^0.0.15",
34
34
  "circuit-json-to-spice": "^0.0.10",
35
35
  "circuit-json-to-tscircuit": "^0.0.9",