brep-io-kernel 1.0.196 → 1.0.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apiExamples/BREP_Booleans.html +2 -2
- package/dist/apiExamples/BREP_Export.html +2 -2
- package/dist/apiExamples/BREP_Primitives.html +2 -2
- package/dist/apiExamples/BREP_Transforms.html +2 -2
- package/dist/apiExamples/Embeded_2D_Sketcher.html +2 -2
- package/dist/apiExamples/Embeded_CAD.html +2 -2
- package/dist/apiExamples/Embeded_CAD_Integration_Test.html +2 -2
- package/dist/assets/{SimulationWorkbenchManager-CZU2PaTA.js → SimulationWorkbenchManager-BlXiJ2tl.js} +121 -37
- package/dist/assets/{apiExample_BREP_Booleans-D4_za_tB.js → apiExample_BREP_Booleans-C2hoasf2.js} +1 -1
- package/dist/assets/{apiExample_BREP_Export-u2fTdaNT.js → apiExample_BREP_Export-B9OOBBCX.js} +1 -1
- package/dist/assets/{apiExample_BREP_Primitives-DAoWeXoq.js → apiExample_BREP_Primitives-Do8y8b_w.js} +1 -1
- package/dist/assets/{apiExample_BREP_Transforms-DFpbDf74.js → apiExample_BREP_Transforms-Dg6kSpF5.js} +1 -1
- package/dist/assets/{apiExample_Embeded_2D_Sketcher-BTLB-XJ1.js → apiExample_Embeded_2D_Sketcher-mfrI-BcL.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD-BN7Rap4P.js → apiExample_Embeded_CAD-GLEJ5EGM.js} +1 -1
- package/dist/assets/{apiExample_Embeded_CAD_Integration_Test-Dl4HRxKv.js → apiExample_Embeded_CAD_Integration_Test-CsWfKgCS.js} +1 -1
- package/dist/assets/{brep-kernel-CTSjNzN4.js → brep-kernel-D6hhTKa0.js} +1 -1
- package/dist/assets/{browserTests-BeGjo-jd.js → browserTests-gCJmMaIE.js} +1 -1
- package/dist/assets/{index.es-DiqUPvrb.js → index.es-CN_DUH2L.js} +1 -1
- package/dist/assets/{javascript-Bao00j9Y.js → javascript-CamWQzyi.js} +1 -1
- package/dist/assets/{main-cad-A9axj9C3.js → main-cad-BgZQtzIN.js} +5 -5
- package/dist/assets/{test-BiekV37i.js → test-q3OlLTks.js} +3 -3
- package/dist/cad.html +1 -1
- package/dist/test.html +1 -1
- package/dist/viewer.html +1 -1
- package/dist-kernel/brep-kernel.js +1 -1
- package/package.json +1 -1
- package/src/simulation/SimulationWorkbenchManager.js +121 -37
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Booleans</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Booleans-C2hoasf2.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Export</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Export-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Export-B9OOBBCX.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Primitives</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Primitives-Do8y8b_w.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Transforms</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_BREP_Transforms-Dg6kSpF5.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>BREP API Example: Embeded 2D Sketcher</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-
|
|
8
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_2D_Sketcher-mfrI-BcL.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
background: #fff;
|
|
32
32
|
}
|
|
33
33
|
</style>
|
|
34
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-
|
|
34
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD-GLEJ5EGM.js"></script>
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
37
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
38
38
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
39
39
|
</head>
|
|
40
40
|
<body>
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
</style>
|
|
95
|
-
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-
|
|
95
|
+
<script type="module" crossorigin src="/assets/apiExample_Embeded_CAD_Integration_Test-CsWfKgCS.js"></script>
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-BdX5DvLD.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ZNr0Qq7Q.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/brep-kernel-D6hhTKa0.js">
|
|
99
99
|
<link rel="stylesheet" crossorigin href="/assets/example-CoxINuWK.css">
|
|
100
100
|
</head>
|
|
101
101
|
<body>
|
|
@@ -33,6 +33,12 @@ function normalizeText(value, fallback = '') {
|
|
|
33
33
|
return next || fallback;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
function normalizeOptionalMotionLimit(value) {
|
|
37
|
+
const numeric = Number(value);
|
|
38
|
+
if (!Number.isFinite(numeric)) return null;
|
|
39
|
+
return Math.abs(numeric) <= 1e-9 ? null : numeric;
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
function normalizeTransform(value) {
|
|
37
43
|
const raw = value && typeof value === 'object' ? value : {};
|
|
38
44
|
return {
|
|
@@ -171,6 +177,9 @@ export class SimulationWorkbenchManager {
|
|
|
171
177
|
center: new THREE.Vector3(),
|
|
172
178
|
axis: new THREE.Vector3(),
|
|
173
179
|
translation: new THREE.Vector3(),
|
|
180
|
+
velocity: new THREE.Vector3(),
|
|
181
|
+
angularVelocity: new THREE.Vector3(),
|
|
182
|
+
radius: new THREE.Vector3(),
|
|
174
183
|
};
|
|
175
184
|
this._bindStateManager();
|
|
176
185
|
}
|
|
@@ -606,7 +615,7 @@ export class SimulationWorkbenchManager {
|
|
|
606
615
|
for (const solid of this._listSceneSolids()) {
|
|
607
616
|
const bodyDesc = (selectedSolid && solid === selectedSolid)
|
|
608
617
|
? rapier.RigidBodyDesc.kinematicPositionBased()
|
|
609
|
-
: (this.
|
|
618
|
+
: (this._isSolidKinematicMotionDriven(solid)
|
|
610
619
|
? rapier.RigidBodyDesc.kinematicPositionBased()
|
|
611
620
|
: (this.getSolidFixed(solid) ? rapier.RigidBodyDesc.fixed() : rapier.RigidBodyDesc.dynamic()));
|
|
612
621
|
const position = solid.getWorldPosition(new THREE.Vector3());
|
|
@@ -695,18 +704,6 @@ export class SimulationWorkbenchManager {
|
|
|
695
704
|
bodyState.body.setNextKinematicRotation(worldQuaternion);
|
|
696
705
|
}
|
|
697
706
|
}
|
|
698
|
-
if (this._isPlaying) {
|
|
699
|
-
for (const solid of this._listSceneSolids()) {
|
|
700
|
-
if (!this._isSolidMotionDriven(solid)) continue;
|
|
701
|
-
const bodyState = this._bodyState.get(solid.uuid);
|
|
702
|
-
if (!bodyState?.body) continue;
|
|
703
|
-
const worldPosition = solid.getWorldPosition(new THREE.Vector3());
|
|
704
|
-
const worldQuaternion = solid.getWorldQuaternion(new THREE.Quaternion());
|
|
705
|
-
bodyState.body.setNextKinematicTranslation(worldPosition);
|
|
706
|
-
bodyState.body.setNextKinematicRotation(worldQuaternion);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
707
|
world.step();
|
|
711
708
|
for (const bodyState of this._bodyState.values()) {
|
|
712
709
|
const { solid, body } = bodyState;
|
|
@@ -715,10 +712,6 @@ export class SimulationWorkbenchManager {
|
|
|
715
712
|
this._syncProxyGroupTransform(solid);
|
|
716
713
|
continue;
|
|
717
714
|
}
|
|
718
|
-
if (this._isSolidMotionDriven(solid)) {
|
|
719
|
-
this._syncProxyGroupTransform(solid);
|
|
720
|
-
continue;
|
|
721
|
-
}
|
|
722
715
|
if (this.getSolidFixed(solid)) {
|
|
723
716
|
this._syncProxyGroupTransform(solid);
|
|
724
717
|
continue;
|
|
@@ -923,15 +916,36 @@ export class SimulationWorkbenchManager {
|
|
|
923
916
|
return this._getMotionEntries().some((motion) => normalizeText(this._resolveReferenceName(motion?.solid), '') === name);
|
|
924
917
|
}
|
|
925
918
|
|
|
919
|
+
_isSolidKinematicMotionDriven(solid) {
|
|
920
|
+
return !!solid && this.getSolidFixed(solid) && this._isSolidMotionDriven(solid);
|
|
921
|
+
}
|
|
922
|
+
|
|
926
923
|
_applyMotionStep(dt) {
|
|
927
|
-
|
|
924
|
+
const selectedSolid = this._transformSession?.solid || null;
|
|
925
|
+
const commands = new Map();
|
|
926
|
+
for (const solid of this._listSceneSolids()) {
|
|
927
|
+
if (!this._isSolidMotionDriven(solid)) continue;
|
|
928
|
+
if (selectedSolid && solid === selectedSolid) continue;
|
|
929
|
+
if (this._isSolidKinematicMotionDriven(solid)) continue;
|
|
930
|
+
const body = this._bodyState.get(solid.uuid)?.body;
|
|
931
|
+
if (!body) continue;
|
|
932
|
+
body.setLinvel({ x: 0, y: 0, z: 0 }, true);
|
|
933
|
+
body.setAngvel({ x: 0, y: 0, z: 0 }, true);
|
|
934
|
+
}
|
|
928
935
|
for (const motion of this._getMotionEntries()) {
|
|
929
936
|
const solid = this._resolveMotionSolid(motion);
|
|
930
937
|
if (!solid) continue;
|
|
931
|
-
if (
|
|
932
|
-
|
|
938
|
+
if (selectedSolid && solid === selectedSolid) continue;
|
|
939
|
+
if (motion.type === 'linear') this._applyLinearMotionStep(solid, motion, dt, commands);
|
|
940
|
+
else this._applyRotationMotionStep(solid, motion, dt, commands);
|
|
933
941
|
}
|
|
934
|
-
|
|
942
|
+
for (const [solidUuid, command] of commands.entries()) {
|
|
943
|
+
const body = this._bodyState.get(solidUuid)?.body;
|
|
944
|
+
if (!body) continue;
|
|
945
|
+
body.setLinvel(command.linear, true);
|
|
946
|
+
body.setAngvel(command.angular, true);
|
|
947
|
+
}
|
|
948
|
+
return commands.size > 0;
|
|
935
949
|
}
|
|
936
950
|
|
|
937
951
|
_resolveMotionSolid(motion) {
|
|
@@ -994,15 +1008,30 @@ export class SimulationWorkbenchManager {
|
|
|
994
1008
|
}
|
|
995
1009
|
}
|
|
996
1010
|
|
|
997
|
-
|
|
1011
|
+
_getMotionCommand(commands, solid) {
|
|
1012
|
+
if (!solid?.uuid) return null;
|
|
1013
|
+
let command = commands.get(solid.uuid);
|
|
1014
|
+
if (!command) {
|
|
1015
|
+
command = {
|
|
1016
|
+
linear: { x: 0, y: 0, z: 0 },
|
|
1017
|
+
angular: { x: 0, y: 0, z: 0 },
|
|
1018
|
+
};
|
|
1019
|
+
commands.set(solid.uuid, command);
|
|
1020
|
+
}
|
|
1021
|
+
return command;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
_applyRotationMotionStep(solid, motion, dt, commands) {
|
|
998
1025
|
const state = this._motionState.get(motion.id) || { progress: 0, completed: false };
|
|
999
|
-
if (state.completed) return;
|
|
1026
|
+
if (state.completed) return false;
|
|
1000
1027
|
const axis = this._resolveMotionAxis(motion);
|
|
1001
|
-
if (!axis) return;
|
|
1028
|
+
if (!axis) return false;
|
|
1029
|
+
const body = this._bodyState.get(solid.uuid)?.body || null;
|
|
1030
|
+
if (!body) return false;
|
|
1002
1031
|
const speedDeg = Number(motion?.speed);
|
|
1003
|
-
if (!Number.isFinite(speedDeg) || Math.abs(speedDeg) <= 1e-9) return;
|
|
1032
|
+
if (!Number.isFinite(speedDeg) || Math.abs(speedDeg) <= 1e-9) return false;
|
|
1004
1033
|
let deltaDeg = speedDeg * dt;
|
|
1005
|
-
const limitDeg =
|
|
1034
|
+
const limitDeg = normalizeOptionalMotionLimit(motion?.angle);
|
|
1006
1035
|
if (limitDeg != null) {
|
|
1007
1036
|
const remaining = limitDeg - state.progress;
|
|
1008
1037
|
if (Math.abs(remaining) <= 1e-9) {
|
|
@@ -1016,24 +1045,53 @@ export class SimulationWorkbenchManager {
|
|
|
1016
1045
|
if (Math.abs(deltaDeg) > Math.abs(remaining)) deltaDeg = remaining;
|
|
1017
1046
|
}
|
|
1018
1047
|
if (Math.abs(deltaDeg) <= 1e-9) return false;
|
|
1019
|
-
this.
|
|
1048
|
+
if (this._isSolidKinematicMotionDriven(solid)) {
|
|
1049
|
+
this._rotateSolidAroundWorldAxis(solid, axis.start, axis.end, THREE.MathUtils.degToRad(deltaDeg));
|
|
1050
|
+
const worldPosition = solid.getWorldPosition(new THREE.Vector3());
|
|
1051
|
+
const worldQuaternion = solid.getWorldQuaternion(new THREE.Quaternion());
|
|
1052
|
+
body.setNextKinematicTranslation(worldPosition);
|
|
1053
|
+
body.setNextKinematicRotation(worldQuaternion);
|
|
1054
|
+
this._updateRuntimeTransformFromSolid(solid, { persist: false });
|
|
1055
|
+
this._movedSolidIds.add(solid.uuid);
|
|
1056
|
+
state.progress += deltaDeg;
|
|
1057
|
+
if (limitDeg != null && Math.abs(limitDeg - state.progress) <= 1e-9) state.completed = true;
|
|
1058
|
+
this._motionState.set(motion.id, state);
|
|
1059
|
+
return true;
|
|
1060
|
+
}
|
|
1061
|
+
const omega = THREE.MathUtils.degToRad(deltaDeg) / Math.max(dt, 1e-9);
|
|
1062
|
+
const scratch = this._scratch;
|
|
1063
|
+
const command = this._getMotionCommand(commands, solid);
|
|
1064
|
+
const translation = body.translation();
|
|
1065
|
+
scratch.axis.copy(axis.end).sub(axis.start).normalize().multiplyScalar(omega);
|
|
1066
|
+
scratch.radius.set(
|
|
1067
|
+
Number(translation?.x) || 0,
|
|
1068
|
+
Number(translation?.y) || 0,
|
|
1069
|
+
Number(translation?.z) || 0,
|
|
1070
|
+
).sub(axis.start);
|
|
1071
|
+
scratch.velocity.copy(scratch.axis).cross(scratch.radius);
|
|
1072
|
+
command.angular.x += scratch.axis.x;
|
|
1073
|
+
command.angular.y += scratch.axis.y;
|
|
1074
|
+
command.angular.z += scratch.axis.z;
|
|
1075
|
+
command.linear.x += scratch.velocity.x;
|
|
1076
|
+
command.linear.y += scratch.velocity.y;
|
|
1077
|
+
command.linear.z += scratch.velocity.z;
|
|
1020
1078
|
state.progress += deltaDeg;
|
|
1021
1079
|
if (limitDeg != null && Math.abs(limitDeg - state.progress) <= 1e-9) state.completed = true;
|
|
1022
1080
|
this._motionState.set(motion.id, state);
|
|
1023
|
-
this._updateRuntimeTransformFromSolid(solid, { persist: false });
|
|
1024
|
-
this._movedSolidIds.add(solid.uuid);
|
|
1025
1081
|
return true;
|
|
1026
1082
|
}
|
|
1027
1083
|
|
|
1028
|
-
_applyLinearMotionStep(solid, motion, dt) {
|
|
1084
|
+
_applyLinearMotionStep(solid, motion, dt, commands) {
|
|
1029
1085
|
const state = this._motionState.get(motion.id) || { progress: 0, completed: false };
|
|
1030
|
-
if (state.completed) return;
|
|
1086
|
+
if (state.completed) return false;
|
|
1031
1087
|
const axis = this._resolveMotionAxis(motion);
|
|
1032
|
-
if (!axis) return;
|
|
1088
|
+
if (!axis) return false;
|
|
1089
|
+
const body = this._bodyState.get(solid.uuid)?.body || null;
|
|
1090
|
+
if (!body) return false;
|
|
1033
1091
|
const speed = Number(motion?.speed);
|
|
1034
|
-
if (!Number.isFinite(speed) || Math.abs(speed) <= 1e-9) return;
|
|
1092
|
+
if (!Number.isFinite(speed) || Math.abs(speed) <= 1e-9) return false;
|
|
1035
1093
|
let delta = speed * dt;
|
|
1036
|
-
const limit =
|
|
1094
|
+
const limit = normalizeOptionalMotionLimit(motion?.distance);
|
|
1037
1095
|
if (limit != null) {
|
|
1038
1096
|
const remaining = limit - state.progress;
|
|
1039
1097
|
if (Math.abs(remaining) <= 1e-9) {
|
|
@@ -1047,12 +1105,38 @@ export class SimulationWorkbenchManager {
|
|
|
1047
1105
|
if (Math.abs(delta) > Math.abs(remaining)) delta = remaining;
|
|
1048
1106
|
}
|
|
1049
1107
|
if (Math.abs(delta) <= 1e-9) return false;
|
|
1050
|
-
this.
|
|
1108
|
+
if (this._isSolidKinematicMotionDriven(solid)) {
|
|
1109
|
+
this._translateSolidAlongWorldAxis(solid, axis.start, axis.end, delta);
|
|
1110
|
+
const worldPosition = solid.getWorldPosition(new THREE.Vector3());
|
|
1111
|
+
const worldQuaternion = solid.getWorldQuaternion(new THREE.Quaternion());
|
|
1112
|
+
body.setNextKinematicTranslation(worldPosition);
|
|
1113
|
+
body.setNextKinematicRotation(worldQuaternion);
|
|
1114
|
+
this._updateRuntimeTransformFromSolid(solid, { persist: false });
|
|
1115
|
+
this._movedSolidIds.add(solid.uuid);
|
|
1116
|
+
state.progress += delta;
|
|
1117
|
+
if (limit != null && Math.abs(limit - state.progress) <= 1e-9) state.completed = true;
|
|
1118
|
+
this._motionState.set(motion.id, state);
|
|
1119
|
+
return true;
|
|
1120
|
+
}
|
|
1121
|
+
const velocityScale = delta / Math.max(dt, 1e-9);
|
|
1122
|
+
const scratch = this._scratch;
|
|
1123
|
+
const command = this._getMotionCommand(commands, solid);
|
|
1124
|
+
const translation = body.translation();
|
|
1125
|
+
scratch.axis.copy(axis.end).sub(axis.start).normalize();
|
|
1126
|
+
scratch.translation.copy(scratch.axis).multiplyScalar(delta);
|
|
1127
|
+
body.setTranslation({
|
|
1128
|
+
x: (Number(translation?.x) || 0) + scratch.translation.x,
|
|
1129
|
+
y: (Number(translation?.y) || 0) + scratch.translation.y,
|
|
1130
|
+
z: (Number(translation?.z) || 0) + scratch.translation.z,
|
|
1131
|
+
}, true);
|
|
1132
|
+
scratch.axis.multiplyScalar(velocityScale);
|
|
1133
|
+
command.linear.x += scratch.axis.x;
|
|
1134
|
+
command.linear.y += scratch.axis.y;
|
|
1135
|
+
command.linear.z += scratch.axis.z;
|
|
1136
|
+
body.setAngvel({ x: 0, y: 0, z: 0 }, true);
|
|
1051
1137
|
state.progress += delta;
|
|
1052
1138
|
if (limit != null && Math.abs(limit - state.progress) <= 1e-9) state.completed = true;
|
|
1053
1139
|
this._motionState.set(motion.id, state);
|
|
1054
|
-
this._updateRuntimeTransformFromSolid(solid, { persist: false });
|
|
1055
|
-
this._movedSolidIds.add(solid.uuid);
|
|
1056
1140
|
return true;
|
|
1057
1141
|
}
|
|
1058
1142
|
|
package/dist/assets/{apiExample_BREP_Booleans-D4_za_tB.js → apiExample_BREP_Booleans-C2hoasf2.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-
|
|
1
|
+
var E=Object.defineProperty;var o=(e,t)=>E(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as i}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),b=document.getElementById("log"),f=document.getElementById("btn-run"),c=o((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),g=o(e=>Number(e).toFixed(6),"fmt"),u=o((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");b.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),s=o(e=>({volume:e.volume(),surfaceArea:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),d=o(()=>{b.textContent="",c("Running...","pending");const e=new i.Cube({x:2.2,y:2.2,z:2.2,name:"Cube"}),t=new i.Sphere({r:1.35,resolution:40,name:"Sphere"}),r=e.union(t),h=e.subtract(t),p=e.intersect(t),n={cube:s(e),sphere:s(t),union:s(r),subtract:s(h),intersect:s(p)};u("--- Boolean Results ---");for(const[v,l]of Object.entries(n))u(`${v.padEnd(10)} volume=${g(l.volume)} area=${g(l.surfaceArea)} triangles=${l.triangles}`);const a=1e-6;if(n.union.volume+a<Math.max(n.cube.volume,n.sphere.volume))throw new Error("Union volume is unexpectedly smaller than both source solids.");if(n.intersect.volume-a>Math.min(n.cube.volume,n.sphere.volume))throw new Error("Intersection volume is unexpectedly larger than a source solid.");if(n.subtract.volume-a>n.cube.volume)throw new Error("Subtract volume is unexpectedly larger than the original cube.");c("Completed","ok")},"runExample");f.addEventListener("click",()=>{try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}});try{d()}catch(e){console.error(e),u("ERROR:",e?.stack||e?.message||String(e)),c("Failed","err")}
|
package/dist/assets/{apiExample_BREP_Export-u2fTdaNT.js → apiExample_BREP_Export-B9OOBBCX.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var r=(t,n)=>g(t,"name",{value:n,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as c}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const l=document.getElementById("status"),d=document.getElementById("log"),p=document.getElementById("btn-run"),s=r((t,n)=>{l.textContent=t,l.className=`status ${n}`},"setStatus"),e=r((...t)=>{const n=t.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");d.textContent+=`${n}
|
|
2
2
|
`,console.log(...t)},"write"),u=r((t,n=8)=>t.split(`
|
|
3
3
|
`).slice(0,n).join(`
|
|
4
4
|
`),"firstLines"),m=r(()=>{d.textContent="",s("Running...","pending");const t=new c.Cylinder({radius:1,height:3,resolution:48,name:"Shaft"}).bakeTRS({position:[0,0,.6],rotationEuler:[90,0,0],scale:[1,1,1]}),n=new c.Cone({radius:1.55,height:1.6,resolution:48,name:"Head"}).bakeTRS({position:[0,1.65,.6],rotationEuler:[-90,0,0],scale:[1,1,1]}),o=t.union(n),i=o.toSTL("api_example_part",4),a=o.toSTEP("api_example_part",{precision:4});if(e("--- Export Summary ---"),e("Volume:",o.volume()),e("Surface area:",o.surfaceArea()),e("Triangles:",o.getTriangleCount()),e("STL characters:",i.length),e("STEP characters:",a.length),e(""),e("--- STL Preview ---"),e(u(i)),e(""),e("--- STEP Preview ---"),e(u(a)),!i.startsWith("solid"))throw new Error('STL output did not start with "solid".');if(!a.includes("ISO-10303-21"))throw new Error("STEP output did not contain expected ISO header.");s("Completed","ok")},"runExample");p.addEventListener("click",()=>{try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}});try{m()}catch(t){console.error(t),e("ERROR:",t?.stack||t?.message||String(t)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-
|
|
1
|
+
var g=Object.defineProperty;var n=(e,t)=>g(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as o}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const m=document.getElementById("status"),u=document.getElementById("log"),y=document.getElementById("btn-run"),s=n((e,t)=>{m.textContent=e,m.className=`status ${t}`},"setStatus"),l=n(e=>Number(e).toFixed(6),"fmt"),a=n((...e)=>{const t=e.map(r=>typeof r=="string"?r:JSON.stringify(r)).join(" ");u.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),C=n(e=>({volume:e.volume(),area:e.surfaceArea(),triangles:e.getTriangleCount()}),"summarize"),c=n(()=>{u.textContent="",s("Running...","pending");const e=[["Cube",()=>new o.Cube({x:2,y:3,z:4,name:"Cube"})],["Sphere",()=>new o.Sphere({r:1.2,resolution:32,name:"Sphere"})],["Cylinder",()=>new o.Cylinder({radius:1,height:2.4,resolution:48,name:"Cylinder"})],["Cone",()=>new o.Cone({radius:1.1,height:2.1,resolution:48,name:"Cone"})],["Torus",()=>new o.Torus({mR:2,tR:.55,resolution:64,name:"Torus"})],["Pyramid",()=>new o.Pyramid({bL:2,s:4,h:2.7,name:"Pyramid"})]];a("--- Primitive Summary ---");for(const[t,r]of e){const d=r(),i=C(d);a(`${t.padEnd(10)} volume=${l(i.volume)} area=${l(i.area)} triangles=${i.triangles}`)}s("Completed","ok")},"runExample");y.addEventListener("click",()=>{try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{c()}catch(e){console.error(e),a("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-
|
|
1
|
+
var u=Object.defineProperty;var n=(e,t)=>u(e,"name",{value:t,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{BREP as g}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const c=document.getElementById("status"),l=document.getElementById("log"),b=document.getElementById("btn-run"),s=n((e,t)=>{c.textContent=e,c.className=`status ${t}`},"setStatus"),i=n(e=>Number(e).toFixed(6),"fmt"),m=n((...e)=>{const t=e.map(o=>typeof o=="string"?o:JSON.stringify(o)).join(" ");l.textContent+=`${t}
|
|
2
2
|
`,console.log(...e)},"write"),r=n((e,t)=>{m(`${e.padEnd(16)} volume=${i(t.volume())} area=${i(t.surfaceArea())} triangles=${t.getTriangleCount()}`)},"describe"),d=n(()=>{l.textContent="",s("Running...","pending");const e=new g.Cube({x:2.2,y:1.4,z:1,name:"BaseCube"}),t=e.clone().bakeTRS({position:[2,.4,.3],rotationEuler:[0,35,20],scale:[1.1,.85,1.25]}),o=t.mirrorAcrossPlane([0,0,0],[1,0,0]),a=t.union(o);if(m("--- Transform Summary ---"),r("base",e),r("moved",t),r("mirrored",o),r("combined",a),a.volume()<=t.volume())throw new Error("Combined solid volume should be greater than a single moved solid.");s("Completed","ok")},"runExample");b.addEventListener("click",()=>{try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}});try{d()}catch(e){console.error(e),m("ERROR:",e?.stack||e?.message||String(e)),s("Failed","err")}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-
|
|
1
|
+
var H=Object.defineProperty;var s=(e,o)=>H(e,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{Sketcher2DEmbed as J}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const k=document.getElementById("btn-create"),C=document.getElementById("btn-destroy"),I=document.getElementById("btn-apply-css"),w=document.getElementById("btn-apply-theme"),B=document.getElementById("btn-export-svg"),$=document.getElementById("btn-export-dxf"),r=document.getElementById("btn-download-dxf"),D=document.getElementById("btn-export-polylines"),F=document.getElementById("geometry-color"),L=document.getElementById("point-color"),N=document.getElementById("constraint-color"),G=document.getElementById("background-color"),T=document.getElementById("point-size-px"),A=document.getElementById("curve-thickness-px"),f=document.getElementById("sidebar-expanded"),u=document.getElementById("grid-visible"),V=document.getElementById("grid-spacing"),W=document.getElementById("curve-resolution"),R=document.getElementById("css-input"),Y=document.getElementById("sketch-status"),q=document.getElementById("sketch-host"),d=document.getElementById("event-output"),g=document.getElementById("svg-preview"),O=document.getElementById("path-output"),P=document.getElementById("dxf-output"),M=document.getElementById("polyline-output");let t=null,i=null,m=0,h=0,y=0,c=null;const K=6,n=s(e=>{Y.textContent=e},"setSketchStatus"),b=s(()=>{c&&(URL.revokeObjectURL(c),c=null)},"revokeDxfDownload"),Q=s(e=>{if(b(),typeof e!="string"||!e.length){r.disabled=!0;return}const o=new Blob([e],{type:"application/dxf"});c=URL.createObjectURL(o),r.disabled=!1},"setDxfDownload"),E=s(e=>{k.disabled=e,C.disabled=!e,I.disabled=!e,w.disabled=!e,B.disabled=!e,$.disabled=!e,D.disabled=!e,r.disabled=!e||!c},"setSketchButtons"),p=s((e,o=null)=>{const a=new Date().toLocaleTimeString(),X=o==null?`[${a}] ${e}`:`[${a}] ${e} ${JSON.stringify(o)}`,z=d.textContent==="(No sketch events yet)"?[]:d.textContent.split(`
|
|
2
2
|
`).filter(Boolean),S=[X,...z].slice(0,K);d.textContent=S.length?S.join(`
|
|
3
3
|
`):"(No sketch events yet)"},"pushEvent"),U=s(()=>({geometryColor:F.value,pointColor:L.value,constraintColor:N.value,backgroundColor:G.value,pointSizePx:Math.max(1,Number(T.value)||10),curveThicknessPx:Math.max(.5,Number(A.value)||2)}),"currentTheme"),x=s(()=>{const e=Number(V.value);return Number.isFinite(e)&&e>0?e:1},"currentGridSpacing"),v=s(()=>{const e=Number(W.value);return Number.isFinite(e)?Math.max(3,Math.min(2048,Math.floor(e))):64},"currentCurveResolution"),Z=s(async()=>{t||(t=new J({cssText:R.value,...U(),sidebarExpanded:f.checked,gridVisible:u.checked,gridSpacing:x(),onChange:s(e=>{i=e,m+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch updated (${m}). Geometries: ${o}`),p("onChange",{geometries:o})},"onChange"),onFinished:s(e=>{i=e,h+=1;const o=Array.isArray(e?.geometries)?e.geometries.length:0;n(`Sketch finished (${h}). Geometries: ${o}`),p("onFinished",{geometries:o}),j().catch(a=>{console.error(a),n(`Failed to export SVG after Finish: ${a?.message||String(a)}`)})},"onFinished"),onCancelled:s(()=>{y+=1,n(`Sketch cancelled (${y}).`),p("onCancelled")},"onCancelled")}),await t.mount(q),i=await t.getSketch(),E(!0),n("Sketcher iframe mounted. Draw geometry and run any export action."))},"attachSketcher"),_=s(async()=>{t&&(await t.destroy(),t=null,i=null,m=0,h=0,y=0,E(!1),n("Sketcher destroyed."),d.textContent="(No sketch events yet)",g.innerHTML="",O.textContent="(No SVG exported yet)",P.textContent="(No DXF exported yet)",M.textContent="(No 3D polylines exported yet)",b())},"detachSketcher"),ee=s(async()=>{t&&(await t.setCss(R.value),n("Custom CSS applied to iframe."))},"applySketchCss"),l=s(async()=>{t&&(await t.setTheme(U()),await t.setSidebarExpanded(f.checked),typeof t.setGrid=="function"?await t.setGrid({visible:u.checked,spacing:x()}):(typeof t.setGridVisible=="function"&&await t.setGridVisible(u.checked),typeof t.setGridSpacing=="function"&&await t.setGridSpacing(x())),n("Theme + sidebar + grid state applied to iframe."))},"applySketchTheme"),j=s(async()=>{if(!t)return;const e=await t.exportSVG({flipY:!0,precision:3,stroke:"#111111",strokeWidth:1.5,fill:"none",padding:12,curveResolution:v()});i=await t.getSketch({preferCached:!0}),g.innerHTML=e.svg,O.textContent=e.paths.length?e.paths.map(o=>`id=${o.id} type=${o.type} d="${o.d}"`).join(`
|
|
4
4
|
`):"(No sketch geometry to export)",n(`Exported ${e.paths.length} SVG paths.`),g.scrollIntoView({behavior:"smooth",block:"start"})},"exportSvg"),te=s(async()=>{if(!t)return;const e=await t.exportDXF({units:"mm",curveResolution:v(),includeConstruction:!1});P.textContent=e?.dxf||"(No DXF payload returned)",Q(e?.dxf||""),n(`Exported DXF with ${e?.polylines?.length||0} polylines.`)},"exportDxf"),ne=s(async()=>{if(!t)return;const e=await t.export3DPolylines({curveResolution:v(),includeConstruction:!1,origin:[0,0,0],xAxis:[1,0,0],yAxis:[0,1,0]});M.textContent=JSON.stringify(e,null,2),n(`Exported ${e?.polylines?.length||0} 3D polylines.`)},"export3DPolylines");k.addEventListener("click",()=>{Z().catch(e=>{console.error(e),n(`Failed to create sketcher: ${e?.message||String(e)}`)})});C.addEventListener("click",()=>{_().catch(e=>{console.error(e),n(`Failed to destroy sketcher: ${e?.message||String(e)}`)})});I.addEventListener("click",()=>{ee().catch(e=>{console.error(e),n(`Failed to apply CSS: ${e?.message||String(e)}`)})});w.addEventListener("click",()=>{l().catch(e=>{console.error(e),n(`Failed to apply theme: ${e?.message||String(e)}`)})});B.addEventListener("click",()=>{j().catch(e=>{console.error(e),n(`Failed to export SVG: ${e?.message||String(e)}`)})});$.addEventListener("click",()=>{te().catch(e=>{console.error(e),n(`Failed to export DXF: ${e?.message||String(e)}`)})});r.addEventListener("click",()=>{if(!c)return;const e=document.createElement("a");e.href=c,e.download="sketch-export.dxf",e.click()});D.addEventListener("click",()=>{ne().catch(e=>{console.error(e),n(`Failed to export 3D polylines: ${e?.message||String(e)}`)})});[F,L,N,G,T,A].forEach(e=>{e.addEventListener("input",()=>{t&&l().catch(o=>{console.error(o),n(`Failed to apply theme: ${o?.message||String(o)}`)})})});f.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply sidebar state: ${e?.message||String(e)}`)})});u.addEventListener("change",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid visibility: ${e?.message||String(e)}`)})});V.addEventListener("input",()=>{t&&l().catch(e=>{console.error(e),n(`Failed to apply grid spacing: ${e?.message||String(e)}`)})});window.addEventListener("beforeunload",()=>{t&&t.destroy().catch(()=>{}),b()});E(!1);i&&!Array.isArray(i?.geometries)&&console.warn("Unexpected sketch payload shape",i);
|
package/dist/assets/{apiExample_Embeded_CAD-BN7Rap4P.js → apiExample_Embeded_CAD-GLEJ5EGM.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-
|
|
1
|
+
var B=Object.defineProperty;var n=(t,o)=>B(t,"name",{value:o,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as v}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const u=document.getElementById("btn-create"),y=document.getElementById("btn-destroy"),p=document.getElementById("btn-state"),g=document.getElementById("btn-history"),b=document.getElementById("btn-sample"),E=document.getElementById("btn-reset"),h=document.getElementById("btn-css"),S=document.getElementById("viewer-only"),i=document.getElementById("sidebar-expanded"),x=document.getElementById("model-path"),w=document.getElementById("model-source"),$=document.getElementById("model-repo"),k=document.getElementById("model-branch"),C=document.getElementById("css-input"),F=document.getElementById("cad-status"),H=document.getElementById("cad-host"),I=document.getElementById("state-output"),f=document.getElementById("history-output");let e=null;const D={features:[{type:"Primitive Cube",inputParams:{id:"sample_cube_1",sizeX:24,sizeY:18,sizeZ:14,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0},s=n(t=>{F.textContent=t},"setStatus"),r=n(t=>{u.disabled=t,y.disabled=!t,p.disabled=!t,g.disabled=!t,b.disabled=!t,E.disabled=!t,h.disabled=!t,S.disabled=t},"setButtons"),L=n(()=>{const t=String(x.value||"").trim();if(!t)return null;const o=String(w.value||"local").trim()||"local",a=String($.value||"").trim(),d=String(k.value||"").trim(),l={modelPath:t,source:o};return a&&(l.repoFull=a),d&&(l.branch=d),l},"currentModelRequest"),c=n((t,o="State updated")=>{I.textContent=JSON.stringify(t||{},null,2);const a=Number(t?.featureCount||0),d=t?.model?.name||"(unsaved/new)";s(`${o}. Features: ${a}. Model: ${d}`)},"renderState"),N=n(async()=>{if(e)return;const t=L();e=new v({mountTo:H,viewerOnlyMode:S.checked,sidebarExpanded:i.checked,cssText:C.value,initialModel:t,onReady:n(a=>{c(a,"CAD ready")},"onReady"),onHistoryChanged:n(a=>{c(a,`History changed (${a?.reason||"update"})`)},"onHistoryChanged")}),await e.mount(),r(!0);const o=await e.getState();c(o,"CAD iframe mounted")},"createCad"),M=n(async()=>{e&&(await e.destroy(),e=null,r(!1),s("CAD iframe destroyed."),I.textContent="(No state yet)",f.textContent="(No history exported yet)")},"destroyCad"),m=n(async()=>{if(!e)return;const t=await e.getState();c(t,"State fetched")},"refreshState"),O=n(async()=>{if(!e)return;const t=await e.getPartHistoryJSON();f.textContent=t||"(History is empty)",s(`History exported (${t?t.length:0} chars).`)},"exportHistory"),A=n(async()=>{e&&(await e.setPartHistory(D),await m(),s("Sample cube history loaded."))},"loadSampleCube"),P=n(async()=>{e&&(await e.reset(),await m(),s("Model reset complete."))},"resetModel"),R=n(async()=>{e&&(await e.setCss(C.value),await e.setSidebarExpanded(i.checked),s("Custom CSS and sidebar state applied."))},"applyCss");u.addEventListener("click",()=>{N().catch(t=>{console.error(t),s(`Failed to create CAD iframe: ${t?.message||String(t)}`)})});y.addEventListener("click",()=>{M().catch(t=>{console.error(t),s(`Failed to destroy CAD iframe: ${t?.message||String(t)}`)})});p.addEventListener("click",()=>{m().catch(t=>{console.error(t),s(`Failed to get state: ${t?.message||String(t)}`)})});g.addEventListener("click",()=>{O().catch(t=>{console.error(t),s(`Failed to export history: ${t?.message||String(t)}`)})});b.addEventListener("click",()=>{A().catch(t=>{console.error(t),s(`Failed to load sample history: ${t?.message||String(t)}`)})});E.addEventListener("click",()=>{P().catch(t=>{console.error(t),s(`Failed to reset model: ${t?.message||String(t)}`)})});h.addEventListener("click",()=>{R().catch(t=>{console.error(t),s(`Failed to apply CSS: ${t?.message||String(t)}`)})});i.addEventListener("change",()=>{e&&e.setSidebarExpanded(i.checked).catch(t=>{console.error(t),s(`Failed to set sidebar state: ${t?.message||String(t)}`)})});r(!1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-
|
|
1
|
+
var O=Object.defineProperty;var i=(t,s)=>O(t,"name",{value:s,configurable:!0});import"./modulepreload-polyfill-BdX5DvLD.js";/* empty css */import{CADEmbed as S}from"./brep-kernel-D6hhTKa0.js";import"./preload-helper-ZNr0Qq7Q.js";const h=document.getElementById("btn-run"),u=document.getElementById("btn-destroy"),P=document.getElementById("viewer-only"),M=document.getElementById("sidebar-expanded"),H=document.getElementById("model-path"),A=document.getElementById("model-source"),j=document.getElementById("model-repo"),B=document.getElementById("model-branch"),x=document.getElementById("css-input"),R=document.getElementById("run-status"),$=document.getElementById("cad-host"),C=document.getElementById("results"),g=document.getElementById("log-output");let n=null,w=!1;const v={features:[{type:"Primitive Cube",inputParams:{id:"integration_sample_cube_1",sizeX:16,sizeY:12,sizeZ:10,transform:{position:[0,0,0],rotationEuler:[0,0,0],scale:[1,1,1]},boolean:{targets:[],operation:"NONE"}},persistentData:{},timestamp:null}],idCounter:1,expressions:`//Examples:
|
|
2
2
|
x = 10 + 6;
|
|
3
3
|
y = x * 2;`,pmiViews:[],metadata:{},assemblyConstraints:[],assemblyConstraintIdCounter:0};function l(t){const a=`[${new Date().toLocaleTimeString()}] ${t}`,o=g.textContent==="(No logs yet)"?[]:g.textContent.split(`
|
|
4
4
|
`).filter(Boolean);o.unshift(a),g.textContent=o.slice(0,120).join(`
|