circuit-json-to-gltf 0.0.26 → 0.0.28
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/index.js +12 -25
- 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
|
|
@@ -14592,7 +14591,6 @@ async function convertSvgToCanvasBrowser(svgString, resolution, backgroundColor)
|
|
|
14592
14591
|
});
|
|
14593
14592
|
}
|
|
14594
14593
|
async function renderBoardTextures(circuitJson, resolution = 1024) {
|
|
14595
|
-
console.log("Generating PCB texture...");
|
|
14596
14594
|
const [top, bottom] = await Promise.all([
|
|
14597
14595
|
renderBoardLayer(circuitJson, {
|
|
14598
14596
|
layer: "top",
|
|
@@ -14607,10 +14605,6 @@ async function renderBoardTextures(circuitJson, resolution = 1024) {
|
|
|
14607
14605
|
// Darker green for bottom layer
|
|
14608
14606
|
})
|
|
14609
14607
|
]);
|
|
14610
|
-
console.log("PCB texture generated:", {
|
|
14611
|
-
topLength: top.length,
|
|
14612
|
-
bottomLength: bottom.length
|
|
14613
|
-
});
|
|
14614
14608
|
return { top, bottom };
|
|
14615
14609
|
}
|
|
14616
14610
|
|
|
@@ -14946,11 +14940,11 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
|
|
|
14946
14940
|
};
|
|
14947
14941
|
const center = cad.position ? {
|
|
14948
14942
|
x: cad.position.x,
|
|
14949
|
-
y:
|
|
14943
|
+
y: cad.position.z,
|
|
14950
14944
|
z: cad.position.y
|
|
14951
14945
|
} : {
|
|
14952
14946
|
x: pcbComponent?.center.x ?? 0,
|
|
14953
|
-
y: isBottomLayer ? -(effectiveBoardThickness + size.y / 2) : effectiveBoardThickness / 2 + size.y / 2,
|
|
14947
|
+
y: isBottomLayer ? -(effectiveBoardThickness / 2 + size.y / 2) : effectiveBoardThickness / 2 + size.y / 2,
|
|
14954
14948
|
z: pcbComponent?.center.y ?? 0
|
|
14955
14949
|
};
|
|
14956
14950
|
const meshType = model_stl_url ? "stl" : model_obj_url ? "obj" : model_gltf_url ? "gltf" : model_glb_url ? "glb" : hasFootprinterModel ? "glb" : void 0;
|
|
@@ -14963,27 +14957,20 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
|
|
|
14963
14957
|
box.meshType = meshType;
|
|
14964
14958
|
}
|
|
14965
14959
|
if (cad.rotation) {
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
});
|
|
14974
|
-
} else {
|
|
14975
|
-
box.rotation = convertRotationFromCadRotation({
|
|
14976
|
-
x: isBottomLayer ? cad.rotation.x + 180 : cad.rotation.x,
|
|
14977
|
-
y: cad.rotation.y,
|
|
14978
|
-
z: cad.rotation.z
|
|
14979
|
-
});
|
|
14980
|
-
}
|
|
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
|
+
});
|
|
14981
14967
|
} else if (isBottomLayer) {
|
|
14982
14968
|
if (model_glb_url || model_gltf_url || hasFootprinterModel) {
|
|
14983
14969
|
box.rotation = convertRotationFromCadRotation({
|
|
14984
|
-
x:
|
|
14970
|
+
x: 0,
|
|
14985
14971
|
y: 0,
|
|
14986
|
-
z:
|
|
14972
|
+
z: 180
|
|
14973
|
+
// Flip via Z rotation for GLB models (matches circuit JSON convention)
|
|
14987
14974
|
});
|
|
14988
14975
|
} else {
|
|
14989
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.
|
|
5
|
+
"version": "0.0.28",
|
|
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.
|
|
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.
|
|
42
|
+
"tscircuit": "^0.0.800",
|
|
43
43
|
"tsup": "^8.5.0",
|
|
44
44
|
"vite": "^7.1.1"
|
|
45
45
|
},
|