ss-component-new 1.1.749 → 1.1.751
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-Bd1pt_oc.js → index-358_uQTt.js} +2 -2
- package/dist/{index-B9b0dhkp.js → index-4HDNxTOL.js} +2 -2
- package/dist/{index-CVOo7m3g.cjs → index-7yN2EIU6.cjs} +1 -1
- package/dist/{index-BZtZQ6Oh.js → index-A-feyQKx.js} +1 -1
- package/dist/{index-2kvkB-Mq.js → index-BAaBb97C.js} +5 -5
- package/dist/{index-BQdZaMXh.cjs → index-C31vQ30s.cjs} +1 -1
- package/dist/{index-DXbhoLas.cjs → index-CDYnP3Ky.cjs} +1 -1
- package/dist/{index-ClvZef1V.cjs → index-CE3d4U5P.cjs} +2 -2
- package/dist/{index-C5IMY-An.cjs → index-CGCeXg2p.cjs} +1 -1
- package/dist/{index-CPQzVcMn.js → index-CLAM2qeD.js} +1 -1
- package/dist/{index-BYmx_UU-.js → index-CNFR5Vgw.js} +1 -1
- package/dist/{index-CrU4Hejr.cjs → index-CO3uBazf.cjs} +1 -1
- package/dist/{index-CR-PJEgu.cjs → index-COOYln8y.cjs} +1 -1
- package/dist/{index-BU4uh8Gv.cjs → index-CRtcGXim.cjs} +1 -1
- package/dist/{index-Dl5V6um8.js → index-CXF9vmgD.js} +2 -2
- package/dist/{index-BjJwBhxx.cjs → index-CYxjs2Jb.cjs} +1 -1
- package/dist/{index-BrmyawXT.cjs → index-C_SsjkD5.cjs} +1 -1
- package/dist/{index-b1GSQ99n.cjs → index-Cgmnob5S.cjs} +1 -1
- package/dist/{index-Pv6AYWx3.cjs → index-ChaQ7Zyw.cjs} +1 -1
- package/dist/{index-DVrGggoN.cjs → index-Cms-tuk5.cjs} +1 -1
- package/dist/{index-Ft3AopMk.cjs → index-D2whX6uq.cjs} +1 -1
- package/dist/{index-DmrLqqsT.cjs → index-DGTQ7H9W.cjs} +1 -1
- package/dist/{index-BxEqDRFO.js → index-DHcv50MH.js} +3 -3
- package/dist/{index-tkMrjj3J.js → index-DIjHE9iB.js} +1 -1
- package/dist/{index-CDP2WPok.cjs → index-DchXIJ-a.cjs} +1 -1
- package/dist/{index-CzW1sAk9.js → index-DsEgzLsF.js} +5 -5
- package/dist/{index-0FVrjK4X.js → index-GXO8xejM.js} +3 -3
- package/dist/{index-DqwEtVof.js → index-J6JsBLpO.js} +3 -3
- package/dist/{index-DYxutIsC.js → index-NCYB3qwq.js} +2 -2
- package/dist/{index-Ctf4-95T.cjs → index-RnxmrRDY.cjs} +1 -1
- package/dist/{index-BI5JLu1e.js → index-TgLs1Cto.js} +5 -5
- package/dist/{index-Dyzu3bJ8.js → index-UCRUT4kD.js} +11 -11
- package/dist/{index-DT38Ou7e.cjs → index-XtusiEHI.cjs} +1 -1
- package/dist/{index-zDi4MXDA.js → index-iFeSyivT.js} +1 -1
- package/dist/{index-C3BDTttn.js → index-l9D6wrob.js} +1 -1
- package/dist/{index-56w61ASw.js → index-oAxCKLLG.js} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-BPn0z0_9.js → index.vue_vue_type_script_setup_true_lang-CH2U6zxB.js} +1 -1
- package/dist/{index.vue_vue_type_script_setup_true_lang-DoME39lI.cjs → index.vue_vue_type_script_setup_true_lang-lg6Nb3C3.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DXQ3Qz2D.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-A3OJ9C57.js} +8203 -8185
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CrmkPWOS.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cuqd9E7-.cjs} +86 -86
- package/dist/{index.vue_vue_type_style_index_0_scoped_30b60427_lang-TcqUlQbO.js → index.vue_vue_type_style_index_0_scoped_30b60427_lang-CcRwQyZ7.js} +1676 -1676
- package/dist/{index.vue_vue_type_style_index_0_scoped_30b60427_lang-Bvu2W7It.cjs → index.vue_vue_type_style_index_0_scoped_30b60427_lang-DOjkKlsQ.cjs} +8 -8
- package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-DAnaxn9V.js → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-BtWWzNnd.js} +4 -4
- package/dist/{index.vue_vue_type_style_index_0_scoped_c81d0427_lang-BboIyorY.cjs → index.vue_vue_type_style_index_0_scoped_c81d0427_lang-CT-3rg7r.cjs} +1 -1
- package/dist/{main-B6eGewLx.cjs → main-BW82t0cN.cjs} +1 -1
- package/dist/{main-VFQgCyhI.js → main-CjPdyOUi.js} +2 -2
- package/dist/obj/model.mtl +42 -0
- package/dist/obj/model.obj +26110 -0
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +8 -8
- package/dist/{threeModel-Ck3sx3yF.js → threeModel-DODl5X6w.js} +1 -1
- package/dist/{threeModel-tREtWajk.cjs → threeModel-kxowYxTF.cjs} +1 -1
- package/dist/{threeSceneView-Cuo5smvn.cjs → threeSceneView-D9Sx73pH.cjs} +1 -1
- package/dist/{threeSceneView-BxzBuZxc.js → threeSceneView-iZRMO5Sk.js} +3 -3
- package/dist/{threeViewerHost-C6sn_CF3.cjs → threeViewerHost-4GkAbqRe.cjs} +1 -1
- package/dist/{threeViewerHost-GqhyNTSh.js → threeViewerHost-Ce6yRa64.js} +2 -2
- package/package.json +1 -1
- package/public/obj/model.mtl +42 -0
- package/public/obj/model.obj +26110 -0
package/dist/ss-component.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { defineAsyncComponent as s } from "vue";
|
|
2
2
|
import { S as A } from "./index-BHtNKL1L.js";
|
|
3
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
3
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-A3OJ9C57.js";
|
|
4
4
|
import "./index.vue_vue_type_style_index_1_lang-DHohSfqc.js";
|
|
5
5
|
import "./index-CA6oJ4ms.js";
|
|
6
6
|
import a from "./ss-component2.js";
|
|
7
|
-
const t = s(() => import("./main-
|
|
7
|
+
const t = s(() => import("./main-CjPdyOUi.js"));
|
|
8
8
|
t.install = (o) => {
|
|
9
9
|
o.component("ssComponent", t);
|
|
10
10
|
};
|
|
11
|
-
const n = s(() => import("./index-
|
|
11
|
+
const n = s(() => import("./index-J6JsBLpO.js").then((o) => o.l));
|
|
12
12
|
n.install = (o) => {
|
|
13
13
|
o.component("ssTab", n);
|
|
14
14
|
};
|
|
15
|
-
const e = s(() => import("./index-
|
|
15
|
+
const e = s(() => import("./index-CLAM2qeD.js"));
|
|
16
16
|
e.install = (o) => {
|
|
17
17
|
o.component("ssMenu", e);
|
|
18
18
|
};
|
|
19
|
-
const r = s(() => import("./index-
|
|
19
|
+
const r = s(() => import("./index-DsEgzLsF.js"));
|
|
20
20
|
r.install = (o) => {
|
|
21
21
|
o.component("ssMenuComponent", r);
|
|
22
22
|
};
|
|
23
|
-
const m = s(() => import("./index-
|
|
23
|
+
const m = s(() => import("./index-iFeSyivT.js"));
|
|
24
24
|
m.install = (o) => {
|
|
25
25
|
o.component("ssCanvas", m);
|
|
26
26
|
};
|
|
@@ -28,15 +28,15 @@ const i = s(() => import("./index-CZtXRS3l.js"));
|
|
|
28
28
|
i.install = (o) => {
|
|
29
29
|
o.component("ssFold", i);
|
|
30
30
|
};
|
|
31
|
-
const p = s(() => import("./index-
|
|
31
|
+
const p = s(() => import("./index-oAxCKLLG.js"));
|
|
32
32
|
p.install = (o) => {
|
|
33
33
|
o.component("ssAvatar", p);
|
|
34
34
|
};
|
|
35
|
-
const l = s(() => import("./threeModel-
|
|
35
|
+
const l = s(() => import("./threeModel-DODl5X6w.js"));
|
|
36
36
|
l.install = (o) => {
|
|
37
37
|
o.component("ssThree", l);
|
|
38
38
|
};
|
|
39
|
-
const c = s(() => import("./threeViewerHost-
|
|
39
|
+
const c = s(() => import("./threeViewerHost-Ce6yRa64.js").then((o) => o.b));
|
|
40
40
|
c.install = (o) => {
|
|
41
41
|
o.component("threeViewerHost", c);
|
|
42
42
|
};
|
package/dist/ss-component2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-CeOHn1Vk.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-DgIjDvT5.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-
|
|
1
|
+
"use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-CeOHn1Vk.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-DgIjDvT5.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-Cgmnob5S.cjs")),children:[{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-CRtcGXim.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-D2whX6uq.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-RnxmrRDY.cjs"))},{path:"系统管理/职位管理",name:"Post",component:async()=>Promise.resolve().then(()=>require("./index-CO3uBazf.cjs"))},{path:"系统管理/用户管理",name:"User",component:async()=>Promise.resolve().then(()=>require("./index-C31vQ30s.cjs"))},{path:"系统管理/角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-COOYln8y.cjs"))},{path:"系统管理/部门管理",name:"Dept",component:async()=>Promise.resolve().then(()=>require("./index-DchXIJ-a.cjs"))}]}],o=n.createRouter({history:n.createWebHashHistory(),routes:t});o.beforeEach((r,s,e)=>{!sessionStorage.getItem("loginToken")&&r.path!=="/login"?e("/login"):e()});module.exports=o;
|
package/dist/ss-component2.js
CHANGED
|
@@ -13,7 +13,7 @@ const a = [
|
|
|
13
13
|
{
|
|
14
14
|
path: "/",
|
|
15
15
|
name: "Model",
|
|
16
|
-
component: async () => import("./index-
|
|
16
|
+
component: async () => import("./index-UCRUT4kD.js"),
|
|
17
17
|
// component: async ()=>import('@/components/views/model/component/main.vue'),
|
|
18
18
|
// component: async ()=>import('@/components/views/canvas/index.vue'),
|
|
19
19
|
// component: async ()=>import('@/components/views/test/index.vue'),
|
|
@@ -21,37 +21,37 @@ const a = [
|
|
|
21
21
|
{
|
|
22
22
|
path: "平台管理/菜单管理",
|
|
23
23
|
name: "Menu",
|
|
24
|
-
component: async () => import("./index-
|
|
24
|
+
component: async () => import("./index-DHcv50MH.js")
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
path: "平台管理/主菜单管理",
|
|
28
28
|
name: "MainMenu",
|
|
29
|
-
component: async () => import("./index-
|
|
29
|
+
component: async () => import("./index-CNFR5Vgw.js")
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
path: "系统管理/个人中心",
|
|
33
33
|
name: "PersonalCenter",
|
|
34
|
-
component: async () => import("./index-
|
|
34
|
+
component: async () => import("./index-NCYB3qwq.js")
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
path: "系统管理/职位管理",
|
|
38
38
|
name: "Post",
|
|
39
|
-
component: async () => import("./index-
|
|
39
|
+
component: async () => import("./index-358_uQTt.js")
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
path: "系统管理/用户管理",
|
|
43
43
|
name: "User",
|
|
44
|
-
component: async () => import("./index-
|
|
44
|
+
component: async () => import("./index-DIjHE9iB.js")
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
path: "系统管理/角色管理",
|
|
48
48
|
name: "Role",
|
|
49
|
-
component: async () => import("./index-
|
|
49
|
+
component: async () => import("./index-A-feyQKx.js")
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
path: "系统管理/部门管理",
|
|
53
53
|
name: "Dept",
|
|
54
|
-
component: async () => import("./index-
|
|
54
|
+
component: async () => import("./index-CXF9vmgD.js")
|
|
55
55
|
}
|
|
56
56
|
// {
|
|
57
57
|
// path: 'priority',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as b, watch as Pe, createElementBlock as q, openBlock as H, createBlock as Le, computed as ie, onMounted as $e, onUnmounted as je, Fragment as Xe, renderList as He, createElementVNode as h, createCommentVNode as xe, toDisplayString as ae, resolveComponent as Je, createVNode as z, defineComponent as Ye, normalizeStyle as Ee, normalizeClass as Fe, nextTick as Be, onBeforeUnmount as qe, withDirectives as se, unref as O, withCtx as Te, isRef as he, vModelRadio as ye, vShow as we } from "vue";
|
|
2
2
|
import { V as M, B as be, S as Ze, C as We, P as Ke, W as Ne, a as Qe, A as et, b as tt, M as Re, X as nt, G as at, c as Me, d as ot, e as De, f as st, D as ke, H as lt, g as Ve, h as Oe, i as Ue, j as ze, E as _e, k as de, l as it, m as rt, T as ct } from "./STLLoader-DofhZbOw.js";
|
|
3
3
|
import { O as ut } from "./OrbitControls-Cm4Xs_Bq.js";
|
|
4
|
-
import { s as dt, d as pt } from "./index-
|
|
4
|
+
import { s as dt, d as pt } from "./index-BAaBb97C.js";
|
|
5
5
|
import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
6
|
import { c as Ge } from "./index.vue_vue_type_style_index_1_lang-DHohSfqc.js";
|
|
7
7
|
import { E as Ie } from "./index-CA6oJ4ms.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./STLLoader-BxpEhvEg.cjs"),fe=require("./OrbitControls-D-XDZGf-.cjs"),pe=require("./index-ClvZef1V.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),me=require("./index.vue_vue_type_style_index_1_lang-BH0_LUL8.cjs"),de=require("./index-BKUqLOwQ.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,E=null;const D=1e3/30;let N=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new fe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),E&&(g.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,g.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-N;l<D||(N=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!h||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;b.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,N=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=N(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),g.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},N=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),g.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:N,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=me.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(pe.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Se={class:"value-display"},Ne={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ce=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),N=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=me.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(de.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,N.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||N.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ce&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{N.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,N.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!N.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!N.value},null,40,De)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Ne,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},N=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":N.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),S=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),N=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=pe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,N.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,N.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(S,{name:"guanjianjiexi",size:"34"}),e.createVNode(S,{name:"guanjiekongzhi",size:"34"}),e.createVNode(S,{name:"gongyishengcheng",size:"34"}),e.createVNode(S,{name:"buchangshezhi",size:"34"}),e.createVNode(S,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(S,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(S,{name:"fangda",size:"24",title:"放大"}),e.createVNode(S,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(S,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(S,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&N.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(S,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&N.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(S,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(S,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(S,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(S,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(S,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(N.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[N.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),N.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./STLLoader-BxpEhvEg.cjs"),fe=require("./OrbitControls-D-XDZGf-.cjs"),pe=require("./index-CE3d4U5P.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),me=require("./index.vue_vue_type_style_index_1_lang-BH0_LUL8.cjs"),de=require("./index-BKUqLOwQ.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,P=null,c=null,E=null;const D=1e3/30;let N=0;const b=e.ref([]),r=e.ref(new n.Vector3),k=e.ref(new n.Vector3),y=()=>{if(!z.value)return;g=new n.Scene,g.background=new n.Color(15790320);const m=z.value;u=new n.PerspectiveCamera(75,m.clientWidth/m.clientHeight,.1,1e4),u.position.set(8,-8,6),u.up.set(0,0,1),u.lookAt(0,0,0),d=new n.WebGLRenderer({antialias:!0,alpha:!0}),d.setSize(m.clientWidth,m.clientHeight),d.localClippingEnabled=!0,d.shadowMap.enabled=!0,d.shadowMap.type=n.PCFSoftShadowMap,d.toneMapping=n.ACESFilmicToneMapping,d.toneMappingExposure=1,d.outputColorSpace=n.SRGBColorSpace,m.appendChild(d.domElement),h=new fe.OrbitControls(u,d.domElement),h.enableDamping=!0,h.dampingFactor=.05,h.mouseButtons={LEFT:null,MIDDLE:n.MOUSE.PAN,RIGHT:n.MOUSE.ROTATE},h.panSpeed=.7,x=new n.Xe(u,d,{container:m,type:"cube",placement:"top-right",offset:{top:10,right:10},background:{color:"#D1D1D1",opacity:1},front:{label:"Top"},bottom:{label:"Front"},left:{label:"Left"},right:{label:"Right"},top:{label:"Back"},back:{label:"Bottom"}}),x.attachControls(h),f(),C()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),E&&(g.remove(E),E.geometry.dispose(),E.material.dispose());const _=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,_,13421772,14540253),c.rotateX(Math.PI/2),c.position.copy(l),g.add(c);const B=new n.PlaneGeometry(m,m),O=new n.ShadowMaterial({opacity:.3,color:0});E=new n.Mesh(B,O),E.position.copy(l),E.position.z-=.01,E.receiveShadow=!0,g.add(E)},p=()=>{if(b.value.length===0)return;const m=new n.Box3;let l=!1;if(b.value.forEach(X=>{if(X.userData.boundingBox)m.union(X.userData.boundingBox),l=!0;else if(X.userData.modelId&&modelBoundingBoxes.has(X.userData.modelId)){const Z=modelBoundingBoxes.get(X.userData.modelId);m.union(Z.box),l=!0}else m.expandByObject(X),l=!0}),!l){console.warn("无法计算包围盒,网格更新失败");return}const _=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(_.x,_.y,_.z),j=Math.max(O*8,50),q=new n.Vector3(B.x,B.y,m.min.z);t(j,q)},f=()=>{const m=new n.AmbientLight(4210752,.6);g.add(m);const l=new n.DirectionalLight(16777215,2);l.position.set(10,10,8),l.castShadow=!0,l.shadow.mapSize.width=4096,l.shadow.mapSize.height=4096,l.shadow.camera.near=.5,l.shadow.camera.far=50,l.shadow.camera.left=-50,l.shadow.camera.right=50,l.shadow.camera.top=50,l.shadow.camera.bottom=-50,g.add(l);const _=new n.DirectionalLight(16777215,.8);_.position.set(-8,-8,6),g.add(_);const B=new n.DirectionalLight(16777215,.6);B.position.set(0,-15,2),g.add(B);const O=new n.HemisphereLight(16777215,4473924,.8);g.add(O);const j=new n.PointLight(16777215,1,50);j.position.set(15,15,15),g.add(j);const q=new n.PointLight(16777215,.5,50);q.position.set(-15,-15,15),g.add(q)},C=()=>{P=requestAnimationFrame(C),h&&h.update();const m=performance.now(),l=m-N;l<D||(N=m-l%D,d&&g&&u&&d.render(g,u),x&&x.render())},I=m=>{["map","normalMap","bumpMap","roughnessMap","metalnessMap","emissiveMap","specularMap","envMap","lightMap","aoMap","displacementMap"].forEach(_=>{m[_]&&m[_].dispose&&m[_].dispose()}),m.dispose&&m.dispose()},A=m=>{m==null||m.traverse(l=>{l.geometry&&l.geometry.dispose(),l.material&&(Array.isArray(l.material)?l.material.forEach(_=>{I(_)}):I(l.material))})};return{currentModels:b,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,_=m.clientHeight;u.aspect=l/_,u.updateProjectionMatrix(),d.setSize(l,_),x.update()},fitCameraToAllModels:m=>{if(!u||!h||b.value.length===0)return;const l=new n.Box3;let _=!1;if(b.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),_=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),_=!0}else l.expandByObject(Z),_=!0}),!_){console.warn("无法计算包围盒");return}const B=l.getSize(new n.Vector3),O=l.getCenter(new n.Vector3),q=Math.max(B.x,B.y,B.z)*.8,X=new n.Vector3(O.x+q,O.y-q,O.z+q);u.position.copy(X),u.lookAt(O),h.target.copy(O),h.update(),r.value.copy(X),k.value.copy(O),p()},getThreeJSObjects:()=>({scene:g,camera:u,renderer:d,controls:h,gizmo:x}),clearAllModels:()=>{if(!g)return;b.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==E&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),b.value=[],p()},cleanup:()=>{P&&cancelAnimationFrame(P),c&&c.dispose(),E&&(E.geometry.dispose(),E.material.dispose()),d&&d.dispose(),h&&h.dispose(),x&&x.dispose()},updateGridForModels:p}}function ge(z,g){const u=e.ref(!1);let d=null,h=12700,x=new n.Vector3,P=new n.Vector3,c=new n.Vector3,E=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,N=t=>{const p=new n.Vector3,f=E*1.2,C=new n.Vector3(c.x+f,c.y,c.z),I=new n.Vector3(c.x,c.y+f,c.z),A=new n.Vector3(c.x,c.y-f,c.z);if(t<=.567){const $=t/.567*Math.PI*2;p.x=c.x+Math.cos($)*f,p.z=c.z+Math.sin($)*f,p.y=c.y}else if(t<=.724){const L=(t-.567)/.157,$=D(L);p.lerpVectors(C,I,$)}else if(t<=.881){const L=(t-.724)/.157,J=D(L)*Math.PI;p.x=c.x+Math.sin(J)*f,p.y=c.y+Math.cos(J)*f,p.z=c.z}else{const L=(t-.881)/.119,$=D(L);p.lerpVectors(A,x,$)}return p},b=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,C=Math.min(f/h,1);if(C>=1){k();return}const I=N(C);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(b)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),P.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const C=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),E=Math.max(C.x,C.y,C.z)*1.2;const I=new n.Vector3(c.x+E*1.2,c.y,c.z);p.enabled=!1;const A=t.position.clone(),L=1e3,$=Date.now(),J=()=>{const G=Date.now()-$,Y=Math.min(G/L,1),m=D(Y);t.position.lerpVectors(A,I,m),t.lookAt(c),p.target.copy(c),Y<1?requestAnimationFrame(J):(u.value=!0,d=null,b())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(P))};return{isAnimating:u,toggleAnimation:()=>{if(u.value){u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{camera:t,controls:p}=z();if(!t||!p)return;p.enabled=!0;const f=t.position.clone(),C=p.target.clone(),I=1500,A=Date.now(),L=()=>{const $=Date.now()-A,J=Math.min($/I,1),G=D(J);t.position.lerpVectors(f,x,G),p.target.lerpVectors(C,P,G),J<1&&requestAnimationFrame(L)};L()}else r()},startAnimation:r,stopAnimation:k}}function he(z,g){const u=e.ref(!1),d=e.ref("none");let h=[],x=[],P=new n.Box3,c=new n.Vector3;const E=()=>{h=[new n.Plane(new n.Vector3(1,0,0),0),new n.Plane(new n.Vector3(0,1,0),0),new n.Plane(new n.Vector3(0,0,1),0)]},F=()=>{P.makeEmpty(),g.value.forEach(y=>{P.expandByObject(y)}),c=P.getCenter(new n.Vector3)},D=y=>{const t=P.getSize(new n.Vector3);let p,f,C;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,Math.PI/2,0)):y==="y"?(p=new n.PlaneGeometry(t.x*1.2,t.z*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(Math.PI/2,0,0)):y==="z"&&(p=new n.PlaneGeometry(t.x*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),C=new n.Euler(0,0,0));const I=new n.MeshPhongMaterial({color:8900331,transparent:!0,opacity:.3,side:n.DoubleSide,depthWrite:!1}),A=new n.Mesh(p,I);return A.position.copy(f),A.rotation.copy(C),A},N=()=>{if(b(),r(),d.value==="none")return;F();let y=null;if(d.value==="x"?(h[0].constant=-c.x,y=h[0]):d.value==="y"?(h[1].constant=-c.y,y=h[1]):d.value==="z"&&(h[2].constant=-c.z,y=h[2]),y){g.value.forEach(p=>{p.traverse(f=>{f.isMesh&&f.material&&(Array.isArray(f.material)?f.material.forEach(C=>{C.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},b=()=>{g.value.forEach(y=>{y.traverse(t=>{t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(p=>{p.clippingPlanes=[]}):t.material.clippingPlanes=[])})})},r=()=>{const{scene:y}=z();y&&x.forEach(t=>{y.remove(t),t.geometry.dispose(),t.material.dispose()}),x=[]};return{isClipping:u,activeClippingAxis:d,toggleClipping:()=>{u.value=!u.value,u.value?(E(),g.value.length>0&&F()):(d.value="none",b(),r())},updateClippingPlanes:N,clearClippingPlanes:b,clearClippingMeshes:r}}const ye={class:"panel-content"},we={__name:"animationPanel",props:{animationData:Object,model:Object},setup(z){const g=z;e.ref();const u=e.ref();return e.watch(()=>[g==null?void 0:g.animationData],()=>{var h;let d=((h=me.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,P,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(pe.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(P=u.value)==null?void 0:P.id,index:(c=u.value)==null?void 0:c.id,showHeader:!1},null,8,["itemData","index"]))])}}},xe=oe._export_sfc(we,[["__scopeId","data-v-2387536e"]]),Ve={class:"panel-content"},Me={key:0,class:"joints-list"},ke={class:"joint-info-row"},Pe={class:"joint-left"},Ce={class:"joint-name"},Ee={class:"joint-range"},be={class:"joint-type"},_e={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Se={class:"value-display"},Ne={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ce=60,Fe={__name:"jointPanel",props:{model:Object,scene:Object,animationData:Object},setup(z,{expose:g}){const u=z;e.ref(!0);const d=e.ref([]),h=e.ref(null),x=e.ref(null),P=e.ref(12.5),c=e.ref(),E=e.ref(1302),F=e.ref(30),D=e.ref(!1),N=e.ref(!1),b=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ce/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;E.value=o.extra.管长,P.value=o.extra.外径/2;let v=((i=me.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const C=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return de.ElMessage.error("未加载 URDF"),!1;let o=null;return h.value.traverse(v=>{o||v.name==="Pipe_Link"&&v.traverse(i=>{i instanceof n.Mesh&&!o&&(o=i)})}),o?(o.position.y-=F.value*ae,c.value=o,o.material=new n.MeshPhongMaterial({color:11184810,shininess:80,side:n.DoubleSide}),!0):(de.ElMessage.error('在 "Pipe_Link" 内未找到任何 Mesh'),!1)},A=o=>{if(!o||!o.joints)return console.warn("URDF模型没有关节信息"),[];let v=null;if(o.traverse(V=>{V.name==="Pipe_Link"&&!v&&(v=V)}),v)c.value=v;else return console.warn("未找到管子模型"),[];const i=[];return Object.keys(o.joints).forEach(V=>{const s=o.joints[V];if(s._jointType==="fixed")return;const a=s.limit?{lower:s.limit.lower??C(s._jointType,!1),upper:s.limit.upper??C(s._jointType,!0)}:{lower:C(s._jointType,!1),upper:C(s._jointType,!0)};i.push({name:V,type:s._jointType||"unknown",limit:a,currentValue:s.angle||0,urdfJoint:s})}),i.sort((V,s)=>V.name.localeCompare(s.name))},L=(o,v)=>{const i=d.value.find(s=>s.name===o);if(!i)return;const V=parseFloat(v);if(i.limit){const s=Math.max(i.limit.lower,Math.min(i.limit.upper,V));i.currentValue=s}else i.currentValue=V;u.model&&u.model.setJointValue?u.model.setJointValue(o,i.currentValue):i.urdfJoint&&i.urdfJoint.setJointValue(i.currentValue)},$=o=>o.reduce((v,i)=>{let V=0;const s=i.Y??0,a=i.C??0,w=i.R??0;return s>0&&(V+=s),a>0&&w>0&&(V+=w*y(a)),v+V},0),J=o=>{const v=[],i=o.Y??0,V=o.B??0,s=o.C??0,a=o.R??0,w={pos:new n.Vector3(0,0,0),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};if(!i&&!s)return v;if(v.push(w.pos.clone()),V!==0){const U=new n.Matrix4().makeRotationAxis(w.localY,y(V));w.localX.applyMatrix4(U),w.localZ.applyMatrix4(U)}if(i>0&&(w.pos.add(w.localY.clone().multiplyScalar(i*ae)),v.push(w.pos.clone())),s>0&&a>0){const U=y(s),T=a*ae,W=w.pos.clone().add(w.localX.clone().multiplyScalar(-T)),R=Math.max(16,Math.ceil(s/5));for(let M=1;M<=R;M++){const H=U*M/R,K=new n.Matrix4().makeRotationAxis(w.localZ,H),se=w.localX.clone().multiplyScalar(T).applyMatrix4(K),ie=W.clone().add(se);v.push(ie)}}return v},G=(o,v=0)=>{let i=f.slice(0,o+1);const V=f[o+1];if(V&&v>0){const R={...V,B:(V.B??0)*v,C:(V.C??0)*v};i.push(R)}const s=$(i),a=Math.max(0,E.value-s),w=[];w.push(new n.Vector3(0,0,0));const U=new n.Vector3(0,a*ae,0);a>0&&w.push(U);let T={pos:U.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const W=[];for(let R=i.length-1;R>=0;R--){const M=i[R],H=J(M);if(H.length>0){const K=H.map(Q=>{const ne=Q.clone(),ue=new n.Matrix4;return ue.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(ue),ne.add(T.pos)});W.push(K);const te=K[K.length-1];T.pos=te.clone();const se=M.B??0,ie=M.C??0;if(se!==0){const Q=new n.Matrix4().makeRotationAxis(T.localY,y(se));T.localX.applyMatrix4(Q),T.localZ.applyMatrix4(Q)}if(ie>0){const Q=y(ie),ne=new n.Matrix4().makeRotationAxis(T.localZ,Q);T.localY.applyMatrix4(ne),T.localX.applyMatrix4(ne)}}}for(const R of W)R.length>1&&w.push(...R.slice(1));w.length<2&&w.push(new n.Vector3(0,.001,0));try{const R=new n.CatmullRomCurve3(w,!1,"catmullrom",.01),M=new n.TubeGeometry(R,Math.max(2,w.length*4),P.value*ae,18,!1);c.value.geometry.dispose(),c.value.geometry=M}catch(R){console.error("管件更新失败",R)}},Y=(o,v,i=1)=>{o&&(Object.keys(o).forEach(V=>{const s=o[V],a=d.value.find(w=>w.name===V);a&&(a.currentValue=s,u.model&&u.model.setJointValue?u.model.setJointValue(V,s):a.urdfJoint&&a.urdfJoint.setJointValue(s))}),G(v,i))},m=(o,v,i)=>o+(v-o)*i,l=(o,v,i)=>{if(!o||!v)return o||v;const V={};return Object.keys(o).forEach(s=>{const a=o[s],w=v[s];V[s]=m(a,w||a,i)}),V},_=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,N.value=!1,b.value=0,r.value=0,B()},B=()=>{if(!D.value||N.value)return;const o=b.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ce,i=f[o],V=f[o+1];if(V){const s=l(i,V,v);Y(s,o,v)}else Y(i,o);r.value++,r.value>ce&&(r.value=0,b.value++),k.value=setTimeout(B,p())},O=()=>{N.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,N.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:_,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),b.value=0,r.value=0,d.value.forEach(o=>{(o.type==="revolute"||o.type==="prismatic")&&L(o.name,0)}),G(-1,0)},fastForward:()=>{t.value<4&&(t.value=Math.min(4,t.value*2))},fastBackward:()=>{t.value>.25&&(t.value=Math.max(.25,t.value/2))}}),e.watch(()=>u.model,o=>{o?(h.value=o,d.value=A(o)):d.value=[]},{immediate:!0});const ee=()=>{!u.model||D.value&&!N.value||d.value.forEach(o=>{o.urdfJoint&&o.urdfJoint.angle!==void 0&&(o.currentValue=o.urdfJoint.angle)})},le=()=>{const o=()=>{ee(),x.value=requestAnimationFrame(o)};o()},re=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{re(),j()}),(o,v)=>(e.openBlock(),e.createElementBlock("div",Ve,[d.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,i=>{var V,s,a,w;return e.openBlock(),e.createElementBlock("div",{key:i.name,class:"joint-item"},[e.createElementVNode("div",ke,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Ce,e.toDisplayString(i.name),1),e.createElementVNode("span",Ee," ["+e.toDisplayString(((V=i.limit)==null?void 0:V.lower.toFixed(2))??(i.type==="revolute"?"-3.14":"-1.00"))+", "+e.toDisplayString(((s=i.limit)==null?void 0:s.upper.toFixed(2))??(i.type==="revolute"?"3.14":"1.00"))+"] ",1)]),e.createElementVNode("span",be,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ze,[e.createElementVNode("input",{type:"range",min:((a=i.limit)==null?void 0:a.lower)??(i.type==="revolute"?-Math.PI:-1),max:((w=i.limit)==null?void 0:w.upper)??(i.type==="revolute"?Math.PI:1),step:.01,value:i.currentValue,onInput:U=>L(i.name,U.target.value),class:"joint-slider",disabled:D.value&&!N.value},null,40,De)]),e.createElementVNode("div",Se,[e.createElementVNode("span",Ne,e.toDisplayString(i.currentValue?Number(i.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Be,e.toDisplayString(i.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)])}),128))])):(e.openBlock(),e.createElementBlock("div",Ae,v[0]||(v[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}},Te=oe._export_sfc(Fe,[["__scopeId","data-v-035ae936"]]),Le={class:"panel-content"},Ie="id",$e={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:z=>["breadth","firstLevel"].includes(z)}},emits:["nodeClick"],setup(z,{emit:g}){const u=z,d=g,h=e.ref([]),x={children:"children",label:"label"},P=r=>{d("nodeClick",r)},c=(r,k=0)=>{const y=[];return Array.isArray(r)&&(r==null?void 0:r.length)>0&&r.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const p={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:k+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:c(t==null?void 0:t.children,k+1),path:t==null?void 0:t.name};y.push(p)}}),y},E=r=>r?[{name:r==null?void 0:r.name,label:r==null?void 0:r.name,show:!0,level:1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:c(r==null?void 0:r.children,1),path:r==null?void 0:r.name}]:[],F=(r,k)=>{const y=[],t=[...r];for(;t.length>0&&y.length<k;){const p=t.shift();p.children&&p.children.length>0&&(y.push(p.id),t.push(...p.children))}return y},D=(r,k)=>{const y=[];return r.forEach(t=>{if(t.children&&t.children.length>0){y.push(t.id);const p=t.children.filter(f=>f.children&&f.children.length>0).slice(0,k).map(f=>f.id);y.push(...p)}}),y.slice(0,k+1)},N=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),b=e.computed(()=>u!=null&&u.model?E(u.model):[]);return e.watch(b,r=>{h.value=JSON.parse(JSON.stringify(r))},{immediate:!0}),(r,k)=>{const y=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(y,{data:h.value,props:x,"default-expanded-keys":N.value,"node-key":Ie,onNodeClick:P},null,8,["data","default-expanded-keys"])])}}},Je=oe._export_sfc($e,[["__scopeId","data-v-290ff4e1"]]),Oe=["xlink:href"],Ue=e.defineComponent({__name:"svgIcon",props:{backgroundColor:{default:"#f0f0f0"},prefix:{default:"icon"},name:{},size:{default:16},spin:{type:Boolean,default:!1},active:{type:Boolean,default:!1}},setup(z){const g=z,u=e.computed(()=>({backgroundColor:g.backgroundColor})),d=e.computed(()=>`#${g.prefix}-${g.name}`),h=e.computed(()=>{const{size:x}=g;let P=`${x}`;return P=`${P.replace("px","")}px`,{width:P,height:P}});return(x,P)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["container",{active:x.active}]),style:e.normalizeStyle(u.value)},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["svg-icon",[x.$attrs.class,x.spin&&"svg-icon-spin"]]),style:e.normalizeStyle(h.value),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":d.value},null,8,Oe)],6))],6))}}),S=oe._export_sfc(Ue,[["__scopeId","data-v-3150a90b"]]),Ge={class:"obj-viewer-container"},je={class:"buttonGroup-top"},qe={class:"buttonGroup-topLeft"},Xe={class:"buttonGroup-left"},He={class:"buttonGroup-right"},Ye={class:"buttonGroup-bottom"},Ze={class:"left-panel"},We={class:"panel-header"},Ke={key:1,class:"clipping-content"},Qe={class:"radio-group"},et={class:"radio-label"},tt={class:"radio-label"},nt={class:"radio-label"},at={class:"radio-label"},ot={class:"right-panel"},lt={class:"panel-header"},st={key:0,class:"loading-overlay"},it={__name:"threeModel",props:{animationData:{type:Object,default:()=>{}}},emits:["getAnimationData"],setup(z,{expose:g,emit:u}){const d=u;let h=null,x=!1;const P=e.ref(null),c=e.ref(!1),E=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),N=e.ref(""),b=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:C,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(P),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:_,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=pe.useModelLoader(A,y,c,E,L),Z=()=>{if(F.value||y.value.length===0)return;F.value=!0,J.value&&Y();const{camera:s,controls:a}=A();if(!s||!a)return;a.enabled=!0;const w=H=>H<.5?4*H*H*H:1-Math.pow(-2*H+2,3)/2,U=s.position.clone(),T=a.target.clone(),W=1500,R=Date.now(),M=()=>{const H=Date.now()-R,K=Math.min(H/W,1),te=w(K);s.position.lerpVectors(U,t.value,te),a.target.lerpVectors(T,p.value,te),K<1?requestAnimationFrame(M):F.value=!1};M()},ee=async()=>x?Promise.resolve():new Promise(s=>{const a=()=>{x?s():requestAnimationFrame(a)};a()}),le=async(s,a)=>{try{await ee(),J.value&&Y(),m.value&&_();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},re=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,N.value=s,s==="剖面视图"&&!m.value&&_()},i=s=>{b.value=!0,r.value=s,s==="动画仿真"&&d("getAnimationData")},V=()=>{e.nextTick(()=>{var s;(s=k.value)==null||s.startAnimation()})};return e.onMounted(async()=>{await e.nextTick();try{f(),h=A().scene,x=!0,window.addEventListener("resize",C)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,N.value="",r.value="",window.removeEventListener("resize",C),J.value&&Y(),$()}),g({addModelsFromUrls:re,loadModelByDefaultPath:o}),(s,a)=>{var U,T,W,R;const w=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:P,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(S,{name:"guanjianjiexi",size:"34"}),e.createVNode(S,{name:"guanjiekongzhi",size:"34"}),e.createVNode(S,{name:"gongyishengcheng",size:"34"}),e.createVNode(S,{name:"buchangshezhi",size:"34"}),e.createVNode(S,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(S,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(S,{name:"fangda",size:"24",title:"放大"}),e.createVNode(S,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(S,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(S,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&N.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(S,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&N.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(S,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:b.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:b.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(S,{name:"donghuafangzhen",size:"24"}),e.createVNode(S,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(S,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(S,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(S,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(S,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(S,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:(R=k.value)==null?void 0:R.resetAll},null,8,["onClick"])]),e.withDirectives(e.createElementVNode("div",Ze,[e.createElementVNode("div",We,[e.createElementVNode("span",null,e.toDisplayString(N.value),1),e.createElementVNode("span",{class:"close",onClick:a[6]||(a[6]=M=>D.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[N.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),N.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Qe,[e.createElementVNode("label",et,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":a[7]||(a[7]=M=>e.isRef(l)?l.value=M:null),onChange:a[8]||(a[8]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[16]||(a[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",tt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":a[9]||(a[9]=M=>e.isRef(l)?l.value=M:null),onChange:a[10]||(a[10]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[17]||(a[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":a[11]||(a[11]=M=>e.isRef(l)?l.value=M:null),onChange:a[12]||(a[12]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[18]||(a[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",at,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":a[13]||(a[13]=M=>e.isRef(l)?l.value=M:null),onChange:a[14]||(a[14]=(...M)=>e.unref(B)&&e.unref(B)(...M))},null,544),[[e.vModelRadio,e.unref(l)]]),a[19]||(a[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})],512),[[e.vShow,D.value]]),e.withDirectives(e.createElementVNode("div",ot,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(r.value),1),e.createElementVNode("span",{class:"close",onClick:a[15]||(a[15]=M=>b.value=!1)}," X ")]),e.createVNode(w,{"max-height":"650px"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Te,{ref_key:"jointRef",ref:k,model:e.unref(q),scene:e.unref(h),animationData:z.animationData},null,8,["model","scene","animationData"]),[[e.vShow,r.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{animationData:z.animationData},null,8,["animationData"]),[[e.vShow,r.value==="动画仿真"]])]),_:1})],512),[[e.vShow,b.value]]),c.value?(e.openBlock(),e.createElementBlock("div",st,[a[20]||(a[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(E.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var G=Object.defineProperty;var K=(N,s,l)=>s in N?G(N,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):N[s]=l;var j=(N,s,l)=>K(N,typeof s!="symbol"?s+"":s,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("./iconfont-hhnosGE8.cjs"),P=require("./index-
|
|
1
|
+
"use strict";var G=Object.defineProperty;var K=(N,s,l)=>s in N?G(N,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):N[s]=l;var j=(N,s,l)=>K(N,typeof s!="symbol"?s+"":s,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("./iconfont-hhnosGE8.cjs"),P=require("./index-CE3d4U5P.cjs"),M=require("./STLLoader-BxpEhvEg.cjs"),B=require("./index-Cms-tuk5.cjs"),L=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cuqd9E7-.cjs"),W=require("./index.vue_vue_type_style_index_1_lang-BH0_LUL8.cjs"),U=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),S=require("./index-BKUqLOwQ.cjs"),H="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function A(N){if(N==null||!isFinite(N))return"";const s=N/(1024*1024);if(s>=1)return`${s.toFixed(1)} MB`;const l=N/1024;return l>=1?`${l.toFixed(1)} KB`:`${N} B`}function O(N){try{const s=N.split("?")[0].split("#")[0];return s.substring(s.lastIndexOf("/")+1)||s}catch{return N}}function X(N){const{manager:s,baseFolderUrl:l,onFileProgress:i}=N,f=new P.URDFLoader(s);return f.packages=p=>`${l.endsWith("/")?l:l+"/"}${p}/`,f.loadMeshCb=(p,w,_)=>{const b=(()=>{const v=p.split("?")[0].split("#")[0],d=v.lastIndexOf(".");return d>=0?v.slice(d+1).toLowerCase():void 0})();switch(b){case"obj":{const v=(()=>{try{return new URL(".",p).toString()}catch{const o=p.lastIndexOf("/");return o>=0?p.slice(0,o+1):p}})(),d=(()=>{var a;return(((a=p.split("/").pop())==null?void 0:a.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),m=`${v}${d}.mtl`,u=o=>{const a=new M.OBJLoader(w);o&&a.setMaterials(o),a.load(p,n=>_(n),n=>i==null?void 0:i(p,n==null?void 0:n.loaded,n==null?void 0:n.total),n=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${p}`,n),_(new M.Group)})},t=new M.MTLLoader(w);t.setResourcePath(v),t.load(m,o=>{try{o.preload()}catch{}u(o)},o=>i==null?void 0:i(m,o==null?void 0:o.loaded,o==null?void 0:o.total),o=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${m}。将尝试无材质加载。`),u(void 0)});break}case"stl":{new M.STLLoader(w).load(p,d=>{const m=new M.MeshPhongMaterial({color:12303291,shininess:30}),u=new M.Mesh(d,m);u.castShadow=!0,u.receiveShadow=!0,_(u)},d=>i==null?void 0:i(p,d==null?void 0:d.loaded,d==null?void 0:d.total),d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${p}`,d),_(new M.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${b} (路径: ${p})`),_(new M.Group)}},f}function Z(N,s,l,i){return{loadSceneFromFile:p=>new Promise((w,_)=>{l.value=!0,i.value="正在初始化 URDF 加载器...";let b=0,v=0,d=null;const m=new M.LoadingManager;m.onStart=(t,o,a)=>{b=a||0,v=o||0,i.value=b>0?`开始下载资源: 0 / ${b}`:"开始下载资源...",l.value=!0},m.onProgress=(t,o,a)=>{v=o,b=a;const n=`正在加载 ${o} / ${a} 个文件: ${O(t)}`;i.value=n,o===a&&(i.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(d){d.updateMatrixWorld(!0);const V=new M.Box3().setFromObject(d);V.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),d.userData.boundingBox=V,d.traverse(C=>{C.isMesh&&(C.castShadow=!0,C.receiveShadow=!0)}),w(d)}else _(new Error("URDF 文件本身加载失败。"));i.value="模型加载完成",setTimeout(()=>{i.value==="模型加载完成"&&(l.value=!1,i.value="")},500)},100))},m.onError=t=>{console.warn(`LoadingManager 报告一个资源加载失败: ${t}。加载流程将继续。`)};const u=(t,o,a)=>{const n=O(t);let V;a&&a>0?V=`${n}(${A(o)} / ${A(a)})`:o&&o>0?V=`${n}(已下载 ${A(o)})`:V=`${n}`,i.value=`正在下载第 ${v+1} / ${b} 个文件: ${V}`};try{const t=URL.createObjectURL(p);X({manager:m,baseFolderUrl:H,onFileProgress:u}).load(t,a=>{d=a},void 0,a=>{console.error(`加载 URDF 文件 (${p.name}) 时发生致命错误:`,a),i.value="URDF 文件解析失败",l.value=!1,_(new Error(`加载 URDF 文件失败: ${p.name}`,{cause:a}))})}catch(t){console.error("初始化 URDF 加载时发生致命错误:",t),i.value="模型加载失败",l.value=!1,_(t)}})}}const Y={class:"panel-content"},Q=e.defineComponent({__name:"animationPanel",props:{model:Object},setup(N){const s=e.ref(),l=e.ref(),i=async()=>{var u;const f=await L.getItemData("弯管仿真加工分析/管件解析",sessionStorage.getItem("systemKey"),"");let p=["管长","外径"],w={};f==null||f.forEach(t=>{var o;(t==null?void 0:t.comp)==="Form"&&((o=t==null?void 0:t.compData)==null||o.forEach(a=>{var n;(a==null?void 0:a.key)==="formContent"&&((n=a==null?void 0:a.contents)==null||n.forEach(V=>{p.includes(V==null?void 0:V.key)&&(w[V.key]=V.value)}))}))});let _=w.管长,b=w.外径;console.log("管长",_,"外径",b,w);let v={};await L.getItemData("弯管仿真加工分析/任务选择",sessionStorage.getItem("systemKey"),"");const d=await L.getItemData("弯管仿真加工分析/仿真动画生成",sessionStorage.getItem("systemKey"),"");d==null||d.forEach(t=>{var o,a,n,V,C,z;if((t==null?void 0:t.comp)==="Table"){let F=[],R=(n=(a=(o=t==null?void 0:t.compData)==null?void 0:o.find(r=>(r==null?void 0:r.key)==="header"))==null?void 0:a.contents)==null?void 0:n.map(r=>r==null?void 0:r.label),g=(z=(C=(V=t==null?void 0:t.compData)==null?void 0:V.find(r=>(r==null?void 0:r.key)==="tableContents"))==null?void 0:C.contents)==null?void 0:z.map(r=>(r=r==null?void 0:r.filter(h=>!(h!=null&&h.id)),r));g==null||g.forEach(r=>{F.push(L.getValueToObjectValue(r,R==null?void 0:R.filter(h=>h!=="操作")))}),v[t.name]=F,v[t.name+"Content"]=t}}),s.value=v;let m=((u=W.cloneDeep(s.value))==null?void 0:u["输出(动画数据)Content"])??[];m&&(l.value=m)};return(f,p)=>{var w,_,b;return e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(B._sfc_main$1,{onClick:i,modelValue:"获取数据"}),(e.openBlock(),e.createBlock(P.ssTable,{itemData:(w=l.value)==null?void 0:w.compData,key:(_=l.value)==null?void 0:_.id,index:(b=l.value)==null?void 0:b.id,showHeader:!1},null,8,["itemData","index"]))])}}}),ee=U._export_sfc(Q,[["__scopeId","data-v-4e724a54"]]);class te{constructor(s){j(this,"robot");j(this,"movableJoints");this.robot=s,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(s=>s.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(s=>s.name)}setJointAngle(s,l){const i=this.robot.joints[s];if(!i||i.jointType==="fixed")return console.warn(`关节 ${s} 不存在或不可动`),!1;if(i.limit){const f=Math.max(i.limit.lower,Math.min(i.limit.upper,l));f!==l&&console.warn(`关节 ${s} 角度被限制在 [${i.limit.lower}, ${i.limit.upper}]`),i.setJointValue(f)}else i.setJointValue(l);return!0}setJointAngles(s){Object.entries(s).forEach(([l,i])=>{typeof i=="number"&&!isNaN(i)&&this.setJointAngle(l,i)})}getCurrentJointStates(){const s={};return this.movableJoints.forEach(l=>{s[l.name]=l.angle||0}),s}resetToZero(){this.movableJoints.forEach(s=>{s.setJointValue(0)})}getJointLimits(s){const l=this.robot.joints[s];return!l||!l.limit?null:{lower:l.limit.lower,upper:l.limit.upper}}async animateToState(s,l=1e3,i){const f=this.getCurrentJointStates(),p=Date.now();return new Promise(w=>{const _=()=>{const b=Date.now()-p,v=Math.min(b/l,1),d=this.easeInOutCubic(v),m={};Object.keys(s).forEach(u=>{const t=f[u]||0,o=s[u];m[u]=t+(o-t)*d}),this.setJointAngles(m),i&&i(v),v<1?requestAnimationFrame(_):w()};_()})}easeInOutCubic(s){return s<.5?4*s*s*s:1-Math.pow(-2*s+2,3)/2}async playSequence(s,l=1e3,i){for(let f=0;f<s.length;f++)await this.animateToState(s[f],l,p=>{i&&i(f,p)})}}const oe={class:"panel-content"},ne={class:"action-bar"},le={key:0,class:"animation-controls"},ae={class:"control-row"},se={class:"control-row"},re={class:"frame-info"},ie={class:"progress-bar"},ce={key:1,class:"table-footer"},ue={class:"dialog-footer"},de=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{}},setup(N){const s=N,l=e.ref([]),i=e.ref(!1),f=e.ref(""),p=e.ref(!1),w=e.ref(0),_=e.ref(0),b=e.ref(1e3),v=e.ref(null);let d=!1;const m=e.computed(()=>s.model?Object.values(s.model.joints).filter(g=>g.jointType!=="fixed").map(g=>g.name):[]),u=e.computed(()=>m.value.length>0?`请按以下格式粘贴数据 (使用 Tab 分隔):
|
|
2
2
|
${m.value.join(" ")}
|
|
3
3
|
...`:"请先加载包含可动关节的模型。");e.watch(m,g=>{if(g.length>0){const r=g.reduce((h,D)=>(h[D]="0",h),{});l.value=[r]}else l.value=[]},{immediate:!0}),e.watch(()=>s.model,g=>{g?v.value=new te(g):v.value=null},{immediate:!0});const t=async()=>{if(m.value.length===0){S.ElMessage.warning("没有可导出的表头");return}const g=m.value.join(" ");try{await navigator.clipboard.writeText(g),S.ElMessage.success("表头已成功复制到剪贴板!")}catch(r){console.error("复制失败:",r),S.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},o=()=>{if(!f.value.trim()){S.ElMessage.warning("导入内容不能为空");return}const r=f.value.trim().split(`
|
|
4
4
|
`).filter(h=>h.trim()!=="").map(h=>{const D=h.split(" "),$={};return m.value.forEach((I,T)=>{$[I]=D[T]||"0"}),$});r.length>0?(l.value=r,S.ElMessage.success(`成功导入 ${r.length} 行数据!`),i.value=!1,f.value=""):S.ElMessage.error("未能解析到有效数据,请检查格式。")},a=()=>{const g=m.value.reduce((r,h)=>(r[h]="0",r),{});l.value.push(g)},n=g=>{l.value.splice(g,1)},V=({rowIndex:g})=>p.value&&g===w.value?"current-frame-row":"",C=g=>{if(!v.value){S.ElMessage.error("机器人控制器未初始化");return}const r=l.value[g],h={};m.value.forEach(D=>{const $=parseFloat(r[D]);isNaN($)||(h[D]=$)}),v.value.setJointAngles(h),w.value=g,S.ElMessage.success(`已切换到第 ${g+1} 帧`)},z=async()=>{if(!v.value||l.value.length===0){S.ElMessage.error("无法播放动画:机器人未加载或无数据");return}p.value=!0,d=!1,w.value=0;try{for(let g=0;g<l.value.length&&!d;g++){w.value=g;const r=l.value[g],h={};m.value.forEach(D=>{const $=parseFloat(r[D]);isNaN($)||(h[D]=$)}),await v.value.animateToState(h,b.value,D=>{_.value=(g+D)/l.value.length*100})}d||S.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g),S.ElMessage.error("动画播放出错")}finally{p.value=!1,_.value=0}},F=()=>{d=!0,p.value=!1,_.value=0,S.ElMessage.info("动画已停止")},R=()=>{if(!v.value){S.ElMessage.error("机器人控制器未初始化");return}v.value.resetToZero(),w.value=0,S.ElMessage.success("机器人已重置到零位")};return e.onUnmounted(()=>{d=!0}),(g,r)=>{const h=e.resolveComponent("el-icon"),D=e.resolveComponent("el-input-number"),$=e.resolveComponent("el-progress"),I=e.resolveComponent("el-table-column"),T=e.resolveComponent("el-input"),J=e.resolveComponent("el-button"),x=e.resolveComponent("el-table"),c=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",oe,[e.createElementVNode("div",ne,[e.createVNode(B._sfc_main$1,{onClick:r[0]||(r[0]=E=>i.value=!0),disabled:m.value.length===0,modelValue:"导入数据"},null,8,["disabled"]),e.createVNode(B._sfc_main$1,{onClick:t,disabled:m.value.length===0,modelValue:"导出表头"},null,8,["disabled"]),e.createVNode(B._sfc_main$1,{modelValue:"播放",onClick:z,disabled:l.value.length===0||p.value,buttonType:"primary"},{default:e.withCtx(()=>[p.value?(e.openBlock(),e.createBlock(h,{key:0,class:"is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(S.loading_default))]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["disabled"]),e.createVNode(B._sfc_main$1,{onClick:F,modelValue:"停止",buttonType:"danger"}),e.createVNode(B._sfc_main$1,{onClick:R,modelValue:"重置机器人",buttonType:"primary"})]),l.value.length>0?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("div",ae,[r[5]||(r[5]=e.createElementVNode("label",null,"帧间隔 (毫秒):",-1)),e.createVNode(D,{modelValue:b.value,"onUpdate:modelValue":r[1]||(r[1]=E=>b.value=E),min:100,max:5e3,step:100,size:"small",style:{width:"120px"}},null,8,["modelValue"])]),e.createElementVNode("div",se,[r[6]||(r[6]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",re,e.toDisplayString(w.value+1)+" / "+e.toDisplayString(l.value.length),1)]),e.createElementVNode("div",ie,[e.createVNode($,{percentage:_.value,"show-text":!1,"stroke-width":6},null,8,["percentage"])])])):e.createCommentVNode("",!0),e.createVNode(x,{data:l.value,border:"",stripe:"",class:"dynamic-table","row-class-name":V},{empty:e.withCtx(()=>r[9]||(r[9]=[e.createElementVNode("p",null,"没有可动的关节或未加载模型",-1)])),default:e.withCtx(()=>[e.createVNode(I,{type:"index",label:"序号",width:"80",align:"center"}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,E=>(e.openBlock(),e.createBlock(I,{key:E,prop:E,label:E,"min-width":"120"},{default:e.withCtx(y=>[e.createVNode(T,{modelValue:y.row[E],"onUpdate:modelValue":q=>y.row[E]=q,placeholder:"角度值...",type:"number",step:.1},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop","label"]))),128)),e.createVNode(I,{label:"操作",width:"150",align:"center"},{default:e.withCtx(E=>[e.createVNode(J,{size:"small",onClick:y=>C(E.$index),disabled:!s.model},{default:e.withCtx(()=>r[7]||(r[7]=[e.createTextVNode(" 预览 ")])),_:2,__:[7]},1032,["onClick","disabled"]),e.createVNode(J,{size:"small",type:"danger",onClick:y=>n(E.$index)},{default:e.withCtx(()=>r[8]||(r[8]=[e.createTextVNode(" 删除 ")])),_:2,__:[8]},1032,["onClick"])]),_:1})]),_:1},8,["data"]),m.value.length>0?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(J,{onClick:a,type:"primary",plain:""},{default:e.withCtx(()=>r[10]||(r[10]=[e.createTextVNode("添加新行")])),_:1,__:[10]})])):e.createCommentVNode("",!0),e.createVNode(c,{modelValue:i.value,"onUpdate:modelValue":r[4]||(r[4]=E=>i.value=E),title:"导入数据",width:"500px"},{footer:e.withCtx(()=>[e.createElementVNode("span",ue,[e.createVNode(B._sfc_main$1,{modelValue:"导出表头",onClick:r[3]||(r[3]=E=>i.value=!1)}),e.createVNode(B._sfc_main$1,{modelValue:"确认导入",onClick:o,type:"primary"})])]),default:e.withCtx(()=>[r[11]||(r[11]=e.createElementVNode("p",{class:"import-instructions"},"请从Excel或csv中复制数据,然后粘贴到下面的文本框中。列使用制表符(Tab)分隔。",-1)),e.createVNode(T,{modelValue:f.value,"onUpdate:modelValue":r[2]||(r[2]=E=>f.value=E),type:"textarea",rows:10,placeholder:u.value},null,8,["modelValue","placeholder"])]),_:1,__:[11]},8,["modelValue"])])}}}),me=U._export_sfc(de,[["__scopeId","data-v-4cd998e0"]]),pe={class:"panel-content"},fe={key:0,class:"joints-list"},ve={class:"joint-info-row"},ge={class:"joint-left"},Ve={class:"joint-name"},he={class:"joint-range"},_e={class:"joint-type"},be={key:0,class:"joint-control-row"},we={class:"slider-container"},Ne=["min","max","value","onInput"],ye={class:"value-display"},ke={class:"joint-value"},Ee={class:"unit"},Ce={key:1,class:"empty-state"},$e=e.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(N,{expose:s}){const l=N,i=e.ref([]),f=e.ref(null),p=(u,t=!1)=>u==="revolute"?t?Math.PI:-Math.PI:u==="prismatic"?t?1:-1:0,w=u=>{if(!u||!u.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const t=[];return Object.keys(u.joints).forEach(o=>{var V,C;const a=u.joints[o];if(a.jointType==="fixed")return;const n={lower:((V=a.limit)==null?void 0:V.lower)??p(a.jointType,!1),upper:((C=a.limit)==null?void 0:C.upper)??p(a.jointType,!0)};t.push({name:o,type:a.jointType||"unknown",limit:n,currentValue:a.angle||0,urdfJoint:a})}),t.sort((o,a)=>o.name.localeCompare(a.name))},_=(u,t)=>{var V;const o=i.value.find(C=>C.name===u);if(!o)return;const a=parseFloat(t),n=Math.max(o.limit.lower,Math.min(o.limit.upper,a));o.currentValue=n,(V=l.model)!=null&&V.setJointValue?l.model.setJointValue(u,n):o.urdfJoint.setJointValue(n)},b=()=>{i.value.forEach(u=>{(u.type==="revolute"||u.type==="prismatic")&&_(u.name,0)})},v=()=>{l.model&&i.value.forEach(u=>{u.urdfJoint.angle!==void 0&&u.currentValue!==u.urdfJoint.angle&&(u.currentValue=u.urdfJoint.angle)})},d=()=>{const u=()=>{v(),f.value=requestAnimationFrame(u)};u()},m=()=>{f.value&&(cancelAnimationFrame(f.value),f.value=null)};return e.watch(()=>l.model,u=>{u?i.value=w(u):i.value=[]},{immediate:!0}),e.onMounted(()=>{d()}),e.onUnmounted(()=>{m()}),s({resetAllJoints:b}),(u,t)=>(e.openBlock(),e.createElementBlock("div",pe,[i.value.length>0?(e.openBlock(),e.createElementBlock("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.name,class:"joint-item"},[e.createElementVNode("div",ve,[e.createElementVNode("div",ge,[e.createElementVNode("span",Ve,e.toDisplayString(o.name),1),e.createElementVNode("span",he," ["+e.toDisplayString(o.limit.lower.toFixed(2))+", "+e.toDisplayString(o.limit.upper.toFixed(2))+"] ",1)]),e.createElementVNode("span",_e,e.toDisplayString(o.type),1)]),o.type==="revolute"||o.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",we,[e.createElementVNode("input",{type:"range",min:o.limit.lower,max:o.limit.upper,step:"0.01",value:o.currentValue,onInput:a=>_(o.name,a.target.value),class:"joint-slider"},null,40,Ne)]),e.createElementVNode("div",ye,[e.createElementVNode("span",ke,e.toDisplayString(o.currentValue?Number(o.currentValue).toFixed(3):"0.000"),1),e.createElementVNode("span",Ee,e.toDisplayString(o.type==="revolute"?"rad":"m"),1)])])):e.createCommentVNode("",!0)]))),128))])):(e.openBlock(),e.createElementBlock("div",Ce,t[0]||(t[0]=[e.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),Se=U._export_sfc($e,[["__scopeId","data-v-9adcbc67"]]),xe={class:"panel-content"},De="id",Ie={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:N=>["breadth","firstLevel"].includes(N)}},emits:["nodeClick"],setup(N,{emit:s}){const l=N,i=s,f=e.ref([]),p={children:"children",label:"label"},w=t=>{i("nodeClick",t)},_=(t,o=0)=>{const a=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const V={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:o+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:_(n==null?void 0:n.children,o+1),path:n==null?void 0:n.name};a.push(V)}}),a},b=t=>t?[{name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:_(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],v=(t,o)=>{const a=[],n=[...t];for(;n.length>0&&a.length<o;){const V=n.shift();V.children&&V.children.length>0&&(a.push(V.id),n.push(...V.children))}return a},d=(t,o)=>{const a=[];return t.forEach(n=>{if(n.children&&n.children.length>0){a.push(n.id);const V=n.children.filter(C=>C.children&&C.children.length>0).slice(0,o).map(C=>C.id);a.push(...V)}}),a.slice(0,o+1)},m=e.computed(()=>!f.value||f.value.length===0?[]:l.expandStrategy==="firstLevel"?d(f.value,l.maxExpandCount):v(f.value,l.maxExpandCount)),u=e.computed(()=>l!=null&&l.model?b(l.model):[]);return e.watch(u,t=>{f.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,o)=>{const a=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",xe,[e.createVNode(a,{data:f.value,props:p,"default-expanded-keys":m.value,"node-key":De,onNodeClick:w},null,8,["data","default-expanded-keys"])])}}},Me=U._export_sfc(Ie,[["__scopeId","data-v-0dda287c"]]),Te={class:"obj-viewer-container"},Be={class:"buttonGroup-top"},Fe={class:"buttonGroup-topLeft"},Re={class:"buttonGroup-left"},ze={class:"buttonGroup-right"},Je={class:"buttonGroup-bottom"},Ue={class:"left-panel"},Le={class:"panel-header"},je={class:"panel-body"},Ae={key:1,class:"clipping-content"},Oe={class:"radio-group"},Pe={class:"radio-label"},qe={class:"radio-label"},Ge={class:"radio-label"},Ke={class:"radio-label"},We={class:"right-panel"},He={class:"panel-header"},Xe={class:"panel-body"},Ze={key:0,class:"loading-overlay"},Ye=e.defineComponent({__name:"threeSceneView",props:{fileBlobs:{default:()=>[]},animationData:{default:()=>({})}},emits:["getAnimationData"],setup(N,{emit:s}){const l=s,i=N,f=e.ref(null),p=e.ref(!1),w=e.ref(""),_=e.ref(!1),b=e.ref(""),v=e.ref(!1),d=e.ref(""),m=e.shallowRef(null),{currentModels:u,resetView:t,initThreeJS:o,handleResize:a,getThreeJSObjects:n,cleanup:V,setModels:C}=k.useThreeJS(f),{loadSceneFromFile:z}=Z(n,u,p,w),{isAnimating:F,toggleAnimation:R,stopAnimation:g}=k.useAnimation(n,u),{isClipping:r,activeClippingAxis:h,toggleClipping:D,updateClippingPlanes:$}=k.useClipping(n,u),I=x=>{_.value=!0,b.value=x,x==="剖面视图"&&!r.value&&D()},T=x=>{v.value=!0,d.value=x,x==="动画仿真"&&l("getAnimationData")},J=()=>{e.nextTick(()=>{})};return e.watch(()=>i.fileBlobs,x=>{if(x&&x.length>0){const c=x[0];if(!c.name.toLowerCase().endsWith(".urdf")){S.ElMessage.warning("提供的文件不是有效的 urdf 文件。");return}z(c).then(E=>{m.value=E}).catch(E=>{console.error("加载URDF文件时发生错误:",E),S.ElMessage.error("加载urdf模型失败"),m.value=null})}else m.value=null},{immediate:!0,deep:!0}),e.watch(m,x=>{C(x?[x]:[])}),e.onMounted(async()=>{await e.nextTick();try{o(),window.addEventListener("resize",a)}catch(x){console.error("Three.js 初始化失败:",x),S.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{b.value="",d.value="",window.removeEventListener("resize",a),F.value&&g(),V()}),(x,c)=>{const E=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:f,class:"threejs-container"},null,512),e.createElementVNode("div",Be,[e.createVNode(k.SvgIcon,{name:"guanjianjiexi",size:"34"}),e.createVNode(k.SvgIcon,{name:"guanjiekongzhi",size:"34"}),e.createVNode(k.SvgIcon,{name:"gongyishengcheng",size:"34"}),e.createVNode(k.SvgIcon,{name:"buchangshezhi",size:"34"}),e.createVNode(k.SvgIcon,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",Fe,[e.createVNode(k.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(t),title:"重置"},null,8,["onClick"]),e.createVNode(k.SvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(k.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(k.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(R),title:e.unref(F)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Re,[e.createVNode(k.SvgIcon,{name:"jiegoushu",size:"24",onClick:c[0]||(c[0]=y=>I("场景树")),active:_.value&&b.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(k.SvgIcon,{name:"clipping",size:"24",onClick:c[1]||(c[1]=y=>I("剖面视图")),active:_.value&&b.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:c[2]||(c[2]=y=>I("场景树3"))}),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:c[3]||(c[3]=y=>I("场景4"))})]),e.createElementVNode("div",ze,[e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(k.SvgIcon,{name:"guanjiekongzhi",size:"24",onClick:c[4]||(c[4]=y=>T("关节控制")),active:v.value&&d.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:c[5]||(c[5]=y=>T("动画仿真")),active:v.value&&d.value==="动画仿真"},null,8,["active"]),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:c[6]||(c[6]=y=>T("urdf动画")),active:v.value&&d.value==="urdf动画"},null,8,["active"]),e.createVNode(k.SvgIcon,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Je,[e.createVNode(k.SvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:c[7]||(c[7]=()=>{})}),e.createVNode(k.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:J}),e.createVNode(k.SvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:c[8]||(c[8]=()=>{})}),e.createVNode(k.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:c[9]||(c[9]=()=>{})}),e.createVNode(k.SvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:c[10]||(c[10]=()=>{})})]),e.withDirectives(e.createElementVNode("div",Ue,[e.createElementVNode("div",Le,[e.createElementVNode("span",null,e.toDisplayString(b.value),1),e.createElementVNode("span",{class:"close",onClick:c[11]||(c[11]=y=>_.value=!1)}," X ")]),e.createElementVNode("div",je,[e.createVNode(E,{height:"100%"},{default:e.withCtx(()=>[b.value==="场景树"?(e.openBlock(),e.createBlock(Me,{key:0,model:m.value},null,8,["model"])):e.createCommentVNode("",!0),b.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",Oe,[e.createElementVNode("label",Pe,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":c[12]||(c[12]=y=>e.isRef(h)?h.value=y:null),onChange:c[13]||(c[13]=(...y)=>e.unref($)&&e.unref($)(...y))},null,544),[[e.vModelRadio,e.unref(h)]]),c[21]||(c[21]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",qe,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":c[14]||(c[14]=y=>e.isRef(h)?h.value=y:null),onChange:c[15]||(c[15]=(...y)=>e.unref($)&&e.unref($)(...y))},null,544),[[e.vModelRadio,e.unref(h)]]),c[22]||(c[22]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",Ge,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":c[16]||(c[16]=y=>e.isRef(h)?h.value=y:null),onChange:c[17]||(c[17]=(...y)=>e.unref($)&&e.unref($)(...y))},null,544),[[e.vModelRadio,e.unref(h)]]),c[23]||(c[23]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",Ke,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":c[18]||(c[18]=y=>e.isRef(h)?h.value=y:null),onChange:c[19]||(c[19]=(...y)=>e.unref($)&&e.unref($)(...y))},null,544),[[e.vModelRadio,e.unref(h)]]),c[24]||(c[24]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0)]),_:1})])],512),[[e.vShow,_.value]]),e.withDirectives(e.createElementVNode("div",We,[e.createElementVNode("div",He,[e.createElementVNode("span",null,e.toDisplayString(d.value),1),e.createElementVNode("span",{class:"close",onClick:c[20]||(c[20]=y=>v.value=!1)}," X ")]),e.createElementVNode("div",Xe,[e.createVNode(E,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(Se,{model:m.value},null,8,["model"]),[[e.vShow,d.value==="关节控制"]]),e.withDirectives(e.createVNode(ee,{model:m.value},null,8,["model"]),[[e.vShow,d.value==="动画仿真"]]),e.withDirectives(e.createVNode(me,{model:m.value},null,8,["model"]),[[e.vShow,d.value==="urdf动画"]])]),_:1})])],512),[[e.vShow,v.value]]),p.value?(e.openBlock(),e.createElementBlock("div",Ze,[c[25]||(c[25]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(w.value),1)])):e.createCommentVNode("",!0)])}}}),Qe=U._export_sfc(Ye,[["__scopeId","data-v-48c2bd71"]]);exports.default=Qe;
|
|
@@ -3,10 +3,10 @@ var ve = (k, o, n) => o in k ? fe(k, o, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var le = (k, o, n) => ve(k, typeof o != "symbol" ? o + "" : o, n);
|
|
4
4
|
import { defineComponent as te, ref as z, createElementBlock as L, openBlock as U, createVNode as c, createBlock as Q, computed as ee, watch as q, onUnmounted as ue, resolveComponent as M, createElementVNode as u, createCommentVNode as K, withCtx as E, unref as T, toDisplayString as j, Fragment as de, renderList as ce, createTextVNode as ne, onMounted as me, shallowRef as ge, nextTick as ie, onBeforeUnmount as be, withDirectives as O, isRef as H, vModelRadio as Y, vShow as Z } from "vue";
|
|
5
5
|
import { u as he, a as _e, b as ye, S as V } from "./iconfont-CDOS8DUW.js";
|
|
6
|
-
import { U as we, s as $e } from "./index-
|
|
6
|
+
import { U as we, s as $e } from "./index-BAaBb97C.js";
|
|
7
7
|
import { L as ke, n as ae, o as Ce, h as Ve, e as Fe, p as xe, O as ze, B as Je } from "./STLLoader-DofhZbOw.js";
|
|
8
|
-
import { a as P } from "./index-
|
|
9
|
-
import { g as oe, a as Ue } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
8
|
+
import { a as P } from "./index-J6JsBLpO.js";
|
|
9
|
+
import { g as oe, a as Ue } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-A3OJ9C57.js";
|
|
10
10
|
import { c as De } from "./index.vue_vue_type_style_index_1_lang-DHohSfqc.js";
|
|
11
11
|
import { _ as X } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
12
12
|
import { Z as Se, E as S } from "./index-CA6oJ4ms.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),p=require("./index-BKUqLOwQ.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
"use strict";const o=require("vue"),p=require("./index-BKUqLOwQ.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cuqd9E7-.cjs");const A=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function F(a){const i=sessionStorage.getItem("loginToken")??"123456";return p.service({url:"/api/sysFile/uploadAvatar",method:"post",data:a,headers:{Authorization:i,"Content-Type":"multipart/form-data"}})}function _(a){const i=sessionStorage.getItem("loginToken")??"123456";return p.service({url:"/api/sysFile/uploadFile",method:"post",data:a,headers:{Authorization:i,"Content-Type":"multipart/form-data"}})}function f(a){const i=sessionStorage.getItem("loginToken")??"123456";return p.service({url:"/api/sysFile/downloadFile",method:"post",data:a,headers:{Authorization:i,Accept:"application/octet-stream"},responseType:"blob"})}const k={key:2,class:"loading"},U=o.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},isThreeScene:{type:Boolean,default:!1},host:{default:"inline"},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},autoSize:{type:Boolean,default:void 0}},setup(a){const i=o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-D9Sx73pH.cjs"))),h=o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-D1kIf-F1.cjs"))),u=a,s=o.ref([]);o.ref(null);const l=o.ref(!1);function v(e){try{const n=new URL(e).pathname,r=n.substring(n.lastIndexOf("/")+1);return decodeURIComponent(r)}catch(n){return console.error("无法解析URL以提取文件名:",e,n),"未知文件名"}}async function y(e){let n,r;if(/^https?:\/\//.test(e))try{const t=await fetch(e);if(!t.ok)throw new Error(`下载文件失败: ${t.statusText} (URL: ${e})`);n=await t.blob(),r=v(e)}catch(t){throw console.error("使用 fetch 下载文件时出错:",t),t}else try{const t=await f({url:e});if(t.status!==200)throw new Error(`下载失败: ${t.status}`);const c=t.headers["content-disposition"];r=w(c)||"无文件名",n=t.data}catch(t){throw console.error("通过 API 下载文件时出错:",t),t}return new File([n],r,{type:n.type})}function w(e){if(!e)return;const n=e.match(/filename\*\s*=\s*([^;]+)/i);if(n){let t=n[1].trim();t=t.replace(/^"(.*)"$/,"$1");const c=t.split("''");if(c.length===2){const b=c[0].toUpperCase(),d=c[1];try{if(b==="UTF-8")return decodeURIComponent(d)}catch{}return d}try{return decodeURIComponent(t)}catch{return t}}const r=e.match(/filename\s*=\s*("?)([^";]+)\1/i);if(r)return r[2].trim()}async function g(e){if(!e||!e.length){s.value=[];return}l.value=!0;try{const n=await Promise.all(e.map(r=>y(r)));s.value=n}catch(n){console.error("文件下载时发生错误:",n),s.value=[]}finally{l.value=!1}}return o.watch(()=>u.fileUrls,async e=>{await g(e??[])},{immediate:!0,deep:!0}),(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(u.host==="electron"?"mv-electron":"mv-inline")},[!l.value&&u.isThreeScene&&s.value.length>0?(o.openBlock(),o.createBlock(o.unref(i),{key:0,"file-blobs":s.value,"animation-data":e.animationData},null,8,["file-blobs","animation-data"])):!l.value&&s.value.length>0?(o.openBlock(),o.createBlock(o.unref(h),{key:1,"file-blobs":s.value,"animation-data":e.animationData},null,8,["file-blobs","animation-data"])):l.value?(o.openBlock(),o.createElementBlock("div",k," 文件下载中,请稍候... ")):o.createCommentVNode("",!0)],2))}}),m=A._export_sfc(U,[["__scopeId","data-v-142044fd"]]),C=Object.freeze(Object.defineProperty({__proto__:null,default:m},Symbol.toStringTag,{value:"Module"}));exports.downloadAvatarApi=f;exports.threeViewerHost=m;exports.threeViewerHost$1=C;exports.uploadAvatarApi=F;exports.uploadFile=_;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as A, defineAsyncComponent as d, ref as p, watch as T, createElementBlock as h, openBlock as c, normalizeClass as k, createBlock as y, createCommentVNode as C, unref as v } from "vue";
|
|
2
2
|
import { s as m } from "./index-CA6oJ4ms.js";
|
|
3
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
3
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-A3OJ9C57.js";
|
|
4
4
|
import { _ as S } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
5
|
function P(n) {
|
|
6
6
|
const r = sessionStorage.getItem("loginToken") ?? "123456";
|
|
@@ -55,7 +55,7 @@ const R = {
|
|
|
55
55
|
autoSize: { type: Boolean, default: void 0 }
|
|
56
56
|
},
|
|
57
57
|
setup(n) {
|
|
58
|
-
const r = d(() => import("./threeSceneView-
|
|
58
|
+
const r = d(() => import("./threeSceneView-iZRMO5Sk.js")), w = d(() => import("./threePreview-BDhrBSWE.js")), u = n, i = p([]);
|
|
59
59
|
p(null);
|
|
60
60
|
const s = p(!1);
|
|
61
61
|
function g(e) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# CAD Exchanger 3.24.0 (cadexchanger.com)
|
|
2
|
+
# Material Count: 5
|
|
3
|
+
|
|
4
|
+
newmtl Material_1
|
|
5
|
+
Ns 0.000000
|
|
6
|
+
Ka 0.200000 0.200000 0.200000
|
|
7
|
+
Kd 0.666667 0.666667 0.666667
|
|
8
|
+
Ks 0.000000 0.000000 0.000000
|
|
9
|
+
Ke 0.000000 0.000000 0.000000
|
|
10
|
+
d 1.000000
|
|
11
|
+
|
|
12
|
+
newmtl Material_2
|
|
13
|
+
Ns 0.000000
|
|
14
|
+
Ka 0.200000 0.200000 0.200000
|
|
15
|
+
Kd 0.133333 0.133333 0.133333
|
|
16
|
+
Ks 0.000000 0.000000 0.000000
|
|
17
|
+
Ke 0.000000 0.000000 0.000000
|
|
18
|
+
d 1.000000
|
|
19
|
+
|
|
20
|
+
newmtl Material_3
|
|
21
|
+
Ns 0.000000
|
|
22
|
+
Ka 0.200000 0.200000 0.200000
|
|
23
|
+
Kd 0.733333 0.733333 0.733333
|
|
24
|
+
Ks 0.000000 0.000000 0.000000
|
|
25
|
+
Ke 0.000000 0.000000 0.000000
|
|
26
|
+
d 1.000000
|
|
27
|
+
|
|
28
|
+
newmtl Material_5
|
|
29
|
+
Ns 0.000000
|
|
30
|
+
Ka 0.200000 0.200000 0.200000
|
|
31
|
+
Kd 0.396078 0.941176 0.450980
|
|
32
|
+
Ks 0.000000 0.000000 0.000000
|
|
33
|
+
Ke 0.000000 0.000000 0.000000
|
|
34
|
+
d 1.000000
|
|
35
|
+
|
|
36
|
+
newmtl Material_4
|
|
37
|
+
Ns 0.000000
|
|
38
|
+
Ka 0.200000 0.200000 0.200000
|
|
39
|
+
Kd 1.000000 1.000000 0.000000
|
|
40
|
+
Ks 0.000000 0.000000 0.000000
|
|
41
|
+
Ke 0.000000 0.000000 0.000000
|
|
42
|
+
d 1.000000
|