ss-component-new 1.2.59 → 1.2.61

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.
Files changed (69) hide show
  1. package/dist/{animationData-FLuoH13j.cjs → animationData-BduUBmUR.cjs} +1 -1
  2. package/dist/{animationData-CEkMmPAJ.js → animationData-ksWjRBya.js} +1 -1
  3. package/dist/{index-DkNldOC0.cjs → index-01wgxMDL.cjs} +1 -1
  4. package/dist/{index-BTwRUubF.js → index-B0wbu4Yi.js} +2 -2
  5. package/dist/{index-DLU6Qv3w.cjs → index-B7Qvtv0u.cjs} +1 -1
  6. package/dist/{index-LVKvj2hU.cjs → index-B9v5hZgH.cjs} +1 -1
  7. package/dist/{index-DuamAhUi.cjs → index-BBuy5K5J.cjs} +1 -1
  8. package/dist/{index-DXGiAs1G.cjs → index-BGRk7yKa.cjs} +1 -1
  9. package/dist/{index-BgwYXT31.cjs → index-BZ_4uOOn.cjs} +1 -1
  10. package/dist/{index--qwZeW47.js → index-Bay7I9Bm.js} +1 -1
  11. package/dist/{index-FUWILZwY.js → index-Bmu2x9mX.js} +22 -19
  12. package/dist/{index-CWG2zhJZ.cjs → index-BpuhfaBg.cjs} +1 -1
  13. package/dist/{index-ChyicQIl.js → index-C2Eyvf5V.js} +1 -1
  14. package/dist/{index-BxEjroD6.cjs → index-C3gW2PyS.cjs} +1 -1
  15. package/dist/{index-rPWz6KHn.js → index-CBkHg1j7.js} +2 -2
  16. package/dist/index-CCWTxFmY.cjs +1 -0
  17. package/dist/{index-YoJfAd5X.js → index-CK30KLFM.js} +1 -1
  18. package/dist/index-CKeQA94a.cjs +1 -0
  19. package/dist/{index-CDW8XzWT.cjs → index-CVmhjMww.cjs} +1 -1
  20. package/dist/{index-C9C84gkB.cjs → index-CXn5smWf.cjs} +1 -1
  21. package/dist/{index-DN40xEbb.js → index-CkC7f2YA.js} +2 -2
  22. package/dist/{index-DNs7ujiq.js → index-CoQ-IzJk.js} +1 -1
  23. package/dist/{index-DIpWkFjh.cjs → index-Cs5rVLDE.cjs} +1 -1
  24. package/dist/{index-BiUFu7a_.js → index-D1NeHiNE.js} +334 -339
  25. package/dist/{index-BFHCLxvz.js → index-D2-lClm5.js} +1 -1
  26. package/dist/{index-DAJoy_Z5.js → index-D7QHwREN.js} +1 -1
  27. package/dist/{index-JXXdn01K.cjs → index-DIc7XjOi.cjs} +1 -1
  28. package/dist/{index-B1U77nyf.cjs → index-DLSVySRQ.cjs} +1 -1
  29. package/dist/{index-BNES2eKm.js → index-DQs8vKMu.js} +1 -1
  30. package/dist/{index-gcSJbApQ.cjs → index-DRlQXINk.cjs} +1 -1
  31. package/dist/{index-DvgAOa6m.js → index-DaJktADu.js} +3 -3
  32. package/dist/{index-bcbWOGXs.js → index-DhUpDiKd.js} +3 -3
  33. package/dist/{index-BooTgcW2.js → index-DlMveOaQ.js} +1 -1
  34. package/dist/{index-BN4opOSk.cjs → index-DlYhArOW.cjs} +1 -1
  35. package/dist/{index-OLQpbvuS.js → index-Dq1hvZtX.js} +5 -5
  36. package/dist/{index-DZQjq0ZR.js → index-DqZAVSNH.js} +1 -1
  37. package/dist/{index-BYIlecoJ.cjs → index-DyiVOF0A.cjs} +1 -1
  38. package/dist/{index-C8IFPtAJ.js → index-aBQ2sEfI.js} +5 -5
  39. package/dist/index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BypjxmMI.cjs +37 -0
  40. package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-D6uh0ooh.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-GWvj-CP4.js} +10159 -10096
  41. package/dist/index.vue_vue_type_style_index_0_scoped_46e2f5ea_lang-C7FUrOoA.cjs +1 -0
  42. package/dist/index.vue_vue_type_style_index_0_scoped_46e2f5ea_lang-DvMhRFrq.js +256 -0
  43. package/dist/{index.vue_vue_type_style_index_1_lang-BUhvhTqt.js → index.vue_vue_type_style_index_1_lang-DqQPBn21.js} +1 -1
  44. package/dist/{index.vue_vue_type_style_index_1_lang-DDYxgdQk.cjs → index.vue_vue_type_style_index_1_lang-Qv4smhed.cjs} +1 -1
  45. package/dist/{main-D-bdppOV.cjs → main-DVHpLepU.cjs} +1 -1
  46. package/dist/{main-ChUyYPuq.js → main-DVImlHpP.js} +2 -2
  47. package/dist/ss-component.cjs +1 -1
  48. package/dist/ss-component.css +1 -1
  49. package/dist/ss-component.js +6 -6
  50. package/dist/ss-component2.cjs +1 -1
  51. package/dist/ss-component2.js +10 -10
  52. package/dist/{threeModel-DcuAlWjb.js → threeModel-C-_-1kt1.js} +2 -2
  53. package/dist/{threeModel-CDFo3As-.cjs → threeModel-D7w_6Pj0.cjs} +1 -1
  54. package/dist/{threeSceneView-CAsVH82L.cjs → threeSceneView-CgL4kV3p.cjs} +1 -1
  55. package/dist/{threeSceneView-Dav7AGkH.js → threeSceneView-DGTBY2Ny.js} +4 -4
  56. package/dist/{threeSceneViewForCPMPIP-9__8NGa5.cjs → threeSceneViewForCPMPIP-CJCwiWY-.cjs} +1 -1
  57. package/dist/{threeSceneViewForCPMPIP-DxFYivgN.js → threeSceneViewForCPMPIP-evlwiSv-.js} +4 -4
  58. package/dist/{threeTrackPathView-DXCMl3aZ.js → threeTrackPathView-BDOUYCiU.js} +1 -1
  59. package/dist/{threeTrackPathView-B7yrSLKq.cjs → threeTrackPathView-DopwJzcl.cjs} +1 -1
  60. package/dist/{threeViewerHost-D70yS3z2.cjs → threeViewerHost-CUT-oKqD.cjs} +1 -1
  61. package/dist/{threeViewerHost-BNnzz6WM.js → threeViewerHost-Cl30BkDb.js} +1 -1
  62. package/dist/{workpieceTreePanel-KdP9UaVe.cjs → workpieceTreePanel-CtfU-Ro2.cjs} +1 -1
  63. package/dist/{workpieceTreePanel-CCbVIIlm.js → workpieceTreePanel-yp3E4Dho.js} +2 -2
  64. package/package.json +1 -1
  65. package/dist/index-CHzlphv9.cjs +0 -1
  66. package/dist/index-lP-_9Gsb.cjs +0 -1
  67. package/dist/index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-Bff2sYnQ.cjs +0 -37
  68. package/dist/index.vue_vue_type_style_index_0_scoped_b00cbae2_lang-DlyCfLDJ.cjs +0 -1
  69. package/dist/index.vue_vue_type_style_index_0_scoped_b00cbae2_lang-Dt5lXvbN.js +0 -195
@@ -5,19 +5,19 @@ import "./index-DsSA-OiE.js";
5
5
  import u from "./ss-component2.js";
6
6
  import { u as C } from "./index-Ce_gZ72y.js";
7
7
  import { t as g, c as T, b as P } from "./index-CAPx0_D4.js";
8
- const n = o(() => import("./main-ChUyYPuq.js"));
8
+ const n = o(() => import("./main-DVImlHpP.js"));
9
9
  n.install = (t) => {
10
10
  t.component("ssComponent", n);
11
11
  };
12
- const s = o(() => import("./index-BooTgcW2.js").then((t) => t.k));
12
+ const s = o(() => import("./index-DlMveOaQ.js").then((t) => t.k));
13
13
  s.install = (t) => {
14
14
  t.component("ssTab", s);
15
15
  };
16
- const r = o(() => import("./index-FUWILZwY.js"));
16
+ const r = o(() => import("./index-Bmu2x9mX.js"));
17
17
  r.install = (t) => {
18
18
  t.component("ssMenu", r);
19
19
  };
20
- const m = o(() => import("./index-OLQpbvuS.js"));
20
+ const m = o(() => import("./index-Dq1hvZtX.js"));
21
21
  m.install = (t) => {
22
22
  t.component("ssMenuComponent", m);
23
23
  };
@@ -33,11 +33,11 @@ const a = o(() => import("./index-NUzOUiu0.js").then((t) => t.i));
33
33
  a.install = (t) => {
34
34
  t.component("ssAvatar", a);
35
35
  };
36
- const l = o(() => import("./threeModel-DcuAlWjb.js"));
36
+ const l = o(() => import("./threeModel-C-_-1kt1.js"));
37
37
  l.install = (t) => {
38
38
  t.component("ssThree", l);
39
39
  };
40
- const p = o(() => import("./threeViewerHost-BNnzz6WM.js").then((t) => t.t));
40
+ const p = o(() => import("./threeViewerHost-Cl30BkDb.js").then((t) => t.t));
41
41
  p.install = (t) => {
42
42
  t.component("threeViewerHost", p);
43
43
  };
@@ -1 +1 @@
1
- "use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-Z3NUprRN.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-ChdWnuTS.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-BN4opOSk.cjs")),children:[{path:"系统配置/站内信",name:"Message",component:async()=>Promise.resolve().then(()=>require("./index-DPIg2S6M.cjs"))},{path:"系统配置/自动生成",name:"Automatic",component:async()=>Promise.resolve().then(()=>require("./index-B2BAJXIH.cjs"))},{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-gcSJbApQ.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-BYIlecoJ.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-CWG2zhJZ.cjs"))},{path:"系统管理/职位管理",name:"Post",component:async()=>Promise.resolve().then(()=>require("./index-DXGiAs1G.cjs"))},{path:"系统管理/用户管理",name:"User",component:async()=>Promise.resolve().then(()=>require("./index-BxEjroD6.cjs"))},{path:"系统管理/角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-JXXdn01K.cjs"))},{path:"系统管理/部门管理",name:"Dept",component:async()=>Promise.resolve().then(()=>require("./index-CDW8XzWT.cjs"))},{path:"系统维护/登录日志",name:"LoginLog",component:async()=>Promise.resolve().then(()=>require("./index-DIpWkFjh.cjs"))},{path:"系统维护/操作日志",name:"OperateLog",component:async()=>Promise.resolve().then(()=>require("./index-B1U77nyf.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;
1
+ "use strict";const n=require("vue-router"),t=[{path:"/tenant",name:"Tenant",component:async()=>Promise.resolve().then(()=>require("./index-Z3NUprRN.cjs"))},{path:"/login",name:"Login",component:async()=>Promise.resolve().then(()=>require("./index-ChdWnuTS.cjs"))},{path:"/",name:"Model",component:async()=>Promise.resolve().then(()=>require("./index-DlYhArOW.cjs")),children:[{path:"系统配置/站内信",name:"Message",component:async()=>Promise.resolve().then(()=>require("./index-DPIg2S6M.cjs"))},{path:"系统配置/自动生成",name:"Automatic",component:async()=>Promise.resolve().then(()=>require("./index-B2BAJXIH.cjs"))},{path:"平台管理/菜单管理",name:"Menu",component:async()=>Promise.resolve().then(()=>require("./index-DRlQXINk.cjs"))},{path:"平台管理/主菜单管理",name:"MainMenu",component:async()=>Promise.resolve().then(()=>require("./index-DyiVOF0A.cjs"))},{path:"系统管理/个人中心",name:"PersonalCenter",component:async()=>Promise.resolve().then(()=>require("./index-BpuhfaBg.cjs"))},{path:"系统管理/职位管理",name:"Post",component:async()=>Promise.resolve().then(()=>require("./index-BGRk7yKa.cjs"))},{path:"系统管理/用户管理",name:"User",component:async()=>Promise.resolve().then(()=>require("./index-C3gW2PyS.cjs"))},{path:"系统管理/角色管理",name:"Role",component:async()=>Promise.resolve().then(()=>require("./index-DIc7XjOi.cjs"))},{path:"系统管理/部门管理",name:"Dept",component:async()=>Promise.resolve().then(()=>require("./index-CVmhjMww.cjs"))},{path:"系统维护/登录日志",name:"LoginLog",component:async()=>Promise.resolve().then(()=>require("./index-Cs5rVLDE.cjs"))},{path:"系统维护/操作日志",name:"OperateLog",component:async()=>Promise.resolve().then(()=>require("./index-DLSVySRQ.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;
@@ -13,7 +13,7 @@ const a = [
13
13
  {
14
14
  path: "/",
15
15
  name: "Model",
16
- component: async () => import("./index-BiUFu7a_.js"),
16
+ component: async () => import("./index-D1NeHiNE.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'),
@@ -31,47 +31,47 @@ const a = [
31
31
  {
32
32
  path: "平台管理/菜单管理",
33
33
  name: "Menu",
34
- component: async () => import("./index-bcbWOGXs.js")
34
+ component: async () => import("./index-DhUpDiKd.js")
35
35
  },
36
36
  {
37
37
  path: "平台管理/主菜单管理",
38
38
  name: "MainMenu",
39
- component: async () => import("./index-DAJoy_Z5.js")
39
+ component: async () => import("./index-D7QHwREN.js")
40
40
  },
41
41
  {
42
42
  path: "系统管理/个人中心",
43
43
  name: "PersonalCenter",
44
- component: async () => import("./index-DN40xEbb.js")
44
+ component: async () => import("./index-CkC7f2YA.js")
45
45
  },
46
46
  {
47
47
  path: "系统管理/职位管理",
48
48
  name: "Post",
49
- component: async () => import("./index-BNES2eKm.js")
49
+ component: async () => import("./index-DQs8vKMu.js")
50
50
  },
51
51
  {
52
52
  path: "系统管理/用户管理",
53
53
  name: "User",
54
- component: async () => import("./index-ChyicQIl.js")
54
+ component: async () => import("./index-C2Eyvf5V.js")
55
55
  },
56
56
  {
57
57
  path: "系统管理/角色管理",
58
58
  name: "Role",
59
- component: async () => import("./index-YoJfAd5X.js")
59
+ component: async () => import("./index-CK30KLFM.js")
60
60
  },
61
61
  {
62
62
  path: "系统管理/部门管理",
63
63
  name: "Dept",
64
- component: async () => import("./index-DNs7ujiq.js")
64
+ component: async () => import("./index-CoQ-IzJk.js")
65
65
  },
66
66
  {
67
67
  path: "系统维护/登录日志",
68
68
  name: "LoginLog",
69
- component: async () => import("./index-DZQjq0ZR.js")
69
+ component: async () => import("./index-DqZAVSNH.js")
70
70
  },
71
71
  {
72
72
  path: "系统维护/操作日志",
73
73
  name: "OperateLog",
74
- component: async () => import("./index--qwZeW47.js")
74
+ component: async () => import("./index-Bay7I9Bm.js")
75
75
  }
76
76
  // {
77
77
  // path: 'priority',
@@ -1,8 +1,8 @@
1
1
  import { ref as b, watch as Pe, createElementBlock as q, openBlock as H, createBlock as Ie, 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 k, defineComponent as Ye, normalizeStyle as Fe, normalizeClass as Ee, 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, r as Qe, A as et, w as tt, M as Re, X as nt, G as at, x as Me, y as ot, z as De, D as st, E as ze, H as lt, F as Ve, J as Oe, K as Ue, L as ke, N as _e, O as de, Q as it, R as rt, T as ct } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BZPnZF-N.js";
3
3
  import { O as ut } from "./OrbitControls-BbhnJ_4u.js";
4
- import { s as dt } from "./index-DvgAOa6m.js";
5
- import { u as pt } from "./index.vue_vue_type_style_index_1_lang-BUhvhTqt.js";
4
+ import { s as dt } from "./index-DaJktADu.js";
5
+ import { u as pt } from "./index.vue_vue_type_style_index_1_lang-DqQPBn21.js";
6
6
  import { _ as me } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
7
  import { c as Ge, E as Le } from "./index-DsSA-OiE.js";
8
8
  function mt(F) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),pe=require("./OrbitControls-BP4_rhtR.cjs"),me=require("./index-C9C84gkB.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-DDYxgdQk.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-C8qRkCgn.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=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 pe.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(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,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});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.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 b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.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 b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);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)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=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(b=>{m[b]&&m[b].dispose&&m[b].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(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){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;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.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,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=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(P,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},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*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,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};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(),P=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(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=[],_=new n.Box3,c=new n.Vector3;const C=()=>{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=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=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),P=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),P=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(P),A},S=()=>{if(E(),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(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{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?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,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=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.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"},_e={class:"joint-left"},Pe={class:"joint-name"},Ce={class:"joint-range"},Ee={class:"joint-type"},be={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=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),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.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):(re.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??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(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,C.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(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),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),_.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},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,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>ue&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.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&&!S.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()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),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",_e,[e.createElementVNode("span",Pe,e.toDisplayString(i.name),1),e.createElementVNode("span",Ce," ["+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",Ee,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",be,[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&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,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"},_=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},C=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)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,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":S.value,"node-key":Ie,onNodeClick:_},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 _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(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))}}),N=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 _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,C,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&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.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",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:ce,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:_,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{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(S.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(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.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=>E.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,E.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(C.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("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),pe=require("./OrbitControls-BP4_rhtR.cjs"),me=require("./index-CXn5smWf.cjs"),fe=require("./index.vue_vue_type_style_index_1_lang-Qv4smhed.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./index-C8qRkCgn.cjs");function ve(z){let g=null,u=null,d=null,h=null,x=null,_=null,c=null,C=null;const D=1e3/30;let S=0;const E=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 pe.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(),P()},t=(m,l)=>{c&&(g.remove(c),c.dispose()),C&&(g.remove(C),C.geometry.dispose(),C.material.dispose());const b=Math.min(Math.max(Math.floor(m/20),30),40);c=new n.GridHelper(m,b,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});C=new n.Mesh(B,O),C.position.copy(l),C.position.z-=.01,C.receiveShadow=!0,g.add(C)},p=()=>{if(E.value.length===0)return;const m=new n.Box3;let l=!1;if(E.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 b=m.getSize(new n.Vector3),B=m.getCenter(new n.Vector3),O=Math.max(b.x,b.y,b.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 b=new n.DirectionalLight(16777215,.8);b.position.set(-8,-8,6),g.add(b);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)},P=()=>{_=requestAnimationFrame(P),h&&h.update();const m=performance.now(),l=m-S;l<D||(S=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(b=>{m[b]&&m[b].dispose&&m[b].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(b=>{I(b)}):I(l.material))})};return{currentModels:E,initialCameraPosition:r,initialTargetPosition:k,initThreeJS:y,handleResize:()=>{if(!z.value||!u||!d||!x)return;const m=z.value,l=m.clientWidth,b=m.clientHeight;u.aspect=l/b,u.updateProjectionMatrix(),d.setSize(l,b),x.update()},fitCameraToAllModels:m=>{if(!u||!h||E.value.length===0)return;const l=new n.Box3;let b=!1;if(E.value.forEach(Z=>{if(Z.userData.boundingBox)l.union(Z.userData.boundingBox),b=!0;else if(Z.userData.modelId&&m.has(Z.userData.modelId)){const ee=m.get(Z.userData.modelId);l.union(ee.box),b=!0}else l.expandByObject(Z),b=!0}),!b){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;E.value.forEach(l=>{g.remove(l),A(l)});const m=[];g.children.forEach(l=>{!l.isLight&&!l.isCamera&&l.type!=="GridHelper"&&l!==C&&m.push(l)}),m.forEach(l=>{g.remove(l),A(l)}),E.value=[],p()},cleanup:()=>{_&&cancelAnimationFrame(_),c&&c.dispose(),C&&(C.geometry.dispose(),C.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,_=new n.Vector3,c=new n.Vector3,C=0,F=null;const D=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,S=t=>{const p=new n.Vector3,f=C*1.2,P=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(P,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},E=()=>{const{camera:t,controls:p}=z();if(!t||!p)return;d||(d=Date.now());const f=Date.now()-d,P=Math.min(f/h,1);if(P>=1){k();return}const I=S(P);t.position.copy(I),t.lookAt(c),p.target.copy(c),F=requestAnimationFrame(E)},r=()=>{if(g.value.length===0)return;const{camera:t,controls:p}=z();if(!t||!p)return;x.copy(t.position),_.copy(p.target);const f=new n.Box3;g.value.forEach(G=>{f.expandByObject(G)});const P=f.getSize(new n.Vector3);c=f.getCenter(new n.Vector3),C=Math.max(P.x,P.y,P.z)*1.2;const I=new n.Vector3(c.x+C*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,E())};J()},k=()=>{u.value=!1,d=null,F&&(cancelAnimationFrame(F),F=null);const{controls:t}=z();t&&(t.enabled=!0,t.target.copy(_))};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(),P=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(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=[],_=new n.Box3,c=new n.Vector3;const C=()=>{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=()=>{_.makeEmpty(),g.value.forEach(y=>{_.expandByObject(y)}),c=_.getCenter(new n.Vector3)},D=y=>{const t=_.getSize(new n.Vector3);let p,f,P;y==="x"?(p=new n.PlaneGeometry(t.z*1.2,t.y*1.2),f=new n.Vector3(c.x,c.y,c.z),P=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),P=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),P=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(P),A},S=()=>{if(E(),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(P=>{P.clippingPlanes=[y]}):f.material.clippingPlanes=[y])})});const{scene:t}=z();if(t){const p=D(d.value);t.add(p),x.push(p)}}},E=()=>{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?(C(),g.value.length>0&&F()):(d.value="none",E(),r())},updateClippingPlanes:S,clearClippingPlanes:E,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=re.cloneDeep(g==null?void 0:g.animationData))==null?void 0:h["输出(动画数据)Content"])??[];d&&(u.value=d)},{deep:!0,immediate:!0}),(d,h)=>{var x,_,c;return e.openBlock(),e.createElementBlock("div",ye,[(e.openBlock(),e.createBlock(me.ssTable,{itemData:(x=u.value)==null?void 0:x.compData,key:(_=u.value)==null?void 0:_.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"},_e={class:"joint-left"},Pe={class:"joint-name"},Ce={class:"joint-range"},Ee={class:"joint-type"},be={key:0,class:"joint-control-row"},ze={class:"slider-container"},De=["min","max","value","onInput","disabled"],Ne={class:"value-display"},Se={class:"joint-value"},Be={class:"unit"},Ae={key:1,class:"empty-state"},ae=.001,Re=1e3,ue=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),_=e.ref(12.5),c=e.ref(),C=e.ref(1302),F=e.ref(30),D=e.ref(!1),S=e.ref(!1),E=e.ref(0),r=e.ref(0),k=e.ref(null),y=n.MathUtils.degToRad,t=e.ref(1),p=()=>Re/ue/t.value;let f=[];e.watch(()=>u.animationData,o=>{var i;C.value=o.extra.管长,_.value=o.extra.外径/2;let v=((i=re.cloneDeep(o))==null?void 0:i["输出(动画数据)"])??[];v&&v.length>0&&(f=v)},{deep:!0}),e.computed(()=>f.length>0);const P=(o,v=!1)=>o==="revolute"?v?Math.PI:-Math.PI:o==="prismatic"?v?1:-1:0,I=()=>{if(!h.value)return re.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):(re.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??P(s._jointType,!1),upper:s.limit.upper??P(s._jointType,!0)}:{lower:P(s._jointType,!1),upper:P(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,C.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(),de=new n.Matrix4;return de.makeBasis(T.localX,T.localY,T.localZ),ne.applyMatrix4(de),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),_.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},b=()=>{if(f.length===0){console.warn("没有动画数据");return}I(),D.value=!0,S.value=!1,E.value=0,r.value=0,B()},B=()=>{if(!D.value||S.value)return;const o=E.value;if(o>=f.length-1){const s=f[f.length-1];Y(s,f.length-1,1),j();return}const v=r.value/ue,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>ue&&(r.value=0,E.value++),k.value=setTimeout(B,p())},O=()=>{S.value=!0,k.value&&(clearTimeout(k.value),k.value=null)},j=()=>{D.value=!1,S.value=!1,t.value=1,k.value&&(clearTimeout(k.value),k.value=null)};g({startAnimation:b,pauseAnimation:O,stopAnimation:j,resetAll:()=>{j(),E.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&&!S.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()},ce=()=>{x.value&&(cancelAnimationFrame(x.value),x.value=null)};return e.onMounted(()=>{le()}),e.onUnmounted(()=>{ce(),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",_e,[e.createElementVNode("span",Pe,e.toDisplayString(i.name),1),e.createElementVNode("span",Ce," ["+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",Ee,e.toDisplayString(i.type),1)]),i.type==="revolute"||i.type==="prismatic"?(e.openBlock(),e.createElementBlock("div",be,[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&&!S.value},null,40,De)]),e.createElementVNode("div",Ne,[e.createElementVNode("span",Se,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"},_=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},C=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)},S=e.computed(()=>!h.value||h.value.length===0?[]:u.expandStrategy==="firstLevel"?D(h.value,u.maxExpandCount):F(h.value,u.maxExpandCount)),E=e.computed(()=>u!=null&&u.model?C(u.model):[]);return e.watch(E,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":S.value,"node-key":Ie,onNodeClick:_},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 _=`${x}`;return _=`${_.replace("px","")}px`,{width:_,height:_}});return(x,_)=>(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))}}),N=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 _=e.ref(null),c=e.ref(!1),C=e.ref("");e.ref(!1);const F=e.ref(!1),D=e.ref(!1),S=e.ref(""),E=e.ref(!1),r=e.ref(""),k=e.ref(),{currentModels:y,initialCameraPosition:t,initialTargetPosition:p,initThreeJS:f,handleResize:P,fitCameraToAllModels:I,getThreeJSObjects:A,clearAllModels:L,cleanup:$}=ve(_),{isAnimating:J,toggleAnimation:G,stopAnimation:Y}=ge(A,y),{isClipping:m,activeClippingAxis:l,toggleClipping:b,updateClippingPlanes:B}=he(A,y),{addModelsFromUrls:O,loadModelByDefaultPath:j,urdfModel:q,modelBoundingBoxes:X}=fe.useModelLoader(A,y,c,C,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&&b();const w=await a(s);return I(X),w}catch(w){throw console.error("加载模型失败:",w),w}},ce=async s=>le(s,O),o=async s=>le(s,j),v=s=>{D.value=!0,S.value=s,s==="剖面视图"&&!m.value&&b()},i=s=>{E.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",P)}catch(s){console.error("Three.js初始化失败:",s)}}),e.onBeforeUnmount(()=>{x=!1,S.value="",r.value="",window.removeEventListener("resize",P),J.value&&Y(),$()}),g({addModelsFromUrls:ce,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:_,class:"threejs-container"},null,512),e.createElementVNode("div",je,[e.createVNode(N,{name:"guanjianjiexi",size:"34"}),e.createVNode(N,{name:"guanjiekongzhi",size:"34"}),e.createVNode(N,{name:"gongyishengcheng",size:"34"}),e.createVNode(N,{name:"buchangshezhi",size:"34"}),e.createVNode(N,{name:"shuchujiagongchengxu",size:"34"})]),e.createElementVNode("div",qe,[e.createVNode(N,{name:"viewReset",size:"24",onClick:Z,title:"重置"}),e.createVNode(N,{name:"fangda",size:"24",title:"放大"}),e.createVNode(N,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(N,{name:"lookAround",size:"24",onClick:e.unref(G),title:e.unref(J)?"停止动画":"动画视图"},null,8,["onClick","title"])]),e.createElementVNode("div",Xe,[e.createVNode(N,{name:"jiegoushu",size:"24",onClick:a[0]||(a[0]=M=>v("场景树")),active:D.value&&S.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(N,{name:"clipping",size:"24",onClick:a[1]||(a[1]=M=>v("剖面视图")),active:D.value&&S.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[2]||(a[2]=M=>v("场景树3"))}),e.createVNode(N,{name:"donghuafangzhen",size:"24",onClick:a[3]||(a[3]=M=>v("场景4"))})]),e.createElementVNode("div",He,[e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"guanjiekongzhi",size:"24",onClick:a[4]||(a[4]=M=>i("关节控制")),active:E.value&&r.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:a[5]||(a[5]=M=>i("动画仿真")),active:E.value&&r.value==="动画仿真"},null,8,["active"]),e.createVNode(N,{name:"donghuafangzhen",size:"24"}),e.createVNode(N,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",Ye,[e.createVNode(N,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:(U=k.value)==null?void 0:U.fastBackward},null,8,["onClick"]),e.createVNode(N,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:V}),e.createVNode(N,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:(T=k.value)==null?void 0:T.fastForward},null,8,["onClick"]),e.createVNode(N,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:(W=k.value)==null?void 0:W.pauseAnimation},null,8,["onClick"]),e.createVNode(N,{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(S.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(()=>[S.value==="场景树"?(e.openBlock(),e.createBlock(Je,{key:0,model:e.unref(q)},null,8,["model"])):e.createCommentVNode("",!0),S.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=>E.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,E.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(C.value),1)])):e.createCommentVNode("",!0)])}}},rt=oe._export_sfc(it,[["__scopeId","data-v-7bc47bb3"]]);exports.default=rt;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost-D70yS3z2.cjs"),me=require("./iconfont-ji7A-_XJ.cjs"),fe=require("./workpieceTreePanel-KdP9UaVe.cjs"),D=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs");require("./index-BpPyaNFa.cjs");const K=require("./index-B2xsH_Wl.cjs");require("./index.vue_vue_type_style_index_1_lang-DDYxgdQk.cjs");require("./index-CF3dfQ01.cjs");require("./index-CX2C-kjD.cjs");const ae=require("./animationData-FLuoH13j.cjs"),ce=require("./urdfTree-CPEMi7wo.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),xe=require("./index-qDBAJZN2.cjs"),Ee=require("./index-D57Bv8co.cjs"),R=require("./svgIcon-CUM54R6L.cjs"),G=.001,W=s.MathUtils.degToRad,ye=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Te(g=.005,m=64){const d=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),r=new s.TubeGeometry(d,m,g,16,!1),p=ye;return new s.Mesh(r,p)}const ke=g=>g.reduce((m,d)=>{let r=0;const p=d.Y??0,b=d.C??0,a=d.R??0;return p>0&&(r+=p),b>0&&a>0&&(r+=a*W(b)),m+r},0),Me=g=>{const m=[],d=g.Y??0,r=g.B??0,p=g.C??0,b=g.R??0,a={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!d&&!p)return m;if(m.push(a.pos.clone()),r!==0){const h=new s.Matrix4().makeRotationAxis(a.localY,W(r));a.localX.applyMatrix4(h),a.localZ.applyMatrix4(h)}if(d>0&&(a.pos.add(a.localY.clone().multiplyScalar(d*G)),m.push(a.pos.clone())),p>0&&b>0){const h=W(p),v=b*G,w=a.pos.clone().add(a.localX.clone().multiplyScalar(-v)),n=Math.max(16,Math.ceil(p/5));for(let y=1;y<=n;y++){const u=h*y/n,_=new s.Matrix4().makeRotationAxis(a.localZ,u),c=a.localX.clone().multiplyScalar(v).applyMatrix4(_),x=w.clone().add(c);m.push(x)}}return m};function Se(g,m){const d=new s.Group;d.name="CompletePipe";const r={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let p=0,b=1;for(let a=0;a<g.length;a++){const h=g[a],v=h.Y??0,w=h.B??0,n=h.C??0,y=h.R??0;if(w!==0){const u=new s.Matrix4().makeRotationAxis(r.localY,W(w));r.localX.applyMatrix4(u),r.localZ.applyMatrix4(u)}if(v>0){const u=r.pos.clone();r.pos.add(r.localY.clone().multiplyScalar(v*G));const _=r.pos.clone(),i=De(u,_,m*G);i.userData={segmentType:"straight",segmentIndex:p,frameIndex:a,length:v,frame:{Y:v,B:w,C:n,R:y}},i.name=`直段_${p}`,d.add(i);const c=u.clone();Pe(d,b,c,m*G),p++}if(n>0&&y>0){const u=W(n),_=y*G,i=[];i.push(r.pos.clone());const c=r.pos.clone().add(r.localX.clone().multiplyScalar(-_)),x=Math.max(16,Math.ceil(n/5));for(let f=1;f<=x;f++){const k=u*f/x,B=new s.Matrix4().makeRotationAxis(r.localZ,k),L=r.localX.clone().multiplyScalar(_).applyMatrix4(B),q=c.clone().add(L);i.push(q)}const E=Re(i,m*G);E.userData={segmentType:"bend",segmentIndex:p,frameIndex:a,angle:n,radius:y,centerPoint:c.toArray(),frame:{Y:v,B:w,C:n,R:y}},E.name=`弯段_${p}`,d.add(E),Math.floor(i.length/2),i[0],r.pos=i[i.length-1].clone();const T=new s.Matrix4().makeRotationAxis(r.localZ,u);r.localY.applyMatrix4(T),r.localX.applyMatrix4(T),p++,b++}}return d}function Pe(g,m,d,r){const p=new s.Vector3(0,r*2,r*5),b=d.clone().add(p),a=[d,b],h=new s.BufferGeometry().setFromPoints(a),v=new s.LineDashedMaterial({color:16711680,dashSize:r*.5,gapSize:r*.3,linewidth:1}),w=new s.Line(h,v);w.computeLineDistances(),g.add(w);const n=document.createElement("canvas"),y=n.getContext("2d");n.width=128,n.height=128,y.clearRect(0,0,128,128),y.fillStyle="#FF0000",y.font="bold 80px Arial",y.textAlign="center",y.textBaseline="middle",y.fillText(m.toString(),64,64);const u=new s.CanvasTexture(n),_=new s.SpriteMaterial({map:u,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(_),c=r*3;i.scale.set(c,c,1),i.position.copy(b),i.name=`Label_${m}`,i.userData={labelNumber:m},g.add(i)}function De(g,m,d){const r=new s.LineCurve3(g,m),p=new s.TubeGeometry(r,2,d,18,!1);return new s.Mesh(p,ye)}function Re(g,m){const d=new s.CatmullRomCurve3(g,!1,"catmullrom",.01),r=new s.TubeGeometry(d,Math.max(16,g.length*2),m,18,!1);return new s.Mesh(r,ye)}function _e(g,m,d,r,p,b=0){let a=m.slice(0,p+1);const h=m[p+1];if(h&&b>0){const i={...h,B:(h.B??0)*b,C:(h.C??0)*b};a.push(i)}const v=ke(a),w=Math.max(0,d-v),n=[];n.push(new s.Vector3(0,0,0));const y=new s.Vector3(0,w*G,0);w>0&&n.push(y);let u={pos:y.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const _=[];for(let i=a.length-1;i>=0;i--){const c=a[i],x=Me(c);if(x.length>0){const E=x.map(B=>{const A=B.clone(),L=new s.Matrix4;return L.makeBasis(u.localX,u.localY,u.localZ),A.applyMatrix4(L),A.add(u.pos)});_.push(E);const T=E[E.length-1];u.pos=T.clone();const f=c.B??0,k=c.C??0;if(f!==0){const B=new s.Matrix4().makeRotationAxis(u.localY,W(f));u.localX.applyMatrix4(B),u.localZ.applyMatrix4(B)}if(k>0){const B=W(k),A=new s.Matrix4().makeRotationAxis(u.localZ,B);u.localY.applyMatrix4(A),u.localX.applyMatrix4(A)}}}for(const i of _)i.length>1&&n.push(...i.slice(1));n.length<2&&n.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(n,!1,"catmullrom",.01),c=new s.TubeGeometry(i,Math.max(2,n.length*4),r*G,18,!1);g.geometry.dispose(),g.geometry=c}catch(i){console.error("管件更新失败",i)}}function Ce(g,m,d,r=0){let p=g.slice(0,d+1);const b=g[d+1];if(b&&r>0){const u={...b,B:(b.B??0)*r,C:(b.C??0)*r};p.push(u)}const a=ke(p),h=Math.max(0,m-a),v=[];v.push(new s.Vector3(0,0,0));const w=new s.Vector3(0,h*G,0);h>0&&v.push(w);let n={pos:w.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const y=[];for(let u=p.length-1;u>=0;u--){const _=p[u],i=Me(_);if(i.length>0){const c=i.map(f=>{const k=f.clone(),B=new s.Matrix4;return B.makeBasis(n.localX,n.localY,n.localZ),k.applyMatrix4(B),k.add(n.pos)});y.push(c);const x=c[c.length-1];n.pos=x.clone();const E=_.B??0,T=_.C??0;if(E!==0){const f=new s.Matrix4().makeRotationAxis(n.localY,W(E));n.localX.applyMatrix4(f),n.localZ.applyMatrix4(f)}if(T>0){const f=W(T),k=new s.Matrix4().makeRotationAxis(n.localZ,f);n.localY.applyMatrix4(k),n.localX.applyMatrix4(k)}}}for(const u of y)u.length>1&&v.push(...u.slice(1));return v.length<2&&v.push(new s.Vector3(0,.001,0)),v}function Ne(g,m,d,r,p,b,a,h=0,v=0){const w=p-v,n=Ce(r,w,a,h);let u=Ce(d,v,a,h);u.forEach(i=>i.y=-i.y),u.reverse();const _=[...u,...n];try{const i=new s.CatmullRomCurve3(_,!1,"catmullrom",.01),c=new s.TubeGeometry(i,Math.max(2,_.length*4),b*G,18,!1);m.geometry.dispose(),g.geometry.dispose(),m.parent&&m.parent.remove(m),g.geometry=c}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},Ae={class:"action-bar"},$e={class:"animation-controls"},Fe={class:"control-row"},ze={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ue={class:"progress-bar"},Ie={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},setup(g,{expose:m}){const d=g,r=e.ref(),p=e.ref();e.watch(()=>d.threeData,o=>{const t=o==null?void 0:o.data;p.value=t==null?void 0:t.type},{immediate:!0});const b=async()=>{let o={};p.value===ne.robotMode.SINGLE&&(o=await ae.fetchSingleRobotAnimationData()),p.value===ne.robotMode.DOUBLE&&(o=await ae.fetchDoubleRobotAnimationData());const{initialPipeLength:t=0,pipeRadius:l=0,clampLength:V=0,animationData:C}=o;T.value=t,f.value=l,k.value=V,r.value=C;const $=D.cloneDeep(r.value),J=se(Y.value),X=($==null?void 0:$["输出(动画数据)"])||[];a.value=X.length?X:[J]},a=e.ref([]),h=e.ref(!1),v=e.ref(""),w=e.ref(!1),n=e.ref(0),y=e.ref(0),u=e.ref(1e3);let _=!1;const i=e.ref(null),c=e.shallowRef(null),x=e.shallowRef(null),E=e.shallowRef(null),T=e.ref(0),f=e.ref(12.5),k=e.ref(30),B=e.ref([]),A=e.ref(null),L=e.computed(()=>d.model?ce.getNonFixedJoints(d.model).map(l=>l.name):[]),q=e.ref(["Y","B","C","R"]),Y=e.computed(()=>[...L.value,...q.value]),ue=e.computed(()=>Y.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost-CUT-oKqD.cjs"),me=require("./iconfont-ji7A-_XJ.cjs"),fe=require("./workpieceTreePanel-CtfU-Ro2.cjs"),D=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs");require("./index-BpPyaNFa.cjs");const K=require("./index-B2xsH_Wl.cjs");require("./index.vue_vue_type_style_index_1_lang-Qv4smhed.cjs");require("./index-CF3dfQ01.cjs");require("./index-CX2C-kjD.cjs");const ae=require("./animationData-BduUBmUR.cjs"),ce=require("./urdfTree-CPEMi7wo.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),xe=require("./index-qDBAJZN2.cjs"),Ee=require("./index-D57Bv8co.cjs"),R=require("./svgIcon-CUM54R6L.cjs"),G=.001,W=s.MathUtils.degToRad,ye=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Te(g=.005,m=64){const d=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),r=new s.TubeGeometry(d,m,g,16,!1),p=ye;return new s.Mesh(r,p)}const ke=g=>g.reduce((m,d)=>{let r=0;const p=d.Y??0,b=d.C??0,a=d.R??0;return p>0&&(r+=p),b>0&&a>0&&(r+=a*W(b)),m+r},0),Me=g=>{const m=[],d=g.Y??0,r=g.B??0,p=g.C??0,b=g.R??0,a={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!d&&!p)return m;if(m.push(a.pos.clone()),r!==0){const h=new s.Matrix4().makeRotationAxis(a.localY,W(r));a.localX.applyMatrix4(h),a.localZ.applyMatrix4(h)}if(d>0&&(a.pos.add(a.localY.clone().multiplyScalar(d*G)),m.push(a.pos.clone())),p>0&&b>0){const h=W(p),v=b*G,w=a.pos.clone().add(a.localX.clone().multiplyScalar(-v)),n=Math.max(16,Math.ceil(p/5));for(let y=1;y<=n;y++){const u=h*y/n,_=new s.Matrix4().makeRotationAxis(a.localZ,u),c=a.localX.clone().multiplyScalar(v).applyMatrix4(_),x=w.clone().add(c);m.push(x)}}return m};function Se(g,m){const d=new s.Group;d.name="CompletePipe";const r={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let p=0,b=1;for(let a=0;a<g.length;a++){const h=g[a],v=h.Y??0,w=h.B??0,n=h.C??0,y=h.R??0;if(w!==0){const u=new s.Matrix4().makeRotationAxis(r.localY,W(w));r.localX.applyMatrix4(u),r.localZ.applyMatrix4(u)}if(v>0){const u=r.pos.clone();r.pos.add(r.localY.clone().multiplyScalar(v*G));const _=r.pos.clone(),i=De(u,_,m*G);i.userData={segmentType:"straight",segmentIndex:p,frameIndex:a,length:v,frame:{Y:v,B:w,C:n,R:y}},i.name=`直段_${p}`,d.add(i);const c=u.clone();Pe(d,b,c,m*G),p++}if(n>0&&y>0){const u=W(n),_=y*G,i=[];i.push(r.pos.clone());const c=r.pos.clone().add(r.localX.clone().multiplyScalar(-_)),x=Math.max(16,Math.ceil(n/5));for(let f=1;f<=x;f++){const k=u*f/x,B=new s.Matrix4().makeRotationAxis(r.localZ,k),L=r.localX.clone().multiplyScalar(_).applyMatrix4(B),q=c.clone().add(L);i.push(q)}const E=Re(i,m*G);E.userData={segmentType:"bend",segmentIndex:p,frameIndex:a,angle:n,radius:y,centerPoint:c.toArray(),frame:{Y:v,B:w,C:n,R:y}},E.name=`弯段_${p}`,d.add(E),Math.floor(i.length/2),i[0],r.pos=i[i.length-1].clone();const T=new s.Matrix4().makeRotationAxis(r.localZ,u);r.localY.applyMatrix4(T),r.localX.applyMatrix4(T),p++,b++}}return d}function Pe(g,m,d,r){const p=new s.Vector3(0,r*2,r*5),b=d.clone().add(p),a=[d,b],h=new s.BufferGeometry().setFromPoints(a),v=new s.LineDashedMaterial({color:16711680,dashSize:r*.5,gapSize:r*.3,linewidth:1}),w=new s.Line(h,v);w.computeLineDistances(),g.add(w);const n=document.createElement("canvas"),y=n.getContext("2d");n.width=128,n.height=128,y.clearRect(0,0,128,128),y.fillStyle="#FF0000",y.font="bold 80px Arial",y.textAlign="center",y.textBaseline="middle",y.fillText(m.toString(),64,64);const u=new s.CanvasTexture(n),_=new s.SpriteMaterial({map:u,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(_),c=r*3;i.scale.set(c,c,1),i.position.copy(b),i.name=`Label_${m}`,i.userData={labelNumber:m},g.add(i)}function De(g,m,d){const r=new s.LineCurve3(g,m),p=new s.TubeGeometry(r,2,d,18,!1);return new s.Mesh(p,ye)}function Re(g,m){const d=new s.CatmullRomCurve3(g,!1,"catmullrom",.01),r=new s.TubeGeometry(d,Math.max(16,g.length*2),m,18,!1);return new s.Mesh(r,ye)}function _e(g,m,d,r,p,b=0){let a=m.slice(0,p+1);const h=m[p+1];if(h&&b>0){const i={...h,B:(h.B??0)*b,C:(h.C??0)*b};a.push(i)}const v=ke(a),w=Math.max(0,d-v),n=[];n.push(new s.Vector3(0,0,0));const y=new s.Vector3(0,w*G,0);w>0&&n.push(y);let u={pos:y.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const _=[];for(let i=a.length-1;i>=0;i--){const c=a[i],x=Me(c);if(x.length>0){const E=x.map(B=>{const A=B.clone(),L=new s.Matrix4;return L.makeBasis(u.localX,u.localY,u.localZ),A.applyMatrix4(L),A.add(u.pos)});_.push(E);const T=E[E.length-1];u.pos=T.clone();const f=c.B??0,k=c.C??0;if(f!==0){const B=new s.Matrix4().makeRotationAxis(u.localY,W(f));u.localX.applyMatrix4(B),u.localZ.applyMatrix4(B)}if(k>0){const B=W(k),A=new s.Matrix4().makeRotationAxis(u.localZ,B);u.localY.applyMatrix4(A),u.localX.applyMatrix4(A)}}}for(const i of _)i.length>1&&n.push(...i.slice(1));n.length<2&&n.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(n,!1,"catmullrom",.01),c=new s.TubeGeometry(i,Math.max(2,n.length*4),r*G,18,!1);g.geometry.dispose(),g.geometry=c}catch(i){console.error("管件更新失败",i)}}function Ce(g,m,d,r=0){let p=g.slice(0,d+1);const b=g[d+1];if(b&&r>0){const u={...b,B:(b.B??0)*r,C:(b.C??0)*r};p.push(u)}const a=ke(p),h=Math.max(0,m-a),v=[];v.push(new s.Vector3(0,0,0));const w=new s.Vector3(0,h*G,0);h>0&&v.push(w);let n={pos:w.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const y=[];for(let u=p.length-1;u>=0;u--){const _=p[u],i=Me(_);if(i.length>0){const c=i.map(f=>{const k=f.clone(),B=new s.Matrix4;return B.makeBasis(n.localX,n.localY,n.localZ),k.applyMatrix4(B),k.add(n.pos)});y.push(c);const x=c[c.length-1];n.pos=x.clone();const E=_.B??0,T=_.C??0;if(E!==0){const f=new s.Matrix4().makeRotationAxis(n.localY,W(E));n.localX.applyMatrix4(f),n.localZ.applyMatrix4(f)}if(T>0){const f=W(T),k=new s.Matrix4().makeRotationAxis(n.localZ,f);n.localY.applyMatrix4(k),n.localX.applyMatrix4(k)}}}for(const u of y)u.length>1&&v.push(...u.slice(1));return v.length<2&&v.push(new s.Vector3(0,.001,0)),v}function Ne(g,m,d,r,p,b,a,h=0,v=0){const w=p-v,n=Ce(r,w,a,h);let u=Ce(d,v,a,h);u.forEach(i=>i.y=-i.y),u.reverse();const _=[...u,...n];try{const i=new s.CatmullRomCurve3(_,!1,"catmullrom",.01),c=new s.TubeGeometry(i,Math.max(2,_.length*4),b*G,18,!1);m.geometry.dispose(),g.geometry.dispose(),m.parent&&m.parent.remove(m),g.geometry=c}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},Ae={class:"action-bar"},$e={class:"animation-controls"},Fe={class:"control-row"},ze={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ue={class:"progress-bar"},Ie={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},setup(g,{expose:m}){const d=g,r=e.ref(),p=e.ref();e.watch(()=>d.threeData,o=>{const t=o==null?void 0:o.data;p.value=t==null?void 0:t.type},{immediate:!0});const b=async()=>{let o={};p.value===ne.robotMode.SINGLE&&(o=await ae.fetchSingleRobotAnimationData()),p.value===ne.robotMode.DOUBLE&&(o=await ae.fetchDoubleRobotAnimationData());const{initialPipeLength:t=0,pipeRadius:l=0,clampLength:V=0,animationData:C}=o;T.value=t,f.value=l,k.value=V,r.value=C;const $=D.cloneDeep(r.value),J=se(Y.value),X=($==null?void 0:$["输出(动画数据)"])||[];a.value=X.length?X:[J]},a=e.ref([]),h=e.ref(!1),v=e.ref(""),w=e.ref(!1),n=e.ref(0),y=e.ref(0),u=e.ref(1e3);let _=!1;const i=e.ref(null),c=e.shallowRef(null),x=e.shallowRef(null),E=e.shallowRef(null),T=e.ref(0),f=e.ref(12.5),k=e.ref(30),B=e.ref([]),A=e.ref(null),L=e.computed(()=>d.model?ce.getNonFixedJoints(d.model).map(l=>l.name):[]),q=e.ref(["Y","B","C","R"]),Y=e.computed(()=>[...L.value,...q.value]),ue=e.computed(()=>Y.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
2
  ${Y.value.join(" ")}
3
3
  0 0 0 ...
4
4
  1 2 3 ...`:"请先加载模型。"),re=()=>a.value.map(o=>({Y:parseFloat(o.Y)||0,B:parseFloat(o.B)||0,C:parseFloat(o.C)||0,R:parseFloat(o.R)||0})),Q=()=>{const o=[],t=[];return a.value.forEach(l=>{const{Y1:V,B1:C,C1:$,R1:J,Y2:X,B2:le,C2:pe,R2:P}=l;o.push({Y:parseFloat(V)||0,B:parseFloat(C)||0,C:parseFloat($)||0,R:parseFloat(J)||0}),t.push({Y:parseFloat(X)||0,B:parseFloat(le)||0,C:parseFloat(pe)||0,R:parseFloat(P)||0})}),{posPipeYbcr:o,negPipeYbcr:t}},M=(o=0,t=0)=>{if(c.value&&x.value){const l=Q();Ne(c.value,x.value,l.posPipeYbcr,l.negPipeYbcr,T.value,f.value,o,t,k.value)}else if(c.value){const l=re();_e(c.value,l,T.value,f.value,o,t)}},N=o=>{if(o<0||o>=a.value.length){console.error(`帧索引 ${o} 超出范围`);return}const t=a.value[o];if(console.log(`应用第 ${o} 帧数据 ${t}`),n.value=o,i.value){const l={};L.value.forEach(V=>{const C=parseFloat(t[V]);isNaN(C)||(l[V]=C)}),i.value.setJointAngles(l)}M(o,0)},U=async()=>{if(a.value.length===0){D.ElMessage.error("无法播放动画:无数据");return}if(!w.value){w.value=!0,_=!1,a.value.length-1===n.value&&(n.value=0);try{for(let o=n.value+1;o<a.value.length&&!_;o++){n.value=o;const t=a.value[o],l={};i.value&&L.value.forEach(V=>{const C=parseFloat(t[V]);isNaN(C)||(l[V]=C)}),i.value?await i.value.animateToState(l,u.value,V=>{y.value=(o+V)/a.value.length*100,M(o-1,V)}):(await new Promise(V=>setTimeout(V,u.value)),y.value=(o+1)/a.value.length*100)}_||D.ElMessage.success("动画播放完成")}catch(o){console.error("动画播放出错:",o),D.ElMessage.error("动画播放出错")}finally{w.value=!1,y.value=0}}},F=()=>{_=!0,w.value=!1,y.value=0,D.ElMessage.info("动画已停止")},I=()=>{n.value=0},z=()=>{if(c.value&&x.value){const o=Q();Ne(c.value,x.value,o.posPipeYbcr,o.negPipeYbcr,T.value,f.value,-1,0,k.value)}else if(c.value){const o=re();_e(c.value,o,T.value,f.value,-1,0)}},Z=()=>{i.value&&i.value.resetToZero(),z(),I(),D.ElMessage.success("机器人和管件已重置")},O=o=>`第 ${o+1} 帧`,j=o=>{w.value&&F(),N(o)},ee=()=>{w.value&&F(),!(n.value+1>=a.value.length)&&N(n.value+1)},S=()=>{w.value&&F(),n.value!==0&&N(n.value-1)},H=()=>{E.value&&(E.value.visible=!0),c.value&&c.value.parent&&c.value.parent.remove(c.value),E.value=null,c.value=null,x.value=null},se=o=>o==null?void 0:o.reduce((t,l)=>(t[l]="0",t),{});e.watch(Y,(o,t)=>{if(JSON.stringify(o)!==JSON.stringify(t))if(o.length>0){const l=se(o);a.value=[l]}else a.value=[]},{immediate:!0});const te=e.ref(0),de=o=>{te.value=o},he=(o,t)=>{if(!o||!t)return;const l=ce.getTargetJoint(o,t),V=Te();V.visible=!1,l==null||l.add(V)},ge=o=>{i.value=new fe.URDFRobotController(o),B.value=ce.getAllLinkName(o),A.value="Pipe_Joint"},oe=()=>{i.value=null,B.value=[],A.value=null},ie=o=>{ge(o),he(o,A.value),de(te.value+1),Z()};e.watch(()=>d.model,o=>{if(H(),o){ie(o);return}oe()},{immediate:!0});const ve=o=>{var l,V;const t=new s.Mesh(o.geometry.clone(),o.material);return t.name="managed_pipe_clone",(V=(l=o==null?void 0:o.parent)==null?void 0:l.add)==null||V.call(l,t),t.position.copy(o.position),t.rotation.copy(o.rotation),t.scale.copy(o.scale),t};e.watch([A,k,T,te],([o,t])=>{if(H(),d.model&&o){const l=ce.getMeshFromJoint(d.model,o);if(console.log(l,"meshToReplace"),l&&l.parent){E.value=l,l.visible=!1;const V=ve(l);if(p.value===ne.robotMode.SINGLE&&(V.position.y-=t*.001),c.value=V,p.value===ne.robotMode.DOUBLE){const C=ve(l);x.value=C}M(0,0)}else o&&console.warn(`在 link '${o}' 中未找到可替换的网格或其没有父级。`)}});const Ve=async()=>{if(Y.value.length===0){D.ElMessage.warning("没有可导出的表头");return}const o=Y.value.join(" ");try{await navigator.clipboard.writeText(o),D.ElMessage.success("表头已成功复制到剪贴板!")}catch(t){console.error("复制失败:",t),D.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},be=()=>{if(!v.value.trim()){D.ElMessage.warning("导入内容不能为空");return}const o=v.value.trim().split(`
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as Be, ref as g, watch as ae, shallowRef as be, computed as Pe, onUnmounted as Ie, resolveComponent as B, createElementBlock as Ve, openBlock as q, createElementVNode as r, createVNode as l, withCtx as R, createBlock as ye, createCommentVNode as ke, unref as X, toDisplayString as he, onMounted as Ge, onBeforeUnmount as Ze, Fragment as He, renderList as Ke, nextTick as Qe, withDirectives as pe, vShow as de, renderSlot as Me } from "vue";
2
- import { r as Te, s as Ye } from "./threeViewerHost-BNnzz6WM.js";
2
+ import { r as Te, s as Ye } from "./threeViewerHost-Cl30BkDb.js";
3
3
  import { u as Je, a as qe, b as et, C as tt } from "./iconfont-Dp3iGl32.js";
4
- import { U as lt, u as ot, a as nt, W as at } from "./workpieceTreePanel-CCbVIIlm.js";
4
+ import { U as lt, u as ot, a as nt, W as at } from "./workpieceTreePanel-yp3E4Dho.js";
5
5
  import { ag as st, c as it, E, aW as rt, aw as ut } from "./index-DsSA-OiE.js";
6
6
  import { R as De, T as xe, V, O as H, Q as ct, U as pt, z as Se, Y as dt, Z as mt, _ as vt, $ as ft, a0 as gt, a1 as ht, a2 as bt, a3 as yt, K as _t } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BZPnZF-N.js";
7
7
  import "./index-BHtNKL1L.js";
8
8
  import { _ as me, s as wt } from "./index-DlClEW8i.js";
9
- import "./index.vue_vue_type_style_index_1_lang-BUhvhTqt.js";
9
+ import "./index.vue_vue_type_style_index_1_lang-DqQPBn21.js";
10
10
  import "./index-BIHEqwHC.js";
11
11
  import "./index-Ce_gZ72y.js";
12
- import { a as Ct, b as kt, d as Pt, e as Le, h as xt } from "./animationData-CEkMmPAJ.js";
12
+ import { a as Ct, b as kt, d as Pt, e as Le, h as xt } from "./animationData-ksWjRBya.js";
13
13
  import { g as Rt, a as Mt, b as Tt, c as Vt, U as Dt, J as St } from "./urdfTree-3Jd59vvU.js";
14
14
  import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
15
15
  import { g as At, a as $t } from "./index-BEfSpHE6.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Te=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),te=require("./threeViewerHost-D70yS3z2.cjs"),H=require("./iconfont-ji7A-_XJ.cjs"),G=require("./workpieceTreePanel-KdP9UaVe.cjs"),p=require("./index-C8qRkCgn.cjs"),ne=require("./index-B2xsH_Wl.cjs"),R=require("./urdfTree-CPEMi7wo.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),b=require("./svgIcon-CUM54R6L.cjs"),xe=require("./animationData-FLuoH13j.cjs"),De=require("./MTLLoader-BlLfoBce.cjs"),le=require("./index-lP-_9Gsb.cjs"),Be={class:"panel-content"},ze={key:0,class:"animation-controls"},Le={class:"control-row"},Me={class:"control-row"},je={class:"frame-info"},$e={class:"control-row"},Ae={key:1,class:"empty-state"},Ue={class:"dialog-footer"},Re=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(x,{expose:s}){const y=x,i=e.ref([]),C=e.ref(!1),V=e.ref(""),d=e.ref("stopped"),f=e.ref(0),D=e.ref(0),B=e.ref(10),_=e.ref(null);let v=0;const z=e.ref([]),L=e.computed(()=>y.model?R.getNonFixedJoints(y.model).map(r=>r.name):[]),S=e.computed(()=>[...L.value]),F=e.computed(()=>S.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Te=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),te=require("./threeViewerHost-CUT-oKqD.cjs"),H=require("./iconfont-ji7A-_XJ.cjs"),G=require("./workpieceTreePanel-CtfU-Ro2.cjs"),p=require("./index-C8qRkCgn.cjs"),ne=require("./index-B2xsH_Wl.cjs"),R=require("./urdfTree-CPEMi7wo.cjs"),oe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),b=require("./svgIcon-CUM54R6L.cjs"),xe=require("./animationData-BduUBmUR.cjs"),De=require("./MTLLoader-BlLfoBce.cjs"),le=require("./index-CKeQA94a.cjs"),Be={class:"panel-content"},ze={key:0,class:"animation-controls"},Le={class:"control-row"},Me={class:"control-row"},je={class:"frame-info"},$e={class:"control-row"},Ae={key:1,class:"empty-state"},Ue={class:"dialog-footer"},Re=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(x,{expose:s}){const y=x,i=e.ref([]),C=e.ref(!1),V=e.ref(""),d=e.ref("stopped"),f=e.ref(0),D=e.ref(0),B=e.ref(10),_=e.ref(null);let v=0;const z=e.ref([]),L=e.computed(()=>y.model?R.getNonFixedJoints(y.model).map(r=>r.name):[]),S=e.computed(()=>[...L.value]),F=e.computed(()=>S.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
2
  ${S.value.join(" ")}
3
3
  0 0 0 ...
4
4
  1 2 3 ...`:"请先加载模型。"),M=e.computed(()=>i.value[f.value]||{});e.watch(()=>y.model,o=>{o?(_.value=new G.URDFRobotController(o),z.value=R.getAllLinkName(o),f.value=0):(_.value=null,z.value=[])},{immediate:!0});const E=o=>{if(o<0||o>=i.value.length){console.error(`帧索引 ${o} 超出范围`);return}const l=i.value[o];if(_.value){const r={};L.value.forEach(h=>{const c=parseFloat(l[h]);isNaN(c)||(r[h]=c)}),_.value.setJointAngles(r)}f.value=o,D.value=i.value.length>1?o/(i.value.length-1)*100:100},k=async o=>{try{for(let l=f.value;l<i.value.length;l++){if(o!==v)return;const r=i.value[l],h={};if(_.value)L.value.forEach(c=>{const m=parseFloat(r[c]);isNaN(m)||(h[c]=m)}),await _.value.animateToState(h,B.value,c=>{o===v&&(D.value=(l+c)/i.value.length*100)});else{if(await new Promise(c=>setTimeout(c,B.value)),o!==v)return;D.value=(l+1)/i.value.length*100}f.value=l}o===v&&(p.ElMessage.success("动画播放完成"),d.value="stopped",D.value=100)}catch(l){console.error("动画播放出错:",l),p.ElMessage.error("动画播放出错"),d.value="stopped"}},T=()=>{if(i.value.length===0){p.ElMessage.error("无动画数据");return}d.value==="stopped"&&(f.value=0,E(0)),d.value="playing",v++,k(v),p.ElMessage.info("动画播放中")},w=()=>{d.value==="playing"&&(v++,d.value="paused",p.ElMessage.info("动画已暂停"))},j=()=>{v++,d.value="stopped",f.value=0,D.value=0,E(0),p.ElMessage.info("动画已停止并重置")},I=()=>{d.value==="playing"?w():T()},P=o=>{v++,d.value="paused",E(o)},$=()=>{if(!V.value.trim()){p.ElMessage.warning("导入内容不能为空");return}const o=V.value.trim().split(`
@@ -1,16 +1,16 @@
1
1
  import { defineComponent as be, ref as r, computed as L, watch as I, onUnmounted as Je, resolveComponent as G, createElementBlock as R, openBlock as T, createElementVNode as a, createCommentVNode as S, createVNode as s, toDisplayString as D, Fragment as Ie, renderList as Ge, withCtx as q, inject as me, shallowRef as ne, onMounted as He, nextTick as Ke, onBeforeUnmount as Xe, withDirectives as E, vShow as J, unref as A, renderSlot as oe, createBlock as re } from "vue";
2
2
  import { b1 as We } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BZPnZF-N.js";
3
- import { s as fe } from "./threeViewerHost-BNnzz6WM.js";
3
+ import { s as fe } from "./threeViewerHost-Cl30BkDb.js";
4
4
  import { u as Ye, a as Ze, b as qe, C as Qe } from "./iconfont-Dp3iGl32.js";
5
- import { U as et, u as tt, a as lt, W as at } from "./workpieceTreePanel-CCbVIIlm.js";
5
+ import { U as et, u as tt, a as lt, W as at } from "./workpieceTreePanel-yp3E4Dho.js";
6
6
  import { c as nt, E as k } from "./index-DsSA-OiE.js";
7
7
  import { _ as he } from "./index-DlClEW8i.js";
8
8
  import { g as ot, b as st, U as it, J as rt, d as ut } from "./urdfTree-3Jd59vvU.js";
9
9
  import { _ as ye } from "./_plugin-vue_export-helper-CHgC5LLL.js";
10
10
  import { T as y } from "./svgIcon-D-_fXUBL.js";
11
- import { i as ct } from "./animationData-CEkMmPAJ.js";
11
+ import { i as ct } from "./animationData-ksWjRBya.js";
12
12
  import { O as dt } from "./MTLLoader-Bl6JMZD-.js";
13
- import { L as vt, j as pt } from "./index-C8IFPtAJ.js";
13
+ import { L as vt, j as pt } from "./index-aBQ2sEfI.js";
14
14
  const mt = { class: "panel-content" }, ft = {
15
15
  key: 0,
16
16
  class: "animation-controls"
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as Ve, ref as T, shallowRef as ue, computed as V, watch as He, onMounted as Ne, onBeforeUnmount as qe, resolveComponent as $e, createElementBlock as fe, openBlock as H, createElementVNode as g, withDirectives as Z, createCommentVNode as J, createVNode as h, unref as R, renderSlot as pe, toDisplayString as K, withCtx as me, createBlock as he, vShow as Q } from "vue";
2
2
  import { u as Xe, a as Ye, b as Ze, C as Je, f as Ke, d as Qe } from "./iconfont-Dp3iGl32.js";
3
3
  import { aT as et, aU as ie, aV as se, aK as O, aW as tt, B as oe, aS as Se, V as U, aX as nt, aY as X, aZ as ze, ab as Ce, a_ as Y, z as it, a$ as W, b0 as st, O as ot, Q as _e, R as at, _ as rt, av as lt, aD as ct } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BZPnZF-N.js";
4
- import { c as dt } from "./threeViewerHost-BNnzz6WM.js";
4
+ import { c as dt } from "./threeViewerHost-Cl30BkDb.js";
5
5
  import { E as ut } from "./index-DsSA-OiE.js";
6
6
  import { U as ft, J as pt } from "./urdfTree-3Jd59vvU.js";
7
7
  import { T as v } from "./svgIcon-D-_fXUBL.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),P=require("./iconfont-ji7A-_XJ.cjs"),c=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),xe=require("./threeViewerHost-D70yS3z2.cjs"),Se=require("./index-C8qRkCgn.cjs"),Z=require("./urdfTree-CPEMi7wo.cjs"),g=require("./svgIcon-CUM54R6L.cjs"),be=require("./isString--eJE54G5.cjs"),ze=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),J=new c.Box3,O=new c.Vector3;class ie extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),J.setFromBufferAttribute(n),this.boundingBox.union(J))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let t=0;for(let r=0,l=e.count;r<l;r++)O.fromBufferAttribute(e,r),t=Math.max(t,o.distanceToSquared(O)),O.fromBufferAttribute(n,r),t=Math.max(t,o.distanceToSquared(O));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),P=require("./iconfont-ji7A-_XJ.cjs"),c=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-fAuSnfOH.cjs"),xe=require("./threeViewerHost-CUT-oKqD.cjs"),Se=require("./index-C8qRkCgn.cjs"),Z=require("./urdfTree-CPEMi7wo.cjs"),g=require("./svgIcon-CUM54R6L.cjs"),be=require("./isString--eJE54G5.cjs"),ze=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),J=new c.Box3,O=new c.Vector3;class ie extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),J.setFromBufferAttribute(n),this.boundingBox.union(J))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let t=0;for(let r=0,l=e.count;r<l;r++)O.fromBufferAttribute(e,r),t=Math.max(t,o.distanceToSquared(O)),O.fromBufferAttribute(n,r),t=Math.max(t,o.distanceToSquared(O));this.boundingSphere.radius=Math.sqrt(t),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>