@tscircuit/cli 0.1.1152 → 0.1.1153

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 CHANGED
@@ -98175,7 +98175,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
98175
98175
  // lib/getVersion.ts
98176
98176
  import { createRequire as createRequire2 } from "node:module";
98177
98177
  // package.json
98178
- var version = "0.1.1151";
98178
+ var version = "0.1.1152";
98179
98179
  var package_default = {
98180
98180
  name: "@tscircuit/cli",
98181
98181
  version,
@@ -98207,7 +98207,7 @@ var package_default = {
98207
98207
  "bun-match-svg": "^0.0.12",
98208
98208
  chokidar: "4.0.1",
98209
98209
  "circuit-json": "^0.0.403",
98210
- "circuit-json-to-kicad": "^0.0.86",
98210
+ "circuit-json-to-kicad": "^0.0.87",
98211
98211
  "circuit-json-to-readable-netlist": "^0.0.15",
98212
98212
  "circuit-json-to-spice": "^0.0.10",
98213
98213
  "circuit-json-to-tscircuit": "^0.0.9",
@@ -104436,17 +104436,18 @@ function convertNoteTexts(noteTexts, componentCenter, componentRotation) {
104436
104436
  }
104437
104437
  return fpTexts;
104438
104438
  }
104439
- function create3DModelsFromCadComponent(cadComponent, componentCenter) {
104439
+ function create3DModelsFromCadComponent(cadComponent, componentCenter, options) {
104440
104440
  const models = [];
104441
104441
  const modelUrl = cadComponent.model_step_url || cadComponent.model_wrl_url;
104442
104442
  if (!modelUrl)
104443
104443
  return models;
104444
104444
  const model = new FootprintModel3(modelUrl);
104445
104445
  if (cadComponent.position) {
104446
+ const boardLayerZOffset = options?.boardLayerZOffset ?? 0;
104446
104447
  model.offset = {
104447
104448
  x: (cadComponent.position.x || 0) - componentCenter.x,
104448
104449
  y: -((cadComponent.position.y || 0) - componentCenter.y),
104449
- z: cadComponent.position.z || 0
104450
+ z: (cadComponent.position.z || 0) - boardLayerZOffset
104450
104451
  };
104451
104452
  }
104452
104453
  if (cadComponent.rotation) {
@@ -104865,7 +104866,10 @@ var AddFootprintsStage = class extends ConverterStage {
104865
104866
  footprint.fpPolys = fpPolys;
104866
104867
  }
104867
104868
  if (cadComponent) {
104868
- const models = create3DModelsFromCadComponent(cadComponent, component.center);
104869
+ const pcbBoard = this.ctx.db.pcb_board?.list()[0];
104870
+ const boardThickness = pcbBoard?.thickness ?? 0;
104871
+ const boardLayerZOffset = component.layer === "bottom" ? -(boardThickness / 2) : boardThickness / 2;
104872
+ const models = create3DModelsFromCadComponent(cadComponent, component.center, { boardLayerZOffset });
104869
104873
  const KICAD_3D_BASE = "${KIPRJMOD}/3dmodels";
104870
104874
  if (models.length > 0) {
104871
104875
  if (this.includeBuiltin3dModels) {
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.1151";
60448
+ var version = "0.1.1152";
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.86",
60480
+ "circuit-json-to-kicad": "^0.0.87",
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",
@@ -65423,17 +65423,18 @@ function convertNoteTexts(noteTexts, componentCenter, componentRotation) {
65423
65423
  }
65424
65424
  return fpTexts;
65425
65425
  }
65426
- function create3DModelsFromCadComponent(cadComponent, componentCenter) {
65426
+ function create3DModelsFromCadComponent(cadComponent, componentCenter, options) {
65427
65427
  const models = [];
65428
65428
  const modelUrl = cadComponent.model_step_url || cadComponent.model_wrl_url;
65429
65429
  if (!modelUrl)
65430
65430
  return models;
65431
65431
  const model = new FootprintModel3(modelUrl);
65432
65432
  if (cadComponent.position) {
65433
+ const boardLayerZOffset = options?.boardLayerZOffset ?? 0;
65433
65434
  model.offset = {
65434
65435
  x: (cadComponent.position.x || 0) - componentCenter.x,
65435
65436
  y: -((cadComponent.position.y || 0) - componentCenter.y),
65436
- z: cadComponent.position.z || 0
65437
+ z: (cadComponent.position.z || 0) - boardLayerZOffset
65437
65438
  };
65438
65439
  }
65439
65440
  if (cadComponent.rotation) {
@@ -65852,7 +65853,10 @@ var AddFootprintsStage = class extends ConverterStage {
65852
65853
  footprint.fpPolys = fpPolys;
65853
65854
  }
65854
65855
  if (cadComponent) {
65855
- const models = create3DModelsFromCadComponent(cadComponent, component.center);
65856
+ const pcbBoard = this.ctx.db.pcb_board?.list()[0];
65857
+ const boardThickness = pcbBoard?.thickness ?? 0;
65858
+ const boardLayerZOffset = component.layer === "bottom" ? -(boardThickness / 2) : boardThickness / 2;
65859
+ const models = create3DModelsFromCadComponent(cadComponent, component.center, { boardLayerZOffset });
65856
65860
  const KICAD_3D_BASE = "${KIPRJMOD}/3dmodels";
65857
65861
  if (models.length > 0) {
65858
65862
  if (this.includeBuiltin3dModels) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1152",
3
+ "version": "0.1.1153",
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.86",
32
+ "circuit-json-to-kicad": "^0.0.87",
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",