circuit-json-to-gltf 0.0.27 → 0.0.29

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 +12 -20
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -14478,7 +14478,6 @@ import { getJscadModelForFootprint } from "jscad-electronics/vanilla";
14478
14478
  import { convertJscadModelToGltf } from "jscad-to-gltf";
14479
14479
  var footprinterCache = /* @__PURE__ */ new Map();
14480
14480
  async function generateFootprinterMesh(footprinterString, transform) {
14481
- console.log(`Generating footprinter model for ${footprinterString}`);
14482
14481
  const renderedModel = getJscadModelForFootprint(
14483
14482
  footprinterString,
14484
14483
  jscadModeling
@@ -14941,11 +14940,11 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
14941
14940
  };
14942
14941
  const center = cad.position ? {
14943
14942
  x: cad.position.x,
14944
- y: isBottomLayer ? -Math.abs(cad.position.z) : cad.position.z,
14943
+ y: cad.position.z,
14945
14944
  z: cad.position.y
14946
14945
  } : {
14947
14946
  x: pcbComponent?.center.x ?? 0,
14948
- y: isBottomLayer ? -(effectiveBoardThickness + size.y / 2) : effectiveBoardThickness / 2 + size.y / 2,
14947
+ y: isBottomLayer ? -(effectiveBoardThickness / 2 + size.y / 2) : effectiveBoardThickness / 2 + size.y / 2,
14949
14948
  z: pcbComponent?.center.y ?? 0
14950
14949
  };
14951
14950
  const meshType = model_stl_url ? "stl" : model_obj_url ? "obj" : model_gltf_url ? "gltf" : model_glb_url ? "glb" : hasFootprinterModel ? "glb" : void 0;
@@ -14958,27 +14957,20 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
14958
14957
  box.meshType = meshType;
14959
14958
  }
14960
14959
  if (cad.rotation) {
14961
- if (model_glb_url || model_gltf_url || hasFootprinterModel) {
14962
- box.rotation = convertRotationFromCadRotation({
14963
- x: isBottomLayer ? cad.rotation.x + 180 : cad.rotation.x,
14964
- y: cad.rotation.z,
14965
- // Circuit Z rotation becomes model Y rotation
14966
- z: cad.rotation.y
14967
- // Circuit Y rotation becomes model Z rotation
14968
- });
14969
- } else {
14970
- box.rotation = convertRotationFromCadRotation({
14971
- x: isBottomLayer ? cad.rotation.x + 180 : cad.rotation.x,
14972
- y: cad.rotation.y,
14973
- z: cad.rotation.z
14974
- });
14975
- }
14960
+ box.rotation = convertRotationFromCadRotation({
14961
+ x: cad.rotation.x,
14962
+ y: cad.rotation.z,
14963
+ // Circuit Z rotation becomes model Y rotation
14964
+ z: cad.rotation.y
14965
+ // Circuit Y rotation becomes model Z rotation
14966
+ });
14976
14967
  } else if (isBottomLayer) {
14977
14968
  if (model_glb_url || model_gltf_url || hasFootprinterModel) {
14978
14969
  box.rotation = convertRotationFromCadRotation({
14979
- x: 180,
14970
+ x: 0,
14980
14971
  y: 0,
14981
- z: 0
14972
+ z: 180
14973
+ // Flip via Z rotation for GLB models (matches circuit JSON convention)
14982
14974
  });
14983
14975
  } else {
14984
14976
  box.rotation = convertRotationFromCadRotation({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "circuit-json-to-gltf",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.27",
5
+ "version": "0.0.29",
6
6
  "scripts": {
7
7
  "test": "bun test tests/",
8
8
  "format": "biome format --write .",
@@ -30,7 +30,7 @@
30
30
  "@types/react-dom": "^19.1.7",
31
31
  "@vitejs/plugin-react": "^5.0.0",
32
32
  "bun-match-svg": "^0.0.12",
33
- "circuit-json": "^0.0.278",
33
+ "circuit-json": "^0.0.289",
34
34
  "circuit-to-svg": "^0.0.240",
35
35
  "graphics-debug": "^0.0.65",
36
36
  "looks-same": "^9.0.1",
@@ -39,7 +39,7 @@
39
39
  "react-cosmos": "^7.0.0",
40
40
  "react-cosmos-plugin-vite": "^7.0.0",
41
41
  "react-dom": "^19.1.1",
42
- "tscircuit": "^0.0.750",
42
+ "tscircuit": "^0.0.800",
43
43
  "tsup": "^8.5.0",
44
44
  "vite": "^7.1.1"
45
45
  },