Skip to content

Commit 4040b44

Browse files
authored
patch (#154)
1 parent 3a019d3 commit 4040b44

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

lib/utils/coordinate-transform.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export const COORDINATE_TRANSFORMS = {
106106
axisMapping: { x: "x", y: "z", z: "-y" },
107107
} as CoordinateTransformConfig,
108108

109-
// For step models, the models are being loaded inverted
109+
// STEP models need Y/Z remap without the extra 180-degree board-direction flip.
110110
STEP_INVERTED: {
111-
axisMapping: { x: "-x", y: "z", z: "-y" },
111+
axisMapping: { x: "x", y: "z", z: "y" },
112112
} as CoordinateTransformConfig,
113113

114114
// USB port fix: flip to top of board (flip Y axis after Z-up conversion)
-2 Bytes
Loading

tests/features/translucent-glb-models/translucent-cadmodel.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ test("translucent-cadmodel-standalone", async () => {
1515
<cadassembly>
1616
<cadmodel
1717
modelUrl="https://modelcdn.tscircuit.com/jscad_models/soic8.step"
18-
rotationOffset={{ x: 0, y: 0, z: 180 }}
1918
showAsTranslucentModel
2019
/>
2120
</cadassembly>

tests/repro/repro6.test.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ test("STEP CAD Model should be included in GLTF output", async () => {
1313
footprint="soic8"
1414
cadModel={
1515
<cadassembly>
16-
<cadmodel
17-
modelUrl="https://modelcdn.tscircuit.com/jscad_models/soic8.step"
18-
rotationOffset={{ x: 0, y: 0, z: 180 }}
19-
/>
16+
<cadmodel modelUrl="https://modelcdn.tscircuit.com/jscad_models/soic8.step" />
2017
</cadassembly>
2118
}
2219
/>
@@ -43,4 +40,4 @@ test("STEP CAD Model should be included in GLTF output", async () => {
4340
expect(
4441
renderGLTFToPNGBufferFromGLBBuffer(glb as ArrayBuffer, cameraOptions),
4542
).toMatchPngSnapshot(import.meta.path)
46-
})
43+
}, 20000)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { expect, test } from "bun:test"
2+
import {
3+
COORDINATE_TRANSFORMS,
4+
applyCoordinateTransform,
5+
} from "../../lib/utils/coordinate-transform"
6+
7+
test("STEP transform preserves board direction while remapping STEP axes", () => {
8+
expect(
9+
applyCoordinateTransform(
10+
{ x: 1, y: 2, z: 3 },
11+
COORDINATE_TRANSFORMS.STEP_INVERTED,
12+
),
13+
).toEqual({ x: 1, y: 3, z: 2 })
14+
})

0 commit comments

Comments
 (0)