diff --git a/e2e/playwright/export-snapshots/gltf-binary.png b/e2e/playwright/export-snapshots/gltf-binary.png index 92a3c5938..aa42dc8e0 100644 Binary files a/e2e/playwright/export-snapshots/gltf-binary.png and b/e2e/playwright/export-snapshots/gltf-binary.png differ diff --git a/e2e/playwright/export-snapshots/gltf-embedded.png b/e2e/playwright/export-snapshots/gltf-embedded.png index 92a3c5938..aa42dc8e0 100644 Binary files a/e2e/playwright/export-snapshots/gltf-embedded.png and b/e2e/playwright/export-snapshots/gltf-embedded.png differ diff --git a/e2e/playwright/export-snapshots/gltf-standard-2.gltf b/e2e/playwright/export-snapshots/gltf-standard-2.gltf index ffaf92e17..c2ea5eafc 100644 --- a/e2e/playwright/export-snapshots/gltf-standard-2.gltf +++ b/e2e/playwright/export-snapshots/gltf-standard-2.gltf @@ -8,13 +8,13 @@ "type": "VEC3", "min": [ 0, - -0.02539999969303608, + -0.6451600193977356, -0 ], "max": [ 0, 0, - 0.10159999877214432 + 2.5806400775909424 ] }, { @@ -39,13 +39,13 @@ "type": "VEC3", "min": [ 0, - -0.02539999969303608, + -0.6451600193977356, -0 ], "max": [ - 0.07861346751451492, - -0.02539999969303608, - 0.10159999877214432 + 1.9967820644378664, + -0.6451600193977356, + 2.5806400775909424 ] }, { @@ -69,14 +69,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.07861346751451492, - -0.07620000094175339, + 1.9967820644378664, + -1.935479998588562, -0 ], "max": [ - 0.15116338431835177, - -0.02539999969303608, - 0.10159999877214432 + 3.839550018310547, + -0.6451600193977356, + 2.5806400775909424 ] }, { @@ -100,14 +100,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.15116338431835177, - -0.07620000094175339, + 3.839550018310547, + -1.935479998588562, -0 ], "max": [ - 0.24130000174045563, - -0.07620000094175339, - 0.10159999877214432 + 6.1290202140808105, + -1.935479998588562, + 2.5806400775909424 ] }, { @@ -131,14 +131,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.24130000174045563, - -0.07620000094175339, + 6.1290202140808105, + -1.935479998588562, -0 ], "max": [ - 0.24130000174045563, - -0.06350000202655792, - 0.10159999877214432 + 6.1290202140808105, + -1.6129000186920166, + 2.5806400775909424 ] }, { @@ -162,14 +162,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.15516768395900726, - -0.06350000202655792, + 3.9412591457366943, + -1.6129000186920166, -0 ], "max": [ - 0.24130000174045563, - -0.06350000202655792, - 0.10159999877214432 + 6.1290202140808105, + -1.6129000186920166, + 2.5806400775909424 ] }, { @@ -193,14 +193,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.06448028236627579, - -0.06350000202655792, + 1.6377992630004885, + -1.6129000186920166, 0 ], "max": [ - 0.15516768395900726, + 3.9412591457366943, 0, - 0.10159999877214432 + 2.5806400775909424 ] }, { @@ -224,14 +224,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.06448028236627579, + 1.6377992630004885, 0, -0 ], "max": [ - 0.1461859941482544, - 0.038100000470876694, - 0.10159999877214432 + 3.713124275207519, + 0.967739999294281, + 2.5806400775909424 ] }, { @@ -255,14 +255,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.1461859941482544, - 0.038100000470876694, + 3.713124275207519, + 0.967739999294281, -0 ], "max": [ - 0.24130000174045563, - 0.038100000470876694, - 0.10159999877214432 + 6.1290202140808105, + 0.967739999294281, + 2.5806400775909424 ] }, { @@ -286,14 +286,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.24130000174045563, - 0.038100000470876694, + 6.1290202140808105, + 0.967739999294281, -0 ], "max": [ - 0.24130000174045563, - 0.05079999938607216, - 0.10159999877214432 + 6.1290202140808105, + 1.2903200387954712, + 2.5806400775909424 ] }, { @@ -317,14 +317,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.14337047934532166, - 0.05079999938607216, + 3.641610145568848, + 1.2903200387954712, -0 ], "max": [ - 0.24130000174045563, - 0.05079999938607216, - 0.10159999877214432 + 6.1290202140808105, + 1.2903200387954712, + 2.5806400775909424 ] }, { @@ -348,14 +348,14 @@ "componentType": 5126, "type": "VEC3", "min": [ - 0.08889999985694885, - 0.02539999969303608, + 2.2580599784851074, + 0.6451600193977356, -0 ], "max": [ - 0.14337047934532166, - 0.05079999938607216, - 0.10159999877214432 + 3.641610145568848, + 1.2903200387954712, + 2.5806400775909424 ] }, { @@ -380,13 +380,13 @@ "type": "VEC3", "min": [ 0, - 0.02539999969303608, + 0.6451600193977356, -0 ], "max": [ - 0.08889999985694885, - 0.02539999969303608, - 0.10159999877214432 + 2.2580599784851074, + 0.6451600193977356, + 2.5806400775909424 ] }, { @@ -416,8 +416,8 @@ ], "max": [ 0, - 0.02539999969303608, - 0.10159999877214432 + 0.6451600193977356, + 2.5806400775909424 ] }, { @@ -442,12 +442,12 @@ "type": "VEC3", "min": [ 0, - -0.07620000094175339, + -1.935479998588562, 0 ], "max": [ - 0.24130000174045563, - 0.05079999938607216, + 6.1290202140808105, + 1.2903200387954712, 0 ] }, @@ -473,13 +473,13 @@ "type": "VEC3", "min": [ 0, - -0.07620000094175339, - 0.10159999877214432 + -1.935479998588562, + 2.5806400775909424 ], "max": [ - 0.24130000174045563, - 0.05079999938607216, - 0.10159999877214432 + 6.1290202140808105, + 1.2903200387954712, + 2.5806400775909424 ] }, { @@ -1311,7 +1311,7 @@ "end": 1, "t": [ 0, - 0.0254 + 0.6451600000000001 ] }, { @@ -1323,7 +1323,7 @@ "end": 2, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1335,7 +1335,7 @@ "end": 2, "t": [ 0, - 0.0254 + 0.6451600000000001 ] }, { @@ -1347,7 +1347,7 @@ "end": 3, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1359,7 +1359,7 @@ "end": 4, "t": [ 0, - 0.07861000000000001 + 1.99678 ] }, { @@ -1371,7 +1371,7 @@ "end": 5, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1383,7 +1383,7 @@ "end": 5, "t": [ 0, - 0.07861000000000001 + 1.99678 ] }, { @@ -1395,7 +1395,7 @@ "end": 6, "t": [ 0, - 0.08857000000000001 + 2.2496 ] }, { @@ -1407,7 +1407,7 @@ "end": 7, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1419,7 +1419,7 @@ "end": 7, "t": [ 0, - 0.08857000000000001 + 2.2496 ] }, { @@ -1431,7 +1431,7 @@ "end": 8, "t": [ 0, - 0.09014 + 2.28947 ] }, { @@ -1443,7 +1443,7 @@ "end": 9, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1455,7 +1455,7 @@ "end": 9, "t": [ 0, - 0.09014 + 2.28947 ] }, { @@ -1467,7 +1467,7 @@ "end": 10, "t": [ 0, - 0.0127 + 0.32258000000000003 ] }, { @@ -1479,7 +1479,7 @@ "end": 11, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1491,7 +1491,7 @@ "end": 11, "t": [ 0, - 0.0127 + 0.32258000000000003 ] }, { @@ -1503,7 +1503,7 @@ "end": 12, "t": [ 0, - 0.08613000000000001 + 2.1877600000000004 ] }, { @@ -1515,7 +1515,7 @@ "end": 13, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1527,7 +1527,7 @@ "end": 13, "t": [ 0, - 0.08613000000000001 + 2.1877600000000004 ] }, { @@ -1539,7 +1539,7 @@ "end": 14, "t": [ 0, - 0.11071 + 2.8120100000000003 ] }, { @@ -1551,7 +1551,7 @@ "end": 15, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1563,7 +1563,7 @@ "end": 15, "t": [ 0, - 0.11071 + 2.8120100000000003 ] }, { @@ -1575,7 +1575,7 @@ "end": 16, "t": [ 0, - 0.09015 + 2.28987 ] }, { @@ -1587,7 +1587,7 @@ "end": 17, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1599,7 +1599,7 @@ "end": 17, "t": [ 0, - 0.09015 + 2.28987 ] }, { @@ -1611,7 +1611,7 @@ "end": 18, "t": [ 0, - 0.09511 + 2.4159 ] }, { @@ -1623,7 +1623,7 @@ "end": 19, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1635,7 +1635,7 @@ "end": 19, "t": [ 0, - 0.09511 + 2.4159 ] }, { @@ -1647,7 +1647,7 @@ "end": 20, "t": [ 0, - 0.0127 + 0.32258000000000003 ] }, { @@ -1659,7 +1659,7 @@ "end": 21, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1671,7 +1671,7 @@ "end": 21, "t": [ 0, - 0.0127 + 0.32258000000000003 ] }, { @@ -1683,7 +1683,7 @@ "end": 22, "t": [ 0, - 0.09793 + 2.48741 ] }, { @@ -1695,7 +1695,7 @@ "end": 23, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1707,7 +1707,7 @@ "end": 23, "t": [ 0, - 0.09793 + 2.48741 ] }, { @@ -1719,7 +1719,7 @@ "end": 24, "t": [ 0, - 0.06010000000000001 + 1.52658 ] }, { @@ -1731,7 +1731,7 @@ "end": 25, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1743,7 +1743,7 @@ "end": 25, "t": [ 0, - 0.06010000000000001 + 1.52658 ] }, { @@ -1755,7 +1755,7 @@ "end": 26, "t": [ 0, - 0.0889 + 2.2580600000000004 ] }, { @@ -1767,7 +1767,7 @@ "end": 27, "t": [ 0, - 0.1016 + 2.5806400000000003 ] }, { @@ -1779,7 +1779,7 @@ "end": 27, "t": [ 0, - 0.0889 + 2.2580600000000004 ] }, { @@ -1791,7 +1791,7 @@ "end": 0, "t": [ 0, - 0.0254 + 0.6451600000000001 ] }, { @@ -1803,7 +1803,7 @@ "end": 3, "t": [ 0, - 0.0254 + 0.6451600000000001 ] } ], @@ -1815,138 +1815,138 @@ ], [ 0, - -0.0254, + -0.6451600000000001, -0 ], [ 0, - -0.0254, - 0.1016 + -0.6451600000000001, + 2.5806400000000003 ], [ 0, 0, - 0.1016 + 2.5806400000000003 ], [ - 0.07861000000000001, - -0.0254, + 1.99678, + -0.6451600000000001, -0 ], [ - 0.07861000000000001, - -0.0254, - 0.1016 + 1.99678, + -0.6451600000000001, + 2.5806400000000003 ], [ - 0.15116000000000002, - -0.0762, + 3.839550000000001, + -1.93548, -0 ], [ - 0.15116000000000002, - -0.0762, - 0.1016 + 3.839550000000001, + -1.93548, + 2.5806400000000003 ], [ - 0.2413, - -0.0762, + 6.129020000000001, + -1.93548, -0 ], [ - 0.2413, - -0.0762, - 0.1016 + 6.129020000000001, + -1.93548, + 2.5806400000000003 ], [ - 0.2413, - -0.0635, + 6.129020000000001, + -1.6129000000000002, -0 ], [ - 0.2413, - -0.0635, - 0.1016 + 6.129020000000001, + -1.6129000000000002, + 2.5806400000000003 ], [ - 0.15517, - -0.0635, + 3.94126, + -1.6129000000000002, -0 ], [ - 0.15517, - -0.0635, - 0.1016 + 3.94126, + -1.6129000000000002, + 2.5806400000000003 ], [ - 0.06448000000000001, + 1.6378, 0, -0 ], [ - 0.06448000000000001, + 1.6378, 0, - 0.1016 + 2.5806400000000003 ], [ - 0.14619, - 0.0381, + 3.71312, + 0.96774, -0 ], [ - 0.14619, - 0.0381, - 0.1016 + 3.71312, + 0.96774, + 2.5806400000000003 ], [ - 0.2413, - 0.0381, + 6.129020000000001, + 0.96774, -0 ], [ - 0.2413, - 0.0381, - 0.1016 + 6.129020000000001, + 0.96774, + 2.5806400000000003 ], [ - 0.2413, - 0.050800000000000005, + 6.129020000000001, + 1.29032, -0 ], [ - 0.2413, - 0.050800000000000005, - 0.1016 + 6.129020000000001, + 1.29032, + 2.5806400000000003 ], [ - 0.14337000000000005, - 0.050800000000000005, + 3.641610000000001, + 1.29032, -0 ], [ - 0.14337000000000005, - 0.050800000000000005, - 0.1016 + 3.641610000000001, + 1.29032, + 2.5806400000000003 ], [ - 0.0889, - 0.0254, + 2.2580600000000004, + 0.6451600000000001, -0 ], [ - 0.0889, - 0.0254, - 0.1016 + 2.2580600000000004, + 0.6451600000000001, + 2.5806400000000003 ], [ 0, - 0.0254, + 0.6451600000000001, -0 ], [ 0, - 0.0254, - 0.1016 + 0.6451600000000001, + 2.5806400000000003 ] ], "surfaces": [ @@ -1965,8 +1965,8 @@ ], "origin": [ 0, - -0.0127, - 0.050800000000000005 + -0.32258000000000003, + 1.29032 ] } }, @@ -1984,9 +1984,9 @@ 1 ], "origin": [ - 0.039310000000000005, - -0.0254, - 0.050800000000000005 + 0.99839, + -0.6451600000000001, + 1.29032 ] } }, @@ -2004,9 +2004,9 @@ 1 ], "origin": [ - 0.11489, - -0.050800000000000005, - 0.050800000000000005 + 2.9181700000000004, + -1.29032, + 1.29032 ] } }, @@ -2024,9 +2024,9 @@ 1 ], "origin": [ - 0.19623, - -0.0762, - 0.050800000000000005 + 4.9842900000000006, + -1.93548, + 1.29032 ] } }, @@ -2044,9 +2044,9 @@ 1 ], "origin": [ - 0.2413, - -0.06985000000000001, - 0.050800000000000005 + 6.129020000000001, + -1.7741900000000002, + 1.29032 ] } }, @@ -2064,9 +2064,9 @@ -1 ], "origin": [ - 0.19823, - -0.0635, - 0.050800000000000005 + 5.03514, + -1.6129000000000002, + 1.29032 ] } }, @@ -2084,9 +2084,9 @@ -1 ], "origin": [ - 0.10982, - -0.03175, - 0.050800000000000005 + 2.78953, + -0.8064500000000001, + 1.29032 ] } }, @@ -2104,9 +2104,9 @@ 1 ], "origin": [ - 0.10533, - 0.01905, - 0.050800000000000005 + 2.67546, + 0.48387, + 1.29032 ] } }, @@ -2124,9 +2124,9 @@ 1 ], "origin": [ - 0.19374, - 0.0381, - 0.050800000000000005 + 4.92107, + 0.96774, + 1.29032 ] } }, @@ -2144,9 +2144,9 @@ 1 ], "origin": [ - 0.2413, - 0.04445, - 0.050800000000000005 + 6.129020000000001, + 1.1290300000000002, + 1.29032 ] } }, @@ -2164,9 +2164,9 @@ -1 ], "origin": [ - 0.19234, - 0.050800000000000005, - 0.050800000000000005 + 4.88532, + 1.29032, + 1.29032 ] } }, @@ -2184,9 +2184,9 @@ -1 ], "origin": [ - 0.11614, - 0.0381, - 0.050800000000000005 + 2.9498400000000005, + 0.96774, + 1.29032 ] } }, @@ -2204,9 +2204,9 @@ -1 ], "origin": [ - 0.04445, - 0.0254, - 0.050800000000000005 + 1.1290300000000002, + 0.6451600000000001, + 1.29032 ] } }, @@ -2225,8 +2225,8 @@ ], "origin": [ 0, - 0.0127, - 0.050800000000000005 + 0.32258000000000003, + 1.29032 ] } }, @@ -2266,7 +2266,7 @@ "origin": [ 0, 0, - 0.1016 + 2.5806400000000003 ] } } @@ -2292,7 +2292,7 @@ "line": { "origin": [ 0, - -0.0254, + -0.6451600000000001, -0 ], "direction": [ @@ -2308,7 +2308,7 @@ "origin": [ 0, 0, - 0.1016 + 2.5806400000000003 ], "direction": [ 0, @@ -2337,7 +2337,7 @@ "line": { "origin": [ 0, - -0.0254, + -0.6451600000000001, -0 ], "direction": [ @@ -2351,8 +2351,8 @@ "type": "line", "line": { "origin": [ - 0.07861000000000001, - -0.0254, + 1.99678, + -0.6451600000000001, -0 ], "direction": [ @@ -2367,8 +2367,8 @@ "line": { "origin": [ 0, - -0.0254, - 0.1016 + -0.6451600000000001, + 2.5806400000000003 ], "direction": [ 1, @@ -2381,8 +2381,8 @@ "type": "line", "line": { "origin": [ - 0.07861000000000001, - -0.0254, + 1.99678, + -0.6451600000000001, -0 ], "direction": [ @@ -2396,8 +2396,8 @@ "type": "line", "line": { "origin": [ - 0.15116000000000002, - -0.0762, + 3.839550000000001, + -1.93548, -0 ], "direction": [ @@ -2411,9 +2411,9 @@ "type": "line", "line": { "origin": [ - 0.07861000000000001, - -0.0254, - 0.1016 + 1.99678, + -0.6451600000000001, + 2.5806400000000003 ], "direction": [ 0.81915, @@ -2426,8 +2426,8 @@ "type": "line", "line": { "origin": [ - 0.15116000000000002, - -0.0762, + 3.839550000000001, + -1.93548, -0 ], "direction": [ @@ -2441,8 +2441,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0762, + 6.129020000000001, + -1.93548, -0 ], "direction": [ @@ -2456,9 +2456,9 @@ "type": "line", "line": { "origin": [ - 0.15116000000000002, - -0.0762, - 0.1016 + 3.839550000000001, + -1.93548, + 2.5806400000000003 ], "direction": [ 1, @@ -2471,8 +2471,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0762, + 6.129020000000001, + -1.93548, -0 ], "direction": [ @@ -2486,8 +2486,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0635, + 6.129020000000001, + -1.6129000000000002, -0 ], "direction": [ @@ -2501,9 +2501,9 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0762, - 0.1016 + 6.129020000000001, + -1.93548, + 2.5806400000000003 ], "direction": [ 0, @@ -2516,8 +2516,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0635, + 6.129020000000001, + -1.6129000000000002, -0 ], "direction": [ @@ -2531,8 +2531,8 @@ "type": "line", "line": { "origin": [ - 0.15517, - -0.0635, + 3.94126, + -1.6129000000000002, -0 ], "direction": [ @@ -2546,9 +2546,9 @@ "type": "line", "line": { "origin": [ - 0.2413, - -0.0635, - 0.1016 + 6.129020000000001, + -1.6129000000000002, + 2.5806400000000003 ], "direction": [ -1, @@ -2561,8 +2561,8 @@ "type": "line", "line": { "origin": [ - 0.15517, - -0.0635, + 3.94126, + -1.6129000000000002, -0 ], "direction": [ @@ -2576,7 +2576,7 @@ "type": "line", "line": { "origin": [ - 0.06448000000000001, + 1.6378, 0, -0 ], @@ -2591,9 +2591,9 @@ "type": "line", "line": { "origin": [ - 0.15517, - -0.0635, - 0.1016 + 3.94126, + -1.6129000000000002, + 2.5806400000000003 ], "direction": [ -0.81915, @@ -2606,7 +2606,7 @@ "type": "line", "line": { "origin": [ - 0.06448000000000001, + 1.6378, 0, -0 ], @@ -2621,8 +2621,8 @@ "type": "line", "line": { "origin": [ - 0.14619, - 0.0381, + 3.71312, + 0.96774, -0 ], "direction": [ @@ -2636,9 +2636,9 @@ "type": "line", "line": { "origin": [ - 0.06448000000000001, + 1.6378, 0, - 0.1016 + 2.5806400000000003 ], "direction": [ 0.90631, @@ -2651,8 +2651,8 @@ "type": "line", "line": { "origin": [ - 0.14619, - 0.0381, + 3.71312, + 0.96774, -0 ], "direction": [ @@ -2666,8 +2666,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.0381, + 6.129020000000001, + 0.96774, -0 ], "direction": [ @@ -2681,9 +2681,9 @@ "type": "line", "line": { "origin": [ - 0.14619, - 0.0381, - 0.1016 + 3.71312, + 0.96774, + 2.5806400000000003 ], "direction": [ 1, @@ -2696,8 +2696,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.0381, + 6.129020000000001, + 0.96774, -0 ], "direction": [ @@ -2711,8 +2711,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.050800000000000005, + 6.129020000000001, + 1.29032, -0 ], "direction": [ @@ -2726,9 +2726,9 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.0381, - 0.1016 + 6.129020000000001, + 0.96774, + 2.5806400000000003 ], "direction": [ 0, @@ -2741,8 +2741,8 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.050800000000000005, + 6.129020000000001, + 1.29032, -0 ], "direction": [ @@ -2756,8 +2756,8 @@ "type": "line", "line": { "origin": [ - 0.14337000000000005, - 0.050800000000000005, + 3.641610000000001, + 1.29032, -0 ], "direction": [ @@ -2771,9 +2771,9 @@ "type": "line", "line": { "origin": [ - 0.2413, - 0.050800000000000005, - 0.1016 + 6.129020000000001, + 1.29032, + 2.5806400000000003 ], "direction": [ -1, @@ -2786,8 +2786,8 @@ "type": "line", "line": { "origin": [ - 0.14337000000000005, - 0.050800000000000005, + 3.641610000000001, + 1.29032, -0 ], "direction": [ @@ -2801,8 +2801,8 @@ "type": "line", "line": { "origin": [ - 0.0889, - 0.0254, + 2.2580600000000004, + 0.6451600000000001, -0 ], "direction": [ @@ -2816,9 +2816,9 @@ "type": "line", "line": { "origin": [ - 0.14337000000000005, - 0.050800000000000005, - 0.1016 + 3.641610000000001, + 1.29032, + 2.5806400000000003 ], "direction": [ -0.90631, @@ -2831,8 +2831,8 @@ "type": "line", "line": { "origin": [ - 0.0889, - 0.0254, + 2.2580600000000004, + 0.6451600000000001, -0 ], "direction": [ @@ -2847,7 +2847,7 @@ "line": { "origin": [ 0, - 0.0254, + 0.6451600000000001, -0 ], "direction": [ @@ -2861,9 +2861,9 @@ "type": "line", "line": { "origin": [ - 0.0889, - 0.0254, - 0.1016 + 2.2580600000000004, + 0.6451600000000001, + 2.5806400000000003 ], "direction": [ -1, @@ -2877,7 +2877,7 @@ "line": { "origin": [ 0, - 0.0254, + 0.6451600000000001, -0 ], "direction": [ @@ -2892,8 +2892,8 @@ "line": { "origin": [ 0, - 0.0254, - 0.1016 + 0.6451600000000001, + 2.5806400000000003 ], "direction": [ 0, diff --git a/e2e/playwright/export-snapshots/gltf-standard.gltf b/e2e/playwright/export-snapshots/gltf-standard.gltf index 41b8ac71e..cc491ece1 100644 Binary files a/e2e/playwright/export-snapshots/gltf-standard.gltf and b/e2e/playwright/export-snapshots/gltf-standard.gltf differ diff --git a/e2e/playwright/export-snapshots/obj-.png b/e2e/playwright/export-snapshots/obj-.png index 755c9a010..67afab68a 100644 Binary files a/e2e/playwright/export-snapshots/obj-.png and b/e2e/playwright/export-snapshots/obj-.png differ diff --git a/e2e/playwright/export-snapshots/ply-ascii.png b/e2e/playwright/export-snapshots/ply-ascii.png index fd6c5f867..69ce9bfef 100644 Binary files a/e2e/playwright/export-snapshots/ply-ascii.png and b/e2e/playwright/export-snapshots/ply-ascii.png differ diff --git a/e2e/playwright/export-snapshots/ply-binary_big_endian.png b/e2e/playwright/export-snapshots/ply-binary_big_endian.png index fd6c5f867..69ce9bfef 100644 Binary files a/e2e/playwright/export-snapshots/ply-binary_big_endian.png and b/e2e/playwright/export-snapshots/ply-binary_big_endian.png differ diff --git a/e2e/playwright/export-snapshots/ply-binary_little_endian.png b/e2e/playwright/export-snapshots/ply-binary_little_endian.png index fd6c5f867..69ce9bfef 100644 Binary files a/e2e/playwright/export-snapshots/ply-binary_little_endian.png and b/e2e/playwright/export-snapshots/ply-binary_little_endian.png differ diff --git a/e2e/playwright/export-snapshots/step-.png b/e2e/playwright/export-snapshots/step-.png index 92a3c5938..aa42dc8e0 100644 Binary files a/e2e/playwright/export-snapshots/step-.png and b/e2e/playwright/export-snapshots/step-.png differ diff --git a/e2e/playwright/export-snapshots/step-.step b/e2e/playwright/export-snapshots/step-.step index ccef5e532..f8dfcdd83 100644 --- a/e2e/playwright/export-snapshots/step-.step +++ b/e2e/playwright/export-snapshots/step-.step @@ -19,59 +19,59 @@ DATA; ); #4 = CARTESIAN_POINT('NONE', (0, 0, -0)); #5 = VERTEX_POINT('NONE', #4); -#6 = CARTESIAN_POINT('NONE', (0, -0.0254, -0)); +#6 = CARTESIAN_POINT('NONE', (0, -0.64516, -0)); #7 = VERTEX_POINT('NONE', #6); -#8 = CARTESIAN_POINT('NONE', (0, -0.0254, 0.1016)); +#8 = CARTESIAN_POINT('NONE', (0, -0.64516, 2.58064)); #9 = VERTEX_POINT('NONE', #8); -#10 = CARTESIAN_POINT('NONE', (0, 0, 0.1016)); +#10 = CARTESIAN_POINT('NONE', (0, 0, 2.58064)); #11 = VERTEX_POINT('NONE', #10); -#12 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0)); +#12 = CARTESIAN_POINT('NONE', (1.996782122555674, -0.64516, -0)); #13 = VERTEX_POINT('NONE', #12); -#14 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, 0.1016)); +#14 = CARTESIAN_POINT('NONE', (1.996782122555674, -0.64516, 2.58064)); #15 = VERTEX_POINT('NONE', #14); -#16 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0)); +#16 = CARTESIAN_POINT('NONE', (3.839550058615159, -1.9354799999999992, -0)); #17 = VERTEX_POINT('NONE', #16); -#18 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, 0.1016)); +#18 = CARTESIAN_POINT('NONE', (3.839550058615159, -1.9354799999999992, 2.58064)); #19 = VERTEX_POINT('NONE', #18); -#20 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0)); +#20 = CARTESIAN_POINT('NONE', (6.12902, -1.93548, -0)); #21 = VERTEX_POINT('NONE', #20); -#22 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, 0.1016)); +#22 = CARTESIAN_POINT('NONE', (6.12902, -1.93548, 2.58064)); #23 = VERTEX_POINT('NONE', #22); -#24 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0)); +#24 = CARTESIAN_POINT('NONE', (6.12902, -1.6129, -0)); #25 = VERTEX_POINT('NONE', #24); -#26 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, 0.1016)); +#26 = CARTESIAN_POINT('NONE', (6.12902, -1.6129, 2.58064)); #27 = VERTEX_POINT('NONE', #26); -#28 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0)); +#28 = CARTESIAN_POINT('NONE', (3.9412591419317424, -1.6129, -0)); #29 = VERTEX_POINT('NONE', #28); -#30 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, 0.1016)); +#30 = CARTESIAN_POINT('NONE', (3.9412591419317424, -1.6129, 2.58064)); #31 = VERTEX_POINT('NONE', #30); -#32 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0)); +#32 = CARTESIAN_POINT('NONE', (1.6377992218573856, 0, -0)); #33 = VERTEX_POINT('NONE', #32); -#34 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, 0.1016)); +#34 = CARTESIAN_POINT('NONE', (1.6377992218573856, 0, 2.58064)); #35 = VERTEX_POINT('NONE', #34); -#36 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0)); +#36 = CARTESIAN_POINT('NONE', (3.7131243491113075, 0.9677400000000002, -0)); #37 = VERTEX_POINT('NONE', #36); -#38 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, 0.1016)); +#38 = CARTESIAN_POINT('NONE', (3.7131243491113075, 0.9677400000000002, 2.58064)); #39 = VERTEX_POINT('NONE', #38); -#40 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0)); +#40 = CARTESIAN_POINT('NONE', (6.12902, 0.9677399999999998, -0)); #41 = VERTEX_POINT('NONE', #40); -#42 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, 0.1016)); +#42 = CARTESIAN_POINT('NONE', (6.12902, 0.9677399999999998, 2.58064)); #43 = VERTEX_POINT('NONE', #42); -#44 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0)); +#44 = CARTESIAN_POINT('NONE', (6.12902, 1.29032, -0)); #45 = VERTEX_POINT('NONE', #44); -#46 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, 0.1016)); +#46 = CARTESIAN_POINT('NONE', (6.12902, 1.29032, 2.58064)); #47 = VERTEX_POINT('NONE', #46); -#48 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0)); +#48 = CARTESIAN_POINT('NONE', (3.6416100848359463, 1.29032, -0)); #49 = VERTEX_POINT('NONE', #48); -#50 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, 0.1016)); +#50 = CARTESIAN_POINT('NONE', (3.6416100848359463, 1.29032, 2.58064)); #51 = VERTEX_POINT('NONE', #50); -#52 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0)); +#52 = CARTESIAN_POINT('NONE', (2.2580599999999995, 0.64516, -0)); #53 = VERTEX_POINT('NONE', #52); -#54 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, 0.1016)); +#54 = CARTESIAN_POINT('NONE', (2.2580599999999995, 0.64516, 2.58064)); #55 = VERTEX_POINT('NONE', #54); -#56 = CARTESIAN_POINT('NONE', (0, 0.0254, -0)); +#56 = CARTESIAN_POINT('NONE', (0, 0.64516, -0)); #57 = VERTEX_POINT('NONE', #56); -#58 = CARTESIAN_POINT('NONE', (0, 0.0254, 0.1016)); +#58 = CARTESIAN_POINT('NONE', (0, 0.64516, 2.58064)); #59 = VERTEX_POINT('NONE', #58); #60 = DIRECTION('NONE', (0, -1, 0)); #61 = VECTOR('NONE', #60, 1); @@ -79,11 +79,11 @@ DATA; #63 = LINE('NONE', #62, #61); #64 = DIRECTION('NONE', (0, 0, 1)); #65 = VECTOR('NONE', #64, 1); -#66 = CARTESIAN_POINT('NONE', (0, -0.0254, -0)); +#66 = CARTESIAN_POINT('NONE', (0, -0.64516, -0)); #67 = LINE('NONE', #66, #65); #68 = DIRECTION('NONE', (0, -1, 0)); #69 = VECTOR('NONE', #68, 1); -#70 = CARTESIAN_POINT('NONE', (0, 0, 0.1016)); +#70 = CARTESIAN_POINT('NONE', (0, 0, 2.58064)); #71 = LINE('NONE', #70, #69); #72 = DIRECTION('NONE', (0, 0, 1)); #73 = VECTOR('NONE', #72, 1); @@ -91,155 +91,155 @@ DATA; #75 = LINE('NONE', #74, #73); #76 = DIRECTION('NONE', (1, 0, 0)); #77 = VECTOR('NONE', #76, 1); -#78 = CARTESIAN_POINT('NONE', (0, -0.0254, -0)); +#78 = CARTESIAN_POINT('NONE', (0, -0.64516, -0)); #79 = LINE('NONE', #78, #77); #80 = DIRECTION('NONE', (0, 0, 1)); #81 = VECTOR('NONE', #80, 1); -#82 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0)); +#82 = CARTESIAN_POINT('NONE', (1.996782122555674, -0.64516, -0)); #83 = LINE('NONE', #82, #81); #84 = DIRECTION('NONE', (1, 0, 0)); #85 = VECTOR('NONE', #84, 1); -#86 = CARTESIAN_POINT('NONE', (0, -0.0254, 0.1016)); +#86 = CARTESIAN_POINT('NONE', (0, -0.64516, 2.58064)); #87 = LINE('NONE', #86, #85); -#88 = DIRECTION('NONE', (0.8191520442889919, -0.5735764363510459, 0)); +#88 = DIRECTION('NONE', (0.819152044288992, -0.5735764363510459, 0)); #89 = VECTOR('NONE', #88, 1); -#90 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, -0)); +#90 = CARTESIAN_POINT('NONE', (1.996782122555674, -0.64516, -0)); #91 = LINE('NONE', #90, #89); #92 = DIRECTION('NONE', (0, 0, 1)); #93 = VECTOR('NONE', #92, 1); -#94 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0)); +#94 = CARTESIAN_POINT('NONE', (3.839550058615159, -1.9354799999999992, -0)); #95 = LINE('NONE', #94, #93); -#96 = DIRECTION('NONE', (0.8191520442889919, -0.5735764363510459, 0)); +#96 = DIRECTION('NONE', (0.819152044288992, -0.5735764363510459, 0)); #97 = VECTOR('NONE', #96, 1); -#98 = CARTESIAN_POINT('NONE', (0.07861346939195568, -0.0254, 0.1016)); +#98 = CARTESIAN_POINT('NONE', (1.996782122555674, -0.64516, 2.58064)); #99 = LINE('NONE', #98, #97); -#100 = DIRECTION('NONE', (1, -0.0000000000000003079278779307945, 0)); +#100 = DIRECTION('NONE', (1, -0.00000000000000038794063361359933, 0)); #101 = VECTOR('NONE', #100, 1); -#102 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, -0)); +#102 = CARTESIAN_POINT('NONE', (3.839550058615159, -1.9354799999999992, -0)); #103 = LINE('NONE', #102, #101); #104 = DIRECTION('NONE', (0, 0, 1)); #105 = VECTOR('NONE', #104, 1); -#106 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0)); +#106 = CARTESIAN_POINT('NONE', (6.12902, -1.93548, -0)); #107 = LINE('NONE', #106, #105); -#108 = DIRECTION('NONE', (1, -0.0000000000000003079278779307945, 0)); +#108 = DIRECTION('NONE', (1, -0.00000000000000038794063361359933, 0)); #109 = VECTOR('NONE', #108, 1); -#110 = CARTESIAN_POINT('NONE', (0.1511633881344551, -0.07619999999999998, 0.1016)); +#110 = CARTESIAN_POINT('NONE', (3.839550058615159, -1.9354799999999992, 2.58064)); #111 = LINE('NONE', #110, #109); #112 = DIRECTION('NONE', (0, 1, 0)); #113 = VECTOR('NONE', #112, 1); -#114 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, -0)); +#114 = CARTESIAN_POINT('NONE', (6.12902, -1.93548, -0)); #115 = LINE('NONE', #114, #113); #116 = DIRECTION('NONE', (0, 0, 1)); #117 = VECTOR('NONE', #116, 1); -#118 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0)); +#118 = CARTESIAN_POINT('NONE', (6.12902, -1.6129, -0)); #119 = LINE('NONE', #118, #117); #120 = DIRECTION('NONE', (0, 1, 0)); #121 = VECTOR('NONE', #120, 1); -#122 = CARTESIAN_POINT('NONE', (0.2413, -0.0762, 0.1016)); +#122 = CARTESIAN_POINT('NONE', (6.12902, -1.93548, 2.58064)); #123 = LINE('NONE', #122, #121); #124 = DIRECTION('NONE', (-1, 0, 0)); #125 = VECTOR('NONE', #124, 1); -#126 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, -0)); +#126 = CARTESIAN_POINT('NONE', (6.12902, -1.6129, -0)); #127 = LINE('NONE', #126, #125); #128 = DIRECTION('NONE', (0, 0, 1)); #129 = VECTOR('NONE', #128, 1); -#130 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0)); +#130 = CARTESIAN_POINT('NONE', (3.9412591419317424, -1.6129, -0)); #131 = LINE('NONE', #130, #129); #132 = DIRECTION('NONE', (-1, 0, 0)); #133 = VECTOR('NONE', #132, 1); -#134 = CARTESIAN_POINT('NONE', (0.2413, -0.0635, 0.1016)); +#134 = CARTESIAN_POINT('NONE', (6.12902, -1.6129, 2.58064)); #135 = LINE('NONE', #134, #133); #136 = DIRECTION('NONE', (-0.8191520442889919, 0.573576436351046, 0)); #137 = VECTOR('NONE', #136, 1); -#138 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, -0)); +#138 = CARTESIAN_POINT('NONE', (3.9412591419317424, -1.6129, -0)); #139 = LINE('NONE', #138, #137); #140 = DIRECTION('NONE', (0, 0, 1)); #141 = VECTOR('NONE', #140, 1); -#142 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0)); +#142 = CARTESIAN_POINT('NONE', (1.6377992218573856, 0, -0)); #143 = LINE('NONE', #142, #141); #144 = DIRECTION('NONE', (-0.8191520442889919, 0.573576436351046, 0)); #145 = VECTOR('NONE', #144, 1); -#146 = CARTESIAN_POINT('NONE', (0.1551676827532182, -0.0635, 0.1016)); +#146 = CARTESIAN_POINT('NONE', (3.9412591419317424, -1.6129, 2.58064)); #147 = LINE('NONE', #146, #145); -#148 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406993, 0)); +#148 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406992, 0)); #149 = VECTOR('NONE', #148, 1); -#150 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, -0)); +#150 = CARTESIAN_POINT('NONE', (1.6377992218573856, 0, -0)); #151 = LINE('NONE', #150, #149); #152 = DIRECTION('NONE', (0, 0, 1)); #153 = VECTOR('NONE', #152, 1); -#154 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0)); +#154 = CARTESIAN_POINT('NONE', (3.7131243491113075, 0.9677400000000002, -0)); #155 = LINE('NONE', #154, #153); -#156 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406993, 0)); +#156 = DIRECTION('NONE', (0.90630778703665, 0.4226182617406992, 0)); #157 = VECTOR('NONE', #156, 1); -#158 = CARTESIAN_POINT('NONE', (0.06448028432509392, 0, 0.1016)); +#158 = CARTESIAN_POINT('NONE', (1.6377992218573856, 0, 2.58064)); #159 = LINE('NONE', #158, #157); -#160 = DIRECTION('NONE', (1, -0.00000000000000007295344279228718, 0)); +#160 = DIRECTION('NONE', (1, -0.0000000000000001378647737807002, 0)); #161 = VECTOR('NONE', #160, 1); -#162 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, -0)); +#162 = CARTESIAN_POINT('NONE', (3.7131243491113075, 0.9677400000000002, -0)); #163 = LINE('NONE', #162, #161); #164 = DIRECTION('NONE', (0, 0, 1)); #165 = VECTOR('NONE', #164, 1); -#166 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0)); +#166 = CARTESIAN_POINT('NONE', (6.12902, 0.9677399999999998, -0)); #167 = LINE('NONE', #166, #165); -#168 = DIRECTION('NONE', (1, -0.00000000000000007295344279228718, 0)); +#168 = DIRECTION('NONE', (1, -0.0000000000000001378647737807002, 0)); #169 = VECTOR('NONE', #168, 1); -#170 = CARTESIAN_POINT('NONE', (0.14618599799650817, 0.03810000000000001, 0.1016)); +#170 = CARTESIAN_POINT('NONE', (3.7131243491113075, 0.9677400000000002, 2.58064)); #171 = LINE('NONE', #170, #169); #172 = DIRECTION('NONE', (0, 1, 0)); #173 = VECTOR('NONE', #172, 1); -#174 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, -0)); +#174 = CARTESIAN_POINT('NONE', (6.12902, 0.9677399999999998, -0)); #175 = LINE('NONE', #174, #173); #176 = DIRECTION('NONE', (0, 0, 1)); #177 = VECTOR('NONE', #176, 1); -#178 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0)); +#178 = CARTESIAN_POINT('NONE', (6.12902, 1.29032, -0)); #179 = LINE('NONE', #178, #177); #180 = DIRECTION('NONE', (0, 1, 0)); #181 = VECTOR('NONE', #180, 1); -#182 = CARTESIAN_POINT('NONE', (0.2413, 0.0381, 0.1016)); +#182 = CARTESIAN_POINT('NONE', (6.12902, 0.9677399999999998, 2.58064)); #183 = LINE('NONE', #182, #181); #184 = DIRECTION('NONE', (-1, 0, 0)); #185 = VECTOR('NONE', #184, 1); -#186 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, -0)); +#186 = CARTESIAN_POINT('NONE', (6.12902, 1.29032, -0)); #187 = LINE('NONE', #186, #185); #188 = DIRECTION('NONE', (0, 0, 1)); #189 = VECTOR('NONE', #188, 1); -#190 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0)); +#190 = CARTESIAN_POINT('NONE', (3.6416100848359463, 1.29032, -0)); #191 = LINE('NONE', #190, #189); #192 = DIRECTION('NONE', (-1, 0, 0)); #193 = VECTOR('NONE', #192, 1); -#194 = CARTESIAN_POINT('NONE', (0.2413, 0.0508, 0.1016)); +#194 = CARTESIAN_POINT('NONE', (6.12902, 1.29032, 2.58064)); #195 = LINE('NONE', #194, #193); -#196 = DIRECTION('NONE', (-0.90630778703665, -0.42261826174069944, 0)); +#196 = DIRECTION('NONE', (-0.90630778703665, -0.4226182617406995, 0)); #197 = VECTOR('NONE', #196, 1); -#198 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, -0)); +#198 = CARTESIAN_POINT('NONE', (3.6416100848359463, 1.29032, -0)); #199 = LINE('NONE', #198, #197); #200 = DIRECTION('NONE', (0, 0, 1)); #201 = VECTOR('NONE', #200, 1); -#202 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0)); +#202 = CARTESIAN_POINT('NONE', (2.2580599999999995, 0.64516, -0)); #203 = LINE('NONE', #202, #201); -#204 = DIRECTION('NONE', (-0.90630778703665, -0.42261826174069944, 0)); +#204 = DIRECTION('NONE', (-0.90630778703665, -0.4226182617406995, 0)); #205 = VECTOR('NONE', #204, 1); -#206 = CARTESIAN_POINT('NONE', (0.14337047578094278, 0.0508, 0.1016)); +#206 = CARTESIAN_POINT('NONE', (3.6416100848359463, 1.29032, 2.58064)); #207 = LINE('NONE', #206, #205); #208 = DIRECTION('NONE', (-1, 0, 0)); #209 = VECTOR('NONE', #208, 1); -#210 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, -0)); +#210 = CARTESIAN_POINT('NONE', (2.2580599999999995, 0.64516, -0)); #211 = LINE('NONE', #210, #209); #212 = DIRECTION('NONE', (0, 0, 1)); #213 = VECTOR('NONE', #212, 1); -#214 = CARTESIAN_POINT('NONE', (0, 0.0254, -0)); +#214 = CARTESIAN_POINT('NONE', (0, 0.64516, -0)); #215 = LINE('NONE', #214, #213); #216 = DIRECTION('NONE', (-1, 0, 0)); #217 = VECTOR('NONE', #216, 1); -#218 = CARTESIAN_POINT('NONE', (0.08889999999999999, 0.0254, 0.1016)); +#218 = CARTESIAN_POINT('NONE', (2.2580599999999995, 0.64516, 2.58064)); #219 = LINE('NONE', #218, #217); #220 = DIRECTION('NONE', (0, -1, 0)); #221 = VECTOR('NONE', #220, 1); -#222 = CARTESIAN_POINT('NONE', (0, 0.0254, -0)); +#222 = CARTESIAN_POINT('NONE', (0, 0.64516, -0)); #223 = LINE('NONE', #222, #221); #224 = DIRECTION('NONE', (0, -1, 0)); #225 = VECTOR('NONE', #224, 1); -#226 = CARTESIAN_POINT('NONE', (0, 0.0254, 0.1016)); +#226 = CARTESIAN_POINT('NONE', (0, 0.64516, 2.58064)); #227 = LINE('NONE', #226, #225); #228 = EDGE_CURVE('NONE', #5, #7, #63, .T.); #229 = EDGE_CURVE('NONE', #7, #9, #67, .T.); @@ -383,59 +383,59 @@ DATA; #367 = ORIENTED_EDGE('NONE', *, *, #267, .T.); #368 = ORIENTED_EDGE('NONE', *, *, #269, .T.); #369 = EDGE_LOOP('NONE', (#355, #356, #357, #358, #359, #360, #361, #362, #363, #364, #365, #366, #367, #368)); -#370 = CARTESIAN_POINT('NONE', (0, -0.0127, 0.0508)); +#370 = CARTESIAN_POINT('NONE', (0, -0.3225799999999985, 1.2903199999999995)); #371 = DIRECTION('NONE', (-1, -0, 0)); #372 = AXIS2_PLACEMENT_3D('NONE', #370, #371, $); #373 = PLANE('NONE', #372); -#374 = CARTESIAN_POINT('NONE', (0.039306734695977924, -0.025399999999999995, 0.0508)); +#374 = CARTESIAN_POINT('NONE', (0.9983910612778368, -0.6451599999999998, 1.2903199999999997)); #375 = DIRECTION('NONE', (0, -1, 0)); #376 = AXIS2_PLACEMENT_3D('NONE', #374, #375, $); #377 = PLANE('NONE', #376); -#378 = CARTESIAN_POINT('NONE', (0.11488842876320533, -0.05079999999999996, 0.05079999999999999)); +#378 = CARTESIAN_POINT('NONE', (2.918166090585415, -1.2903199999999988, 1.2903199999999997)); #379 = DIRECTION('NONE', (-0.5735764363510459, -0.8191520442889919, 0)); #380 = AXIS2_PLACEMENT_3D('NONE', #378, #379, $); #381 = PLANE('NONE', #380); -#382 = CARTESIAN_POINT('NONE', (0.19623169406722757, -0.07619999999999999, 0.0508)); +#382 = CARTESIAN_POINT('NONE', (4.984285029307579, -1.9354799999999992, 1.2903199999999997)); #383 = DIRECTION('NONE', (0, -1, 0)); #384 = AXIS2_PLACEMENT_3D('NONE', #382, #383, $); #385 = PLANE('NONE', #384); -#386 = CARTESIAN_POINT('NONE', (0.2413, -0.06985, 0.0508)); +#386 = CARTESIAN_POINT('NONE', (6.129019999999999, -1.7741899999999997, 1.2903199999999997)); #387 = DIRECTION('NONE', (1, -0, 0)); #388 = AXIS2_PLACEMENT_3D('NONE', #386, #387, $); #389 = PLANE('NONE', #388); -#390 = CARTESIAN_POINT('NONE', (0.19823384137660915, -0.0635, 0.0508)); +#390 = CARTESIAN_POINT('NONE', (5.035139570965871, -1.6128999999999998, 1.2903199999999997)); #391 = DIRECTION('NONE', (0, 1, -0)); #392 = AXIS2_PLACEMENT_3D('NONE', #390, #391, $); #393 = PLANE('NONE', #392); -#394 = CARTESIAN_POINT('NONE', (0.10982398353915601, -0.03174999999999997, 0.0508)); -#395 = DIRECTION('NONE', (0.5735764363510459, 0.8191520442889917, -0)); +#394 = CARTESIAN_POINT('NONE', (2.7895291818945633, -0.8064499999999998, 1.2903199999999995)); +#395 = DIRECTION('NONE', (0.5735764363510459, 0.8191520442889918, -0)); #396 = AXIS2_PLACEMENT_3D('NONE', #394, #395, $); #397 = PLANE('NONE', #396); -#398 = CARTESIAN_POINT('NONE', (0.105333141160801, 0.019049999999999987, 0.0508)); -#399 = DIRECTION('NONE', (0.4226182617406993, -0.90630778703665, 0)); +#398 = CARTESIAN_POINT('NONE', (2.6754617854843468, 0.4838700000000003, 1.2903199999999997)); +#399 = DIRECTION('NONE', (0.4226182617406992, -0.90630778703665, 0)); #400 = AXIS2_PLACEMENT_3D('NONE', #398, #399, $); #401 = PLANE('NONE', #400); -#402 = CARTESIAN_POINT('NONE', (0.19374299899825406, 0.0381, 0.0508)); +#402 = CARTESIAN_POINT('NONE', (4.921072174555653, 0.9677399999999998, 1.2903199999999995)); #403 = DIRECTION('NONE', (0, -1, 0)); #404 = AXIS2_PLACEMENT_3D('NONE', #402, #403, $); #405 = PLANE('NONE', #404); -#406 = CARTESIAN_POINT('NONE', (0.2413, 0.044449999999999996, 0.0508)); +#406 = CARTESIAN_POINT('NONE', (6.129019999999998, 1.1290299999999989, 1.2903199999999995)); #407 = DIRECTION('NONE', (1, -0, 0)); #408 = AXIS2_PLACEMENT_3D('NONE', #406, #407, $); #409 = PLANE('NONE', #408); -#410 = CARTESIAN_POINT('NONE', (0.19233523789047138, 0.0508, 0.0508)); +#410 = CARTESIAN_POINT('NONE', (4.8853150424179725, 1.2903199999999997, 1.2903199999999997)); #411 = DIRECTION('NONE', (0, 1, -0)); #412 = AXIS2_PLACEMENT_3D('NONE', #410, #411, $); #413 = PLANE('NONE', #412); -#414 = CARTESIAN_POINT('NONE', (0.11613523789047137, 0.0381, 0.05079999999999999)); -#415 = DIRECTION('NONE', (-0.42261826174069966, 0.90630778703665, -0)); +#414 = CARTESIAN_POINT('NONE', (2.9498350424179733, 0.9677399999999998, 1.2903199999999997)); +#415 = DIRECTION('NONE', (-0.42261826174069933, 0.9063077870366499, -0)); #416 = AXIS2_PLACEMENT_3D('NONE', #414, #415, $); #417 = PLANE('NONE', #416); -#418 = CARTESIAN_POINT('NONE', (0.044449999999999996, 0.0254, 0.0508)); +#418 = CARTESIAN_POINT('NONE', (1.1290299999999998, 0.6451599999999998, 1.29032)); #419 = DIRECTION('NONE', (0, 1, -0)); #420 = AXIS2_PLACEMENT_3D('NONE', #418, #419, $); #421 = PLANE('NONE', #420); -#422 = CARTESIAN_POINT('NONE', (0, 0.0127, 0.0508)); +#422 = CARTESIAN_POINT('NONE', (0, 0.32257999999999987, 1.2903199999999995)); #423 = DIRECTION('NONE', (-1, -0, 0)); #424 = AXIS2_PLACEMENT_3D('NONE', #422, #423, $); #425 = PLANE('NONE', #424); @@ -443,7 +443,7 @@ DATA; #427 = DIRECTION('NONE', (0, 0, 1)); #428 = AXIS2_PLACEMENT_3D('NONE', #426, #427, $); #429 = PLANE('NONE', #428); -#430 = CARTESIAN_POINT('NONE', (0, 0, 0.1016)); +#430 = CARTESIAN_POINT('NONE', (0, 0, 2.58064)); #431 = DIRECTION('NONE', (0, 0, 1)); #432 = AXIS2_PLACEMENT_3D('NONE', #430, #431, $); #433 = PLANE('NONE', #432); diff --git a/e2e/playwright/export-snapshots/stl-ascii.png b/e2e/playwright/export-snapshots/stl-ascii.png index c1b146fe9..39fac8f85 100644 Binary files a/e2e/playwright/export-snapshots/stl-ascii.png and b/e2e/playwright/export-snapshots/stl-ascii.png differ diff --git a/e2e/playwright/export-snapshots/stl-ascii.stl b/e2e/playwright/export-snapshots/stl-ascii.stl index 00213e5f6..40370c8a8 100644 --- a/e2e/playwright/export-snapshots/stl-ascii.stl +++ b/e2e/playwright/export-snapshots/stl-ascii.stl @@ -1,478 +1,478 @@ solid unnamed facet normal -1 0 0 outer loop - vertex 0 -4 0 + vertex 0 -101.600006 0 vertex 0 -0 0 - vertex 0 -4 -1 + vertex 0 -101.600006 -25.400002 endloop endfacet facet normal -1 0 0 outer loop - vertex 0 -4 -1 + vertex 0 -101.600006 -25.400002 vertex 0 -0 0 - vertex 0 -0 -1 + vertex 0 -0 -25.400002 endloop endfacet facet normal 0 0 -1 outer loop - vertex 0 -4 -1 - vertex 0 -0 -1 - vertex 3.0950184 -4 -1 + vertex 0 -101.600006 -25.400002 + vertex 0 -0 -25.400002 + vertex 78.613464 -101.600006 -25.400002 endloop endfacet facet normal 0 0 -1 outer loop - vertex 3.0950184 -4 -1 - vertex 0 -0 -1 - vertex 3.0950184 -0 -1 + vertex 78.613464 -101.600006 -25.400002 + vertex 0 -0 -25.400002 + vertex 78.613464 -0 -25.400002 endloop endfacet -facet normal -0.57357645 0 -0.81915206 +facet normal -0.5735764 0 -0.8191522 outer loop - vertex 3.0950184 -4 -1 - vertex 3.0950184 -0 -1 - vertex 5.9513144 -4 -3 + vertex 78.613464 -101.600006 -25.400002 + vertex 78.613464 -0 -25.400002 + vertex 151.16339 -101.600006 -76.2 endloop endfacet -facet normal -0.57357645 0 -0.81915206 +facet normal -0.5735764 0 -0.8191522 outer loop - vertex 5.9513144 -4 -3 - vertex 3.0950184 -0 -1 - vertex 5.9513144 -0 -3 + vertex 151.16339 -101.600006 -76.2 + vertex 78.613464 -0 -25.400002 + vertex 151.16339 -0 -76.2 endloop endfacet facet normal 0 0 -1 outer loop - vertex 5.9513144 -4 -3 - vertex 5.9513144 -0 -3 - vertex 9.5 -4 -3 + vertex 151.16339 -101.600006 -76.2 + vertex 151.16339 -0 -76.2 + vertex 241.3 -101.600006 -76.2 endloop endfacet facet normal 0 0 -1 outer loop - vertex 9.5 -4 -3 - vertex 5.9513144 -0 -3 - vertex 9.5 -0 -3 + vertex 241.3 -101.600006 -76.2 + vertex 151.16339 -0 -76.2 + vertex 241.3 -0 -76.2 endloop endfacet facet normal 1 0 0 outer loop - vertex 9.5 -4 -3 - vertex 9.5 -0 -3 - vertex 9.5 -4 -2.5 + vertex 241.3 -101.600006 -76.2 + vertex 241.3 -0 -76.2 + vertex 241.3 -101.600006 -63.5 endloop endfacet facet normal 1 -0 0 outer loop - vertex 9.5 -4 -2.5 - vertex 9.5 -0 -3 - vertex 9.5 -0 -2.5 + vertex 241.3 -101.600006 -63.5 + vertex 241.3 -0 -76.2 + vertex 241.3 -0 -63.5 + endloop +endfacet +facet normal 0 -0 1 + outer loop + vertex 241.3 -101.600006 -63.5 + vertex 241.3 -0 -63.5 + vertex 155.16768 -101.600006 -63.5 + endloop +endfacet +facet normal 0 0 1 + outer loop + vertex 155.16768 -101.600006 -63.5 + vertex 241.3 -0 -63.5 + vertex 155.16768 -0 -63.5 + endloop +endfacet +facet normal 0.5735765 0 0.81915194 + outer loop + vertex 87.15214 -101.600006 -15.875 + vertex 109.82398 -101.600006 -31.75 + vertex 109.82398 -0 -31.75 + endloop +endfacet +facet normal 0.57357645 0 0.819152 + outer loop + vertex 109.82398 -101.600006 -31.75 + vertex 155.16768 -101.600006 -63.5 + vertex 155.16768 -0 -63.5 + endloop +endfacet +facet normal 0.57357645 0 0.81915206 + outer loop + vertex 87.15214 -0 -15.875 + vertex 64.480286 -101.600006 0 + vertex 87.15214 -101.600006 -15.875 + endloop +endfacet +facet normal 0.5735765 0 0.81915194 + outer loop + vertex 109.82398 -0 -31.75 + vertex 87.15214 -0 -15.875 + vertex 87.15214 -101.600006 -15.875 + endloop +endfacet +facet normal 0.57357645 -0 0.819152 + outer loop + vertex 109.82398 -101.600006 -31.75 + vertex 155.16768 -0 -63.5 + vertex 109.82398 -0 -31.75 + endloop +endfacet +facet normal 0.57357645 -0 0.81915206 + outer loop + vertex 64.480286 -101.600006 0 + vertex 87.15214 -0 -15.875 + vertex 64.480286 -0 0 + endloop +endfacet +facet normal 0.4226182 0 -0.9063078 + outer loop + vertex 84.906715 -101.600006 9.525 + vertex 64.480286 -101.600006 0 + vertex 64.480286 -0 0 + endloop +endfacet +facet normal 0.42261833 0 -0.90630776 + outer loop + vertex 105.33314 -101.600006 19.05 + vertex 84.906715 -101.600006 9.525 + vertex 84.906715 -0 9.525 + endloop +endfacet +facet normal 0.4226182 0 -0.9063078 + outer loop + vertex 84.906715 -0 9.525 + vertex 84.906715 -101.600006 9.525 + vertex 64.480286 -0 0 + endloop +endfacet +facet normal 0.4226183 0 -0.9063078 + outer loop + vertex 105.33314 -0 19.05 + vertex 146.18599 -101.600006 38.1 + vertex 105.33314 -101.600006 19.05 + endloop +endfacet +facet normal 0.42261833 0 -0.90630776 + outer loop + vertex 105.33314 -101.600006 19.05 + vertex 84.906715 -0 9.525 + vertex 105.33314 -0 19.05 + endloop +endfacet +facet normal 0.4226183 0 -0.9063078 + outer loop + vertex 146.18599 -101.600006 38.1 + vertex 105.33314 -0 19.05 + vertex 146.18599 -0 38.1 + endloop +endfacet +facet normal 0 0 -1 + outer loop + vertex 146.18599 -101.600006 38.1 + vertex 146.18599 -0 38.1 + vertex 241.3 -101.600006 38.1 + endloop +endfacet +facet normal 0 0 -1 + outer loop + vertex 241.3 -101.600006 38.1 + vertex 146.18599 -0 38.1 + vertex 241.3 -0 38.1 + endloop +endfacet +facet normal 1 0 0 + outer loop + vertex 241.3 -101.600006 38.1 + vertex 241.3 -0 38.1 + vertex 241.3 -101.600006 50.800003 + endloop +endfacet +facet normal 1 -0 0 + outer loop + vertex 241.3 -101.600006 50.800003 + vertex 241.3 -0 38.1 + vertex 241.3 -0 50.800003 endloop endfacet facet normal 0 -0 0.99999994 outer loop - vertex 9.5 -4 -2.5 - vertex 9.5 -0 -2.5 - vertex 6.108964 -4 -2.5 + vertex 241.3 -101.600006 50.800003 + vertex 241.3 -0 50.800003 + vertex 143.37048 -101.600006 50.800003 endloop endfacet facet normal 0 0 0.99999994 outer loop - vertex 6.108964 -4 -2.5 - vertex 9.5 -0 -2.5 - vertex 6.108964 -0 -2.5 + vertex 143.37048 -101.600006 50.800003 + vertex 241.3 -0 50.800003 + vertex 143.37048 -0 50.800003 endloop endfacet -facet normal 0.5735763 0 0.8191522 +facet normal -0.42261827 0 0.9063078 outer loop - vertex 3.4311862 -4 -0.625 - vertex 4.323779 -4 -1.25 - vertex 4.323779 -0 -1.25 + vertex 143.37048 -101.600006 50.800003 + vertex 143.37048 -0 50.800003 + vertex 88.9 -101.600006 25.400002 endloop endfacet -facet normal 0.57357645 0 0.819152 +facet normal -0.42261827 0 0.9063078 outer loop - vertex 4.323779 -4 -1.25 - vertex 6.108964 -4 -2.5 - vertex 6.108964 -0 -2.5 - endloop -endfacet -facet normal 0.57357645 0 0.819152 - outer loop - vertex 3.4311862 -0 -0.625 - vertex 2.5385938 -4 0 - vertex 3.4311862 -4 -0.625 - endloop -endfacet -facet normal 0.5735763 0 0.8191522 - outer loop - vertex 4.323779 -0 -1.25 - vertex 3.4311862 -0 -0.625 - vertex 3.4311862 -4 -0.625 - endloop -endfacet -facet normal 0.57357645 -0 0.819152 - outer loop - vertex 4.323779 -4 -1.25 - vertex 6.108964 -0 -2.5 - vertex 4.323779 -0 -1.25 - endloop -endfacet -facet normal 0.57357645 -0 0.819152 - outer loop - vertex 2.5385938 -4 0 - vertex 3.4311862 -0 -0.625 - vertex 2.5385938 -0 0 - endloop -endfacet -facet normal 0.42261824 0 -0.9063078 - outer loop - vertex 3.342784 -4 0.375 - vertex 2.5385938 -4 0 - vertex 2.5385938 -0 0 - endloop -endfacet -facet normal 0.42261824 0 -0.9063078 - outer loop - vertex 4.146974 -4 0.75 - vertex 3.342784 -4 0.375 - vertex 3.342784 -0 0.375 - endloop -endfacet -facet normal 0.42261824 0 -0.9063078 - outer loop - vertex 3.342784 -0 0.375 - vertex 3.342784 -4 0.375 - vertex 2.5385938 -0 0 - endloop -endfacet -facet normal 0.42261833 0 -0.90630776 - outer loop - vertex 4.146974 -0 0.75 - vertex 5.755354 -4 1.5 - vertex 4.146974 -4 0.75 - endloop -endfacet -facet normal 0.42261824 0 -0.9063078 - outer loop - vertex 4.146974 -4 0.75 - vertex 3.342784 -0 0.375 - vertex 4.146974 -0 0.75 - endloop -endfacet -facet normal 0.42261833 0 -0.90630776 - outer loop - vertex 5.755354 -4 1.5 - vertex 4.146974 -0 0.75 - vertex 5.755354 -0 1.5 - endloop -endfacet -facet normal 0 0 -1 - outer loop - vertex 5.755354 -4 1.5 - vertex 5.755354 -0 1.5 - vertex 9.5 -4 1.5 - endloop -endfacet -facet normal 0 0 -1 - outer loop - vertex 9.5 -4 1.5 - vertex 5.755354 -0 1.5 - vertex 9.5 -0 1.5 - endloop -endfacet -facet normal 1 0 0 - outer loop - vertex 9.5 -4 1.5 - vertex 9.5 -0 1.5 - vertex 9.5 -4 2 - endloop -endfacet -facet normal 1 -0 0 - outer loop - vertex 9.5 -4 2 - vertex 9.5 -0 1.5 - vertex 9.5 -0 2 + vertex 88.9 -101.600006 25.400002 + vertex 143.37048 -0 50.800003 + vertex 88.9 -0 25.400002 endloop endfacet facet normal 0 -0 1 outer loop - vertex 9.5 -4 2 - vertex 9.5 -0 2 - vertex 5.644507 -4 2 + vertex 88.9 -101.600006 25.400002 + vertex 88.9 -0 25.400002 + vertex 0 -101.600006 25.400002 endloop endfacet facet normal 0 0 1 outer loop - vertex 5.644507 -4 2 - vertex 9.5 -0 2 - vertex 5.644507 -0 2 - endloop -endfacet -facet normal -0.42261824 0 0.90630776 - outer loop - vertex 5.644507 -4 2 - vertex 5.644507 -0 2 - vertex 3.5 -4 1 - endloop -endfacet -facet normal -0.42261824 0 0.90630776 - outer loop - vertex 3.5 -4 1 - vertex 5.644507 -0 2 - vertex 3.5 -0 1 - endloop -endfacet -facet normal 0 -0 1 - outer loop - vertex 3.5 -4 1 - vertex 3.5 -0 1 - vertex 0 -4 1 - endloop -endfacet -facet normal 0 0 1 - outer loop - vertex 0 -4 1 - vertex 3.5 -0 1 - vertex 0 -0 1 + vertex 0 -101.600006 25.400002 + vertex 88.9 -0 25.400002 + vertex 0 -0 25.400002 endloop endfacet facet normal -1 0 0 outer loop - vertex 0 -4 1 - vertex 0 -0 1 - vertex 0 -4 0 + vertex 0 -101.600006 25.400002 + vertex 0 -0 25.400002 + vertex 0 -101.600006 0 endloop endfacet facet normal -1 0 0 outer loop - vertex 0 -4 0 - vertex 0 -0 1 + vertex 0 -101.600006 0 + vertex 0 -0 25.400002 vertex 0 -0 0 endloop endfacet facet normal 0 1 -0 outer loop - vertex 3.342784 -0 0.375 - vertex 2.5385938 -0 0 - vertex 3.5 -0 1 + vertex 84.906715 -0 9.525 + vertex 64.480286 -0 0 + vertex 88.9 -0 25.400002 endloop endfacet facet normal 0 1 0 outer loop - vertex 4.146974 -0 0.75 - vertex 3.342784 -0 0.375 - vertex 3.5 -0 1 + vertex 105.33314 -0 19.05 + vertex 84.906715 -0 9.525 + vertex 88.9 -0 25.400002 endloop endfacet facet normal 0 1 0 outer loop - vertex 3.4311862 -0 -0.625 - vertex 4.323779 -0 -1.25 - vertex 3.0950184 -0 -1 + vertex 87.15214 -0 -15.875 + vertex 109.82398 -0 -31.75 + vertex 78.613464 -0 -25.400002 endloop endfacet -facet normal 0 0.99999994 0 +facet normal 0 1 0 outer loop - vertex 4.146974 -0 0.75 - vertex 5.644507 -0 2 - vertex 5.755354 -0 1.5 + vertex 105.33314 -0 19.05 + vertex 143.37048 -0 50.800003 + vertex 146.18599 -0 38.1 endloop endfacet facet normal -0 1 0 outer loop - vertex 0 -0 1 - vertex 3.5 -0 1 - vertex 2.5385938 -0 0 + vertex 0 -0 25.400002 + vertex 88.9 -0 25.400002 + vertex 64.480286 -0 0 endloop endfacet facet normal 0 1 0 outer loop - vertex 0 -0 1 - vertex 2.5385938 -0 0 + vertex 0 -0 25.400002 + vertex 64.480286 -0 0 vertex 0 -0 0 endloop endfacet facet normal -0 1 0 outer loop - vertex 5.644507 -0 2 - vertex 9.5 -0 2 - vertex 5.755354 -0 1.5 + vertex 143.37048 -0 50.800003 + vertex 241.3 -0 50.800003 + vertex 146.18599 -0 38.1 endloop endfacet facet normal 0 1 0 outer loop - vertex 9.5 -0 2 - vertex 9.5 -0 1.5 - vertex 5.755354 -0 1.5 + vertex 241.3 -0 50.800003 + vertex 241.3 -0 38.1 + vertex 146.18599 -0 38.1 endloop endfacet facet normal 0 1 -0 outer loop - vertex 4.146974 -0 0.75 - vertex 3.5 -0 1 - vertex 5.644507 -0 2 + vertex 105.33314 -0 19.05 + vertex 88.9 -0 25.400002 + vertex 143.37048 -0 50.800003 endloop endfacet facet normal 0 0.99999994 0 outer loop - vertex 2.5385938 -0 0 - vertex 3.4311862 -0 -0.625 - vertex 3.0950184 -0 -1 - endloop -endfacet -facet normal 0 0.99999994 0 - outer loop - vertex 4.323779 -0 -1.25 - vertex 5.9513144 -0 -3 - vertex 3.0950184 -0 -1 + vertex 64.480286 -0 0 + vertex 87.15214 -0 -15.875 + vertex 78.613464 -0 -25.400002 endloop endfacet facet normal 0 1 0 outer loop - vertex 6.108964 -0 -2.5 - vertex 5.9513144 -0 -3 - vertex 4.323779 -0 -1.25 - endloop -endfacet -facet normal 0 0.99999994 0 - outer loop - vertex 9.5 -0 -2.5 - vertex 9.5 -0 -3 - vertex 6.108964 -0 -2.5 + vertex 109.82398 -0 -31.75 + vertex 151.16339 -0 -76.2 + vertex 78.613464 -0 -25.400002 endloop endfacet facet normal 0 1 0 outer loop - vertex 6.108964 -0 -2.5 - vertex 9.5 -0 -3 - vertex 5.9513144 -0 -3 + vertex 155.16768 -0 -63.5 + vertex 151.16339 -0 -76.2 + vertex 109.82398 -0 -31.75 endloop endfacet facet normal 0 1 0 outer loop - vertex 2.5385938 -0 0 - vertex 3.0950184 -0 -1 - vertex 0 -0 -1 + vertex 241.3 -0 -63.5 + vertex 241.3 -0 -76.2 + vertex 155.16768 -0 -63.5 endloop endfacet facet normal 0 1 0 outer loop - vertex 0 -0 -1 + vertex 155.16768 -0 -63.5 + vertex 241.3 -0 -76.2 + vertex 151.16339 -0 -76.2 + endloop +endfacet +facet normal 0 1 0 + outer loop + vertex 64.480286 -0 0 + vertex 78.613464 -0 -25.400002 + vertex 0 -0 -25.400002 + endloop +endfacet +facet normal 0 1 0 + outer loop + vertex 0 -0 -25.400002 vertex 0 -0 0 - vertex 2.5385938 -0 0 + vertex 64.480286 -0 0 endloop endfacet facet normal -0 -1 0 outer loop - vertex 3.342784 -4 0.375 - vertex 3.5 -4 1 - vertex 2.5385938 -4 0 + vertex 84.906715 -101.600006 9.525 + vertex 88.9 -101.600006 25.400002 + vertex 64.480286 -101.600006 0 endloop endfacet facet normal -0 -1 0 outer loop - vertex 4.146974 -4 0.75 - vertex 3.5 -4 1 - vertex 3.342784 -4 0.375 + vertex 105.33314 -101.600006 19.05 + vertex 88.9 -101.600006 25.400002 + vertex 84.906715 -101.600006 9.525 endloop endfacet facet normal 0 -1 -0 outer loop - vertex 3.4311862 -4 -0.625 - vertex 3.0950184 -4 -1 - vertex 4.323779 -4 -1.25 + vertex 87.15214 -101.600006 -15.875 + vertex 78.613464 -101.600006 -25.400002 + vertex 109.82398 -101.600006 -31.75 + endloop +endfacet +facet normal 0 -1 0 + outer loop + vertex 105.33314 -101.600006 19.05 + vertex 146.18599 -101.600006 38.1 + vertex 143.37048 -101.600006 50.800003 + endloop +endfacet +facet normal 0 -1 0 + outer loop + vertex 0 -101.600006 25.400002 + vertex 64.480286 -101.600006 0 + vertex 88.9 -101.600006 25.400002 + endloop +endfacet +facet normal 0 -1 0 + outer loop + vertex 0 -101.600006 25.400002 + vertex 0 -101.600006 0 + vertex 64.480286 -101.600006 0 + endloop +endfacet +facet normal 0 -1 0 + outer loop + vertex 143.37048 -101.600006 50.800003 + vertex 146.18599 -101.600006 38.1 + vertex 241.3 -101.600006 50.800003 + endloop +endfacet +facet normal 0 -1 -0 + outer loop + vertex 241.3 -101.600006 50.800003 + vertex 146.18599 -101.600006 38.1 + vertex 241.3 -101.600006 38.1 + endloop +endfacet +facet normal 0 -1 0 + outer loop + vertex 105.33314 -101.600006 19.05 + vertex 143.37048 -101.600006 50.800003 + vertex 88.9 -101.600006 25.400002 endloop endfacet facet normal 0 -0.99999994 0 outer loop - vertex 4.146974 -4 0.75 - vertex 5.755354 -4 1.5 - vertex 5.644507 -4 2 + vertex 64.480286 -101.600006 0 + vertex 78.613464 -101.600006 -25.400002 + vertex 87.15214 -101.600006 -15.875 endloop endfacet -facet normal 0 -1 0 +facet normal -0 -1 -0 outer loop - vertex 0 -4 1 - vertex 2.5385938 -4 0 - vertex 3.5 -4 1 - endloop -endfacet -facet normal 0 -1 0 - outer loop - vertex 0 -4 1 - vertex 0 -4 0 - vertex 2.5385938 -4 0 - endloop -endfacet -facet normal 0 -1 0 - outer loop - vertex 5.644507 -4 2 - vertex 5.755354 -4 1.5 - vertex 9.5 -4 2 - endloop -endfacet -facet normal 0 -1 -0 - outer loop - vertex 9.5 -4 2 - vertex 5.755354 -4 1.5 - vertex 9.5 -4 1.5 - endloop -endfacet -facet normal 0 -1 0 - outer loop - vertex 4.146974 -4 0.75 - vertex 5.644507 -4 2 - vertex 3.5 -4 1 - endloop -endfacet -facet normal 0 -0.99999994 0 - outer loop - vertex 2.5385938 -4 0 - vertex 3.0950184 -4 -1 - vertex 3.4311862 -4 -0.625 - endloop -endfacet -facet normal -0 -0.99999994 -0 - outer loop - vertex 4.323779 -4 -1.25 - vertex 3.0950184 -4 -1 - vertex 5.9513144 -4 -3 + vertex 109.82398 -101.600006 -31.75 + vertex 78.613464 -101.600006 -25.400002 + vertex 151.16339 -101.600006 -76.2 endloop endfacet facet normal -0 -1 0 outer loop - vertex 6.108964 -4 -2.5 - vertex 4.323779 -4 -1.25 - vertex 5.9513144 -4 -3 + vertex 155.16768 -101.600006 -63.5 + vertex 109.82398 -101.600006 -31.75 + vertex 151.16339 -101.600006 -76.2 endloop endfacet -facet normal -0 -0.99999994 -0 +facet normal -0 -1 -0 outer loop - vertex 9.5 -4 -2.5 - vertex 6.108964 -4 -2.5 - vertex 9.5 -4 -3 + vertex 241.3 -101.600006 -63.5 + vertex 155.16768 -101.600006 -63.5 + vertex 241.3 -101.600006 -76.2 endloop endfacet facet normal 0 -1 -0 outer loop - vertex 6.108964 -4 -2.5 - vertex 5.9513144 -4 -3 - vertex 9.5 -4 -3 + vertex 155.16768 -101.600006 -63.5 + vertex 151.16339 -101.600006 -76.2 + vertex 241.3 -101.600006 -76.2 endloop endfacet facet normal 0 -1 -0 outer loop - vertex 2.5385938 -4 0 - vertex 0 -4 -1 - vertex 3.0950184 -4 -1 + vertex 64.480286 -101.600006 0 + vertex 0 -101.600006 -25.400002 + vertex 78.613464 -101.600006 -25.400002 endloop endfacet facet normal 0 -1 0 outer loop - vertex 0 -4 -1 - vertex 2.5385938 -4 0 - vertex 0 -4 0 + vertex 0 -101.600006 -25.400002 + vertex 64.480286 -101.600006 0 + vertex 0 -101.600006 0 endloop endfacet endsolid unnamed diff --git a/e2e/playwright/export-snapshots/stl-binary.png b/e2e/playwright/export-snapshots/stl-binary.png index c1b146fe9..39fac8f85 100644 Binary files a/e2e/playwright/export-snapshots/stl-binary.png and b/e2e/playwright/export-snapshots/stl-binary.png differ diff --git a/e2e/playwright/export-snapshots/stl-binary.stl b/e2e/playwright/export-snapshots/stl-binary.stl index 451173e65..cd0b2f820 100644 Binary files a/e2e/playwright/export-snapshots/stl-binary.stl and b/e2e/playwright/export-snapshots/stl-binary.stl differ diff --git a/e2e/playwright/flow-tests.spec.ts b/e2e/playwright/flow-tests.spec.ts index ef2a30bc5..29f4c78e1 100644 --- a/e2e/playwright/flow-tests.spec.ts +++ b/e2e/playwright/flow-tests.spec.ts @@ -72,7 +72,7 @@ test('Basic sketch', async ({ page }) => { const startXPx = 600 await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10) - const startAt = '[23.89, -32.23]' + const startAt = '[23.74, -32.03]' await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %)`) @@ -82,7 +82,7 @@ test('Basic sketch', async ({ page }) => { await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10) await page.waitForTimeout(100) - const num = 24.11 + const num = 23.97 await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) @@ -93,14 +93,14 @@ test('Basic sketch', async ({ page }) => { .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %)`) + |> line([0, ${num}], %)`) await page.mouse.click(startXPx, 500 - PUR * 20) await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %) - |> line([-48, 0], %)`) + |> line([0, ${num}], %) + |> line([-47.71, 0], %)`) // deselect line tool await page.getByRole('button', { name: 'Line' }).click() @@ -124,7 +124,7 @@ test('Basic sketch', async ({ page }) => { .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line({ to: [${num}, 0], tag: 'seg01' }, %) - |> line([0, ${num + 0.01}], %) + |> line([0, ${num}], %) |> angledLine([180, segLen('seg01', %)], %)`) }) @@ -461,7 +461,7 @@ test('Selections work on fresh and edited sketch', async ({ page }) => { const startXPx = 600 await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10) - const startAt = '[23.89, -32.23]' + const startAt = '[23.74, -32.03]' await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %)`) @@ -470,8 +470,8 @@ test('Selections work on fresh and edited sketch', async ({ page }) => { await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10) - const num = 24.11 - const num2 = '48' + const num = 23.97 + const num2 = '47.71' await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) @@ -482,13 +482,13 @@ test('Selections work on fresh and edited sketch', async ({ page }) => { .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %)`) + |> line([0, ${num}], %)`) await page.mouse.click(startXPx, 500 - PUR * 20) await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %) + |> line([0, ${num}], %) |> line([-${num2}, 0], %)`) // deselect line tool @@ -574,12 +574,13 @@ test('Selections work on fresh and edited sketch', async ({ page }) => { await u.closeDebugPanel() // select a line - await topHorzSegmentClick() - await page.waitForTimeout(200) + // await topHorzSegmentClick() + await page.getByText(startAt).click() // TODO remove this and reinstate // await topHorzSegmentClick() + await page.waitForTimeout(100) // enter sketch again await page.getByRole('button', { name: 'Edit Sketch' }).click() - await page.waitForTimeout(700) // wait for animation + await page.waitForTimeout(300) // wait for animation // hover again and check it works await selectionSequence() @@ -715,7 +716,7 @@ test('Can add multiple sketches', async ({ page }) => { const startXPx = 600 await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10) - const startAt = '[23.89, -32.23]' + const startAt = '[23.74, -32.03]' await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %)`) @@ -725,7 +726,7 @@ test('Can add multiple sketches', async ({ page }) => { await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10) await page.waitForTimeout(100) - const num = 24.11 + const num = 23.97 await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) @@ -736,13 +737,13 @@ test('Can add multiple sketches', async ({ page }) => { .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %)`) + |> line([0, ${num}], %)`) await page.mouse.click(startXPx, 500 - PUR * 20) const finalCodeFirstSketch = `const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) |> line([${num}, 0], %) - |> line([0, ${num + 0.01}], %) - |> line([-48, 0], %)` + |> line([0, ${num}], %) + |> line([-47.71, 0], %)` await expect(page.locator('.cm-content')).toHaveText(finalCodeFirstSketch) // exit the sketch diff --git a/e2e/playwright/snapshot-tests.spec.ts b/e2e/playwright/snapshot-tests.spec.ts index 0ee4ff20c..309f3fd86 100644 --- a/e2e/playwright/snapshot-tests.spec.ts +++ b/e2e/playwright/snapshot-tests.spec.ts @@ -369,13 +369,13 @@ test('extrude on each default plane should be stable', async ({ }) => { const u = getUtils(page) const makeCode = (plane = 'XY') => `const part001 = startSketchOn('${plane}') - |> startProfileAt([14.06, 8.88], %) - |> line([12.98, -0.15], %) - |> line([5.56, 9.89], %) - |> line([-11.28, 8.96], %) - |> line([-10.81, -7.57], %) + |> startProfileAt([0.70, 0.44], %) + |> line([0.66, -0.02], %) + |> line([0.28, 0.50], %) + |> line([-0.56, 0.44], %) + |> line([-0.54, -0.38], %) |> close(%) - |> extrude(20, %) + |> extrude(1.00, %) ` await context.addInitScript(async (code) => { localStorage.setItem('persistCode', code) @@ -448,7 +448,7 @@ test('Draft segments should look right', async ({ page }) => { const startXPx = 600 await page.mouse.click(startXPx + PUR * 10, 500 - PUR * 10) - const startAt = '[23.89, -32.23]' + const startAt = '[23.74, -32.03]' await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %)`) @@ -463,7 +463,7 @@ test('Draft segments should look right', async ({ page }) => { await page.mouse.click(startXPx + PUR * 20, 500 - PUR * 10) await page.waitForTimeout(100) - const num = 24.11 + const num = 23.97 await expect(page.locator('.cm-content')) .toHaveText(`const part001 = startSketchOn('-XZ') |> startProfileAt(${startAt}, %) diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-1-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-1-Google-Chrome-linux.png index 69cb71326..b346acf08 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-1-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-1-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-2-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-2-Google-Chrome-linux.png index a3752d6c3..ac86c5469 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-2-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/Draft-segments-should-look-right-2-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-1-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-1-Google-Chrome-linux.png index 400b0d198..61768ecea 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-1-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-1-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-2-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-2-Google-Chrome-linux.png index 60d96c250..d284b68a6 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-2-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-2-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-3-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-3-Google-Chrome-linux.png index f5b644f2b..0574023b3 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-3-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-3-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-4-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-4-Google-Chrome-linux.png index 11a746cd3..9cefe62c2 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-4-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-4-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-5-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-5-Google-Chrome-linux.png index e8b353ccc..0c31a3367 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-5-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-5-Google-Chrome-linux.png differ diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-6-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-6-Google-Chrome-linux.png index 513602e08..c4f0221b3 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-6-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/extrude-on-each-default-plane-should-be-stable-6-Google-Chrome-linux.png differ diff --git a/src/clientSideScene/sceneInfra.ts b/src/clientSideScene/sceneInfra.ts index 2b1ea7a05..82e7745e1 100644 --- a/src/clientSideScene/sceneInfra.ts +++ b/src/clientSideScene/sceneInfra.ts @@ -14,10 +14,8 @@ import { Vector2, Group, PlaneGeometry, - EdgesGeometry, MeshBasicMaterial, Mesh, - LineSegments, DoubleSide, Intersection, Object3D, @@ -34,7 +32,7 @@ import * as TWEEN from '@tweenjs/tween.js' import { MouseGuard, cameraMouseDragGuards } from 'lib/cameraControls' import { SourceRange } from 'lang/wasm' import { Axis } from 'lib/selections' -import { createGridHelper } from './helpers' +import { BaseUnit, SETTINGS_PERSIST_KEY } from 'machines/settingsMachine' type SendType = ReturnType['send'] @@ -308,8 +306,17 @@ class SceneInfra { this.scene.background = null // CAMERA + const camHeightDistanceRatio = 0.5 + const baseUnit: BaseUnit = + JSON.parse(localStorage?.getItem(SETTINGS_PERSIST_KEY) || ('{}' as any)) + .baseUnit || 'mm' + const baseRadius = 5.6 + const length = baseUnitTomm(baseUnit) * baseRadius + const ang = Math.atan(camHeightDistanceRatio) + const x = Math.cos(ang) * length + const y = Math.sin(ang) * length this.camera = this.createPerspectiveCamera() - this.camera.position.set(0, -128, 64) + this.camera.position.set(0, -x, y) if (DEBUG_SHOW_INTERSECTION_PLANE) this.camera.layers.enable(INTERSECTION_PLANE_LAYER) @@ -1107,6 +1114,23 @@ export function getSceneScale( return 1 } +function baseUnitTomm(baseUnit: BaseUnit) { + switch (baseUnit) { + case 'mm': + return 1 + case 'cm': + return 10 + case 'm': + return 1000 + case 'in': + return 25.4 + case 'ft': + return 304.8 + case 'yd': + return 914.4 + } +} + export function isQuaternionVertical(q: Quaternion) { const v = new Vector3(0, 0, 1).applyQuaternion(q) // no x or y components means it's vertical diff --git a/src/components/GlobalStateProvider.tsx b/src/components/GlobalStateProvider.tsx index 10724241e..e31035adf 100644 --- a/src/components/GlobalStateProvider.tsx +++ b/src/components/GlobalStateProvider.tsx @@ -30,6 +30,12 @@ type GlobalContext = { settings: MachineContext } +// a little hacky for sure, open to changing it +// this implies that we should only even have one instance of this provider mounted at any one time +// but I think that's a safe assumption +let settingsStateRef: (typeof settingsMachine)['context'] | undefined +export const getSettingsState = () => settingsStateRef + export const GlobalStateContext = createContext({} as GlobalContext) export const GlobalStateProvider = ({ @@ -71,6 +77,7 @@ export const GlobalStateProvider = ({ }, }, }) + settingsStateRef = settingsState.context useStateMachineCommands({ machineId: 'settings', diff --git a/src/lang/wasm.ts b/src/lang/wasm.ts index b53092b6a..f724b4d40 100644 --- a/src/lang/wasm.ts +++ b/src/lang/wasm.ts @@ -136,15 +136,21 @@ export const executor = async ( return _programMemory } +const getSettingsState = import('components/GlobalStateProvider').then( + (module) => module.getSettingsState +) + export const _executor = async ( node: Program, programMemory: ProgramMemory = { root: {}, return: null }, engineCommandManager: EngineCommandManager ): Promise => { try { + const baseUnit = (await getSettingsState)()?.baseUnit || 'mm' const memory: ProgramMemory = await execute_wasm( JSON.stringify(node), JSON.stringify(programMemory), + baseUnit, engineCommandManager, fileSystemManager ) diff --git a/src/machines/settingsMachine.ts b/src/machines/settingsMachine.ts index 08649aadc..036377d8f 100644 --- a/src/machines/settingsMachine.ts +++ b/src/machines/settingsMachine.ts @@ -3,6 +3,10 @@ import { Themes, getSystemTheme, setThemeClass } from '../lib/theme' import { CameraSystem } from 'lib/cameraControls' import { Models } from '@kittycad/lib' +const kclManagerPromise = import('lang/KclSingleton').then( + (module) => module.kclManager +) + export const DEFAULT_PROJECT_NAME = 'project-$nnn' export enum UnitSystem { @@ -29,7 +33,7 @@ export const settingsMachine = createMachine( id: 'Settings', predictableActionArguments: true, context: { - baseUnit: 'in' as BaseUnit, + baseUnit: 'mm' as BaseUnit, cameraControls: 'KittyCAD' as CameraSystem, defaultDirectory: '', defaultProjectName: DEFAULT_PROJECT_NAME, @@ -37,7 +41,7 @@ export const settingsMachine = createMachine( showDebugPanel: false, textWrapping: 'On' as Toggle, theme: Themes.System, - unitSystem: UnitSystem.Imperial, + unitSystem: UnitSystem.Metric, }, initial: 'idle', states: { @@ -47,13 +51,13 @@ export const settingsMachine = createMachine( 'Set Base Unit': { actions: [ assign({ - baseUnit: (_, event) => { - console.log('event', event) - return event.data.baseUnit - }, + baseUnit: (_, event) => event.data.baseUnit, }), 'persistSettings', 'toastSuccess', + async () => { + ;(await kclManagerPromise).executeAst() + }, ], target: 'idle', internal: true, @@ -134,6 +138,9 @@ export const settingsMachine = createMachine( }), 'persistSettings', 'toastSuccess', + async () => { + ;(await kclManagerPromise).executeAst() + }, ], target: 'idle', internal: true, diff --git a/src/wasm-lib/Cargo.lock b/src/wasm-lib/Cargo.lock index 900d87ad0..19c4ae3d6 100644 --- a/src/wasm-lib/Cargo.lock +++ b/src/wasm-lib/Cargo.lock @@ -1948,9 +1948,9 @@ dependencies = [ [[package]] name = "kittycad" -version = "0.2.53" +version = "0.2.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a086e1a1bbddb3b38959c0f0ce6de6b3a3b7566e38e0b7d5fb101e91911beed4" +checksum = "13958174d876353f429ea8230dc92fe86f164819cea2e51bbf22e01a4c2a496e" dependencies = [ "anyhow", "async-trait", diff --git a/src/wasm-lib/Cargo.toml b/src/wasm-lib/Cargo.toml index 498487fea..b0727496b 100644 --- a/src/wasm-lib/Cargo.toml +++ b/src/wasm-lib/Cargo.toml @@ -58,7 +58,7 @@ members = [ ] [workspace.dependencies] -kittycad = { version = "0.2.53", default-features = false, features = ["js", "requests"] } +kittycad = { version = "0.2.54", default-features = false, features = ["js", "requests"] } kittycad-execution-plan = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" } kittycad-execution-plan-traits = "0.1.10" kittycad-modeling-session = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" } diff --git a/src/wasm-lib/kcl/src/executor.rs b/src/wasm-lib/kcl/src/executor.rs index 79715d426..52c026601 100644 --- a/src/wasm-lib/kcl/src/executor.rs +++ b/src/wasm-lib/kcl/src/executor.rs @@ -13,7 +13,7 @@ use tower_lsp::lsp_types::{Position as LspPosition, Range as LspRange}; use crate::{ ast::types::{BodyItem, FunctionExpression, KclNone, Value}, - engine::EngineConnection, + engine::{EngineConnection, EngineManager}, errors::{KclError, KclErrorDetails}, fs::FileManager, std::{FunctionKind, StdLib}, @@ -950,27 +950,30 @@ pub struct ExecutorContext { pub engine: EngineConnection, pub fs: FileManager, pub stdlib: Arc, + pub units: kittycad::types::UnitLength, } impl ExecutorContext { /// Create a new default executor context. #[cfg(test)] - pub async fn new() -> Result { + pub async fn new(units: kittycad::types::UnitLength) -> Result { Ok(Self { engine: EngineConnection::new().await?, fs: FileManager::new(), stdlib: Arc::new(StdLib::new()), + units, }) } /// Create a new default executor context. #[cfg(not(test))] #[cfg(not(target_arch = "wasm32"))] - pub async fn new(ws: reqwest::Upgraded) -> Result { + pub async fn new(ws: reqwest::Upgraded, units: kittycad::types::UnitLength) -> Result { Ok(Self { engine: EngineConnection::new(ws).await?, fs: FileManager::new(), stdlib: Arc::new(StdLib::new()), + units, }) } } @@ -983,6 +986,17 @@ pub async fn execute( options: BodyType, ctx: &ExecutorContext, ) -> Result { + // Before we even start executing the program, set the units. + ctx.engine + .send_modeling_cmd( + uuid::Uuid::new_v4(), + SourceRange::default(), + kittycad::types::ModelingCmd::SetSceneUnits { + unit: ctx.units.clone(), + }, + ) + .await?; + let mut pipe_info = PipeInfo::default(); // Iterate over the body of the program. @@ -1269,7 +1283,7 @@ mod tests { let parser = crate::parser::Parser::new(tokens); let program = parser.ast()?; let mut mem: ProgramMemory = Default::default(); - let ctx = ExecutorContext::new().await?; + let ctx = ExecutorContext::new(kittycad::types::UnitLength::Mm).await?; let memory = execute(program, &mut mem, BodyType::Root, &ctx).await?; Ok(memory) diff --git a/src/wasm-lib/kcl/src/std/utils.rs b/src/wasm-lib/kcl/src/std/utils.rs index 389ab7d99..55dec5127 100644 --- a/src/wasm-lib/kcl/src/std/utils.rs +++ b/src/wasm-lib/kcl/src/std/utils.rs @@ -772,3 +772,24 @@ pub fn get_tangent_point_from_previous_arc( tangential_angle.to_radians().sin() * 10.0 + last_arc_end[1], ] } + +fn unit_length_to_mm(base_unit: kittycad::types::UnitLength) -> f64 { + match base_unit { + kittycad::types::UnitLength::Mm => 1.0, + kittycad::types::UnitLength::Cm => 10.0, + kittycad::types::UnitLength::M => 1000.0, + kittycad::types::UnitLength::In => 25.4, + kittycad::types::UnitLength::Ft => 304.8, + kittycad::types::UnitLength::Yd => 914.4, + } +} + +pub fn get_camera_zoom_magnitude_per_unit_length(unit: kittycad::types::UnitLength) -> (f64, f64) { + let base_radius = 5.6_f64; + let cam_height_distance_ratio = 0.5_f64; + let length = unit_length_to_mm(unit) * base_radius * 20.0; + let ang = cam_height_distance_ratio.atan(); + let x = ang.cos() * length; + let y = ang.sin() * length; + (x, y) +} diff --git a/src/wasm-lib/src/lib.rs b/src/wasm-lib/src/lib.rs index 92c8018ab..ca3c34b8e 100644 --- a/src/wasm-lib/src/lib.rs +++ b/src/wasm-lib/src/lib.rs @@ -1,327 +1,7 @@ //! Wasm bindings for `kcl`. #[cfg(target_arch = "wasm32")] -use std::sync::{Arc, RwLock}; +mod wasm; #[cfg(target_arch = "wasm32")] -use futures::stream::TryStreamExt; -use gloo_utils::format::JsValueSerdeExt; -#[cfg(target_arch = "wasm32")] -use tower_lsp::{LspService, Server}; -use wasm_bindgen::prelude::*; - -// wasm_bindgen wrapper for execute -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub async fn execute_wasm( - program_str: &str, - memory_str: &str, - engine_manager: kcl_lib::engine::conn_wasm::EngineCommandManager, - fs_manager: kcl_lib::fs::wasm::FileSystemManager, -) -> Result { - // deserialize the ast from a stringified json - - use kcl_lib::executor::ExecutorContext; - let program: kcl_lib::ast::types::Program = serde_json::from_str(program_str).map_err(|e| e.to_string())?; - let mut mem: kcl_lib::executor::ProgramMemory = serde_json::from_str(memory_str).map_err(|e| e.to_string())?; - - let engine = kcl_lib::engine::EngineConnection::new(engine_manager) - .await - .map_err(|e| format!("{:?}", e))?; - let fs = kcl_lib::fs::FileManager::new(fs_manager); - let ctx = ExecutorContext { - engine, - fs, - stdlib: std::sync::Arc::new(kcl_lib::std::StdLib::new()), - }; - - let memory = kcl_lib::executor::execute(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx) - .await - .map_err(String::from)?; - // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the - // gloo-serialize crate instead. - JsValue::from_serde(&memory).map_err(|e| e.to_string()) -} - -// wasm_bindgen wrapper for execute -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub async fn modify_ast_for_sketch_wasm( - manager: kcl_lib::engine::conn_wasm::EngineCommandManager, - program_str: &str, - sketch_name: &str, - plane_type: &str, - sketch_id: &str, -) -> Result { - // deserialize the ast from a stringified json - let mut program: kcl_lib::ast::types::Program = serde_json::from_str(program_str).map_err(|e| e.to_string())?; - - let plane: kcl_lib::executor::PlaneType = serde_json::from_str(plane_type).map_err(|e| e.to_string())?; - - let mut engine = kcl_lib::engine::EngineConnection::new(manager) - .await - .map_err(|e| format!("{:?}", e))?; - - let _ = kcl_lib::ast::modify::modify_ast_for_sketch( - &mut engine, - &mut program, - sketch_name, - plane, - uuid::Uuid::parse_str(sketch_id).map_err(|e| e.to_string())?, - ) - .await - .map_err(String::from)?; - - // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the - // gloo-serialize crate instead. - JsValue::from_serde(&program).map_err(|e| e.to_string()) -} - -#[wasm_bindgen] -pub fn deserialize_files(data: &[u8]) -> Result { - let ws_resp: kittycad::types::WebSocketResponse = bson::from_slice(data)?; - - if let Some(success) = ws_resp.success { - if !success { - return Err(JsError::new(&format!("Server returned error: {:?}", ws_resp.errors))); - } - } - - if let Some(kittycad::types::OkWebSocketResponseData::Export { files }) = ws_resp.resp { - return Ok(JsValue::from_serde(&files)?); - } - - Err(JsError::new(&format!("Invalid response type, got: {:?}", ws_resp))) -} - -// wasm_bindgen wrapper for lexer -// test for this function and by extension lexer are done in javascript land src/lang/tokeniser.test.ts -#[wasm_bindgen] -pub fn lexer_wasm(js: &str) -> Result { - let tokens = kcl_lib::token::lexer(js); - Ok(JsValue::from_serde(&tokens)?) -} - -#[wasm_bindgen] -pub fn parse_wasm(js: &str) -> Result { - let tokens = kcl_lib::token::lexer(js); - let parser = kcl_lib::parser::Parser::new(tokens); - let program = parser.ast().map_err(String::from)?; - // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the - // gloo-serialize crate instead. - JsValue::from_serde(&program).map_err(|e| e.to_string()) -} - -// wasm_bindgen wrapper for recast -// test for this function and by extension the recaster are done in javascript land src/lang/recast.test.ts -#[wasm_bindgen] -pub fn recast_wasm(json_str: &str) -> Result { - // deserialize the ast from a stringified json - let program: kcl_lib::ast::types::Program = serde_json::from_str(json_str).map_err(JsError::from)?; - - // Use the default options until we integrate into the UI the ability to change them. - let result = program.recast(&Default::default(), 0); - Ok(JsValue::from_serde(&result)?) -} - -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub struct ServerConfig { - into_server: js_sys::AsyncIterator, - from_server: web_sys::WritableStream, - fs: kcl_lib::fs::wasm::FileSystemManager, -} - -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -impl ServerConfig { - #[wasm_bindgen(constructor)] - pub fn new( - into_server: js_sys::AsyncIterator, - from_server: web_sys::WritableStream, - fs: kcl_lib::fs::wasm::FileSystemManager, - ) -> Self { - Self { - into_server, - from_server, - fs, - } - } -} - -/// Run the `kcl` lsp server. -// -// NOTE: we don't use web_sys::ReadableStream for input here because on the -// browser side we need to use a ReadableByteStreamController to construct it -// and so far only Chromium-based browsers support that functionality. - -// NOTE: input needs to be an AsyncIterator specifically -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub async fn kcl_lsp_run(config: ServerConfig) -> Result<(), JsValue> { - let ServerConfig { - into_server, - from_server, - fs, - } = config; - - let stdlib = kcl_lib::std::StdLib::new(); - let stdlib_completions = kcl_lib::lsp::kcl::get_completions_from_stdlib(&stdlib).map_err(|e| e.to_string())?; - let stdlib_signatures = kcl_lib::lsp::kcl::get_signatures_from_stdlib(&stdlib).map_err(|e| e.to_string())?; - // We can unwrap here because we know the tokeniser is valid, since - // we have a test for it. - let token_types = kcl_lib::token::TokenType::all_semantic_token_types().unwrap(); - - let (service, socket) = LspService::new(|client| kcl_lib::lsp::kcl::Backend { - client, - fs: kcl_lib::fs::FileManager::new(fs), - stdlib_completions, - stdlib_signatures, - token_types, - token_map: Default::default(), - ast_map: Default::default(), - current_code_map: Default::default(), - diagnostics_map: Default::default(), - symbols_map: Default::default(), - semantic_tokens_map: Default::default(), - }); - - let input = wasm_bindgen_futures::stream::JsStream::from(into_server); - let input = input - .map_ok(|value| { - value - .dyn_into::() - .expect("could not cast stream item to Uint8Array") - .to_vec() - }) - .map_err(|_err| std::io::Error::from(std::io::ErrorKind::Other)) - .into_async_read(); - - let output = wasm_bindgen::JsCast::unchecked_into::(from_server); - let output = wasm_streams::WritableStream::from_raw(output); - let output = output.try_into_async_write().map_err(|err| err.0)?; - - Server::new(input, output, socket).serve(service).await; - - Ok(()) -} - -/// Run the `copilot` lsp server. -// -// NOTE: we don't use web_sys::ReadableStream for input here because on the -// browser side we need to use a ReadableByteStreamController to construct it -// and so far only Chromium-based browsers support that functionality. - -// NOTE: input needs to be an AsyncIterator specifically -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub async fn copilot_lsp_run(config: ServerConfig, token: String) -> Result<(), JsValue> { - let ServerConfig { - into_server, - from_server, - fs, - } = config; - - let (service, socket) = LspService::build(|client| kcl_lib::lsp::copilot::Backend { - client, - fs: kcl_lib::fs::FileManager::new(fs), - current_code_map: Default::default(), - editor_info: Arc::new(RwLock::new(kcl_lib::lsp::copilot::types::CopilotEditorInfo::default())), - cache: kcl_lib::lsp::copilot::cache::CopilotCache::new(), - token, - }) - .custom_method("setEditorInfo", kcl_lib::lsp::copilot::Backend::set_editor_info) - .custom_method( - "getCompletions", - kcl_lib::lsp::copilot::Backend::get_completions_cycling, - ) - .custom_method("notifyAccepted", kcl_lib::lsp::copilot::Backend::accept_completions) - .custom_method("notifyRejected", kcl_lib::lsp::copilot::Backend::reject_completions) - .finish(); - - let input = wasm_bindgen_futures::stream::JsStream::from(into_server); - let input = input - .map_ok(|value| { - value - .dyn_into::() - .expect("could not cast stream item to Uint8Array") - .to_vec() - }) - .map_err(|_err| std::io::Error::from(std::io::ErrorKind::Other)) - .into_async_read(); - - let output = wasm_bindgen::JsCast::unchecked_into::(from_server); - let output = wasm_streams::WritableStream::from_raw(output); - let output = output.try_into_async_write().map_err(|err| err.0)?; - - Server::new(input, output, socket).serve(service).await; - - Ok(()) -} - -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub fn is_points_ccw(points: &[f64]) -> i32 { - kcl_lib::std::utils::is_points_ccw_wasm(points) -} - -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub struct TangentialArcInfoOutputWasm { - /// The geometric center of the arc x. - pub center_x: f64, - /// The geometric center of the arc y. - pub center_y: f64, - /// The midpoint of the arc x. - pub arc_mid_point_x: f64, - /// The midpoint of the arc y. - pub arc_mid_point_y: f64, - /// The radius of the arc. - pub radius: f64, - /// Start angle of the arc in radians. - pub start_angle: f64, - /// End angle of the arc in radians. - pub end_angle: f64, - /// Flag to determine if the arc is counter clockwise. - pub ccw: i32, -} - -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub fn get_tangential_arc_to_info( - arc_start_point_x: f64, - arc_start_point_y: f64, - arc_end_point_x: f64, - arc_end_point_y: f64, - tan_previous_point_x: f64, - tan_previous_point_y: f64, - obtuse: bool, -) -> TangentialArcInfoOutputWasm { - let result = kcl_lib::std::utils::get_tangential_arc_to_info(kcl_lib::std::utils::TangentialArcInfoInput { - arc_start_point: [arc_start_point_x, arc_start_point_y], - arc_end_point: [arc_end_point_x, arc_end_point_y], - tan_previous_point: [tan_previous_point_x, tan_previous_point_y], - obtuse: obtuse, - }); - TangentialArcInfoOutputWasm { - center_x: result.center[0], - center_y: result.center[1], - arc_mid_point_x: result.arc_mid_point[0], - arc_mid_point_y: result.arc_mid_point[1], - radius: result.radius, - start_angle: result.start_angle, - end_angle: result.end_angle, - ccw: result.ccw, - } -} - -/// Create the default program memory. -#[cfg(target_arch = "wasm32")] -#[wasm_bindgen] -pub fn program_memory_init() -> Result { - let memory = kcl_lib::executor::ProgramMemory::default(); - - // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the - // gloo-serialize crate instead. - JsValue::from_serde(&memory).map_err(|e| e.to_string()) -} +pub use wasm::*; diff --git a/src/wasm-lib/src/wasm.rs b/src/wasm-lib/src/wasm.rs new file mode 100644 index 000000000..b50945e16 --- /dev/null +++ b/src/wasm-lib/src/wasm.rs @@ -0,0 +1,320 @@ +//! Wasm bindings for `kcl`. + +use std::{ + str::FromStr, + sync::{Arc, RwLock}, +}; + +use futures::stream::TryStreamExt; +use gloo_utils::format::JsValueSerdeExt; +use tower_lsp::{LspService, Server}; +use wasm_bindgen::prelude::*; + +// wasm_bindgen wrapper for execute +#[wasm_bindgen] +pub async fn execute_wasm( + program_str: &str, + memory_str: &str, + units: &str, + engine_manager: kcl_lib::engine::conn_wasm::EngineCommandManager, + fs_manager: kcl_lib::fs::wasm::FileSystemManager, +) -> Result { + // deserialize the ast from a stringified json + + use kcl_lib::executor::ExecutorContext; + let program: kcl_lib::ast::types::Program = serde_json::from_str(program_str).map_err(|e| e.to_string())?; + let mut mem: kcl_lib::executor::ProgramMemory = serde_json::from_str(memory_str).map_err(|e| e.to_string())?; + let units = kittycad::types::UnitLength::from_str(units).map_err(|e| e.to_string())?; + + let engine = kcl_lib::engine::EngineConnection::new(engine_manager) + .await + .map_err(|e| format!("{:?}", e))?; + let fs = kcl_lib::fs::FileManager::new(fs_manager); + let ctx = ExecutorContext { + engine, + fs, + stdlib: std::sync::Arc::new(kcl_lib::std::StdLib::new()), + units, + }; + + let memory = kcl_lib::executor::execute(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx) + .await + .map_err(String::from)?; + // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the + // gloo-serialize crate instead. + JsValue::from_serde(&memory).map_err(|e| e.to_string()) +} + +// wasm_bindgen wrapper for execute +#[wasm_bindgen] +pub async fn modify_ast_for_sketch_wasm( + manager: kcl_lib::engine::conn_wasm::EngineCommandManager, + program_str: &str, + sketch_name: &str, + plane_type: &str, + sketch_id: &str, +) -> Result { + // deserialize the ast from a stringified json + let mut program: kcl_lib::ast::types::Program = serde_json::from_str(program_str).map_err(|e| e.to_string())?; + + let plane: kcl_lib::executor::PlaneType = serde_json::from_str(plane_type).map_err(|e| e.to_string())?; + + let mut engine = kcl_lib::engine::EngineConnection::new(manager) + .await + .map_err(|e| format!("{:?}", e))?; + + let _ = kcl_lib::ast::modify::modify_ast_for_sketch( + &mut engine, + &mut program, + sketch_name, + plane, + uuid::Uuid::parse_str(sketch_id).map_err(|e| e.to_string())?, + ) + .await + .map_err(String::from)?; + + // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the + // gloo-serialize crate instead. + JsValue::from_serde(&program).map_err(|e| e.to_string()) +} + +#[wasm_bindgen] +pub fn deserialize_files(data: &[u8]) -> Result { + let ws_resp: kittycad::types::WebSocketResponse = bson::from_slice(data)?; + + if let Some(success) = ws_resp.success { + if !success { + return Err(JsError::new(&format!("Server returned error: {:?}", ws_resp.errors))); + } + } + + if let Some(kittycad::types::OkWebSocketResponseData::Export { files }) = ws_resp.resp { + return Ok(JsValue::from_serde(&files)?); + } + + Err(JsError::new(&format!("Invalid response type, got: {:?}", ws_resp))) +} + +// wasm_bindgen wrapper for lexer +// test for this function and by extension lexer are done in javascript land src/lang/tokeniser.test.ts +#[wasm_bindgen] +pub fn lexer_wasm(js: &str) -> Result { + let tokens = kcl_lib::token::lexer(js); + Ok(JsValue::from_serde(&tokens)?) +} + +#[wasm_bindgen] +pub fn parse_wasm(js: &str) -> Result { + let tokens = kcl_lib::token::lexer(js); + let parser = kcl_lib::parser::Parser::new(tokens); + let program = parser.ast().map_err(String::from)?; + // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the + // gloo-serialize crate instead. + JsValue::from_serde(&program).map_err(|e| e.to_string()) +} + +// wasm_bindgen wrapper for recast +// test for this function and by extension the recaster are done in javascript land src/lang/recast.test.ts +#[wasm_bindgen] +pub fn recast_wasm(json_str: &str) -> Result { + // deserialize the ast from a stringified json + let program: kcl_lib::ast::types::Program = serde_json::from_str(json_str).map_err(JsError::from)?; + + // Use the default options until we integrate into the UI the ability to change them. + let result = program.recast(&Default::default(), 0); + Ok(JsValue::from_serde(&result)?) +} + +#[wasm_bindgen] +pub struct ServerConfig { + into_server: js_sys::AsyncIterator, + from_server: web_sys::WritableStream, + fs: kcl_lib::fs::wasm::FileSystemManager, +} + +#[wasm_bindgen] +impl ServerConfig { + #[wasm_bindgen(constructor)] + pub fn new( + into_server: js_sys::AsyncIterator, + from_server: web_sys::WritableStream, + fs: kcl_lib::fs::wasm::FileSystemManager, + ) -> Self { + Self { + into_server, + from_server, + fs, + } + } +} + +/// Run the `kcl` lsp server. +// +// NOTE: we don't use web_sys::ReadableStream for input here because on the +// browser side we need to use a ReadableByteStreamController to construct it +// and so far only Chromium-based browsers support that functionality. + +// NOTE: input needs to be an AsyncIterator specifically +#[wasm_bindgen] +pub async fn kcl_lsp_run(config: ServerConfig) -> Result<(), JsValue> { + let ServerConfig { + into_server, + from_server, + fs, + } = config; + + let stdlib = kcl_lib::std::StdLib::new(); + let stdlib_completions = kcl_lib::lsp::kcl::get_completions_from_stdlib(&stdlib).map_err(|e| e.to_string())?; + let stdlib_signatures = kcl_lib::lsp::kcl::get_signatures_from_stdlib(&stdlib).map_err(|e| e.to_string())?; + // We can unwrap here because we know the tokeniser is valid, since + // we have a test for it. + let token_types = kcl_lib::token::TokenType::all_semantic_token_types().unwrap(); + + let (service, socket) = LspService::new(|client| kcl_lib::lsp::kcl::Backend { + client, + fs: kcl_lib::fs::FileManager::new(fs), + stdlib_completions, + stdlib_signatures, + token_types, + token_map: Default::default(), + ast_map: Default::default(), + current_code_map: Default::default(), + diagnostics_map: Default::default(), + symbols_map: Default::default(), + semantic_tokens_map: Default::default(), + }); + + let input = wasm_bindgen_futures::stream::JsStream::from(into_server); + let input = input + .map_ok(|value| { + value + .dyn_into::() + .expect("could not cast stream item to Uint8Array") + .to_vec() + }) + .map_err(|_err| std::io::Error::from(std::io::ErrorKind::Other)) + .into_async_read(); + + let output = wasm_bindgen::JsCast::unchecked_into::(from_server); + let output = wasm_streams::WritableStream::from_raw(output); + let output = output.try_into_async_write().map_err(|err| err.0)?; + + Server::new(input, output, socket).serve(service).await; + + Ok(()) +} + +/// Run the `copilot` lsp server. +// +// NOTE: we don't use web_sys::ReadableStream for input here because on the +// browser side we need to use a ReadableByteStreamController to construct it +// and so far only Chromium-based browsers support that functionality. + +// NOTE: input needs to be an AsyncIterator specifically +#[wasm_bindgen] +pub async fn copilot_lsp_run(config: ServerConfig, token: String) -> Result<(), JsValue> { + let ServerConfig { + into_server, + from_server, + fs, + } = config; + + let (service, socket) = LspService::build(|client| kcl_lib::lsp::copilot::Backend { + client, + fs: kcl_lib::fs::FileManager::new(fs), + current_code_map: Default::default(), + editor_info: Arc::new(RwLock::new(kcl_lib::lsp::copilot::types::CopilotEditorInfo::default())), + cache: kcl_lib::lsp::copilot::cache::CopilotCache::new(), + token, + }) + .custom_method("setEditorInfo", kcl_lib::lsp::copilot::Backend::set_editor_info) + .custom_method( + "getCompletions", + kcl_lib::lsp::copilot::Backend::get_completions_cycling, + ) + .custom_method("notifyAccepted", kcl_lib::lsp::copilot::Backend::accept_completions) + .custom_method("notifyRejected", kcl_lib::lsp::copilot::Backend::reject_completions) + .finish(); + + let input = wasm_bindgen_futures::stream::JsStream::from(into_server); + let input = input + .map_ok(|value| { + value + .dyn_into::() + .expect("could not cast stream item to Uint8Array") + .to_vec() + }) + .map_err(|_err| std::io::Error::from(std::io::ErrorKind::Other)) + .into_async_read(); + + let output = wasm_bindgen::JsCast::unchecked_into::(from_server); + let output = wasm_streams::WritableStream::from_raw(output); + let output = output.try_into_async_write().map_err(|err| err.0)?; + + Server::new(input, output, socket).serve(service).await; + + Ok(()) +} + +#[wasm_bindgen] +pub fn is_points_ccw(points: &[f64]) -> i32 { + kcl_lib::std::utils::is_points_ccw_wasm(points) +} + +#[wasm_bindgen] +pub struct TangentialArcInfoOutputWasm { + /// The geometric center of the arc x. + pub center_x: f64, + /// The geometric center of the arc y. + pub center_y: f64, + /// The midpoint of the arc x. + pub arc_mid_point_x: f64, + /// The midpoint of the arc y. + pub arc_mid_point_y: f64, + /// The radius of the arc. + pub radius: f64, + /// Start angle of the arc in radians. + pub start_angle: f64, + /// End angle of the arc in radians. + pub end_angle: f64, + /// Flag to determine if the arc is counter clockwise. + pub ccw: i32, +} + +#[wasm_bindgen] +pub fn get_tangential_arc_to_info( + arc_start_point_x: f64, + arc_start_point_y: f64, + arc_end_point_x: f64, + arc_end_point_y: f64, + tan_previous_point_x: f64, + tan_previous_point_y: f64, + obtuse: bool, +) -> TangentialArcInfoOutputWasm { + let result = kcl_lib::std::utils::get_tangential_arc_to_info(kcl_lib::std::utils::TangentialArcInfoInput { + arc_start_point: [arc_start_point_x, arc_start_point_y], + arc_end_point: [arc_end_point_x, arc_end_point_y], + tan_previous_point: [tan_previous_point_x, tan_previous_point_y], + obtuse: obtuse, + }); + TangentialArcInfoOutputWasm { + center_x: result.center[0], + center_y: result.center[1], + arc_mid_point_x: result.arc_mid_point[0], + arc_mid_point_y: result.arc_mid_point[1], + radius: result.radius, + start_angle: result.start_angle, + end_angle: result.end_angle, + ccw: result.ccw, + } +} + +/// Create the default program memory. +#[wasm_bindgen] +pub fn program_memory_init() -> Result { + let memory = kcl_lib::executor::ProgramMemory::default(); + + // The serde-wasm-bindgen does not work here because of weird HashMap issues so we use the + // gloo-serialize crate instead. + JsValue::from_serde(&memory).map_err(|e| e.to_string()) +} diff --git a/src/wasm-lib/tests/executor/main.rs b/src/wasm-lib/tests/executor/main.rs index c1640a41e..8a7058935 100644 --- a/src/wasm-lib/tests/executor/main.rs +++ b/src/wasm-lib/tests/executor/main.rs @@ -3,7 +3,7 @@ use kcl_lib::engine::EngineManager; /// Executes a kcl program and takes a snapshot of the result. /// This returns the bytes of the snapshot. -async fn execute_and_snapshot(code: &str) -> Result { +async fn execute_and_snapshot(code: &str, units: kittycad::types::UnitLength) -> Result { let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),); let http_client = reqwest::Client::builder() .user_agent(user_agent) @@ -38,9 +38,25 @@ async fn execute_and_snapshot(code: &str) -> Result { let parser = kcl_lib::parser::Parser::new(tokens); let program = parser.ast()?; let mut mem: kcl_lib::executor::ProgramMemory = Default::default(); - let ctx = kcl_lib::executor::ExecutorContext::new(ws).await?; + let ctx = kcl_lib::executor::ExecutorContext::new(ws, units.clone()).await?; + let _ = kcl_lib::executor::execute(program, &mut mem, kcl_lib::executor::BodyType::Root, &ctx).await?; + let (x, y) = kcl_lib::std::utils::get_camera_zoom_magnitude_per_unit_length(units); + + ctx.engine + .send_modeling_cmd( + uuid::Uuid::new_v4(), + kcl_lib::executor::SourceRange::default(), + kittycad::types::ModelingCmd::DefaultCameraLookAt { + center: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 0.0 }, + up: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 1.0 }, + vantage: kittycad::types::Point3D { x: 0.0, y: -x, z: y }, + sequence: None, + }, + ) + .await?; + // Send a snapshot request to the engine. let resp = ctx .engine @@ -87,7 +103,9 @@ const part002 = startSketchOn(part001, "here") |> extrude(5, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, 0.999); } @@ -115,7 +133,9 @@ const part002 = startSketchOn(part001, "start") |> extrude(5, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_start.png", &result, 0.999); } @@ -143,7 +163,9 @@ const part002 = startSketchOn(part001, "END") |> extrude(5, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_end.png", &result, 0.999); } @@ -162,10 +184,11 @@ async fn serial_test_execute_with_function_sketch() { } const fnBox = box(3, 6, 10) +"#; -show(fnBox)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/function_sketch.png", &result, 0.999); } @@ -183,9 +206,11 @@ async fn serial_test_execute_with_function_sketch_with_position() { return myBox } -show(box([0,0], 3, 6, 10))"#; +const thing = box([0,0], 3, 6, 10)"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/function_sketch_with_position.png", &result, @@ -204,10 +229,11 @@ async fn serial_test_execute_with_angled_line() { |> line([-13.02, 10.03], %) |> close(%) |> extrude(4, %) +"#; -show(part001)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/angled_line.png", &result, 0.999); } @@ -231,10 +257,11 @@ const bracket = startSketchOn('XY') |> line([0, -leg1 + thickness], %) |> close(%) |> extrude(width, %) +"#; -show(bracket)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/parametric.png", &result, 0.999); } @@ -266,10 +293,11 @@ const bracket = startSketchAt([0, 0]) |> line([0, -wallMountL], %) |> close(%) |> extrude(width, %) +"#; -show(bracket)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/parametric_with_tan_arc.png", &result, 0.999); } @@ -284,7 +312,7 @@ async fn serial_test_execute_engine_error_return() { |> extrude(4, %) "#; - let result = execute_and_snapshot(code).await; + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm).await; assert!(result.is_err()); assert_eq!( result.err().unwrap().to_string(), @@ -297,7 +325,9 @@ async fn serial_test_execute_engine_error_return() { async fn serial_test_execute_pipes_on_pipes() { let code = include_str!("inputs/pipes_on_pipes.kcl"); - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/pipes_on_pipes.png", &result, 0.999); } @@ -305,7 +335,9 @@ async fn serial_test_execute_pipes_on_pipes() { async fn serial_test_execute_cylinder() { let code = include_str!("inputs/cylinder.kcl"); - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/cylinder.png", &result, 0.999); } @@ -314,7 +346,9 @@ async fn serial_test_execute_cylinder() { async fn serial_test_execute_kittycad_svg() { let code = include_str!("inputs/kittycad_svg.kcl"); - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/kittycad_svg.png", &result, 0.999); } @@ -335,11 +369,11 @@ const b2 = cube([3,3], 4) const pt1 = b1.value[0] const pt2 = b2.value[0] +"#; -show(b1) -show(b2)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/member_expression_sketch_group.png", &result, @@ -358,10 +392,11 @@ const body = startSketchOn('XY') |> arc({angle_end: 360, angle_start: 0, radius: radius}, %) |> close(%) |> extrude(height, %) +"#; -show(body)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/close_arc.png", &result, 0.999); } @@ -387,7 +422,9 @@ box(10, 23, 8) let thing = box(-12, -15, 10) box(-20, -5, 10)"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/negative_args.png", &result, 0.999); } @@ -400,7 +437,9 @@ async fn serial_test_basic_tangential_arc() { |> extrude(10, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc.png", &result, 0.999); } @@ -413,7 +452,9 @@ async fn serial_test_basic_tangential_arc_with_point() { |> extrude(10, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_with_point.png", &result, 0.999); } @@ -426,7 +467,9 @@ async fn serial_test_basic_tangential_arc_to() { |> extrude(10, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_to.png", &result, 0.999); } @@ -453,7 +496,9 @@ box(30, 43, 18, '-xy') let thing = box(-12, -15, 10, 'yz') box(-20, -5, 10, 'xy')"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/different_planes_same_drawing.png", &result, @@ -488,7 +533,6 @@ const bracket = startSketchOn('XY') |> close(%) |> extrude(width, %) -show(bracket) const part001 = startSketchOn('XY') |> startProfileAt([-15.53, -10.28], %) |> line([10.49, -2.08], %) @@ -516,7 +560,9 @@ const part004 = startSketchOn('YZ') |> close(%) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/lots_of_planes.png", &result, 0.999); } @@ -540,11 +586,11 @@ const square = startSketchOn('XY') |> hole(circle([2, 2], .5), %) |> hole(circle([2, 8], .5), %) |> extrude(2, %) - -show(square) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/holes.png", &result, 0.999); } @@ -560,9 +606,11 @@ async fn optional_params() { return sg } - show(circle([2, 2], 20)) +const thing = circle([2, 2], 20) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/optional_params.png", &result, 0.999); } @@ -608,10 +656,11 @@ const part = roundedRectangle([0, 0], 20, 20, 4) |> hole(circle([-holeIndex, -holeIndex], holeRadius), %) |> hole(circle([holeIndex, -holeIndex], holeRadius), %) |> extrude(2, %) +"#; -show(part)"#; - - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/rounded_with_holes.png", &result, 0.999); } @@ -631,7 +680,9 @@ async fn serial_test_top_level_expression() { circle([0,0], 22) |> extrude(14, %)"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/top_level_expression.png", &result, 0.999); } @@ -653,7 +704,9 @@ const part = circle([0,0], 2) |> patternLinear({axis: [0,0,1], repetitions: 12, distance: 2}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic.png", &result, 0.999); } @@ -681,7 +734,9 @@ const part = startSketchOn('XY') |> patternLinear({axis: [1, 0,1], repetitions: 3, distance: 6}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic_3d.png", &result, 0.999); } @@ -703,7 +758,9 @@ const part = circle([0,0], 2) |> patternLinear({axis: [0,0,1], repetitions: 12, distance: -2}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/patterns_linear_basic_negative_distance.png", &result, @@ -729,7 +786,9 @@ const part = circle([0,0], 2) |> patternLinear({axis: [0,0,-1], repetitions: 12, distance: 2}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/patterns_linear_basic_negative_axis.png", &result, @@ -764,7 +823,9 @@ const rectangle = startSketchOn('XY') "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic_holes.png", &result, 0.999); } @@ -786,7 +847,9 @@ const part = circle([0,0], 2) |> patternCircular({axis: [0,0,1], center: [20, 20, 20], repetitions: 12, arcDegrees: 210, rotateDuplicates: true}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/patterns_circular_basic_2d.png", &result, 0.999); } @@ -814,7 +877,9 @@ const part = startSketchOn('XY') |> patternCircular({axis: [0,1,0], center: [-20, -20, -20], repetitions: 40, arcDegrees: 360, rotateDuplicates: false}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/patterns_circular_basic_3d.png", &result, 0.999); } @@ -842,7 +907,9 @@ const part = startSketchOn('XY') |> patternCircular({axis: [1,1,-1], center: [10, 0, 10], repetitions: 10, arcDegrees: 360, rotateDuplicates: true}, %) "#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image( "tests/executor/outputs/patterns_circular_3d_tilted_axis.png", &result, @@ -854,7 +921,7 @@ const part = startSketchOn('XY') async fn serial_test_import_file_doesnt_exist() { let code = r#"const model = import("thing.obj")"#; - let result = execute_and_snapshot(code).await; + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm).await; assert!(result.is_err()); assert_eq!( result.err().unwrap().to_string(), @@ -866,7 +933,9 @@ async fn serial_test_import_file_doesnt_exist() { async fn serial_test_import_obj_with_mtl() { let code = r#"const model = import("tests/executor/inputs/cube.obj")"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_obj_with_mtl.png", &result, 0.999); } @@ -874,7 +943,9 @@ async fn serial_test_import_obj_with_mtl() { async fn serial_test_import_obj_with_mtl_units() { let code = r#"const model = import("tests/executor/inputs/cube.obj", {type: "obj", units: "m"})"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_obj_with_mtl_units.png", &result, 0.999); } @@ -882,7 +953,9 @@ async fn serial_test_import_obj_with_mtl_units() { async fn serial_test_import_gltf_with_bin() { let code = r#"const model = import("tests/executor/inputs/cube.gltf")"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_gltf_with_bin.png", &result, 0.999); } @@ -890,7 +963,9 @@ async fn serial_test_import_gltf_with_bin() { async fn serial_test_import_gltf_embedded() { let code = r#"const model = import("tests/executor/inputs/cube-embedded.gltf")"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_gltf_embedded.png", &result, 0.999); } @@ -898,7 +973,9 @@ async fn serial_test_import_gltf_embedded() { async fn serial_test_import_glb() { let code = r#"const model = import("tests/executor/inputs/cube.glb")"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_glb.png", &result, 0.999); } @@ -906,7 +983,9 @@ async fn serial_test_import_glb() { async fn serial_test_import_glb_no_assign() { let code = r#"import("tests/executor/inputs/cube.glb")"#; - let result = execute_and_snapshot(code).await.unwrap(); + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); twenty_twenty::assert_image("tests/executor/outputs/import_glb_no_assign.png", &result, 0.999); } @@ -914,10 +993,148 @@ async fn serial_test_import_glb_no_assign() { async fn serial_test_import_ext_doesnt_match() { let code = r#"const model = import("tests/executor/inputs/cube.gltf", {type: "obj", units: "m"})"#; - let result = execute_and_snapshot(code).await; + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm).await; assert!(result.is_err()); assert_eq!( result.err().unwrap().to_string(), r#"semantic: KclErrorDetails { source_ranges: [SourceRange([14, 82])], message: "The given format does not match the file extension. Expected: `gltf`, Given: `obj`" }"# ); } + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_mm() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Mm) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_mm.png", &result, 1.0); +} + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_cm() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Cm) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_cm.png", &result, 1.0); +} + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_m() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::M) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_m.png", &result, 1.0); +} + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_in() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::In) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_in.png", &result, 1.0); +} + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_ft() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Ft) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_ft.png", &result, 1.0); +} + +#[tokio::test(flavor = "multi_thread")] +async fn serial_test_cube_yd() { + let code = r#"fn cube = (pos, scale) => { + const sg = startSketchOn('XY') + |> startProfileAt(pos, %) + |> line([0, scale], %) + |> line([scale, 0], %) + |> line([0, -scale], %) + |> close(%) + |> extrude(scale, %) + + return sg +} + +const myCube = cube([0,0], 10) +"#; + + let result = execute_and_snapshot(code, kittycad::types::UnitLength::Yd) + .await + .unwrap(); + twenty_twenty::assert_image("tests/executor/outputs/cube_yd.png", &result, 1.0); +} diff --git a/src/wasm-lib/tests/executor/outputs/angled_line.png b/src/wasm-lib/tests/executor/outputs/angled_line.png index 46024d661..0845ce68e 100644 Binary files a/src/wasm-lib/tests/executor/outputs/angled_line.png and b/src/wasm-lib/tests/executor/outputs/angled_line.png differ diff --git a/src/wasm-lib/tests/executor/outputs/close_arc.png b/src/wasm-lib/tests/executor/outputs/close_arc.png index 58d66c45d..fa50ea171 100644 Binary files a/src/wasm-lib/tests/executor/outputs/close_arc.png and b/src/wasm-lib/tests/executor/outputs/close_arc.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_cm.png b/src/wasm-lib/tests/executor/outputs/cube_cm.png new file mode 100644 index 000000000..ed56b3c5f Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_cm.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_ft.png b/src/wasm-lib/tests/executor/outputs/cube_ft.png new file mode 100644 index 000000000..5a7f5ae18 Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_ft.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_in.png b/src/wasm-lib/tests/executor/outputs/cube_in.png new file mode 100644 index 000000000..2cc0b5e01 Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_in.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_m.png b/src/wasm-lib/tests/executor/outputs/cube_m.png new file mode 100644 index 000000000..09b28b3fc Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_m.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_mm.png b/src/wasm-lib/tests/executor/outputs/cube_mm.png new file mode 100644 index 000000000..86405543b Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_mm.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cube_yd.png b/src/wasm-lib/tests/executor/outputs/cube_yd.png new file mode 100644 index 000000000..462fef08c Binary files /dev/null and b/src/wasm-lib/tests/executor/outputs/cube_yd.png differ diff --git a/src/wasm-lib/tests/executor/outputs/cylinder.png b/src/wasm-lib/tests/executor/outputs/cylinder.png index 0cad1968d..f3185636a 100644 Binary files a/src/wasm-lib/tests/executor/outputs/cylinder.png and b/src/wasm-lib/tests/executor/outputs/cylinder.png differ diff --git a/src/wasm-lib/tests/executor/outputs/different_planes_same_drawing.png b/src/wasm-lib/tests/executor/outputs/different_planes_same_drawing.png index 9c1987ad5..3de2e9487 100644 Binary files a/src/wasm-lib/tests/executor/outputs/different_planes_same_drawing.png and b/src/wasm-lib/tests/executor/outputs/different_planes_same_drawing.png differ diff --git a/src/wasm-lib/tests/executor/outputs/function_sketch.png b/src/wasm-lib/tests/executor/outputs/function_sketch.png index ef9cad152..0cb656e58 100644 Binary files a/src/wasm-lib/tests/executor/outputs/function_sketch.png and b/src/wasm-lib/tests/executor/outputs/function_sketch.png differ diff --git a/src/wasm-lib/tests/executor/outputs/function_sketch_with_position.png b/src/wasm-lib/tests/executor/outputs/function_sketch_with_position.png index ef9cad152..0cb656e58 100644 Binary files a/src/wasm-lib/tests/executor/outputs/function_sketch_with_position.png and b/src/wasm-lib/tests/executor/outputs/function_sketch_with_position.png differ diff --git a/src/wasm-lib/tests/executor/outputs/holes.png b/src/wasm-lib/tests/executor/outputs/holes.png index d5775d753..75cd2820f 100644 Binary files a/src/wasm-lib/tests/executor/outputs/holes.png and b/src/wasm-lib/tests/executor/outputs/holes.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_glb.png b/src/wasm-lib/tests/executor/outputs/import_glb.png index 7eeb08f28..a34b01cb3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_glb.png and b/src/wasm-lib/tests/executor/outputs/import_glb.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_glb_no_assign.png b/src/wasm-lib/tests/executor/outputs/import_glb_no_assign.png index 7eeb08f28..a34b01cb3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_glb_no_assign.png and b/src/wasm-lib/tests/executor/outputs/import_glb_no_assign.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_gltf_embedded.png b/src/wasm-lib/tests/executor/outputs/import_gltf_embedded.png index 7eeb08f28..a34b01cb3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_gltf_embedded.png and b/src/wasm-lib/tests/executor/outputs/import_gltf_embedded.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_gltf_with_bin.png b/src/wasm-lib/tests/executor/outputs/import_gltf_with_bin.png index 7eeb08f28..a34b01cb3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_gltf_with_bin.png and b/src/wasm-lib/tests/executor/outputs/import_gltf_with_bin.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl.png b/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl.png index 0a4ac8b71..27d69bd9d 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl.png and b/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl.png differ diff --git a/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl_units.png b/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl_units.png index 7eeb08f28..a34b01cb3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl_units.png and b/src/wasm-lib/tests/executor/outputs/import_obj_with_mtl_units.png differ diff --git a/src/wasm-lib/tests/executor/outputs/lots_of_planes.png b/src/wasm-lib/tests/executor/outputs/lots_of_planes.png index 1d09f114a..d6040dca8 100644 Binary files a/src/wasm-lib/tests/executor/outputs/lots_of_planes.png and b/src/wasm-lib/tests/executor/outputs/lots_of_planes.png differ diff --git a/src/wasm-lib/tests/executor/outputs/member_expression_sketch_group.png b/src/wasm-lib/tests/executor/outputs/member_expression_sketch_group.png index 34dfbda04..7a2674b4a 100644 Binary files a/src/wasm-lib/tests/executor/outputs/member_expression_sketch_group.png and b/src/wasm-lib/tests/executor/outputs/member_expression_sketch_group.png differ diff --git a/src/wasm-lib/tests/executor/outputs/negative_args.png b/src/wasm-lib/tests/executor/outputs/negative_args.png index 349f36d51..1a82c85a8 100644 Binary files a/src/wasm-lib/tests/executor/outputs/negative_args.png and b/src/wasm-lib/tests/executor/outputs/negative_args.png differ diff --git a/src/wasm-lib/tests/executor/outputs/optional_params.png b/src/wasm-lib/tests/executor/outputs/optional_params.png index ed37a993a..6c7ad1d00 100644 Binary files a/src/wasm-lib/tests/executor/outputs/optional_params.png and b/src/wasm-lib/tests/executor/outputs/optional_params.png differ diff --git a/src/wasm-lib/tests/executor/outputs/parametric.png b/src/wasm-lib/tests/executor/outputs/parametric.png index b86c421bb..28378da77 100644 Binary files a/src/wasm-lib/tests/executor/outputs/parametric.png and b/src/wasm-lib/tests/executor/outputs/parametric.png differ diff --git a/src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png b/src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png index 52f1eff92..010739f39 100644 Binary files a/src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png and b/src/wasm-lib/tests/executor/outputs/parametric_with_tan_arc.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_circular_3d_tilted_axis.png b/src/wasm-lib/tests/executor/outputs/patterns_circular_3d_tilted_axis.png index beced47ee..449215385 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_circular_3d_tilted_axis.png and b/src/wasm-lib/tests/executor/outputs/patterns_circular_3d_tilted_axis.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_2d.png b/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_2d.png index ef8b773ba..e685878fd 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_2d.png and b/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_2d.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_3d.png b/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_3d.png index a946751d4..e00f90870 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_3d.png and b/src/wasm-lib/tests/executor/outputs/patterns_circular_basic_3d.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic.png b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic.png index b5e6cca26..5b9355b1c 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic.png and b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_3d.png b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_3d.png index 0deb03869..a52b09d87 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_3d.png and b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_3d.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_holes.png b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_holes.png index 770e2b4ea..454f9ae12 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_holes.png and b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_holes.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_axis.png b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_axis.png index 0f6e47dee..7721f0178 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_axis.png and b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_axis.png differ diff --git a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_distance.png b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_distance.png index 0f6e47dee..7721f0178 100644 Binary files a/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_distance.png and b/src/wasm-lib/tests/executor/outputs/patterns_linear_basic_negative_distance.png differ diff --git a/src/wasm-lib/tests/executor/outputs/rounded_with_holes.png b/src/wasm-lib/tests/executor/outputs/rounded_with_holes.png index c0b6991dc..d941b1649 100644 Binary files a/src/wasm-lib/tests/executor/outputs/rounded_with_holes.png and b/src/wasm-lib/tests/executor/outputs/rounded_with_holes.png differ diff --git a/src/wasm-lib/tests/executor/outputs/sketch_on_face.png b/src/wasm-lib/tests/executor/outputs/sketch_on_face.png index 589f596ee..857b2ef27 100644 Binary files a/src/wasm-lib/tests/executor/outputs/sketch_on_face.png and b/src/wasm-lib/tests/executor/outputs/sketch_on_face.png differ diff --git a/src/wasm-lib/tests/executor/outputs/sketch_on_face_end.png b/src/wasm-lib/tests/executor/outputs/sketch_on_face_end.png index ed48273f6..a189152a5 100644 Binary files a/src/wasm-lib/tests/executor/outputs/sketch_on_face_end.png and b/src/wasm-lib/tests/executor/outputs/sketch_on_face_end.png differ diff --git a/src/wasm-lib/tests/executor/outputs/sketch_on_face_start.png b/src/wasm-lib/tests/executor/outputs/sketch_on_face_start.png index b1909ba06..a641057c3 100644 Binary files a/src/wasm-lib/tests/executor/outputs/sketch_on_face_start.png and b/src/wasm-lib/tests/executor/outputs/sketch_on_face_start.png differ diff --git a/src/wasm-lib/tests/executor/outputs/tangential_arc.png b/src/wasm-lib/tests/executor/outputs/tangential_arc.png index c8a1136be..962ad16b9 100644 Binary files a/src/wasm-lib/tests/executor/outputs/tangential_arc.png and b/src/wasm-lib/tests/executor/outputs/tangential_arc.png differ diff --git a/src/wasm-lib/tests/executor/outputs/tangential_arc_to.png b/src/wasm-lib/tests/executor/outputs/tangential_arc_to.png index c8a1136be..962ad16b9 100644 Binary files a/src/wasm-lib/tests/executor/outputs/tangential_arc_to.png and b/src/wasm-lib/tests/executor/outputs/tangential_arc_to.png differ diff --git a/src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png b/src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png index c8a1136be..962ad16b9 100644 Binary files a/src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png and b/src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png differ diff --git a/src/wasm-lib/tests/executor/outputs/top_level_expression.png b/src/wasm-lib/tests/executor/outputs/top_level_expression.png index 0cad1968d..f3185636a 100644 Binary files a/src/wasm-lib/tests/executor/outputs/top_level_expression.png and b/src/wasm-lib/tests/executor/outputs/top_level_expression.png differ diff --git a/src/wasm-lib/tests/modify/main.rs b/src/wasm-lib/tests/modify/main.rs index fd2b08632..c03239c12 100644 --- a/src/wasm-lib/tests/modify/main.rs +++ b/src/wasm-lib/tests/modify/main.rs @@ -37,7 +37,7 @@ async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, uuid let parser = kcl_lib::parser::Parser::new(tokens); let program = parser.ast()?; let mut mem: kcl_lib::executor::ProgramMemory = Default::default(); - let ctx = kcl_lib::executor::ExecutorContext::new(ws).await?; + let ctx = kcl_lib::executor::ExecutorContext::new(ws, kittycad::types::UnitLength::Mm).await?; let memory = kcl_lib::executor::execute(program.clone(), &mut mem, kcl_lib::executor::BodyType::Root, &ctx).await?; // We need to get the sketch ID.