ss-component-new 1.2.199 → 1.2.201

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 (113) hide show
  1. package/dist/{MTLLoader-DACeOwx8.cjs → MTLLoader-DeVVTn9U.cjs} +1 -1
  2. package/dist/{MTLLoader-DO6JtV2J.js → MTLLoader-EGw2WpGn.js} +1 -1
  3. package/dist/{OrbitControls-Dnwv1l-5.cjs → OrbitControls-DUDihpSn.cjs} +1 -1
  4. package/dist/{OrbitControls-CVZSxhco.js → OrbitControls-DsREqTNw.js} +1 -1
  5. package/dist/{URDFLoader-BoSgd6gH.cjs → URDFLoader-CNnR_d-M.cjs} +1 -1
  6. package/dist/{URDFLoader-BNqQfPqb.js → URDFLoader-DR_ZnSlg.js} +2 -2
  7. package/dist/{animationData-D3-99sWf.js → animationData-B0xfieMG.js} +2 -2
  8. package/dist/{animationData-DHASNMoi.cjs → animationData-BmO7uT95.cjs} +1 -1
  9. package/dist/{array-DuMZPpVP.cjs → array-C-4Fn6kn.cjs} +1 -1
  10. package/dist/{array-DxkXasEB.js → array-DtzBMDtX.js} +3 -3
  11. package/dist/{iconfont-U7rG6UGs.cjs → iconfont-BU-e8plC.cjs} +1 -1
  12. package/dist/{iconfont-AyWwUMxc.js → iconfont-hcY1c1Ph.js} +2 -2
  13. package/dist/{index-C71_AKGx.cjs → index--na8gJFk.cjs} +1 -1
  14. package/dist/{index-r48vNrKN.js → index-B3Nii_wb.js} +2 -2
  15. package/dist/{index-ub7lvsfV.cjs → index-B7pEfxW6.cjs} +1 -1
  16. package/dist/{index-DRDKKizg.js → index-BA2liwLn.js} +7 -8
  17. package/dist/{index-CO41nOz7.js → index-BAaCpfqG.js} +2 -2
  18. package/dist/{index-BnITIl1C.cjs → index-BCn8LcAH.cjs} +1 -1
  19. package/dist/{index-C5jivsmi.js → index-BEDAWaV5.js} +11 -11
  20. package/dist/{index-8w6PrNkw.cjs → index-BFDTTNzf.cjs} +1 -1
  21. package/dist/{index-BPTR1s4o.cjs → index-BFzjLkhB.cjs} +10 -10
  22. package/dist/{index-0lSRcHqv.js → index-BKNTCrry.js} +2 -2
  23. package/dist/{index-DOItJqcJ.cjs → index-BP07Gnjo.cjs} +11 -11
  24. package/dist/{index-DfFq9kkn.js → index-BdG8TrO6.js} +2 -2
  25. package/dist/{index-CcNuHoZS.cjs → index-BnrtLGSt.cjs} +1 -1
  26. package/dist/{index-CP6V9Df_.cjs → index-BuAS_9Ow.cjs} +1 -1
  27. package/dist/{index-DEN8cJAm.js → index-BvOJGx4t.js} +2 -2
  28. package/dist/{index-CXC0u8pm.cjs → index-By--71sB.cjs} +1 -1
  29. package/dist/{index-Chmm97CU.js → index-C1JRzzYq.js} +5 -5
  30. package/dist/{index-Oy-hRR6Z.js → index-C71lL2Zl.js} +4 -4
  31. package/dist/{index-zAtSFM2v.cjs → index-C8JWH8zu.cjs} +1 -1
  32. package/dist/{index-DiRujSe_.cjs → index-CB-3bIU7.cjs} +1 -1
  33. package/dist/{index-Bwb6w0wO.js → index-CGNh6A1u.js} +4 -4
  34. package/dist/{index-C1fTLujM.js → index-CQOLlnCU.js} +3 -3
  35. package/dist/{index-CmNMrF68.js → index-CS7eiT5k.js} +12 -12
  36. package/dist/{index-EzLiPHAn.js → index-CXsoc0ts.js} +4 -4
  37. package/dist/{index-BJO_TiAy.cjs → index-CeTyBScG.cjs} +1 -1
  38. package/dist/index-CleiTW2d.cjs +1 -0
  39. package/dist/{index-RLfjsj4L.js → index-CwHRaxk9.js} +2 -2
  40. package/dist/{index-DjzwipY0.cjs → index-Cz4gIM1f.cjs} +1 -1
  41. package/dist/{index-BZ5_PpJp.cjs → index-D04LOBS0.cjs} +1 -1
  42. package/dist/{index-CdMT_Zkq.cjs → index-D3BeZsw9.cjs} +1 -1
  43. package/dist/{index-DYFZIY8j.cjs → index-DDJnuYAl.cjs} +1 -1
  44. package/dist/index-DGcizPdx.js +3112 -0
  45. package/dist/{index-gruT7omp.js → index-DHtKscY6.js} +1 -1
  46. package/dist/{index-BDhmy-7L.js → index-DKyiUFoj.js} +20 -20
  47. package/dist/{index-CgelR-6I.js → index-DN9fWZ39.js} +3 -3
  48. package/dist/{index-CT-1q_Sb.js → index-DQsD0m6q.js} +1 -1
  49. package/dist/{index-Dq9Tho6E.js → index-DRjU_LhS.js} +3 -3
  50. package/dist/{index-BQEwWecE.cjs → index-DVuG6QBw.cjs} +1 -1
  51. package/dist/{index-D-uo7H2E.cjs → index-DW1RCzWC.cjs} +1 -1
  52. package/dist/{index-B-d6-ohn.js → index-DW33UCCH.js} +3 -3
  53. package/dist/{index-BDcBHWC2.cjs → index-D_07hjnO.cjs} +1 -1
  54. package/dist/{index-CnuMyt69.cjs → index-DbkmELIs.cjs} +1 -1
  55. package/dist/{index-D_DpNI2W.cjs → index-DmKjHcw7.cjs} +1 -1
  56. package/dist/{index-BCfX45g1.cjs → index-DoL-xCP9.cjs} +1 -1
  57. package/dist/{index-CFl9wC5o.js → index-Dr6wRpUQ.js} +6 -6
  58. package/dist/{index-CLqCXsqK.cjs → index-DtFLuXja.cjs} +1 -1
  59. package/dist/{index-7MBVUN82.js → index-DufZVmKf.js} +8 -9
  60. package/dist/{index-BO3Qkqzh.js → index-DvgKkg8E.js} +3 -3
  61. package/dist/{index-D31qdo3B.cjs → index-DywCAE3u.cjs} +1 -1
  62. package/dist/{index-4awf2rkD.js → index-ELxg57Gi.js} +6 -6
  63. package/dist/{index-z78zgQsK.cjs → index-G1p03SY5.cjs} +1 -1
  64. package/dist/{index-DzElE7Kh.js → index-HFvfNokw.js} +1 -1
  65. package/dist/{index-KaxOq1_-.cjs → index-K6PeHL12.cjs} +1 -1
  66. package/dist/{index-DqdWYUrz.cjs → index-MtfLKQp3.cjs} +1 -1
  67. package/dist/{index-BucMQlBB.js → index-P6FeXt6g.js} +1 -1
  68. package/dist/{index-3oQGURYh.js → index-VnVlZEmb.js} +1 -1
  69. package/dist/{index-B6K14gG9.cjs → index-i6xf9v_E.cjs} +1 -1
  70. package/dist/{index-BseikzDK.js → index-m_LW0QsX.js} +2 -2
  71. package/dist/{index-DaRuwvRP.cjs → index-mjz9Da8Y.cjs} +1 -1
  72. package/dist/{index-aWkZx7My.js → index-svyWq6yw.js} +2 -2
  73. package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DpRm1D1L.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-3T-DoEef.cjs} +13 -13
  74. package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-hMJCL1Qk.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-Db2wtXl-.js} +7085 -7043
  75. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs} +215 -215
  76. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js} +15959 -15925
  77. package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-B9POGhwa.js → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-Bg3P8eER.js} +7 -7
  78. package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-aE8dAbK9.cjs → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-YDD6WZNQ.cjs} +1 -1
  79. package/dist/index.vue_vue_type_style_index_1_lang-B6P8tuhB.cjs +3 -0
  80. package/dist/{index.vue_vue_type_style_index_1_lang-CtOB5lpf.js → index.vue_vue_type_style_index_1_lang-BwYhIkBS.js} +343 -467
  81. package/dist/{isString-D70CzuJZ.js → isString-5Nawl-Uc.js} +1 -1
  82. package/dist/{isString-Do5yyRUw.cjs → isString-DKZ1g7Pn.cjs} +1 -1
  83. package/dist/{main-Bhc4rs1O.js → main-CXonSl7o.js} +5 -5
  84. package/dist/{main-QJTAJyAl.cjs → main-CfdiYgA1.cjs} +1 -1
  85. package/dist/obj/model.mtl +42 -0
  86. package/dist/obj/model.obj +26110 -0
  87. package/dist/ss-component.cjs +1 -1
  88. package/dist/ss-component.css +1 -1
  89. package/dist/ss-component.js +11 -11
  90. package/dist/ss-component2.cjs +1 -1
  91. package/dist/ss-component2.js +12 -12
  92. package/dist/{threeModel-poOL5V2M.js → threeModel-CTtZuUDg.js} +5 -5
  93. package/dist/{threeModel-r6kZdDei.cjs → threeModel-CcZ_mIob.cjs} +1 -1
  94. package/dist/{threePreview-BY1POvl8.js → threePreview-D-RkLYC8.js} +4 -4
  95. package/dist/{threePreview-DKs8aYcW.cjs → threePreview-DUyJ3mb_.cjs} +1 -1
  96. package/dist/{threeSceneView-Cuz_EMZU.cjs → threeSceneView-BFqSAGP1.cjs} +1 -1
  97. package/dist/{threeSceneView-KKWkkD2y.js → threeSceneView-Cr5UX8FG.js} +11 -11
  98. package/dist/{threeSceneViewForCPMPIP-Dwa17cnT.js → threeSceneViewForCPMPIP-CTvL-EyL.js} +8 -8
  99. package/dist/{threeSceneViewForCPMPIP-DFMYV0Jz.cjs → threeSceneViewForCPMPIP-N80YwIx-.cjs} +1 -1
  100. package/dist/{threeTrackPathView-BrPuXqrr.cjs → threeTrackPathView-C3tSwHTX.cjs} +1 -1
  101. package/dist/{threeTrackPathView-D4w6l9m2.js → threeTrackPathView-Cp83uYdc.js} +5 -5
  102. package/dist/{threeViewerHost-krP0Lb0-.cjs → threeViewerHost--jBITe3r.cjs} +1 -1
  103. package/dist/{threeViewerHost-DCU9cNEx.js → threeViewerHost-DSYrQH3r.js} +4 -4
  104. package/dist/{urdfTree-CcC8aW11.cjs → urdfTree-B73vL4dE.cjs} +1 -1
  105. package/dist/{urdfTree-CQQPUmyr.js → urdfTree-CiLrHpgG.js} +1 -1
  106. package/dist/{workpieceTreePanel-B6x641Qw.js → workpieceTreePanel-CUiwX5FV.js} +4 -4
  107. package/dist/{workpieceTreePanel-Bm8mjA8R.cjs → workpieceTreePanel-sYKZQx-o.cjs} +1 -1
  108. package/package.json +1 -1
  109. package/public/obj/model.mtl +42 -0
  110. package/public/obj/model.obj +26110 -0
  111. package/dist/index-9FU0RWoV.js +0 -3297
  112. package/dist/index-B2FiRoly.cjs +0 -1
  113. package/dist/index.vue_vue_type_style_index_1_lang-UuP0ZBQR.cjs +0 -3
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost-krP0Lb0-.cjs"),pe=require("./iconfont-U7rG6UGs.cjs"),ve=require("./workpieceTreePanel-Bm8mjA8R.cjs"),R=require("./index-DOItJqcJ.cjs"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs");require("./index-BpPyaNFa.cjs");const le=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs");require("./index.vue_vue_type_style_index_1_lang-UuP0ZBQR.cjs");require("./index-KaxOq1_-.cjs");require("./index-CXC0u8pm.cjs");const fe=require("./animationData-DHASNMoi.cjs"),ie=require("./urdfTree-CcC8aW11.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Me=require("./index-CnuMyt69.cjs"),B=require("./svgIcon-CUM54R6L.cjs"),G=.001,W=n.MathUtils.degToRad,ye=new n.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:n.DoubleSide});function Te(V=.005,v=64){const p=new n.CatmullRomCurve3([new n.Vector3(0,0,0),new n.Vector3(0,0,0)]),a=new n.TubeGeometry(p,v,V,16,!1),m=ye;return new n.Mesh(a,m)}const xe=V=>V.reduce((v,p)=>{let a=0;const m=p.Y??0,b=p.C??0,s=p.R??0;return m>0&&(a+=m),b>0&&s>0&&(a+=s*W(b)),v+a},0),ke=V=>{const v=[],p=V.Y??0,a=V.B??0,m=V.C??0,b=V.R??0,s={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(!p&&!m)return v;if(v.push(s.pos.clone()),a!==0){const g=new n.Matrix4().makeRotationAxis(s.localY,W(a));s.localX.applyMatrix4(g),s.localZ.applyMatrix4(g)}if(p>0&&(s.pos.add(s.localY.clone().multiplyScalar(p*G)),v.push(s.pos.clone())),m>0&&b>0){const g=W(m),f=b*G,w=s.pos.clone().add(s.localX.clone().multiplyScalar(-f)),r=Math.max(16,Math.ceil(m/5));for(let y=1;y<=r;y++){const d=g*y/r,_=new n.Matrix4().makeRotationAxis(s.localZ,d),u=s.localX.clone().multiplyScalar(f).applyMatrix4(_),k=w.clone().add(u);v.push(k)}}return v};function Ee(V,v){const p=new n.Group;p.name="CompletePipe";const a={pos:new n.Vector3(0,0,0),localX:new n.Vector3(1,0,0),localY:new n.Vector3(0,1,0),localZ:new n.Vector3(0,0,1)};let m=0,b=1;for(let s=0;s<V.length;s++){const g=V[s],f=g.Y??0,w=g.B??0,r=g.C??0,y=g.R??0;if(w!==0){const d=new n.Matrix4().makeRotationAxis(a.localY,W(w));a.localX.applyMatrix4(d),a.localZ.applyMatrix4(d)}if(f>0){const d=a.pos.clone();a.pos.add(a.localY.clone().multiplyScalar(f*G));const _=a.pos.clone(),c=Pe(d,_,v*G);c.userData={segmentType:"straight",segmentIndex:m,frameIndex:s,length:f,frame:{Y:f,B:w,C:r,R:y}},c.name=`直段_${m}`,p.add(c);const u=d.clone();Se(p,b,u,v*G),m++}if(r>0&&y>0){const d=W(r),_=y*G,c=[];c.push(a.pos.clone());const u=a.pos.clone().add(a.localX.clone().multiplyScalar(-_)),k=Math.max(16,Math.ceil(r/5));for(let h=1;h<=k;h++){const M=d*h/k,A=new n.Matrix4().makeRotationAxis(a.localZ,M),L=a.localX.clone().multiplyScalar(_).applyMatrix4(A),q=u.clone().add(L);c.push(q)}const E=De(c,v*G);E.userData={segmentType:"bend",segmentIndex:m,frameIndex:s,angle:r,radius:y,centerPoint:u.toArray(),frame:{Y:f,B:w,C:r,R:y}},E.name=`弯段_${m}`,p.add(E),Math.floor(c.length/2),c[0],a.pos=c[c.length-1].clone();const S=new n.Matrix4().makeRotationAxis(a.localZ,d);a.localY.applyMatrix4(S),a.localX.applyMatrix4(S),m++,b++}}return p}function Se(V,v,p,a){const m=new n.Vector3(0,a*2,a*5),b=p.clone().add(m),s=[p,b],g=new n.BufferGeometry().setFromPoints(s),f=new n.LineDashedMaterial({color:16711680,dashSize:a*.5,gapSize:a*.3,linewidth:1}),w=new n.Line(g,f);w.computeLineDistances(),V.add(w);const r=document.createElement("canvas"),y=r.getContext("2d");r.width=128,r.height=128,y.clearRect(0,0,128,128),y.fillStyle="#FF0000",y.font="bold 80px Arial",y.textAlign="center",y.textBaseline="middle",y.fillText(v.toString(),64,64);const d=new n.CanvasTexture(r),_=new n.SpriteMaterial({map:d,transparent:!0,depthTest:!1,depthWrite:!1}),c=new n.Sprite(_),u=a*3;c.scale.set(u,u,1),c.position.copy(b),c.name=`Label_${v}`,c.userData={labelNumber:v},V.add(c)}function Pe(V,v,p){const a=new n.LineCurve3(V,v),m=new n.TubeGeometry(a,2,p,18,!1);return new n.Mesh(m,ye)}function De(V,v){const p=new n.CatmullRomCurve3(V,!1,"catmullrom",.01),a=new n.TubeGeometry(p,Math.max(16,V.length*2),v,18,!1);return new n.Mesh(a,ye)}function _e(V,v,p,a,m,b=0){let s=v.slice(0,m+1);const g=v[m+1];if(g&&b>0){const c={...g,B:(g.B??0)*b,C:(g.C??0)*b};s.push(c)}const f=xe(s),w=Math.max(0,p-f),r=[];r.push(new n.Vector3(0,0,0));const y=new n.Vector3(0,w*G,0);w>0&&r.push(y);let d={pos:y.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const _=[];for(let c=s.length-1;c>=0;c--){const u=s[c],k=ke(u);if(k.length>0){const E=k.map(A=>{const $=A.clone(),L=new n.Matrix4;return L.makeBasis(d.localX,d.localY,d.localZ),$.applyMatrix4(L),$.add(d.pos)});_.push(E);const S=E[E.length-1];d.pos=S.clone();const h=u.B??0,M=u.C??0;if(h!==0){const A=new n.Matrix4().makeRotationAxis(d.localY,W(h));d.localX.applyMatrix4(A),d.localZ.applyMatrix4(A)}if(M>0){const A=W(M),$=new n.Matrix4().makeRotationAxis(d.localZ,A);d.localY.applyMatrix4($),d.localX.applyMatrix4($)}}}for(const c of _)c.length>1&&r.push(...c.slice(1));r.length<2&&r.push(new n.Vector3(0,.001,0));try{const c=new n.CatmullRomCurve3(r,!1,"catmullrom",.01),u=new n.TubeGeometry(c,Math.max(2,r.length*4),a*G,18,!1);V.geometry.dispose(),V.geometry=u}catch(c){console.error("管件更新失败",c)}}function Ce(V,v,p,a=0){let m=V.slice(0,p+1);const b=V[p+1];if(b&&a>0){const d={...b,B:(b.B??0)*a,C:(b.C??0)*a};m.push(d)}const s=xe(m),g=Math.max(0,v-s),f=[];f.push(new n.Vector3(0,0,0));const w=new n.Vector3(0,g*G,0);g>0&&f.push(w);let r={pos:w.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const y=[];for(let d=m.length-1;d>=0;d--){const _=m[d],c=ke(_);if(c.length>0){const u=c.map(h=>{const M=h.clone(),A=new n.Matrix4;return A.makeBasis(r.localX,r.localY,r.localZ),M.applyMatrix4(A),M.add(r.pos)});y.push(u);const k=u[u.length-1];r.pos=k.clone();const E=_.B??0,S=_.C??0;if(E!==0){const h=new n.Matrix4().makeRotationAxis(r.localY,W(E));r.localX.applyMatrix4(h),r.localZ.applyMatrix4(h)}if(S>0){const h=W(S),M=new n.Matrix4().makeRotationAxis(r.localZ,h);r.localY.applyMatrix4(M),r.localX.applyMatrix4(M)}}}for(const d of y)d.length>1&&f.push(...d.slice(1));return f.length<2&&f.push(new n.Vector3(0,.001,0)),f}function Ne(V,v,p,a,m,b,s,g=0,f=0){const w=m-f,r=Ce(a,w,s,g);let d=Ce(p,f,s,g);d.forEach(c=>c.y=-c.y),d.reverse();const _=[...d,...r];try{const c=new n.CatmullRomCurve3(_,!1,"catmullrom",.01),u=new n.TubeGeometry(c,Math.max(2,_.length*4),b*G,18,!1);v.geometry.dispose(),V.geometry.dispose(),v.parent&&v.parent.remove(v),V.geometry=u}catch(c){console.error("管件更新失败",c)}}const Re={class:"panel-content"},Be={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},ze={class:"frame-info"},Ye={class:"control-row"},Le={class:"progress-bar"},Ue={class:"dialog-footer"},Ie=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},setup(V,{expose:v}){const p=V,a=e.ref(),m=e.ref();e.watch(()=>p.threeData,t=>{const l=t==null?void 0:t.data;m.value=l==null?void 0:l.type},{immediate:!0});const b=async()=>{let t={};m.value===ne.robotMode.SINGLE&&(t=await fe.fetchSingleRobotAnimationData()),m.value===ne.robotMode.DOUBLE&&(t=await fe.fetchDoubleRobotAnimationData());const{initialPipeLength:l=0,pipeRadius:o=0,clampLength:i=0,animationData:x}=t;S.value=l,h.value=o,M.value=i,a.value=x;const N=R.cloneDeep(a.value),J=re(Y.value),X=(N==null?void 0:N["输出(动画数据)"])||[];s.value=X.length?X:[J]},s=e.ref([]),g=e.ref(!1),f=e.ref(""),w=e.ref(!1),r=e.ref(0),y=e.ref(0),d=e.ref(1e3);let _=!1;const c=e.ref(null),u=e.shallowRef(null),k=e.shallowRef(null),E=e.shallowRef(null),S=e.ref(0),h=e.ref(12.5),M=e.ref(30),A=e.ref([]),$=e.ref(null),L=e.computed(()=>p.model?ie.getNonFixedJoints(p.model).map(o=>o.name):[]),q=e.ref(["Y","B","C","R"]),Y=e.computed(()=>[...L.value,...q.value]),ce=e.computed(()=>Y.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ne=require("./threeViewerHost--jBITe3r.cjs"),pe=require("./iconfont-BU-e8plC.cjs"),ve=require("./workpieceTreePanel-sYKZQx-o.cjs"),R=require("./index-BP07Gnjo.cjs"),n=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs");require("./index-BpPyaNFa.cjs");const le=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs");require("./index.vue_vue_type_style_index_1_lang-B6P8tuhB.cjs");require("./index-K6PeHL12.cjs");require("./index-By--71sB.cjs");const fe=require("./animationData-BmO7uT95.cjs"),ie=require("./urdfTree-B73vL4dE.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Me=require("./index-DbkmELIs.cjs"),B=require("./svgIcon-CUM54R6L.cjs"),G=.001,W=n.MathUtils.degToRad,ye=new n.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:n.DoubleSide});function Te(V=.005,v=64){const p=new n.CatmullRomCurve3([new n.Vector3(0,0,0),new n.Vector3(0,0,0)]),a=new n.TubeGeometry(p,v,V,16,!1),m=ye;return new n.Mesh(a,m)}const xe=V=>V.reduce((v,p)=>{let a=0;const m=p.Y??0,b=p.C??0,s=p.R??0;return m>0&&(a+=m),b>0&&s>0&&(a+=s*W(b)),v+a},0),ke=V=>{const v=[],p=V.Y??0,a=V.B??0,m=V.C??0,b=V.R??0,s={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(!p&&!m)return v;if(v.push(s.pos.clone()),a!==0){const g=new n.Matrix4().makeRotationAxis(s.localY,W(a));s.localX.applyMatrix4(g),s.localZ.applyMatrix4(g)}if(p>0&&(s.pos.add(s.localY.clone().multiplyScalar(p*G)),v.push(s.pos.clone())),m>0&&b>0){const g=W(m),f=b*G,w=s.pos.clone().add(s.localX.clone().multiplyScalar(-f)),r=Math.max(16,Math.ceil(m/5));for(let y=1;y<=r;y++){const d=g*y/r,_=new n.Matrix4().makeRotationAxis(s.localZ,d),u=s.localX.clone().multiplyScalar(f).applyMatrix4(_),k=w.clone().add(u);v.push(k)}}return v};function Ee(V,v){const p=new n.Group;p.name="CompletePipe";const a={pos:new n.Vector3(0,0,0),localX:new n.Vector3(1,0,0),localY:new n.Vector3(0,1,0),localZ:new n.Vector3(0,0,1)};let m=0,b=1;for(let s=0;s<V.length;s++){const g=V[s],f=g.Y??0,w=g.B??0,r=g.C??0,y=g.R??0;if(w!==0){const d=new n.Matrix4().makeRotationAxis(a.localY,W(w));a.localX.applyMatrix4(d),a.localZ.applyMatrix4(d)}if(f>0){const d=a.pos.clone();a.pos.add(a.localY.clone().multiplyScalar(f*G));const _=a.pos.clone(),c=Pe(d,_,v*G);c.userData={segmentType:"straight",segmentIndex:m,frameIndex:s,length:f,frame:{Y:f,B:w,C:r,R:y}},c.name=`直段_${m}`,p.add(c);const u=d.clone();Se(p,b,u,v*G),m++}if(r>0&&y>0){const d=W(r),_=y*G,c=[];c.push(a.pos.clone());const u=a.pos.clone().add(a.localX.clone().multiplyScalar(-_)),k=Math.max(16,Math.ceil(r/5));for(let h=1;h<=k;h++){const M=d*h/k,A=new n.Matrix4().makeRotationAxis(a.localZ,M),L=a.localX.clone().multiplyScalar(_).applyMatrix4(A),q=u.clone().add(L);c.push(q)}const E=De(c,v*G);E.userData={segmentType:"bend",segmentIndex:m,frameIndex:s,angle:r,radius:y,centerPoint:u.toArray(),frame:{Y:f,B:w,C:r,R:y}},E.name=`弯段_${m}`,p.add(E),Math.floor(c.length/2),c[0],a.pos=c[c.length-1].clone();const S=new n.Matrix4().makeRotationAxis(a.localZ,d);a.localY.applyMatrix4(S),a.localX.applyMatrix4(S),m++,b++}}return p}function Se(V,v,p,a){const m=new n.Vector3(0,a*2,a*5),b=p.clone().add(m),s=[p,b],g=new n.BufferGeometry().setFromPoints(s),f=new n.LineDashedMaterial({color:16711680,dashSize:a*.5,gapSize:a*.3,linewidth:1}),w=new n.Line(g,f);w.computeLineDistances(),V.add(w);const r=document.createElement("canvas"),y=r.getContext("2d");r.width=128,r.height=128,y.clearRect(0,0,128,128),y.fillStyle="#FF0000",y.font="bold 80px Arial",y.textAlign="center",y.textBaseline="middle",y.fillText(v.toString(),64,64);const d=new n.CanvasTexture(r),_=new n.SpriteMaterial({map:d,transparent:!0,depthTest:!1,depthWrite:!1}),c=new n.Sprite(_),u=a*3;c.scale.set(u,u,1),c.position.copy(b),c.name=`Label_${v}`,c.userData={labelNumber:v},V.add(c)}function Pe(V,v,p){const a=new n.LineCurve3(V,v),m=new n.TubeGeometry(a,2,p,18,!1);return new n.Mesh(m,ye)}function De(V,v){const p=new n.CatmullRomCurve3(V,!1,"catmullrom",.01),a=new n.TubeGeometry(p,Math.max(16,V.length*2),v,18,!1);return new n.Mesh(a,ye)}function _e(V,v,p,a,m,b=0){let s=v.slice(0,m+1);const g=v[m+1];if(g&&b>0){const c={...g,B:(g.B??0)*b,C:(g.C??0)*b};s.push(c)}const f=xe(s),w=Math.max(0,p-f),r=[];r.push(new n.Vector3(0,0,0));const y=new n.Vector3(0,w*G,0);w>0&&r.push(y);let d={pos:y.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const _=[];for(let c=s.length-1;c>=0;c--){const u=s[c],k=ke(u);if(k.length>0){const E=k.map(A=>{const $=A.clone(),L=new n.Matrix4;return L.makeBasis(d.localX,d.localY,d.localZ),$.applyMatrix4(L),$.add(d.pos)});_.push(E);const S=E[E.length-1];d.pos=S.clone();const h=u.B??0,M=u.C??0;if(h!==0){const A=new n.Matrix4().makeRotationAxis(d.localY,W(h));d.localX.applyMatrix4(A),d.localZ.applyMatrix4(A)}if(M>0){const A=W(M),$=new n.Matrix4().makeRotationAxis(d.localZ,A);d.localY.applyMatrix4($),d.localX.applyMatrix4($)}}}for(const c of _)c.length>1&&r.push(...c.slice(1));r.length<2&&r.push(new n.Vector3(0,.001,0));try{const c=new n.CatmullRomCurve3(r,!1,"catmullrom",.01),u=new n.TubeGeometry(c,Math.max(2,r.length*4),a*G,18,!1);V.geometry.dispose(),V.geometry=u}catch(c){console.error("管件更新失败",c)}}function Ce(V,v,p,a=0){let m=V.slice(0,p+1);const b=V[p+1];if(b&&a>0){const d={...b,B:(b.B??0)*a,C:(b.C??0)*a};m.push(d)}const s=xe(m),g=Math.max(0,v-s),f=[];f.push(new n.Vector3(0,0,0));const w=new n.Vector3(0,g*G,0);g>0&&f.push(w);let r={pos:w.clone(),localY:new n.Vector3(0,1,0),localX:new n.Vector3(1,0,0),localZ:new n.Vector3(0,0,1)};const y=[];for(let d=m.length-1;d>=0;d--){const _=m[d],c=ke(_);if(c.length>0){const u=c.map(h=>{const M=h.clone(),A=new n.Matrix4;return A.makeBasis(r.localX,r.localY,r.localZ),M.applyMatrix4(A),M.add(r.pos)});y.push(u);const k=u[u.length-1];r.pos=k.clone();const E=_.B??0,S=_.C??0;if(E!==0){const h=new n.Matrix4().makeRotationAxis(r.localY,W(E));r.localX.applyMatrix4(h),r.localZ.applyMatrix4(h)}if(S>0){const h=W(S),M=new n.Matrix4().makeRotationAxis(r.localZ,h);r.localY.applyMatrix4(M),r.localX.applyMatrix4(M)}}}for(const d of y)d.length>1&&f.push(...d.slice(1));return f.length<2&&f.push(new n.Vector3(0,.001,0)),f}function Ne(V,v,p,a,m,b,s,g=0,f=0){const w=m-f,r=Ce(a,w,s,g);let d=Ce(p,f,s,g);d.forEach(c=>c.y=-c.y),d.reverse();const _=[...d,...r];try{const c=new n.CatmullRomCurve3(_,!1,"catmullrom",.01),u=new n.TubeGeometry(c,Math.max(2,_.length*4),b*G,18,!1);v.geometry.dispose(),V.geometry.dispose(),v.parent&&v.parent.remove(v),V.geometry=u}catch(c){console.error("管件更新失败",c)}}const Re={class:"panel-content"},Be={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},ze={class:"frame-info"},Ye={class:"control-row"},Le={class:"progress-bar"},Ue={class:"dialog-footer"},Ie=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},setup(V,{expose:v}){const p=V,a=e.ref(),m=e.ref();e.watch(()=>p.threeData,t=>{const l=t==null?void 0:t.data;m.value=l==null?void 0:l.type},{immediate:!0});const b=async()=>{let t={};m.value===ne.robotMode.SINGLE&&(t=await fe.fetchSingleRobotAnimationData()),m.value===ne.robotMode.DOUBLE&&(t=await fe.fetchDoubleRobotAnimationData());const{initialPipeLength:l=0,pipeRadius:o=0,clampLength:i=0,animationData:x}=t;S.value=l,h.value=o,M.value=i,a.value=x;const N=R.cloneDeep(a.value),J=re(Y.value),X=(N==null?void 0:N["输出(动画数据)"])||[];s.value=X.length?X:[J]},s=e.ref([]),g=e.ref(!1),f=e.ref(""),w=e.ref(!1),r=e.ref(0),y=e.ref(0),d=e.ref(1e3);let _=!1;const c=e.ref(null),u=e.shallowRef(null),k=e.shallowRef(null),E=e.shallowRef(null),S=e.ref(0),h=e.ref(12.5),M=e.ref(30),A=e.ref([]),$=e.ref(null),L=e.computed(()=>p.model?ie.getNonFixedJoints(p.model).map(o=>o.name):[]),q=e.ref(["Y","B","C","R"]),Y=e.computed(()=>[...L.value,...q.value]),ce=e.computed(()=>Y.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
2
  ${Y.value.join(" ")}
3
3
  0 0 0 ...
4
4
  1 2 3 ...`:"请先加载模型。"),ae=()=>s.value.map(t=>({Y:parseFloat(t.Y)||0,B:parseFloat(t.B)||0,C:parseFloat(t.C)||0,R:parseFloat(t.R)||0})),K=()=>{const t=[],l=[];return s.value.forEach(o=>{const{Y1:i,B1:x,C1:N,R1:J,Y2:X,B2:oe,C2:de,R2:D}=o;t.push({Y:parseFloat(i)||0,B:parseFloat(x)||0,C:parseFloat(N)||0,R:parseFloat(J)||0}),l.push({Y:parseFloat(X)||0,B:parseFloat(oe)||0,C:parseFloat(de)||0,R:parseFloat(D)||0})}),{posPipeYbcr:t,negPipeYbcr:l}},T=(t=0,l=0)=>{if(u.value&&k.value){const o=K();Ne(u.value,k.value,o.posPipeYbcr,o.negPipeYbcr,S.value,h.value,t,l,M.value)}else if(u.value){const o=ae();_e(u.value,o,S.value,h.value,t,l)}},C=t=>{if(t<0||t>=s.value.length){console.error(`帧索引 ${t} 超出范围`);return}const l=s.value[t];if(console.log(`应用第 ${t} 帧数据 ${l}`),r.value=t,c.value){const o={};L.value.forEach(i=>{const x=parseFloat(l[i]);isNaN(x)||(o[i]=x)}),c.value.setJointAngles(o)}T(t,0)},U=async()=>{if(s.value.length===0){R.ElMessage.error("无法播放动画:无数据");return}if(!w.value){w.value=!0,_=!1,s.value.length-1===r.value&&(r.value=0);try{for(let t=r.value+1;t<s.value.length&&!_;t++){r.value=t;const l=s.value[t],o={};c.value&&L.value.forEach(i=>{const x=parseFloat(l[i]);isNaN(x)||(o[i]=x)}),c.value?await c.value.animateToState(o,d.value,i=>{y.value=(t+i)/s.value.length*100,T(t-1,i)}):(await new Promise(i=>setTimeout(i,d.value)),y.value=(t+1)/s.value.length*100)}_||R.ElMessage.success("动画播放完成")}catch(t){console.error("动画播放出错:",t),R.ElMessage.error("动画播放出错")}finally{w.value=!1,y.value=0}}},F=()=>{_=!0,w.value=!1,y.value=0,R.ElMessage.info("动画已停止")},I=()=>{r.value=0},z=()=>{if(u.value&&k.value){const t=K();Ne(u.value,k.value,t.posPipeYbcr,t.negPipeYbcr,S.value,h.value,-1,0,M.value)}else if(u.value){const t=ae();_e(u.value,t,S.value,h.value,-1,0)}},Z=()=>{c.value&&c.value.resetToZero(),z(),I(),R.ElMessage.success("机器人和管件已重置")},O=t=>`第 ${t+1} 帧`,j=t=>{w.value&&F(),C(t)},Q=()=>{w.value&&F(),!(r.value+1>=s.value.length)&&C(r.value+1)},P=()=>{w.value&&F(),r.value!==0&&C(r.value-1)},H=()=>{E.value&&(E.value.visible=!0),u.value&&u.value.parent&&u.value.parent.remove(u.value),E.value=null,u.value=null,k.value=null},re=t=>t==null?void 0:t.reduce((l,o)=>(l[o]="0",l),{});e.watch(Y,(t,l)=>{if(JSON.stringify(t)!==JSON.stringify(l))if(t.length>0){const o=re(t);s.value=[o]}else s.value=[]},{immediate:!0});const ee=e.ref(0),ue=t=>{ee.value=t},he=(t,l)=>{if(!t||!l)return;const o=ie.getTargetJoint(t,l),i=Te();i.visible=!1,o==null||o.add(i)},ge=t=>{c.value=new ve.URDFRobotController(t),A.value=ie.getAllLinkName(t),$.value="Pipe_Joint"},te=()=>{c.value=null,A.value=[],$.value=null},se=t=>{ge(t),he(t,$.value),ue(ee.value+1),Z()};e.watch(()=>p.model,t=>{if(H(),t){se(t);return}te()},{immediate:!0});const me=t=>{var o,i;const l=new n.Mesh(t.geometry.clone(),t.material);return l.name="managed_pipe_clone",(i=(o=t==null?void 0:t.parent)==null?void 0:o.add)==null||i.call(o,l),l.position.copy(t.position),l.rotation.copy(t.rotation),l.scale.copy(t.scale),l};e.watch([$,M,S,ee],([t,l])=>{if(H(),p.model&&t){const o=ie.getMeshFromJoint(p.model,t);if(console.log(o,"meshToReplace"),o&&o.parent){E.value=o,o.visible=!1;const i=me(o);if(m.value===ne.robotMode.SINGLE&&(i.position.y-=l*.001),u.value=i,m.value===ne.robotMode.DOUBLE){const x=me(o);k.value=x}T(0,0)}else t&&console.warn(`在 link '${t}' 中未找到可替换的网格或其没有父级。`)}});const Ve=async()=>{if(Y.value.length===0){R.ElMessage.warning("没有可导出的表头");return}const t=Y.value.join(" ");try{await navigator.clipboard.writeText(t),R.ElMessage.success("表头已成功复制到剪贴板!")}catch(l){console.error("复制失败:",l),R.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},be=()=>{if(!f.value.trim()){R.ElMessage.warning("导入内容不能为空");return}const t=f.value.trim().split(`
@@ -1,18 +1,18 @@
1
1
  import { defineComponent as Le, ref as h, watch as ae, shallowRef as be, computed as Pe, onUnmounted as Ie, resolveComponent as U, createElementBlock as Te, openBlock as Q, createElementVNode as u, createVNode as l, withCtx as M, createBlock as ye, createCommentVNode as ke, unref as X, toDisplayString as he, onMounted as Ge, onBeforeUnmount as Ze, Fragment as He, renderList as qe, nextTick as Ke, withDirectives as pe, vShow as de, renderSlot as Me } from "vue";
2
- import { r as De, s as Ye } from "./threeViewerHost-DCU9cNEx.js";
3
- import { u as Je, a as Qe, b as et, C as tt } from "./iconfont-AyWwUMxc.js";
4
- import { U as lt, u as ot, a as nt, W as at } from "./workpieceTreePanel-B6x641Qw.js";
5
- import { aa as st, c as it, E, aM as rt, ao as ct } from "./index-7MBVUN82.js";
6
- import { aF as Ve, aG as xe, ag as V, aD as H, aE as ut, b1 as pt, au as Se, b2 as dt, b3 as mt, b4 as vt, b5 as ft, b6 as gt, b7 as ht, b8 as bt, b9 as yt, aA as _t, ba as Be, bb as wt, bc as Ct, bd as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
2
+ import { r as De, s as Ye } from "./threeViewerHost-DSYrQH3r.js";
3
+ import { u as Je, a as Qe, b as et, C as tt } from "./iconfont-hcY1c1Ph.js";
4
+ import { U as lt, u as ot, a as nt, W as at } from "./workpieceTreePanel-CUiwX5FV.js";
5
+ import { aa as st, c as it, E, aM as rt, ao as ct } from "./index-DufZVmKf.js";
6
+ import { aF as Ve, aG as xe, ag as V, aD as H, aE as ut, b1 as pt, au as Se, b2 as dt, b3 as mt, b4 as vt, b5 as ft, b6 as gt, b7 as ht, b8 as bt, b9 as yt, aA as _t, ba as Be, bb as wt, bc as Ct, bd as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
7
7
  import "./index-BHtNKL1L.js";
8
8
  import { _ as me } from "./index.vue_vue_type_script_setup_true_lang-DRzriV-s.js";
9
- import "./index.vue_vue_type_style_index_1_lang-CtOB5lpf.js";
10
- import "./index-DfFq9kkn.js";
11
- import "./index-3oQGURYh.js";
12
- import { f as Pt, a as xt, g as Rt, b as Mt } from "./animationData-D3-99sWf.js";
13
- import { g as Dt, a as Tt, b as Vt, c as St, U as At, J as $t } from "./urdfTree-CQQPUmyr.js";
9
+ import "./index.vue_vue_type_style_index_1_lang-BwYhIkBS.js";
10
+ import "./index-BdG8TrO6.js";
11
+ import "./index-VnVlZEmb.js";
12
+ import { f as Pt, a as xt, g as Rt, b as Mt } from "./animationData-B0xfieMG.js";
13
+ import { g as Dt, a as Tt, b as Vt, c as St, U as At, J as $t } from "./urdfTree-CiLrHpgG.js";
14
14
  import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
15
- import { s as Ft } from "./index-DzElE7Kh.js";
15
+ import { s as Ft } from "./index-HFvfNokw.js";
16
16
  import { T as Y } from "./svgIcon-D-_fXUBL.js";
17
17
  const I = 1e-3, oe = ut.degToRad, Ee = new dt({
18
18
  // 灰色
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as ge, ref as r, computed as k, watch as X, onUnmounted as De, resolveComponent as G, createElementBlock as x, openBlock as g, createElementVNode as n, createCommentVNode as U, createVNode as s, toDisplayString as L, Fragment as Be, renderList as Je, withCtx as le, shallowRef as te, onMounted as Me, nextTick as me, onBeforeUnmount as Ee, withDirectives as I, vShow as W, unref as z, renderSlot as ve, createBlock as de } from "vue";
2
- import { s as pe } from "./threeViewerHost-DCU9cNEx.js";
3
- import { u as Ge, a as He, b as Ie, C as We } from "./iconfont-AyWwUMxc.js";
4
- import { U as Xe, u as Ye, a as Ze, W as qe } from "./workpieceTreePanel-B6x641Qw.js";
5
- import { c as Ke, E as _ } from "./index-7MBVUN82.js";
6
- import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
2
+ import { s as pe } from "./threeViewerHost-DSYrQH3r.js";
3
+ import { u as Ge, a as He, b as Ie, C as We } from "./iconfont-hcY1c1Ph.js";
4
+ import { U as Xe, u as Ye, a as Ze, W as qe } from "./workpieceTreePanel-CUiwX5FV.js";
5
+ import { c as Ke, E as _ } from "./index-DufZVmKf.js";
6
+ import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
7
7
  import { _ as fe } from "./index.vue_vue_type_script_setup_true_lang-DRzriV-s.js";
8
- import { g as Qe, b as et, U as tt, J as lt, d as nt } from "./urdfTree-CQQPUmyr.js";
8
+ import { g as Qe, b as et, U as tt, J as lt, d as nt } from "./urdfTree-CiLrHpgG.js";
9
9
  import { _ as he } from "./_plugin-vue_export-helper-CHgC5LLL.js";
10
10
  import { T as y } from "./svgIcon-D-_fXUBL.js";
11
- import { i as at } from "./animationData-D3-99sWf.js";
12
- import { O as ot } from "./MTLLoader-DO6JtV2J.js";
11
+ import { i as at } from "./animationData-B0xfieMG.js";
12
+ import { O as ot } from "./MTLLoader-EGw2WpGn.js";
13
13
  const st = { class: "panel-content" }, it = {
14
14
  key: 0,
15
15
  class: "animation-controls"
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ee=require("./threeViewerHost-krP0Lb0-.cjs"),q=require("./iconfont-U7rG6UGs.cjs"),J=require("./workpieceTreePanel-Bm8mjA8R.cjs"),f=require("./index-DOItJqcJ.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs");const te=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs"),U=require("./urdfTree-CcC8aW11.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),h=require("./svgIcon-CUM54R6L.cjs"),Ce=require("./animationData-DHASNMoi.cjs"),_e=require("./MTLLoader-DACeOwx8.cjs"),we={class:"panel-content"},Se={key:0,class:"animation-controls"},Pe={class:"control-row"},Te={class:"control-row"},Be={class:"frame-info"},xe={class:"control-row"},ze={key:1,class:"empty-state"},De={class:"dialog-footer"},Le=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(P,{expose:m}){const y=P,s=e.ref([]),_=e.ref(!1),T=e.ref(""),i=e.ref("stopped"),g=e.ref(0),w=e.ref(0),b=e.ref(10),u=e.ref(null);let c=0;const V=e.ref([]),N=e.computed(()=>y.model?U.getNonFixedJoints(y.model).map(p=>p.name):[]),S=e.computed(()=>[...N.value]),H=e.computed(()=>S.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),ee=require("./threeViewerHost--jBITe3r.cjs"),q=require("./iconfont-BU-e8plC.cjs"),J=require("./workpieceTreePanel-sYKZQx-o.cjs"),f=require("./index-BP07Gnjo.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs");const te=require("./index.vue_vue_type_script_setup_true_lang-BKTJR2th.cjs"),U=require("./urdfTree-B73vL4dE.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),h=require("./svgIcon-CUM54R6L.cjs"),Ce=require("./animationData-BmO7uT95.cjs"),_e=require("./MTLLoader-DeVVTn9U.cjs"),we={class:"panel-content"},Se={key:0,class:"animation-controls"},Pe={class:"control-row"},Te={class:"control-row"},Be={class:"frame-info"},xe={class:"control-row"},ze={key:1,class:"empty-state"},De={class:"dialog-footer"},Le=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(P,{expose:m}){const y=P,s=e.ref([]),_=e.ref(!1),T=e.ref(""),i=e.ref("stopped"),g=e.ref(0),w=e.ref(0),b=e.ref(10),u=e.ref(null);let c=0;const V=e.ref([]),N=e.computed(()=>y.model?U.getNonFixedJoints(y.model).map(p=>p.name):[]),S=e.computed(()=>[...N.value]),H=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(()=>s.value[g.value]||{});e.watch(()=>y.model,o=>{o?(u.value=new J.URDFRobotController(o),V.value=U.getAllLinkName(o),g.value=0):(u.value=null,V.value=[])},{immediate:!0});const D=o=>{if(o<0||o>=s.value.length){console.error(`帧索引 ${o} 超出范围`);return}const n=s.value[o];if(u.value){const p={};N.value.forEach(k=>{const r=parseFloat(n[k]);isNaN(r)||(p[k]=r)}),u.value.setJointAngles(p)}g.value=o,w.value=s.value.length>1?o/(s.value.length-1)*100:100},L=async o=>{try{for(let n=g.value;n<s.value.length;n++){if(o!==c)return;const p=s.value[n],k={};if(u.value)N.value.forEach(r=>{const d=parseFloat(p[r]);isNaN(d)||(k[r]=d)}),await u.value.animateToState(k,b.value,r=>{o===c&&(w.value=(n+r)/s.value.length*100)});else{if(await new Promise(r=>setTimeout(r,b.value)),o!==c)return;w.value=(n+1)/s.value.length*100}g.value=n}o===c&&(f.ElMessage.success("动画播放完成"),i.value="stopped",w.value=100)}catch(n){console.error("动画播放出错:",n),f.ElMessage.error("动画播放出错"),i.value="stopped"}},B=()=>{if(s.value.length===0){f.ElMessage.error("无动画数据");return}i.value==="stopped"&&(g.value=0,D(0)),i.value="playing",c++,L(c),f.ElMessage.info("动画播放中")},$=()=>{i.value==="playing"&&(c++,i.value="paused",f.ElMessage.info("动画已暂停"))},R=()=>{c++,i.value="stopped",g.value=0,w.value=0,D(0),f.ElMessage.info("动画已停止并重置")},G=()=>{i.value==="playing"?$():B()},x=o=>{c++,i.value="paused",D(o)},X=()=>{if(!T.value.trim()){f.ElMessage.warning("导入内容不能为空");return}const o=T.value.trim().split(`
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),x=require("./iconfont-U7rG6UGs.cjs"),p=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs"),I=require("./index-DOItJqcJ.cjs"),K=require("./urdfTree-CcC8aW11.cjs"),R=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),w=require("./svgIcon-CUM54R6L.cjs"),ge=require("./isString-Do5yyRUw.cjs");function ye(t=.5,o=4){const r=new p.Mesh(new p.ConeGeometry(t,o,32),new p.MeshStandardMaterial({color:"#919191ff",metalness:.3,roughness:.6})),s=r.geometry.parameters.height;return r.geometry.translate(0,-s/2,0),r.rotation.set(-90,0,0,"XYZ"),r}function Ce(t,o){t.position.copy(o)}function we(t,o,r=new p.Color(16711680)){const s=new p.Vector3;o.getWorldPosition(s);const a=t.geometry.attributes.position,n=t.geometry.attributes.color,l=new p.Color(55551);let c=1/0,f=-1;for(let u=0;u<a.count;u++){const v=new p.Vector3().fromBufferAttribute(a,u).distanceTo(s);v<c&&(c=v,f=u)}for(let u=0;u<n.count;u++)l.toArray(n.array,u*3);if(f!==-1){const u=r.toArray(),m=f*3+2;for(let v=0;v<m;v=v+3)n.array[v]=u[0],n.array[v+1]=u[1],n.array[v+2]=u[2]}n.needsUpdate=!0}function S(t,o,r,s=new p.Color(16711680)){Ce(t,o),we(r,t,s)}const ke={class:"panel-content"},_e={class:"animation-controls"},Ve={class:"control-row"},be={class:"control-row"},Ne={class:"frame-info"},Te={class:"control-row"},Ee=e.defineComponent({__name:"trackAnimationPanel",props:{cloud:{},knife:{},vectors:{}},emits:["getThreeData"],setup(t,{expose:o,emit:r}){const s=t,a=e.computed(()=>s.vectors),n=e.ref(!1),l=e.ref(0),c=e.ref(100);let f=!1;const u=g=>`第 ${g+1} 帧`,m=g=>{if(g<0||g>=a.value.length){console.error(`帧索引 ${g} 超出范围`);return}const y=a.value[g];l.value=g,S(s.knife,y,s.cloud)},v=async()=>{if(a.value.length===0){I.ElMessage.error("无法播放动画:无数据");return}if(!n.value){n.value=!0,f=!1,a.value.length-1===l.value&&(l.value=0);try{for(let g=l.value+1;g<a.value.length&&!f;g++)await new Promise(y=>setTimeout(y,c.value)),m(g);f||I.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g)}finally{n.value=!1}}},C=()=>{f=!0,n.value=!1,I.ElMessage.info("动画已停止")},N=g=>{n.value&&C(),m(g)},_=()=>{n.value&&C(),!(l.value+1>=a.value.length)&&m(l.value+1)},V=()=>{n.value&&C(),l.value!==0&&m(l.value-1)},h=()=>{l.value=0};return o({playAnimation:v,stopAnimation:C,forwardFrame:_,backwardFrame:V,resetAnimationFrame:h,reset:async()=>{await C(),h()}}),(g,y)=>{const L=e.resolveComponent("el-input-number"),B=e.resolveComponent("el-form-item"),D=e.resolveComponent("el-form"),$=e.resolveComponent("el-slider");return e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",_e,[e.createElementVNode("div",Ve,[e.createVNode(D,{"label-width":"auto",style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(B,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:e.withCtx(()=>[e.createVNode(L,{modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=z=>c.value=z),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),e.createElementVNode("div",be,[y[2]||(y[2]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",Ne,e.toDisplayString(l.value+1)+" / "+e.toDisplayString(a.value.length),1)]),e.createElementVNode("div",Te,[y[3]||(y[3]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode($,{modelValue:l.value,"onUpdate:modelValue":y[1]||(y[1]=z=>l.value=z),min:0,max:a.value.length>0?a.value.length-1:0,step:1,"format-tooltip":u,onInput:N,disabled:a.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),xe=R._export_sfc(Ee,[["__scopeId","data-v-f6fc7a8c"]]);function ze(t){const o=[];return t.forEach(r=>{const[s,a,n]=r.trim().split(/\s+/);o.push(+s,+a,+n)}),o}function U(t,o,r){switch(t){case"X":o.x=+r||0;break;case"Y":o.y=+r||0;break;case"Z":o.z=+r||0;break}}function Ae(t){const o=[],r=["X","Y","Z"];return t.forEach(s=>{const a={x:0,y:0,z:0},n=s.trim();if(!n)return;let l=null,c="";for(let f=0;f<(n==null?void 0:n.length);f++){const u=n[f],m=r.find(v=>v===u);if(m){l&&U(l,a,c),c="",l=m;continue}c=c+u}U(l,a,c),o.push(a.x,a.y,a.z)}),o}const Pe=t=>t==null?void 0:t.filter(r=>r.includes("=")),Me=t=>t.replace(/,/g,""),Fe=t=>t==null?void 0:t.map(r=>Me(r)),Ie=t=>{const o=Pe(t);return Fe(o)};function Ue(t){const o=Ie(t),r=[];return o.forEach(s=>{var v,C,N,_,V,h;let[a,n,l,c]=s.trim().split(/\s+/);n=(v=n==null?void 0:n.trim)==null?void 0:v.call(n),l=(C=l==null?void 0:l.trim)==null?void 0:C.call(l),c=(N=c==null?void 0:c.trim)==null?void 0:N.call(c);const[,f]=(_=n==null?void 0:n.split)==null?void 0:_.call(n,"="),[,u]=(V=l==null?void 0:l.split)==null?void 0:V.call(l,"="),[,m]=(h=c==null?void 0:c.split)==null?void 0:h.call(c,"=");r.push(+f,+u,+m)}),r}const Le=t=>t>="0"&&t<="9",Be=t=>t==="+"||t==="-",De=t=>t===".";function $e(t){return Le(t)||Be(t)||De(t)}function je(t){const o=[],r=new Set(["X","Y","Z"]);return t.forEach(s=>{const a={x:0,y:0,z:0},n=s.trim();if(!n)return;let l=null,c="";for(let f=0;f<(n==null?void 0:n.length);f++){const u=n[f];if(u==="T")break;const m=r.has(u)?u:null,v=$e(u);if(m||!v){l&&U(l,a,c),l=m,c="";continue}c=c+u}l&&U(l,a,c),o.push(a.x,a.y,a.z)}),o}function qe(t){return t==null?void 0:t.includes("=")}async function Xe(t){var a,n;const o=(a=t==null?void 0:t.trim())==null?void 0:a.split(/\r?\n/);if(qe(t))return Ue(o);const r=o==null?void 0:o[0],s=(n=r==null?void 0:r.trim())==null?void 0:n.split(/\s+/);if((s==null?void 0:s.length)>=3)return ze(o);if((s==null?void 0:s.length)===1)return Ae(o)}async function Ye(t){const o=t.trim().split(/\r?\n/),r=[];return o.forEach(s=>{const a=s.trim().split(/\s+/);if(a.length!=3)return;const[n,l,c]=a;r.push(+n,+l,+c)}),r}async function Ze(t){const o=t.trim().split(/\r?\n/),r=[];return o.forEach(s=>{const a=s.trim().split(/\s+/);if(a.length!=3)return;const[n,l,c]=a;r.push(+n,+l,+c)}),r}async function Oe(t){let o=t.trim().split(/\r?\n/);return o=o.filter(s=>{const a=s.startsWith("X")||s.startsWith("Y")||s.startsWith("Z"),n=s.startsWith("G")&&(s.includes("X")||s.includes("Y")||s.includes("Z")),l=s.startsWith("N")&&(s.includes("X")||s.includes("Y")||s.includes("Z"));return a||n||l}),je(o)}async function Ge(t,o){const{isCyd:r,isUv:s,isCpt:a,isNc:n}=o;return s?Xe(t):r?Ze(t):a?Ye(t):n?Oe(t):[]}function Ke(t){const o=[];for(let r=0;r<t.length;r+=3)o.push(new p.Vector3(t[r],t[r+1],t[r+2]));return o}function Re(t){const o=new p.BufferGeometry;o.setAttribute("position",new p.Float32BufferAttribute(t,3));const r=new p.LineBasicMaterial({color:55551,linewidth:3});return new p.Line(o,r)}function Se(t,o){if(!o||o.length<3)return;const{scene:r,camera:s,renderer:a,controls:n}=t();if(!r||!s||!a||!n)return;const l=Re(o);return l.name="轨迹路径",r.add(l),l}function We(t,o,r,s=4,a=50){let n=1/0,l=-1/0,c=1/0,f=-1/0,u=1/0,m=-1/0;for(let h=0;h<t.length;h+=3){const A=t[h],g=t[h+1],y=t[h+2];n=Math.min(n,A),l=Math.max(l,A),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,y),m=Math.max(m,y)}const C=Math.sqrt((l-n)**2+(f-c)**2+(m-u)**2)*.05,N=p.MathUtils.degToRad(o.fov),_=2*Math.tan(N/2)*a,V=C/_*r.domElement.height*(s/4);return Math.min(.4,V)}function He(t){if(t.length%3!==0)return console.error("points array length is not a multiple of 3:",t),null;const o=new p.BufferGeometry;o.setAttribute("position",new p.Float32BufferAttribute(t,3));const r=new Float32Array(t.length);for(let n=0;n<t.length;n+=3)r[n]=0,r[n+1]=.847,r[n+2]=1;o.setAttribute("color",new p.BufferAttribute(r,3));const s=new p.PointsMaterial({vertexColors:!0,size:.4,sizeAttenuation:!0}),a=new p.Points(o,s);return s.needsUpdate=!0,a}function Je(t,o){if(!o)return;const{scene:r,camera:s,renderer:a,controls:n}=t();if(!r||!s||!a||!n)return;const l=He(o);if(!l)return;l.name="轨迹路径",r.add(l);const c=We(o,s,a,.1,50);return l.material.size=c,l}const Qe={class:"obj-viewer-container"},et={class:"buttonGroup-topLeft"},tt={class:"buttonGroup-left"},nt={class:"buttonGroup-right"},ot={class:"buttonGroup-bottom"},rt={class:"left-panel"},lt={class:"panel-header"},st={class:"panel-body"},it={class:"right-panel"},at={class:"panel-header"},ct={class:"panel-body"},ut={key:0,class:"loading-overlay"},dt=e.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},setup(t){const o=t,r=e.ref(null),s=e.ref(!1),a=e.ref(""),n=e.ref(),l=e.ref(!1),c=e.ref(""),f=e.ref(!1),u=e.ref(""),m=e.shallowRef(null),v=e.shallowRef(null),{currentModels:C,resetView:N,initThreeJS:_,handleResize:V,getThreeJSObjects:h,cleanup:A,setModels:g,setAndFitModels:y,axesHelperVisible:L,toggleAxesVisibility:B,zoomIn:D,zoomOut:$}=x.useThreeJS(r),{isAnimating:z,toggleAnimation:W,startAnimation:vt,stopAnimation:H}=x.useAnimation(h,C),{isClipping:J,activeClippingAxis:Y,toggleClipping:Q,updateClippingPlanes:ee}=x.useClipping(h,C),te=()=>{B()},ne=i=>{Y.value=i,ee()},j=i=>{l.value=!0,c.value=i,i==="剖面视图"&&!J.value&&Q()},q=i=>{f.value=!0,u.value=i},X=e.ref([]),P=e.ref([]),oe=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isUv}),re=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isCyd}),le=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isCpt}),T=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isNc}),Z=e.computed(()=>{const i=o.fileBlobs||[];return i==null?void 0:i[0]});let k=e.shallowRef(),E=e.shallowRef();const se=()=>{const{scene:i}=h();k.value&&i&&(x.disposeObj(k.value,i),k.value=null)},ie=()=>{const{scene:i}=h();E.value&&i&&(x.disposeObj(E.value,i),E.value=null)},O=()=>{se(),ie()},ae=async i=>{const d=URL.createObjectURL(i),M=await p.readFileText(d);if(URL.revokeObjectURL(d),ge.isString(M)){X.value=await Ge(M,o.trackFileType)||[];const b=X.value;oe.value&&(k.value=Se(h,b)),(re.value||le.value||T.value)&&(k.value=Je(h,b))}},ce=async()=>{var i,d;E.value=ye(),P.value=Ke(X.value),P.value&&P.value.length&&(S(E.value,P.value[0],k.value,new p.Color(16711680)),(d=(i=v.value)==null?void 0:i.add)==null||d.call(i,E.value))},G=async i=>{O(),await ae(i),k.value&&x.frameCameraToObject3D(h,k.value),T.value&&ce()};e.watch(()=>Z.value,async i=>{i&&await G(i)},{immediate:!0,deep:!0});const ue=async()=>{var i;await((i=n==null?void 0:n.value)==null?void 0:i.reset()),await G(Z.value)},de=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.playAnimation())},fe=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.stopAnimation())},ve=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.forwardFrame())},me=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.backwardFrame())},pe=()=>{_(),e.nextTick(()=>{r.value&&(F=new ResizeObserver(V),F.observe(r.value))});const i=h();v.value=i.scene,v.value&&(v.value.name="CPMPIP")},he=()=>{F&&F.disconnect(),z.value&&H(),O(),A()};let F=null;return e.onMounted(async()=>{try{pe()}catch(i){console.error("Three.js 初始化失败:",i),I.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{he()}),(i,d)=>{const M=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",et,[e.createVNode(w.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:ue,title:"重置"}),e.createVNode(w.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大",onClick:e.unref(D)},null,8,["onClick"]),e.createVNode(w.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小",onClick:e.unref($)},null,8,["onClick"]),e.createVNode(w.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:e.unref(W),title:e.unref(z)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(w.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(L),onClick:te,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",tt,[e.renderSlot(i.$slots,"button-left",{switchRightPanel:j},void 0,!0),e.createVNode(w.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:d[0]||(d[0]=b=>j("场景树")),active:l.value&&c.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(w.ThreeSvgIcon,{name:"clipping",size:"24",onClick:d[1]||(d[1]=b=>j("剖面视图")),active:l.value&&c.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),e.createElementVNode("div",nt,[e.renderSlot(i.$slots,"button-right",{switchRightPanel:q},void 0,!0),e.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:d[2]||(d[2]=b=>q("关节控制")),active:f.value&&u.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:d[3]||(d[3]=b=>q("动画仿真")),active:f.value&&u.value==="动画仿真"},null,8,["active"])]),e.createElementVNode("div",ot,[e.createVNode(w.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:me}),e.createVNode(w.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:de}),e.createVNode(w.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:ve}),e.createVNode(w.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:fe})]),e.withDirectives(e.createElementVNode("div",rt,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(c.value),1),e.createElementVNode("span",{class:"close",onClick:d[4]||(d[4]=b=>l.value=!1)}," X ")]),e.createElementVNode("div",st,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[c.value==="场景树"?(e.openBlock(),e.createBlock(K.UrdfTree,{key:0,model:m.value},null,8,["model"])):e.createCommentVNode("",!0),c.value==="剖面视图"?(e.openBlock(),e.createBlock(x.ClippingPanel,{key:1,value:e.unref(Y),onChange:ne},null,8,["value"])):e.createCommentVNode("",!0)]),_:1})])],512),[[e.vShow,l.value]]),e.withDirectives(e.createElementVNode("div",it,[e.createElementVNode("div",at,[e.createElementVNode("span",null,e.toDisplayString(u.value),1),e.createElementVNode("span",{class:"close",onClick:d[5]||(d[5]=b=>f.value=!1)}," X ")]),e.createElementVNode("div",ct,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(K.JointPanel,{model:m.value},null,8,["model"]),[[e.vShow,u.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{ref_key:"animationPanelRef",ref:n,cloud:e.unref(k),knife:e.unref(E),vectors:P.value},null,8,["cloud","knife","vectors"]),[[e.vShow,u.value==="动画仿真"&&T.value]])]),_:1})])],512),[[e.vShow,f.value]]),s.value?(e.openBlock(),e.createElementBlock("div",ut,[d[6]||(d[6]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(a.value),1)])):e.createCommentVNode("",!0)])}}}),ft=R._export_sfc(dt,[["__scopeId","data-v-7178b621"]]);exports.default=ft;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),x=require("./iconfont-BU-e8plC.cjs"),p=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs"),I=require("./index-BP07Gnjo.cjs"),K=require("./urdfTree-B73vL4dE.cjs"),R=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),w=require("./svgIcon-CUM54R6L.cjs"),ge=require("./isString-DKZ1g7Pn.cjs");function ye(t=.5,o=4){const r=new p.Mesh(new p.ConeGeometry(t,o,32),new p.MeshStandardMaterial({color:"#919191ff",metalness:.3,roughness:.6})),s=r.geometry.parameters.height;return r.geometry.translate(0,-s/2,0),r.rotation.set(-90,0,0,"XYZ"),r}function Ce(t,o){t.position.copy(o)}function we(t,o,r=new p.Color(16711680)){const s=new p.Vector3;o.getWorldPosition(s);const a=t.geometry.attributes.position,n=t.geometry.attributes.color,l=new p.Color(55551);let c=1/0,f=-1;for(let u=0;u<a.count;u++){const v=new p.Vector3().fromBufferAttribute(a,u).distanceTo(s);v<c&&(c=v,f=u)}for(let u=0;u<n.count;u++)l.toArray(n.array,u*3);if(f!==-1){const u=r.toArray(),m=f*3+2;for(let v=0;v<m;v=v+3)n.array[v]=u[0],n.array[v+1]=u[1],n.array[v+2]=u[2]}n.needsUpdate=!0}function S(t,o,r,s=new p.Color(16711680)){Ce(t,o),we(r,t,s)}const ke={class:"panel-content"},_e={class:"animation-controls"},Ve={class:"control-row"},be={class:"control-row"},Ne={class:"frame-info"},Te={class:"control-row"},Ee=e.defineComponent({__name:"trackAnimationPanel",props:{cloud:{},knife:{},vectors:{}},emits:["getThreeData"],setup(t,{expose:o,emit:r}){const s=t,a=e.computed(()=>s.vectors),n=e.ref(!1),l=e.ref(0),c=e.ref(100);let f=!1;const u=g=>`第 ${g+1} 帧`,m=g=>{if(g<0||g>=a.value.length){console.error(`帧索引 ${g} 超出范围`);return}const y=a.value[g];l.value=g,S(s.knife,y,s.cloud)},v=async()=>{if(a.value.length===0){I.ElMessage.error("无法播放动画:无数据");return}if(!n.value){n.value=!0,f=!1,a.value.length-1===l.value&&(l.value=0);try{for(let g=l.value+1;g<a.value.length&&!f;g++)await new Promise(y=>setTimeout(y,c.value)),m(g);f||I.ElMessage.success("动画播放完成")}catch(g){console.error("动画播放出错:",g)}finally{n.value=!1}}},C=()=>{f=!0,n.value=!1,I.ElMessage.info("动画已停止")},N=g=>{n.value&&C(),m(g)},_=()=>{n.value&&C(),!(l.value+1>=a.value.length)&&m(l.value+1)},V=()=>{n.value&&C(),l.value!==0&&m(l.value-1)},h=()=>{l.value=0};return o({playAnimation:v,stopAnimation:C,forwardFrame:_,backwardFrame:V,resetAnimationFrame:h,reset:async()=>{await C(),h()}}),(g,y)=>{const L=e.resolveComponent("el-input-number"),B=e.resolveComponent("el-form-item"),D=e.resolveComponent("el-form"),$=e.resolveComponent("el-slider");return e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",_e,[e.createElementVNode("div",Ve,[e.createVNode(D,{"label-width":"auto",style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(B,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:e.withCtx(()=>[e.createVNode(L,{modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=z=>c.value=z),min:0,max:5e3,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),e.createElementVNode("div",be,[y[2]||(y[2]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",Ne,e.toDisplayString(l.value+1)+" / "+e.toDisplayString(a.value.length),1)]),e.createElementVNode("div",Te,[y[3]||(y[3]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode($,{modelValue:l.value,"onUpdate:modelValue":y[1]||(y[1]=z=>l.value=z),min:0,max:a.value.length>0?a.value.length-1:0,step:1,"format-tooltip":u,onInput:N,disabled:a.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])])])])}}}),xe=R._export_sfc(Ee,[["__scopeId","data-v-f6fc7a8c"]]);function ze(t){const o=[];return t.forEach(r=>{const[s,a,n]=r.trim().split(/\s+/);o.push(+s,+a,+n)}),o}function U(t,o,r){switch(t){case"X":o.x=+r||0;break;case"Y":o.y=+r||0;break;case"Z":o.z=+r||0;break}}function Ae(t){const o=[],r=["X","Y","Z"];return t.forEach(s=>{const a={x:0,y:0,z:0},n=s.trim();if(!n)return;let l=null,c="";for(let f=0;f<(n==null?void 0:n.length);f++){const u=n[f],m=r.find(v=>v===u);if(m){l&&U(l,a,c),c="",l=m;continue}c=c+u}U(l,a,c),o.push(a.x,a.y,a.z)}),o}const Pe=t=>t==null?void 0:t.filter(r=>r.includes("=")),Me=t=>t.replace(/,/g,""),Fe=t=>t==null?void 0:t.map(r=>Me(r)),Ie=t=>{const o=Pe(t);return Fe(o)};function Ue(t){const o=Ie(t),r=[];return o.forEach(s=>{var v,C,N,_,V,h;let[a,n,l,c]=s.trim().split(/\s+/);n=(v=n==null?void 0:n.trim)==null?void 0:v.call(n),l=(C=l==null?void 0:l.trim)==null?void 0:C.call(l),c=(N=c==null?void 0:c.trim)==null?void 0:N.call(c);const[,f]=(_=n==null?void 0:n.split)==null?void 0:_.call(n,"="),[,u]=(V=l==null?void 0:l.split)==null?void 0:V.call(l,"="),[,m]=(h=c==null?void 0:c.split)==null?void 0:h.call(c,"=");r.push(+f,+u,+m)}),r}const Le=t=>t>="0"&&t<="9",Be=t=>t==="+"||t==="-",De=t=>t===".";function $e(t){return Le(t)||Be(t)||De(t)}function je(t){const o=[],r=new Set(["X","Y","Z"]);return t.forEach(s=>{const a={x:0,y:0,z:0},n=s.trim();if(!n)return;let l=null,c="";for(let f=0;f<(n==null?void 0:n.length);f++){const u=n[f];if(u==="T")break;const m=r.has(u)?u:null,v=$e(u);if(m||!v){l&&U(l,a,c),l=m,c="";continue}c=c+u}l&&U(l,a,c),o.push(a.x,a.y,a.z)}),o}function qe(t){return t==null?void 0:t.includes("=")}async function Xe(t){var a,n;const o=(a=t==null?void 0:t.trim())==null?void 0:a.split(/\r?\n/);if(qe(t))return Ue(o);const r=o==null?void 0:o[0],s=(n=r==null?void 0:r.trim())==null?void 0:n.split(/\s+/);if((s==null?void 0:s.length)>=3)return ze(o);if((s==null?void 0:s.length)===1)return Ae(o)}async function Ye(t){const o=t.trim().split(/\r?\n/),r=[];return o.forEach(s=>{const a=s.trim().split(/\s+/);if(a.length!=3)return;const[n,l,c]=a;r.push(+n,+l,+c)}),r}async function Ze(t){const o=t.trim().split(/\r?\n/),r=[];return o.forEach(s=>{const a=s.trim().split(/\s+/);if(a.length!=3)return;const[n,l,c]=a;r.push(+n,+l,+c)}),r}async function Oe(t){let o=t.trim().split(/\r?\n/);return o=o.filter(s=>{const a=s.startsWith("X")||s.startsWith("Y")||s.startsWith("Z"),n=s.startsWith("G")&&(s.includes("X")||s.includes("Y")||s.includes("Z")),l=s.startsWith("N")&&(s.includes("X")||s.includes("Y")||s.includes("Z"));return a||n||l}),je(o)}async function Ge(t,o){const{isCyd:r,isUv:s,isCpt:a,isNc:n}=o;return s?Xe(t):r?Ze(t):a?Ye(t):n?Oe(t):[]}function Ke(t){const o=[];for(let r=0;r<t.length;r+=3)o.push(new p.Vector3(t[r],t[r+1],t[r+2]));return o}function Re(t){const o=new p.BufferGeometry;o.setAttribute("position",new p.Float32BufferAttribute(t,3));const r=new p.LineBasicMaterial({color:55551,linewidth:3});return new p.Line(o,r)}function Se(t,o){if(!o||o.length<3)return;const{scene:r,camera:s,renderer:a,controls:n}=t();if(!r||!s||!a||!n)return;const l=Re(o);return l.name="轨迹路径",r.add(l),l}function We(t,o,r,s=4,a=50){let n=1/0,l=-1/0,c=1/0,f=-1/0,u=1/0,m=-1/0;for(let h=0;h<t.length;h+=3){const A=t[h],g=t[h+1],y=t[h+2];n=Math.min(n,A),l=Math.max(l,A),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,y),m=Math.max(m,y)}const C=Math.sqrt((l-n)**2+(f-c)**2+(m-u)**2)*.05,N=p.MathUtils.degToRad(o.fov),_=2*Math.tan(N/2)*a,V=C/_*r.domElement.height*(s/4);return Math.min(.4,V)}function He(t){if(t.length%3!==0)return console.error("points array length is not a multiple of 3:",t),null;const o=new p.BufferGeometry;o.setAttribute("position",new p.Float32BufferAttribute(t,3));const r=new Float32Array(t.length);for(let n=0;n<t.length;n+=3)r[n]=0,r[n+1]=.847,r[n+2]=1;o.setAttribute("color",new p.BufferAttribute(r,3));const s=new p.PointsMaterial({vertexColors:!0,size:.4,sizeAttenuation:!0}),a=new p.Points(o,s);return s.needsUpdate=!0,a}function Je(t,o){if(!o)return;const{scene:r,camera:s,renderer:a,controls:n}=t();if(!r||!s||!a||!n)return;const l=He(o);if(!l)return;l.name="轨迹路径",r.add(l);const c=We(o,s,a,.1,50);return l.material.size=c,l}const Qe={class:"obj-viewer-container"},et={class:"buttonGroup-topLeft"},tt={class:"buttonGroup-left"},nt={class:"buttonGroup-right"},ot={class:"buttonGroup-bottom"},rt={class:"left-panel"},lt={class:"panel-header"},st={class:"panel-body"},it={class:"right-panel"},at={class:"panel-header"},ct={class:"panel-body"},ut={key:0,class:"loading-overlay"},dt=e.defineComponent({__name:"threeTrackPathView",props:{fileBlobs:{},threeData:{default:()=>""},trackFileType:{}},setup(t){const o=t,r=e.ref(null),s=e.ref(!1),a=e.ref(""),n=e.ref(),l=e.ref(!1),c=e.ref(""),f=e.ref(!1),u=e.ref(""),m=e.shallowRef(null),v=e.shallowRef(null),{currentModels:C,resetView:N,initThreeJS:_,handleResize:V,getThreeJSObjects:h,cleanup:A,setModels:g,setAndFitModels:y,axesHelperVisible:L,toggleAxesVisibility:B,zoomIn:D,zoomOut:$}=x.useThreeJS(r),{isAnimating:z,toggleAnimation:W,startAnimation:vt,stopAnimation:H}=x.useAnimation(h,C),{isClipping:J,activeClippingAxis:Y,toggleClipping:Q,updateClippingPlanes:ee}=x.useClipping(h,C),te=()=>{B()},ne=i=>{Y.value=i,ee()},j=i=>{l.value=!0,c.value=i,i==="剖面视图"&&!J.value&&Q()},q=i=>{f.value=!0,u.value=i},X=e.ref([]),P=e.ref([]),oe=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isUv}),re=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isCyd}),le=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isCpt}),T=e.computed(()=>{var d;return(d=o.trackFileType)==null?void 0:d.isNc}),Z=e.computed(()=>{const i=o.fileBlobs||[];return i==null?void 0:i[0]});let k=e.shallowRef(),E=e.shallowRef();const se=()=>{const{scene:i}=h();k.value&&i&&(x.disposeObj(k.value,i),k.value=null)},ie=()=>{const{scene:i}=h();E.value&&i&&(x.disposeObj(E.value,i),E.value=null)},O=()=>{se(),ie()},ae=async i=>{const d=URL.createObjectURL(i),M=await p.readFileText(d);if(URL.revokeObjectURL(d),ge.isString(M)){X.value=await Ge(M,o.trackFileType)||[];const b=X.value;oe.value&&(k.value=Se(h,b)),(re.value||le.value||T.value)&&(k.value=Je(h,b))}},ce=async()=>{var i,d;E.value=ye(),P.value=Ke(X.value),P.value&&P.value.length&&(S(E.value,P.value[0],k.value,new p.Color(16711680)),(d=(i=v.value)==null?void 0:i.add)==null||d.call(i,E.value))},G=async i=>{O(),await ae(i),k.value&&x.frameCameraToObject3D(h,k.value),T.value&&ce()};e.watch(()=>Z.value,async i=>{i&&await G(i)},{immediate:!0,deep:!0});const ue=async()=>{var i;await((i=n==null?void 0:n.value)==null?void 0:i.reset()),await G(Z.value)},de=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.playAnimation())},fe=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.stopAnimation())},ve=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.forwardFrame())},me=()=>{var i;T.value&&((i=n==null?void 0:n.value)==null||i.backwardFrame())},pe=()=>{_(),e.nextTick(()=>{r.value&&(F=new ResizeObserver(V),F.observe(r.value))});const i=h();v.value=i.scene,v.value&&(v.value.name="CPMPIP")},he=()=>{F&&F.disconnect(),z.value&&H(),O(),A()};let F=null;return e.onMounted(async()=>{try{pe()}catch(i){console.error("Three.js 初始化失败:",i),I.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{he()}),(i,d)=>{const M=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",{ref_key:"threejsContainer",ref:r,class:"threejs-container"},null,512),e.createElementVNode("div",et,[e.createVNode(w.ThreeSvgIcon,{name:"viewReset",size:"24",onClick:ue,title:"重置"}),e.createVNode(w.ThreeSvgIcon,{name:"fangda",size:"24",title:"放大",onClick:e.unref(D)},null,8,["onClick"]),e.createVNode(w.ThreeSvgIcon,{name:"suoxiao",size:"24",title:"缩小",onClick:e.unref($)},null,8,["onClick"]),e.createVNode(w.ThreeSvgIcon,{name:"lookAround",size:"24",onClick:e.unref(W),title:e.unref(z)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(w.ThreeSvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(L),onClick:te,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",tt,[e.renderSlot(i.$slots,"button-left",{switchRightPanel:j},void 0,!0),e.createVNode(w.ThreeSvgIcon,{name:"jiegoushu",size:"24",onClick:d[0]||(d[0]=b=>j("场景树")),active:l.value&&c.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(w.ThreeSvgIcon,{name:"clipping",size:"24",onClick:d[1]||(d[1]=b=>j("剖面视图")),active:l.value&&c.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),e.createElementVNode("div",nt,[e.renderSlot(i.$slots,"button-right",{switchRightPanel:q},void 0,!0),e.createVNode(w.ThreeSvgIcon,{name:"guanjiekongzhi",size:"24",onClick:d[2]||(d[2]=b=>q("关节控制")),active:f.value&&u.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(w.ThreeSvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:d[3]||(d[3]=b=>q("动画仿真")),active:f.value&&u.value==="动画仿真"},null,8,["active"])]),e.createElementVNode("div",ot,[e.createVNode(w.ThreeSvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:me}),e.createVNode(w.ThreeSvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:de}),e.createVNode(w.ThreeSvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:ve}),e.createVNode(w.ThreeSvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:fe})]),e.withDirectives(e.createElementVNode("div",rt,[e.createElementVNode("div",lt,[e.createElementVNode("span",null,e.toDisplayString(c.value),1),e.createElementVNode("span",{class:"close",onClick:d[4]||(d[4]=b=>l.value=!1)}," X ")]),e.createElementVNode("div",st,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[c.value==="场景树"?(e.openBlock(),e.createBlock(K.UrdfTree,{key:0,model:m.value},null,8,["model"])):e.createCommentVNode("",!0),c.value==="剖面视图"?(e.openBlock(),e.createBlock(x.ClippingPanel,{key:1,value:e.unref(Y),onChange:ne},null,8,["value"])):e.createCommentVNode("",!0)]),_:1})])],512),[[e.vShow,l.value]]),e.withDirectives(e.createElementVNode("div",it,[e.createElementVNode("div",at,[e.createElementVNode("span",null,e.toDisplayString(u.value),1),e.createElementVNode("span",{class:"close",onClick:d[5]||(d[5]=b=>f.value=!1)}," X ")]),e.createElementVNode("div",ct,[e.createVNode(M,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(K.JointPanel,{model:m.value},null,8,["model"]),[[e.vShow,u.value==="关节控制"]]),e.withDirectives(e.createVNode(xe,{ref_key:"animationPanelRef",ref:n,cloud:e.unref(k),knife:e.unref(E),vectors:P.value},null,8,["cloud","knife","vectors"]),[[e.vShow,u.value==="动画仿真"&&T.value]])]),_:1})])],512),[[e.vShow,f.value]]),s.value?(e.openBlock(),e.createElementBlock("div",ut,[d[6]||(d[6]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(a.value),1)])):e.createCommentVNode("",!0)])}}}),ft=R._export_sfc(dt,[["__scopeId","data-v-7178b621"]]);exports.default=ft;
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as ce, computed as U, ref as w, resolveComponent as E, createElementBlock as ee, openBlock as V, createElementVNode as d, createVNode as p, withCtx as I, toDisplayString as X, shallowRef as D, watch as Ee, onMounted as Ve, onBeforeUnmount as Xe, withDirectives as N, createCommentVNode as S, unref as A, renderSlot as ie, createBlock as le, vShow as Z, nextTick as Ye } from "vue";
2
- import { u as De, a as Ne, b as Ze, C as Be, f as Ie, d as re } from "./iconfont-AyWwUMxc.js";
3
- import { aj as O, au as Oe, c5 as Ge, b2 as qe, ag as te, b4 as ue, bg as fe, bm as Ke, b6 as We, bl as Je, bi as Re, bj as He, aE as Qe, c6 as Se } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
4
- import { E as B } from "./index-7MBVUN82.js";
5
- import { U as et, J as tt } from "./urdfTree-CQQPUmyr.js";
2
+ import { u as De, a as Ne, b as Ze, C as Be, f as Ie, d as re } from "./iconfont-hcY1c1Ph.js";
3
+ import { aj as O, au as Oe, c5 as Ge, b2 as qe, ag as te, b4 as ue, bg as fe, bm as Ke, b6 as We, bl as Je, bi as Re, bj as He, aE as Qe, c6 as Se } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
4
+ import { E as B } from "./index-DufZVmKf.js";
5
+ import { U as et, J as tt } from "./urdfTree-CiLrHpgG.js";
6
6
  import { _ as ve } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
7
  import { T as b } from "./svgIcon-D-_fXUBL.js";
8
- import { i as nt } from "./isString-D70CzuJZ.js";
8
+ import { i as nt } from "./isString-5Nawl-Uc.js";
9
9
  function ot(e = 0.5, n = 4) {
10
10
  const o = new Oe(
11
11
  new Ge(e, n, 32),
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),h=require("./index-DOItJqcJ.cjs"),b=require("./index-CXC0u8pm.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs"),F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),R={SINGLE:"单机",DOUBLE:"双机"},N={ROBOT:1,PIPECOMPARSION:2},i={ROBOT_SCENE:"robot",TRACK_PATH:"trackPath",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},I=h.defineStore("threeState",{state:()=>({data:{files:[],data:{}}}),actions:{setData(v){this.data=v},getData(){return this.data}}});function O(){const v=b.useMenuState(h.pinia),{platform:g}=h.storeToRefs(v),P=I(h.pinia),c=["uv","cyd","nc"],d=["urdf"],r=["obj","stl"],T=[...c,...d,...r],f=t=>{if(!C())throw new Error("不是三维系统");P.setData(t)},y=()=>P.getData(),C=()=>g.value==="three",l=t=>S.getFileExtension(t),m=t=>{if(!t)return!1;const o=l(t);return T==null?void 0:T.includes(o)},E=t=>{if(!t)return!1;const o=l(t);return r==null?void 0:r.includes(o)},p=t=>{if(!t)return!1;const o=l(t);return c==null?void 0:c.includes(o)},u=t=>{if(!t)return{isCpt:!1,isCyd:!1,isUv:!1,isNc:!1};const o=l(t),a=c==null?void 0:c.find(k=>k===o);return{isCpt:a==="cpt",isCyd:a==="cyd",isUv:a==="uv",isNc:a==="nc"}},_=t=>{if(!t)return!1;const o=l(t);return d==null?void 0:d.includes(o)},B=t=>C()&&m(t),n=t=>({url:t,extension:l(t)});return{getData:y,setData:f,isThreeSystem:C,isUrdf:_,isGeneralFile:E,isTrackPathFile:p,isThreeFile:m,isUseBackdrop:B,initTrackFileType:u,getFileExtension:l,getFileInfo:n,getFilesInfo:t=>{const o=[];for(let a=0;a<t.length;a++){const w=t[a],k=n(w);o.push(k)}return o}}}const V={class:"three-platform mv-inline"},A={class:"top-menu"},M={key:4,class:"loading"},H=e.defineComponent({__name:"threeViewerHost",props:{files:{default:()=>[]},threeData:{},componentType:{},width:{default:"100%"},height:{default:"100%"}},setup(v){const g=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-Cuz_EMZU.cjs"))),P=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-DKs8aYcW.cjs"))),c=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-BrPuXqrr.cjs"))),d=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-DFMYV0Jz.cjs"))),r=v,T=b.useMenuState(h.pinia),{platName:f}=h.storeToRefs(T),{isUrdf:y,isTrackPathFile:C}=O(),l=e.computed(()=>{var n;return(n=r==null?void 0:r.files)==null?void 0:n.map(s=>{const{url:t}=s;return t})}),m=e.computed(()=>{var t;const n=(t=r==null?void 0:r.files)==null?void 0:t[0];return(n==null?void 0:n.extension)||""}),E=e.computed(()=>{var n,s;return(s=(n=r==null?void 0:r.threeData)==null?void 0:n.data)==null?void 0:s.trackFileType}),p=e.computed(()=>{if(r.componentType)switch(r.componentType){case"robot":return i.ROBOT_SCENE;case"track":return i.TRACK_PATH;case"cpmpip":return i.CPMPIP_SCENE;case"preview":return i.PREVIEW}return(f==null?void 0:f.value)===S.platNameConstants.CPMPIP&&y(m.value)?i.CPMPIP_SCENE:(f==null?void 0:f.value)===S.platNameConstants.ROBOT&&y(m.value)?i.ROBOT_SCENE:C(m.value)&&E.value?i.TRACK_PATH:i.PREVIEW}),u=e.ref([]),_=e.ref(!1);async function B(n){if(!n||!n.length){u.value=[];return}_.value=!0;try{const s=await Promise.all(n.map(t=>S.downloadFile(t)));u.value=s}catch(s){console.error("文件下载时发生错误:",s),u.value=[]}finally{_.value=!1}}return e.watch(()=>l.value,async n=>{await B(n||[])},{immediate:!0,deep:!0}),(n,s)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",A,[e.renderSlot(n.$slots,"top-menu",{},void 0,!0)]),p.value===e.unref(i).ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(g),{key:0,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).TRACK_PATH?(e.openBlock(),e.createBlock(e.unref(c),{key:1,fileBlobs:u.value,threeData:r.threeData,trackFileType:E.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData","trackFileType"])):p.value===e.unref(i).CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(d),{key:2,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).PREVIEW?(e.openBlock(),e.createBlock(e.unref(P),{key:3,fileBlobs:u.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",M," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)]))}}),D=F._export_sfc(H,[["__scopeId","data-v-9798f55b"]]),$=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=D;exports.robotMode=R;exports.sceneType=N;exports.threeViewerHost=$;exports.useThreeState=I;exports.useThreeSystem=O;
1
+ "use strict";const e=require("vue"),h=require("./index-BP07Gnjo.cjs"),b=require("./index-By--71sB.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs"),F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),R={SINGLE:"单机",DOUBLE:"双机"},N={ROBOT:1,PIPECOMPARSION:2},i={ROBOT_SCENE:"robot",TRACK_PATH:"trackPath",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},I=h.defineStore("threeState",{state:()=>({data:{files:[],data:{}}}),actions:{setData(v){this.data=v},getData(){return this.data}}});function O(){const v=b.useMenuState(h.pinia),{platform:g}=h.storeToRefs(v),P=I(h.pinia),c=["uv","cyd","nc"],d=["urdf"],r=["obj","stl"],T=[...c,...d,...r],f=t=>{if(!C())throw new Error("不是三维系统");P.setData(t)},y=()=>P.getData(),C=()=>g.value==="three",l=t=>S.getFileExtension(t),m=t=>{if(!t)return!1;const o=l(t);return T==null?void 0:T.includes(o)},E=t=>{if(!t)return!1;const o=l(t);return r==null?void 0:r.includes(o)},p=t=>{if(!t)return!1;const o=l(t);return c==null?void 0:c.includes(o)},u=t=>{if(!t)return{isCpt:!1,isCyd:!1,isUv:!1,isNc:!1};const o=l(t),a=c==null?void 0:c.find(k=>k===o);return{isCpt:a==="cpt",isCyd:a==="cyd",isUv:a==="uv",isNc:a==="nc"}},_=t=>{if(!t)return!1;const o=l(t);return d==null?void 0:d.includes(o)},B=t=>C()&&m(t),n=t=>({url:t,extension:l(t)});return{getData:y,setData:f,isThreeSystem:C,isUrdf:_,isGeneralFile:E,isTrackPathFile:p,isThreeFile:m,isUseBackdrop:B,initTrackFileType:u,getFileExtension:l,getFileInfo:n,getFilesInfo:t=>{const o=[];for(let a=0;a<t.length;a++){const w=t[a],k=n(w);o.push(k)}return o}}}const V={class:"three-platform mv-inline"},A={class:"top-menu"},M={key:4,class:"loading"},H=e.defineComponent({__name:"threeViewerHost",props:{files:{default:()=>[]},threeData:{},componentType:{},width:{default:"100%"},height:{default:"100%"}},setup(v){const g=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-BFqSAGP1.cjs"))),P=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-DUyJ3mb_.cjs"))),c=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-C3tSwHTX.cjs"))),d=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-N80YwIx-.cjs"))),r=v,T=b.useMenuState(h.pinia),{platName:f}=h.storeToRefs(T),{isUrdf:y,isTrackPathFile:C}=O(),l=e.computed(()=>{var n;return(n=r==null?void 0:r.files)==null?void 0:n.map(s=>{const{url:t}=s;return t})}),m=e.computed(()=>{var t;const n=(t=r==null?void 0:r.files)==null?void 0:t[0];return(n==null?void 0:n.extension)||""}),E=e.computed(()=>{var n,s;return(s=(n=r==null?void 0:r.threeData)==null?void 0:n.data)==null?void 0:s.trackFileType}),p=e.computed(()=>{if(r.componentType)switch(r.componentType){case"robot":return i.ROBOT_SCENE;case"track":return i.TRACK_PATH;case"cpmpip":return i.CPMPIP_SCENE;case"preview":return i.PREVIEW}return(f==null?void 0:f.value)===S.platNameConstants.CPMPIP&&y(m.value)?i.CPMPIP_SCENE:(f==null?void 0:f.value)===S.platNameConstants.ROBOT&&y(m.value)?i.ROBOT_SCENE:C(m.value)&&E.value?i.TRACK_PATH:i.PREVIEW}),u=e.ref([]),_=e.ref(!1);async function B(n){if(!n||!n.length){u.value=[];return}_.value=!0;try{const s=await Promise.all(n.map(t=>S.downloadFile(t)));u.value=s}catch(s){console.error("文件下载时发生错误:",s),u.value=[]}finally{_.value=!1}}return e.watch(()=>l.value,async n=>{await B(n||[])},{immediate:!0,deep:!0}),(n,s)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",A,[e.renderSlot(n.$slots,"top-menu",{},void 0,!0)]),p.value===e.unref(i).ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(g),{key:0,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).TRACK_PATH?(e.openBlock(),e.createBlock(e.unref(c),{key:1,fileBlobs:u.value,threeData:r.threeData,trackFileType:E.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData","trackFileType"])):p.value===e.unref(i).CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(d),{key:2,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).PREVIEW?(e.openBlock(),e.createBlock(e.unref(P),{key:3,fileBlobs:u.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",M," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)]))}}),D=F._export_sfc(H,[["__scopeId","data-v-9798f55b"]]),$=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=D;exports.robotMode=R;exports.sceneType=N;exports.threeViewerHost=$;exports.useThreeState=I;exports.useThreeSystem=O;
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as U, defineAsyncComponent as S, computed as I, ref as R, watch as H, createElementBlock as N, openBlock as T, createElementVNode as K, createBlock as B, createCommentVNode as V, renderSlot as u, unref as m, withCtx as d } from "vue";
2
- import { bD as W, p as w, s as $ } from "./index-7MBVUN82.js";
3
- import { u as A } from "./index-3oQGURYh.js";
4
- import { c as j, a$ as M, b0 as L } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
2
+ import { bD as W, p as w, s as $ } from "./index-DufZVmKf.js";
3
+ import { u as A } from "./index-VnVlZEmb.js";
4
+ import { c as j, a$ as M, b0 as L } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
5
5
  import { _ as G } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
6
  const se = {
7
7
  SINGLE: "单机",
@@ -113,7 +113,7 @@ const q = { class: "three-platform mv-inline" }, J = { class: "top-menu" }, Q =
113
113
  height: { default: "100%" }
114
114
  },
115
115
  setup(E) {
116
- const D = S(() => import("./threeSceneView-KKWkkD2y.js")), y = S(() => import("./threePreview-BY1POvl8.js")), i = S(() => import("./threeTrackPathView-D4w6l9m2.js")), p = S(() => import("./threeSceneViewForCPMPIP-Dwa17cnT.js")), n = E, P = A(w), { platName: f } = $(P), { isUrdf: _, isTrackPathFile: g } = Y(), c = I(() => {
116
+ const D = S(() => import("./threeSceneView-Cr5UX8FG.js")), y = S(() => import("./threePreview-D-RkLYC8.js")), i = S(() => import("./threeTrackPathView-Cp83uYdc.js")), p = S(() => import("./threeSceneViewForCPMPIP-CTvL-EyL.js")), n = E, P = A(w), { platName: f } = $(P), { isUrdf: _, isTrackPathFile: g } = Y(), c = I(() => {
117
117
  var t;
118
118
  return (t = n == null ? void 0 : n.files) == null ? void 0 : t.map((s) => {
119
119
  const { url: e } = s;
@@ -1 +1 @@
1
- "use strict";const n=require("vue"),k=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs"),x=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),J=(o,a)=>{if(!a)return null;const i=o.joints[a];return i||null},V=(o,a)=>{if(!a)return null;const i=J(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},F=(o,a)=>{if(!a)return null;const i=o.links[a];return i||null},L=(o,a)=>{if(!a)return null;const i=F(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},E=o=>{const a=o.joints;return Object.values(a)},M=o=>E(o).filter(u=>u.jointType!=="fixed"),N=o=>{const a=o.links;return Object.keys(a)},w={class:"panel-content"},B={key:0,class:"joints-list"},b={class:"joint-info-row"},I={class:"joint-left"},S={class:"joint-name"},C={class:"joint-range"},D={class:"joint-type"},P={key:0,class:"joint-control-row"},T={class:"slider-container"},U=["min","max","value","onInput"],A={class:"value-display"},R={class:"joint-value"},q={class:"unit"},O={key:1,class:"empty-state"},K=n.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:a}){const i=o,u=n.ref([]),c=n.ref(null),f=(r,e=!1)=>r==="revolute"?e?Math.PI:-Math.PI:r==="prismatic"?e?1:-1:0,h=r=>{if(!r||!r.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const e=[];return E(r).forEach(l=>{var d,p;if(l.jointType==="fixed")return;let t={lower:((d=l.limit)==null?void 0:d.lower)??f(l.jointType,!1),upper:((p=l.limit)==null?void 0:p.upper)??f(l.jointType,!0)};l.jointType==="continuous"&&(t={lower:-10*Math.PI,upper:10*Math.PI}),e.push({name:l.name,type:l.jointType||"unknown",limit:t,currentValue:l.angle||0,urdfJoint:l})}),e},m=(r,e)=>{var d;const s=u.value.find(p=>p.name===r);if(!s)return;const l=parseFloat(e),t=Math.max(s.limit.lower,Math.min(s.limit.upper,l));s.currentValue=t,(d=i.model)!=null&&d.setJointValue?i.model.setJointValue(r,t):s.urdfJoint.setJointValue(t)},_=()=>{u.value.forEach(r=>{(r.type==="revolute"||r.type==="continuous"||r.type==="prismatic")&&m(r.name,0)})},g=()=>{i.model&&u.value.forEach(r=>{r.urdfJoint.angle!==void 0&&r.currentValue!==r.urdfJoint.angle&&(r.currentValue=r.urdfJoint.angle)})},v=()=>{const r=()=>{g(),c.value=requestAnimationFrame(r)};r()},y=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return n.watch(()=>i.model,r=>{r?u.value=h(r):u.value=[]},{immediate:!0}),n.onMounted(()=>{v()}),n.onUnmounted(()=>{y()}),a({resetAllJoints:_}),(r,e)=>(n.openBlock(),n.createElementBlock("div",w,[u.value.length>0?(n.openBlock(),n.createElementBlock("div",B,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,s=>(n.openBlock(),n.createElementBlock("div",{key:s.name,class:"joint-item"},[n.createElementVNode("div",b,[n.createElementVNode("div",I,[n.createElementVNode("span",S,n.toDisplayString(s.name),1),n.createElementVNode("span",C," ["+n.toDisplayString(s.limit.lower.toFixed(2))+", "+n.toDisplayString(s.limit.upper.toFixed(2))+"] ",1)]),n.createElementVNode("span",D,n.toDisplayString(s.type),1)]),s.type==="revolute"||s.type==="prismatic"||s.type==="continuous"?(n.openBlock(),n.createElementBlock("div",P,[n.createElementVNode("div",T,[n.createElementVNode("input",{type:"range",min:s.limit.lower,max:s.limit.upper,step:"0.001",value:s.currentValue,onInput:l=>m(s.name,l.target.value),class:"joint-slider"},null,40,U)]),n.createElementVNode("div",A,[n.createElementVNode("span",R,n.toDisplayString(s.currentValue?Number(s.currentValue).toFixed(3):"0.000"),1),n.createElementVNode("span",q,n.toDisplayString(s.type==="prismatic"?"m":"rad"),1)])])):n.createCommentVNode("",!0)]))),128))])):(n.openBlock(),n.createElementBlock("div",O,e[0]||(e[0]=[n.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),$=x._export_sfc(K,[["__scopeId","data-v-750b831d"]]),H={class:"panel-content"},z="id",G={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)}},emits:["nodeClick"],setup(o,{emit:a}){const i=o,u=a,c=n.ref([]),f={children:"children",label:"label"},h=e=>{u("nodeClick",e)},m=(e,s=0)=>{const l=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const d={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:s+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:m(t==null?void 0:t.children,s+1),path:t==null?void 0:t.name};l.push(d)}}),l},_=e=>e?[{name:e==null?void 0:e.name,label:e==null?void 0:e.name,show:!0,level:1,isPenultimate:!1,type:e==null?void 0:e.type,id:e==null?void 0:e.id,limit:(e==null?void 0:e.limit)??"",children:m(e==null?void 0:e.children,1)||[],path:e==null?void 0:e.name}]:[],g=(e,s)=>{const l=[],t=[...e];for(;t.length>0&&l.length<s;){const d=t.shift();d.children&&d.children.length>0&&(l.push(d.id),t.push(...d.children))}return l},v=(e,s)=>{const l=[];return e.forEach(t=>{if(t.children&&t.children.length>0){l.push(t.id);const d=t.children.filter(p=>p.children&&p.children.length>0).slice(0,s).map(p=>p.id);l.push(...d)}}),l.slice(0,s+1)},y=n.computed(()=>!c.value||c.value.length===0?[]:i.expandStrategy==="firstLevel"?v(c.value,i.maxExpandCount):g(c.value,i.maxExpandCount)),r=n.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:i!=null&&i.model?_(i.model):[],path:"场景"}]);return n.watch(r,e=>{c.value=JSON.parse(JSON.stringify(e))},{immediate:!0}),(e,s)=>{const l=n.resolveComponent("el-tree");return n.openBlock(),n.createElementBlock("div",H,[n.createVNode(l,{data:c.value,props:f,"default-expanded-keys":y.value,"node-key":z,onNodeClick:h},null,8,["data","default-expanded-keys"])])}}},Q=x._export_sfc(G,[["__scopeId","data-v-cfde50c3"]]);exports.JointPanel=$;exports.UrdfTree=Q;exports.getAllLinkName=N;exports.getMeshFromJoint=V;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=J;
1
+ "use strict";const n=require("vue"),k=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs"),x=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),J=(o,a)=>{if(!a)return null;const i=o.joints[a];return i||null},V=(o,a)=>{if(!a)return null;const i=J(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},F=(o,a)=>{if(!a)return null;const i=o.links[a];return i||null},L=(o,a)=>{if(!a)return null;const i=F(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},E=o=>{const a=o.joints;return Object.values(a)},M=o=>E(o).filter(u=>u.jointType!=="fixed"),N=o=>{const a=o.links;return Object.keys(a)},w={class:"panel-content"},B={key:0,class:"joints-list"},b={class:"joint-info-row"},I={class:"joint-left"},S={class:"joint-name"},C={class:"joint-range"},D={class:"joint-type"},P={key:0,class:"joint-control-row"},T={class:"slider-container"},U=["min","max","value","onInput"],A={class:"value-display"},R={class:"joint-value"},q={class:"unit"},O={key:1,class:"empty-state"},K=n.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:a}){const i=o,u=n.ref([]),c=n.ref(null),f=(r,e=!1)=>r==="revolute"?e?Math.PI:-Math.PI:r==="prismatic"?e?1:-1:0,h=r=>{if(!r||!r.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const e=[];return E(r).forEach(l=>{var d,p;if(l.jointType==="fixed")return;let t={lower:((d=l.limit)==null?void 0:d.lower)??f(l.jointType,!1),upper:((p=l.limit)==null?void 0:p.upper)??f(l.jointType,!0)};l.jointType==="continuous"&&(t={lower:-10*Math.PI,upper:10*Math.PI}),e.push({name:l.name,type:l.jointType||"unknown",limit:t,currentValue:l.angle||0,urdfJoint:l})}),e},m=(r,e)=>{var d;const s=u.value.find(p=>p.name===r);if(!s)return;const l=parseFloat(e),t=Math.max(s.limit.lower,Math.min(s.limit.upper,l));s.currentValue=t,(d=i.model)!=null&&d.setJointValue?i.model.setJointValue(r,t):s.urdfJoint.setJointValue(t)},_=()=>{u.value.forEach(r=>{(r.type==="revolute"||r.type==="continuous"||r.type==="prismatic")&&m(r.name,0)})},g=()=>{i.model&&u.value.forEach(r=>{r.urdfJoint.angle!==void 0&&r.currentValue!==r.urdfJoint.angle&&(r.currentValue=r.urdfJoint.angle)})},v=()=>{const r=()=>{g(),c.value=requestAnimationFrame(r)};r()},y=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return n.watch(()=>i.model,r=>{r?u.value=h(r):u.value=[]},{immediate:!0}),n.onMounted(()=>{v()}),n.onUnmounted(()=>{y()}),a({resetAllJoints:_}),(r,e)=>(n.openBlock(),n.createElementBlock("div",w,[u.value.length>0?(n.openBlock(),n.createElementBlock("div",B,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,s=>(n.openBlock(),n.createElementBlock("div",{key:s.name,class:"joint-item"},[n.createElementVNode("div",b,[n.createElementVNode("div",I,[n.createElementVNode("span",S,n.toDisplayString(s.name),1),n.createElementVNode("span",C," ["+n.toDisplayString(s.limit.lower.toFixed(2))+", "+n.toDisplayString(s.limit.upper.toFixed(2))+"] ",1)]),n.createElementVNode("span",D,n.toDisplayString(s.type),1)]),s.type==="revolute"||s.type==="prismatic"||s.type==="continuous"?(n.openBlock(),n.createElementBlock("div",P,[n.createElementVNode("div",T,[n.createElementVNode("input",{type:"range",min:s.limit.lower,max:s.limit.upper,step:"0.001",value:s.currentValue,onInput:l=>m(s.name,l.target.value),class:"joint-slider"},null,40,U)]),n.createElementVNode("div",A,[n.createElementVNode("span",R,n.toDisplayString(s.currentValue?Number(s.currentValue).toFixed(3):"0.000"),1),n.createElementVNode("span",q,n.toDisplayString(s.type==="prismatic"?"m":"rad"),1)])])):n.createCommentVNode("",!0)]))),128))])):(n.openBlock(),n.createElementBlock("div",O,e[0]||(e[0]=[n.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),$=x._export_sfc(K,[["__scopeId","data-v-750b831d"]]),H={class:"panel-content"},z="id",G={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)}},emits:["nodeClick"],setup(o,{emit:a}){const i=o,u=a,c=n.ref([]),f={children:"children",label:"label"},h=e=>{u("nodeClick",e)},m=(e,s=0)=>{const l=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const d={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:s+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:m(t==null?void 0:t.children,s+1),path:t==null?void 0:t.name};l.push(d)}}),l},_=e=>e?[{name:e==null?void 0:e.name,label:e==null?void 0:e.name,show:!0,level:1,isPenultimate:!1,type:e==null?void 0:e.type,id:e==null?void 0:e.id,limit:(e==null?void 0:e.limit)??"",children:m(e==null?void 0:e.children,1)||[],path:e==null?void 0:e.name}]:[],g=(e,s)=>{const l=[],t=[...e];for(;t.length>0&&l.length<s;){const d=t.shift();d.children&&d.children.length>0&&(l.push(d.id),t.push(...d.children))}return l},v=(e,s)=>{const l=[];return e.forEach(t=>{if(t.children&&t.children.length>0){l.push(t.id);const d=t.children.filter(p=>p.children&&p.children.length>0).slice(0,s).map(p=>p.id);l.push(...d)}}),l.slice(0,s+1)},y=n.computed(()=>!c.value||c.value.length===0?[]:i.expandStrategy==="firstLevel"?v(c.value,i.maxExpandCount):g(c.value,i.maxExpandCount)),r=n.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:i!=null&&i.model?_(i.model):[],path:"场景"}]);return n.watch(r,e=>{c.value=JSON.parse(JSON.stringify(e))},{immediate:!0}),(e,s)=>{const l=n.resolveComponent("el-tree");return n.openBlock(),n.createElementBlock("div",H,[n.createVNode(l,{data:c.value,props:f,"default-expanded-keys":y.value,"node-key":z,onNodeClick:h},null,8,["data","default-expanded-keys"])])}}},Q=x._export_sfc(G,[["__scopeId","data-v-cfde50c3"]]);exports.JointPanel=$;exports.UrdfTree=Q;exports.getAllLinkName=N;exports.getMeshFromJoint=V;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=J;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as I, ref as F, watch as M, onMounted as C, onUnmounted as E, createElementBlock as m, openBlock as f, Fragment as P, renderList as T, createElementVNode as c, createCommentVNode as U, toDisplayString as h, computed as L, resolveComponent as S, createVNode as A } from "vue";
2
- import { au as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
2
+ import { au as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
3
3
  import { _ as b } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
4
  const D = (i, a) => {
5
5
  if (!a)
@@ -1,11 +1,11 @@
1
1
  var ce = Object.defineProperty;
2
2
  var de = (b, l, t) => l in b ? ce(b, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : b[l] = t;
3
3
  var J = (b, l, t) => de(b, typeof l != "symbol" ? l + "" : l, t);
4
- import { U as me } from "./URDFLoader-BNqQfPqb.js";
5
- import { S as ve, M as pe, O as fe } from "./MTLLoader-DO6JtV2J.js";
6
- import { c7 as be, c8 as re, b1 as O, az as we, au as he, c9 as E, ah as _e, ca as ge, bu as je, ag as ye } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DgCNtMnV.js";
4
+ import { U as me } from "./URDFLoader-DR_ZnSlg.js";
5
+ import { S as ve, M as pe, O as fe } from "./MTLLoader-EGw2WpGn.js";
6
+ import { c7 as be, c8 as re, b1 as O, az as we, au as he, c9 as E, ah as _e, ca as ge, bu as je, ag as ye } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DzxsDmSo.js";
7
7
  import { ref as T, defineComponent as Le, computed as M, watch as ue, resolveComponent as x, createElementBlock as k, openBlock as z, createVNode as U, createElementVNode as c, withCtx as F, createTextVNode as D, toDisplayString as C } from "vue";
8
- import { c as Re, e as Ue, g as $e } from "./iconfont-AyWwUMxc.js";
8
+ import { c as Re, e as Ue, g as $e } from "./iconfont-hcY1c1Ph.js";
9
9
  import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
10
10
  const Se = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
11
11
  function Me(b) {
@@ -1 +1 @@
1
- "use strict";var ee=Object.defineProperty;var te=(b,i,o)=>i in b?ee(b,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[i]=o;var C=(b,i,o)=>te(b,typeof i!="symbol"?i+"":i,o);const oe=require("./URDFLoader-BoSgd6gH.cjs"),S=require("./MTLLoader-DACeOwx8.cjs"),N=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-C8n9olfd.cjs"),e=require("vue"),D=require("./iconfont-U7rG6UGs.cjs"),se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function re(b){const{mtlUrl:i,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:_}=b,p=new S.MTLLoader(o);return l&&p.setResourcePath(l),p.load(i,m,r,_),p}function ie(b){const{objUrl:i,manager:o,materials:l,onLoad:m,onProgress:r,onError:_}=b,p=new S.OBJLoader(o);return l&&p.setMaterials(l),p.load(i,m,r,_),p}function ne(b){const{manager:i,baseFolderUrl:o,onFileProgress:l}=b,m=new oe.URDFLoader(i);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,_,p)=>{const g=(()=>{const h=r.split("?")[0].split("#")[0],c=h.lastIndexOf(".");return c>=0?h.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const h=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${h}${c}.mtl`,V=a=>{ie({objUrl:r,manager:_,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new N.Group)}})};re({mtlUrl:f,manager:_,resourcePath:h,onLoad:a=>{try{a.preload()}catch{}V(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),V(void 0)}});break}case"stl":{new S.STLLoader(_).load(r,c=>{const f=new N.MeshPhongMaterial({color:12303291,shininess:30}),V=new N.Mesh(c,f);V.castShadow=!0,V.receiveShadow=!0,p(V)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new N.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new N.Group)}},m}function ae(b,i,o,l){return{loadSceneFromFile:r=>new Promise((_,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,h=0,c=null;const f=new N.LoadingManager;f.onStart=(a,d,E)=>{g=E||0,h=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,E)=>{h=d,g=E;const R=`正在加载 ${d} / ${E} 个文件: ${N.getFilenameFromUrl(a)}`;l.value=R,d===E&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new N.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),_(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const V=(a,d,E)=>{const R=N.getFilenameFromUrl(a);let v;E&&E>0?v=`${R}(${N.formatBytes(d)} / ${N.formatBytes(E)})`:d&&d>0?v=`${R}(已下载 ${N.formatBytes(d)})`:v=`${R}`,l.value=`正在下载第 ${h+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ne({manager:f,baseFolderUrl:le,onFileProgress:V}).load(a,E=>{c=E},void 0,E=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,E),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function ce(b,i,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),_=new N.Raycaster,p=new N.Vector2,g=new Map;function h(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new N.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,_.setFromCamera(p,m);const t=_.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,w=null;for(;s;){if(g.has(s.id)){w=g.get(s.id);break}s=s.parent}w&&c(w)}function V(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=i();m=u,h(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function E(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function R(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:V,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:E,updateRotation:R}}class de{constructor(i){C(this,"robot");C(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(_=>{const p=()=>{const g=Date.now()-r,h=Math.min(g/o,1),c=this.easeInOutCubic(h),f={};Object.keys(i).forEach(V=>{const a=m[V]||0,d=i[V];f[V]=a+(d-a)*c}),this.setJointAngles(f),l&&l(h),h<1?requestAnimationFrame(p):_()};p()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,r=>{l&&l(m,r)})}}const ue={class:"panel-content"},me={class:"obj"},pe={key:0,class:"obj-base"},ve=["title"],fe=["title"],be={key:1},we={class:"obj-position"},_e={class:"coord-item"},he={class:"coord-item"},Ve={class:"coord-item"},Ee={class:"obj-rotation"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"coord-item"},Le={class:"world"},Re={class:"coord-line"},je={class:"coord-text"},Ce={class:"world-position-item"},De={class:"world-position-item"},Se={class:"world-position-item"},Ue={class:"coord-line"},Fe={class:"coord-text"},$e={class:"world-rotation-item"},Me={class:"world-rotation-item"},xe={class:"world-rotation-item"},Je=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:i}){const o=b,l=i,m=e.ref([]),r=e.ref({}),_=(t,s=0)=>{const w=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(n=>{if(!(n!=null&&n.isMesh)){const y={name:n==null?void 0:n.name,label:(n==null?void 0:n.name)||(n==null?void 0:n.type),show:!0,level:s+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:_(n==null?void 0:n.children,s+1),path:n==null?void 0:n.name};w.push(y)}}),w},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:_(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const w=[],n=[...t];for(;n.length>0&&w.length<s;){const y=n.shift();y.children&&y.children.length>0&&(w.push(y.id),n.push(...y.children))}return w},h=(t,s)=>{const w=[];return t.forEach(n=>{if(n.children&&n.children.length>0){w.push(n.id);const y=n.children.filter(j=>j.children&&j.children.length>0).slice(0,s).map(j=>j.id);w.push(...y)}}),w.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?h(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,V=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},E=e.computed(()=>o!=null&&o.model?p(o.model):[]),R=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(E,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var j,U,F,$,M,x,J,O,k,T,P,z,B,A,q,I,W,G,X,Y,Z,K,H,Q;const w=e.resolveComponent("el-divider"),n=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(w,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",me,[o.model?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",{class:"obj-name",title:R.value},e.toDisplayString(R.value),9,ve),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,fe)])):(e.openBlock(),e.createElementBlock("div",be,"空")),e.createVNode(n,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(w,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",we,[e.createElementVNode("div",_e,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((U=(j=r.value)==null?void 0:j.position)==null?void 0:U.x),onChange:s[0]||(s[0]=L=>V(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",he,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=r.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=L=>V(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ve,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(M=r.value)==null?void 0:M.position)==null?void 0:x.z),onChange:s[2]||(s[2]=L=>V(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ee,[e.createElementVNode("div",ge,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((O=(J=r.value)==null?void 0:J.rotation)==null?void 0:O.x),onChange:s[3]||(s[3]=L=>a(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((T=(k=r.value)==null?void 0:k.rotation)==null?void 0:T.y),onChange:s[4]||(s[4]=L=>a(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(P=r.value)==null?void 0:P.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=L=>a(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Le,[e.createElementVNode("div",Re,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",je,[e.createElementVNode("div",Ce,e.toDisplayString(c((A=(B=r.value)==null?void 0:B.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",De,e.toDisplayString(c((I=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:I.y))+", ",1),e.createElementVNode("div",Se,e.toDisplayString(c((G=(W=r.value)==null?void 0:W.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Ue,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Fe,[e.createElementVNode("div",$e,e.toDisplayString(f((Y=(X=r.value)==null?void 0:X.worldRotation)==null?void 0:Y.x))+"°, ",1),e.createElementVNode("div",Me,e.toDisplayString(f((K=(Z=r.value)==null?void 0:Z.worldRotation)==null?void 0:K.y))+"°, ",1),e.createElementVNode("div",xe,e.toDisplayString(f((Q=(H=r.value)==null?void 0:H.worldRotation)==null?void 0:Q.z))+"° ",1)])])])])}}}),Oe=se._export_sfc(Je,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=de;exports.WorkpieceTreePanel=Oe;exports.useRaycaster=ce;exports.useUrdfLoader=ae;
1
+ "use strict";var ee=Object.defineProperty;var te=(b,i,o)=>i in b?ee(b,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[i]=o;var C=(b,i,o)=>te(b,typeof i!="symbol"?i+"":i,o);const oe=require("./URDFLoader-CNnR_d-M.cjs"),S=require("./MTLLoader-DeVVTn9U.cjs"),N=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bft_35IC.cjs"),e=require("vue"),D=require("./iconfont-BU-e8plC.cjs"),se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function re(b){const{mtlUrl:i,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:_}=b,p=new S.MTLLoader(o);return l&&p.setResourcePath(l),p.load(i,m,r,_),p}function ie(b){const{objUrl:i,manager:o,materials:l,onLoad:m,onProgress:r,onError:_}=b,p=new S.OBJLoader(o);return l&&p.setMaterials(l),p.load(i,m,r,_),p}function ne(b){const{manager:i,baseFolderUrl:o,onFileProgress:l}=b,m=new oe.URDFLoader(i);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,_,p)=>{const g=(()=>{const h=r.split("?")[0].split("#")[0],c=h.lastIndexOf(".");return c>=0?h.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const h=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${h}${c}.mtl`,V=a=>{ie({objUrl:r,manager:_,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new N.Group)}})};re({mtlUrl:f,manager:_,resourcePath:h,onLoad:a=>{try{a.preload()}catch{}V(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),V(void 0)}});break}case"stl":{new S.STLLoader(_).load(r,c=>{const f=new N.MeshPhongMaterial({color:12303291,shininess:30}),V=new N.Mesh(c,f);V.castShadow=!0,V.receiveShadow=!0,p(V)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new N.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new N.Group)}},m}function ae(b,i,o,l){return{loadSceneFromFile:r=>new Promise((_,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,h=0,c=null;const f=new N.LoadingManager;f.onStart=(a,d,E)=>{g=E||0,h=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,E)=>{h=d,g=E;const R=`正在加载 ${d} / ${E} 个文件: ${N.getFilenameFromUrl(a)}`;l.value=R,d===E&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new N.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),_(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const V=(a,d,E)=>{const R=N.getFilenameFromUrl(a);let v;E&&E>0?v=`${R}(${N.formatBytes(d)} / ${N.formatBytes(E)})`:d&&d>0?v=`${R}(已下载 ${N.formatBytes(d)})`:v=`${R}`,l.value=`正在下载第 ${h+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ne({manager:f,baseFolderUrl:le,onFileProgress:V}).load(a,E=>{c=E},void 0,E=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,E),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function ce(b,i,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),_=new N.Raycaster,p=new N.Vector2,g=new Map;function h(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new N.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,_.setFromCamera(p,m);const t=_.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,w=null;for(;s;){if(g.has(s.id)){w=g.get(s.id);break}s=s.parent}w&&c(w)}function V(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=i();m=u,h(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function E(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function R(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:V,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:E,updateRotation:R}}class de{constructor(i){C(this,"robot");C(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(_=>{const p=()=>{const g=Date.now()-r,h=Math.min(g/o,1),c=this.easeInOutCubic(h),f={};Object.keys(i).forEach(V=>{const a=m[V]||0,d=i[V];f[V]=a+(d-a)*c}),this.setJointAngles(f),l&&l(h),h<1?requestAnimationFrame(p):_()};p()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,r=>{l&&l(m,r)})}}const ue={class:"panel-content"},me={class:"obj"},pe={key:0,class:"obj-base"},ve=["title"],fe=["title"],be={key:1},we={class:"obj-position"},_e={class:"coord-item"},he={class:"coord-item"},Ve={class:"coord-item"},Ee={class:"obj-rotation"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"coord-item"},Le={class:"world"},Re={class:"coord-line"},je={class:"coord-text"},Ce={class:"world-position-item"},De={class:"world-position-item"},Se={class:"world-position-item"},Ue={class:"coord-line"},Fe={class:"coord-text"},$e={class:"world-rotation-item"},Me={class:"world-rotation-item"},xe={class:"world-rotation-item"},Je=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:i}){const o=b,l=i,m=e.ref([]),r=e.ref({}),_=(t,s=0)=>{const w=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(n=>{if(!(n!=null&&n.isMesh)){const y={name:n==null?void 0:n.name,label:(n==null?void 0:n.name)||(n==null?void 0:n.type),show:!0,level:s+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:_(n==null?void 0:n.children,s+1),path:n==null?void 0:n.name};w.push(y)}}),w},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:_(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const w=[],n=[...t];for(;n.length>0&&w.length<s;){const y=n.shift();y.children&&y.children.length>0&&(w.push(y.id),n.push(...y.children))}return w},h=(t,s)=>{const w=[];return t.forEach(n=>{if(n.children&&n.children.length>0){w.push(n.id);const y=n.children.filter(j=>j.children&&j.children.length>0).slice(0,s).map(j=>j.id);w.push(...y)}}),w.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?h(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,V=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},E=e.computed(()=>o!=null&&o.model?p(o.model):[]),R=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(E,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var j,U,F,$,M,x,J,O,k,T,P,z,B,A,q,I,W,G,X,Y,Z,K,H,Q;const w=e.resolveComponent("el-divider"),n=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(w,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",me,[o.model?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",{class:"obj-name",title:R.value},e.toDisplayString(R.value),9,ve),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,fe)])):(e.openBlock(),e.createElementBlock("div",be,"空")),e.createVNode(n,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(w,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",we,[e.createElementVNode("div",_e,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((U=(j=r.value)==null?void 0:j.position)==null?void 0:U.x),onChange:s[0]||(s[0]=L=>V(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",he,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=r.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=L=>V(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ve,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(M=r.value)==null?void 0:M.position)==null?void 0:x.z),onChange:s[2]||(s[2]=L=>V(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ee,[e.createElementVNode("div",ge,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((O=(J=r.value)==null?void 0:J.rotation)==null?void 0:O.x),onChange:s[3]||(s[3]=L=>a(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((T=(k=r.value)==null?void 0:k.rotation)==null?void 0:T.y),onChange:s[4]||(s[4]=L=>a(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(P=r.value)==null?void 0:P.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=L=>a(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Le,[e.createElementVNode("div",Re,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",je,[e.createElementVNode("div",Ce,e.toDisplayString(c((A=(B=r.value)==null?void 0:B.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",De,e.toDisplayString(c((I=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:I.y))+", ",1),e.createElementVNode("div",Se,e.toDisplayString(c((G=(W=r.value)==null?void 0:W.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Ue,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Fe,[e.createElementVNode("div",$e,e.toDisplayString(f((Y=(X=r.value)==null?void 0:X.worldRotation)==null?void 0:Y.x))+"°, ",1),e.createElementVNode("div",Me,e.toDisplayString(f((K=(Z=r.value)==null?void 0:Z.worldRotation)==null?void 0:K.y))+"°, ",1),e.createElementVNode("div",xe,e.toDisplayString(f((Q=(H=r.value)==null?void 0:H.worldRotation)==null?void 0:Q.z))+"° ",1)])])])])}}}),Oe=se._export_sfc(Je,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=de;exports.WorkpieceTreePanel=Oe;exports.useRaycaster=ce;exports.useUrdfLoader=ae;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ss-component-new",
3
3
  "private": false,
4
- "version": "1.2.199",
4
+ "version": "1.2.201",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -0,0 +1,42 @@
1
+ # CAD Exchanger 3.24.0 (cadexchanger.com)
2
+ # Material Count: 5
3
+
4
+ newmtl Material_1
5
+ Ns 0.000000
6
+ Ka 0.200000 0.200000 0.200000
7
+ Kd 0.666667 0.666667 0.666667
8
+ Ks 0.000000 0.000000 0.000000
9
+ Ke 0.000000 0.000000 0.000000
10
+ d 1.000000
11
+
12
+ newmtl Material_2
13
+ Ns 0.000000
14
+ Ka 0.200000 0.200000 0.200000
15
+ Kd 0.133333 0.133333 0.133333
16
+ Ks 0.000000 0.000000 0.000000
17
+ Ke 0.000000 0.000000 0.000000
18
+ d 1.000000
19
+
20
+ newmtl Material_3
21
+ Ns 0.000000
22
+ Ka 0.200000 0.200000 0.200000
23
+ Kd 0.733333 0.733333 0.733333
24
+ Ks 0.000000 0.000000 0.000000
25
+ Ke 0.000000 0.000000 0.000000
26
+ d 1.000000
27
+
28
+ newmtl Material_5
29
+ Ns 0.000000
30
+ Ka 0.200000 0.200000 0.200000
31
+ Kd 0.396078 0.941176 0.450980
32
+ Ks 0.000000 0.000000 0.000000
33
+ Ke 0.000000 0.000000 0.000000
34
+ d 1.000000
35
+
36
+ newmtl Material_4
37
+ Ns 0.000000
38
+ Ka 0.200000 0.200000 0.200000
39
+ Kd 1.000000 1.000000 0.000000
40
+ Ks 0.000000 0.000000 0.000000
41
+ Ke 0.000000 0.000000 0.000000
42
+ d 1.000000