ss-component-new 1.2.44 → 1.2.45

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 (98) hide show
  1. package/dist/{MTLLoader-S0-tgcId.js → MTLLoader-Bp_zXJHj.js} +1 -1
  2. package/dist/{MTLLoader-z5-t3xJP.cjs → MTLLoader-CP_pjCVi.cjs} +1 -1
  3. package/dist/{OrbitControls-BV-VucZ-.cjs → OrbitControls-B5zHPgTk.cjs} +1 -1
  4. package/dist/{OrbitControls-neGlLp4U.js → OrbitControls-QeoZHu0O.js} +1 -1
  5. package/dist/{animationData-DGlw1Pwm.js → animationData-B5eOmRnz.js} +3 -3
  6. package/dist/{animationData-BI3PXunj.cjs → animationData-Ba6obiMd.cjs} +1 -1
  7. package/dist/{array-BzXzat0I.cjs → array-CXTr_u8T.cjs} +1 -1
  8. package/dist/{array-B0sVMejm.js → array-CpD9GkZu.js} +1 -1
  9. package/dist/{dataUtil-BMiqO5iF.cjs → dataUtil-BxHv9-qc.cjs} +1 -1
  10. package/dist/{dataUtil-yN0F9IZh.js → dataUtil-iQRU-HFQ.js} +1 -1
  11. package/dist/{fileUtil-CLjIZqTr.cjs → fileUtil-DOKmUgX6.cjs} +1 -1
  12. package/dist/{fileUtil-Bev09uzf.js → fileUtil-DtFX4qSS.js} +1 -1
  13. package/dist/{iconfont-DCNS3tUf.js → iconfont-BI4Uo8yP.js} +2 -2
  14. package/dist/{iconfont-DIct6CCo.cjs → iconfont-nIq9TlPr.cjs} +1 -1
  15. package/dist/{index-Dn9nE8Eq.cjs → index-AosP55-j.cjs} +1 -1
  16. package/dist/{index-Cy7dhIjv.cjs → index-B-ErCfWs.cjs} +1 -1
  17. package/dist/{index-CmPg86RO.js → index-B4ekORH0.js} +1 -1
  18. package/dist/{index-DuQEB-MM.cjs → index-B5ElOuGg.cjs} +1 -1
  19. package/dist/{index-CB9fhGS6.js → index-B8iVe_eb.js} +17 -17
  20. package/dist/{index-CbbcH5oq.js → index-B9sOWZWH.js} +5 -5
  21. package/dist/{index-Cx2uJNrm.cjs → index-BDur1jFN.cjs} +1 -1
  22. package/dist/index-BJu7m-Nr.cjs +1 -0
  23. package/dist/{index-BobtqupC.cjs → index-Bb0GRmmB.cjs} +1 -1
  24. package/dist/{index-CLfSP16a.cjs → index-BfP_DVsu.cjs} +1 -1
  25. package/dist/{index-XI2Rvi0q.js → index-BiXsFita.js} +1 -1
  26. package/dist/{index-DLOY0GPB.js → index-BtQRcdm8.js} +2 -2
  27. package/dist/{index-DsELssZh.cjs → index-By2szESa.cjs} +1 -1
  28. package/dist/{index-BA3EBTs5.cjs → index-C7enRklE.cjs} +1 -1
  29. package/dist/{index-BhBoXLgm.cjs → index-C8peX_zn.cjs} +1 -1
  30. package/dist/{index-bwwqrQDH.js → index-C9jcqjv8.js} +1 -1
  31. package/dist/{index-lMKlyOCK.js → index-CB31dswD.js} +4 -4
  32. package/dist/{index-Bl_wu7Ce.js → index-CG_g2ziw.js} +1 -1
  33. package/dist/{index-CbXglzHn.cjs → index-CIasmB1I.cjs} +1 -1
  34. package/dist/{index-_hpntJ68.js → index-CLtZ8LSX.js} +1 -1
  35. package/dist/{index-_R_mDcr0.cjs → index-CRSHYsls.cjs} +1 -1
  36. package/dist/{index-DVFTyM4M.js → index-CXXjdjCc.js} +4 -4
  37. package/dist/{index-r1aE58w0.cjs → index-CaCpfXzA.cjs} +1 -1
  38. package/dist/{index-Da7Akok4.js → index-CeXS_yjh.js} +4 -4
  39. package/dist/{index-Dbkrv2wN.cjs → index-Cgo-pHHk.cjs} +1 -1
  40. package/dist/{index-CsCIkw9R.cjs → index-ChzT-uN5.cjs} +1 -1
  41. package/dist/{index-B_Tkvppm.js → index-CjlgPPLu.js} +7 -7
  42. package/dist/{index-DL6qIAmS.cjs → index-CqYwvSb1.cjs} +1 -1
  43. package/dist/{index-DIPySh01.cjs → index-Cxu7w2E_.cjs} +1 -1
  44. package/dist/{index-DwJ_KFIl.js → index-DDz2Uaa6.js} +1 -1
  45. package/dist/{index-Doph8iRz.js → index-DFgo_-tB.js} +1 -1
  46. package/dist/{index-6PGBoTBs.cjs → index-DIqmyCXw.cjs} +1 -1
  47. package/dist/{index-D86mE5bR.js → index-DNTETHco.js} +1 -1
  48. package/dist/{index-D2pDrujp.cjs → index-DZrrnLsD.cjs} +1 -1
  49. package/dist/{index-DpBque0B.js → index-DaNkpB7i.js} +8 -8
  50. package/dist/{index-BgFjc2to.js → index-DerJOgVr.js} +3 -3
  51. package/dist/index-Dl_nOM4w.js +602 -0
  52. package/dist/{index-DAQyshAW.js → index-Hsfgg6Jr.js} +1 -1
  53. package/dist/{index-CY-dTAL6.js → index-QsfFZ239.js} +3 -3
  54. package/dist/{index-B0cPiCrJ.cjs → index-Rn_5RMYO.cjs} +1 -1
  55. package/dist/{index-cZUdQLs9.cjs → index-W04qB42v.cjs} +1 -1
  56. package/dist/{index-DJ9hDOV8.js → index-Yj-fe5Fq.js} +2 -2
  57. package/dist/{index-Cm0sETei.js → index-ntjMJGUe.js} +1 -1
  58. package/dist/{index-BoXz8LQd.js → index-s5__Qjzi.js} +1 -1
  59. package/dist/{index-3HHIJyYz.cjs → index-xnnwo0kC.cjs} +1 -1
  60. package/dist/{index-Hznc1RHv.cjs → index-ytX2FVZK.cjs} +1 -1
  61. package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BI9sR6fB.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-Bj08IQ8o.js} +8 -8
  62. package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-HDmb-6aI.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-D1qJ0WdA.cjs} +1 -1
  63. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js} +2095 -2110
  64. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs} +51 -51
  65. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-wyjrIVAw.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-BYGwQPjD.js} +4 -4
  66. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DsySz2Q6.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-Dp-hCMfv.cjs} +1 -1
  67. package/dist/{index.vue_vue_type_style_index_1_lang-Cu2BshsL.js → index.vue_vue_type_style_index_1_lang-CU-2e_BS.js} +3 -3
  68. package/dist/{index.vue_vue_type_style_index_1_lang-HFKqIlIz.cjs → index.vue_vue_type_style_index_1_lang-Ckqvc1oN.cjs} +1 -1
  69. package/dist/{main-DnoUlIhf.cjs → main-Cu9JHgqK.cjs} +1 -1
  70. package/dist/{main-CZ7ecnlE.js → main-Dr4DzkFw.js} +3 -3
  71. package/dist/ss-component.cjs +1 -1
  72. package/dist/ss-component.css +1 -1
  73. package/dist/ss-component.js +9 -9
  74. package/dist/ss-component2.cjs +1 -1
  75. package/dist/ss-component2.js +11 -11
  76. package/dist/{threeModel-DoiYcvs4.js → threeModel-BxSAmes5.js} +4 -4
  77. package/dist/{threeModel-SJkYCRZG.cjs → threeModel-CfE4qItC.cjs} +1 -1
  78. package/dist/{threePreview-CJ3vTE2P.js → threePreview-Bo7UlxmA.js} +3 -3
  79. package/dist/{threePreview-UGPvJ0Kr.cjs → threePreview-Do2o5OBN.cjs} +1 -1
  80. package/dist/{threeSceneView-4qe_PpyY.cjs → threeSceneView-D7n8nPfy.cjs} +1 -1
  81. package/dist/{threeSceneView-CWbDj-33.js → threeSceneView-DZs6WyDt.js} +8 -8
  82. package/dist/{threeSceneViewForCPMPIP-GISXOGMC.js → threeSceneViewForCPMPIP-BlOqsiB_.js} +8 -8
  83. package/dist/{threeSceneViewForCPMPIP-YOScA2Ku.cjs → threeSceneViewForCPMPIP-jBfAtm1G.cjs} +1 -1
  84. package/dist/{threeTrackPathView-SikIkQ4h.js → threeTrackPathView-DVHETbx3.js} +4 -4
  85. package/dist/{threeTrackPathView-C7GA97Vy.cjs → threeTrackPathView-D_mOz7ZU.cjs} +1 -1
  86. package/dist/{threeViewerHost-CbmFGUtP.js → threeViewerHost-B4_JNQvE.js} +2 -2
  87. package/dist/{threeViewerHost-DNfmRw6a.cjs → threeViewerHost-CSVMxHgm.cjs} +1 -1
  88. package/dist/{urdfTree-bqnyp0ks.cjs → urdfTree-77wdErmJ.cjs} +1 -1
  89. package/dist/{urdfTree-DfcawAzu.js → urdfTree-C6zY5_p4.js} +1 -1
  90. package/dist/{workpieceTreePanel-DtlsVo1q.js → workpieceTreePanel-27hu7whF.js} +5 -5
  91. package/dist/{workpieceTreePanel-XHkn5qFT.cjs → workpieceTreePanel-CMwRzaFj.cjs} +1 -1
  92. package/package.json +1 -1
  93. package/dist/index-e1IN0g06.js +0 -577
  94. package/dist/index-zo_7oW0G.cjs +0 -1
  95. package/dist/obj/model.mtl +0 -42
  96. package/dist/obj/model.obj +0 -26110
  97. package/public/obj/model.mtl +0 -42
  98. package/public/obj/model.obj +0 -26110
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-XHkn5qFT.cjs"),pe=require("./iconfont-DIct6CCo.cjs"),$=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs");require("./index-BpPyaNFa.cjs");const Q=require("./index-Cx2uJNrm.cjs");require("./index.vue_vue_type_style_index_1_lang-HFKqIlIz.cjs");require("./index-CkKrD8Sj.cjs");require("./index-H18D4EBa.cjs");const Ce=require("./animationData-BI3PXunj.cjs"),ne=require("./urdfTree-bqnyp0ks.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ee=require("./dataUtil-BMiqO5iF.cjs"),M=require("./svgIcon-CUM54R6L.cjs"),Z=.001,H=s.MathUtils.degToRad,Ne=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Me(V=.005,m=64){const f=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),n=new s.TubeGeometry(f,m,V,16,!1),g=Ne;return new s.Mesh(n,g)}const ke=V=>V.reduce((m,f)=>{let n=0;const g=f.Y??0,h=f.C??0,c=f.R??0;return g>0&&(n+=g),h>0&&c>0&&(n+=c*H(h)),m+n},0),Te=V=>{const m=[],f=V.Y??0,n=V.B??0,g=V.C??0,h=V.R??0,c={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!f&&!g)return m;if(m.push(c.pos.clone()),n!==0){const C=new s.Matrix4().makeRotationAxis(c.localY,H(n));c.localX.applyMatrix4(C),c.localZ.applyMatrix4(C)}if(f>0&&(c.pos.add(c.localY.clone().multiplyScalar(f*Z)),m.push(c.pos.clone())),g>0&&h>0){const C=H(g),u=h*Z,_=c.pos.clone().add(c.localX.clone().multiplyScalar(-u)),r=Math.max(16,Math.ceil(g/5));for(let p=1;p<=r;p++){const a=C*p/r,d=new s.Matrix4().makeRotationAxis(c.localZ,a),b=c.localX.clone().multiplyScalar(u).applyMatrix4(d),E=_.clone().add(b);m.push(E)}}return m};function Se(V,m){const f=new s.Group;f.name="CompletePipe";const n={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let g=0,h=1;for(let c=0;c<V.length;c++){const C=V[c],u=C.Y??0,_=C.B??0,r=C.C??0,p=C.R??0;if(_!==0){const a=new s.Matrix4().makeRotationAxis(n.localY,H(_));n.localX.applyMatrix4(a),n.localZ.applyMatrix4(a)}if(u>0){const a=n.pos.clone();n.pos.add(n.localY.clone().multiplyScalar(u*Z));const d=n.pos.clone(),i=Pe(a,d,m*Z);i.userData={segmentType:"straight",segmentIndex:g,frameIndex:c,length:u,frame:{Y:u,B:_,C:r,R:p}},i.name=`直段_${g}`,f.add(i);const b=a.clone();De(f,h,b,m*Z),g++}if(r>0&&p>0){const a=H(r),d=p*Z,i=[];i.push(n.pos.clone());const b=n.pos.clone().add(n.localX.clone().multiplyScalar(-d)),E=Math.max(16,Math.ceil(r/5));for(let P=1;P<=E;P++){const D=a*P/E,T=new s.Matrix4().makeRotationAxis(n.localZ,D),k=n.localX.clone().multiplyScalar(d).applyMatrix4(T),w=b.clone().add(k);i.push(w)}const v=Re(i,m*Z);v.userData={segmentType:"bend",segmentIndex:g,frameIndex:c,angle:r,radius:p,centerPoint:b.toArray(),frame:{Y:u,B:_,C:r,R:p}},v.name=`弯段_${g}`,f.add(v),Math.floor(i.length/2),i[0],n.pos=i[i.length-1].clone();const S=new s.Matrix4().makeRotationAxis(n.localZ,a);n.localY.applyMatrix4(S),n.localX.applyMatrix4(S),g++,h++}}return f}function De(V,m,f,n){const g=new s.Vector3(0,n*2,n*5),h=f.clone().add(g),c=[f,h],C=new s.BufferGeometry().setFromPoints(c),u=new s.LineDashedMaterial({color:16711680,dashSize:n*.5,gapSize:n*.3,linewidth:1}),_=new s.Line(C,u);_.computeLineDistances(),V.add(_);const r=document.createElement("canvas"),p=r.getContext("2d");r.width=128,r.height=128,p.clearRect(0,0,128,128),p.fillStyle="#FF0000",p.font="bold 80px Arial",p.textAlign="center",p.textBaseline="middle",p.fillText(m.toString(),64,64);const a=new s.CanvasTexture(r),d=new s.SpriteMaterial({map:a,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(d),b=n*3;i.scale.set(b,b,1),i.position.copy(h),i.name=`Label_${m}`,i.userData={labelNumber:m},V.add(i)}function Pe(V,m,f){const n=new s.LineCurve3(V,m),g=new s.TubeGeometry(n,2,f,18,!1);return new s.Mesh(g,Ne)}function Re(V,m){const f=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),n=new s.TubeGeometry(f,Math.max(16,V.length*2),m,18,!1);return new s.Mesh(n,Ne)}function _e(V,m,f,n,g,h=0){let c=m.slice(0,g+1);const C=m[g+1];if(C&&h>0){const i={...C,B:(C.B??0)*h,C:(C.C??0)*h};c.push(i)}const u=ke(c),_=Math.max(0,f-u),r=[];r.push(new s.Vector3(0,0,0));const p=new s.Vector3(0,_*Z,0);_>0&&r.push(p);let a={pos:p.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const d=[];for(let i=c.length-1;i>=0;i--){const b=c[i],E=Te(b);if(E.length>0){const v=E.map(T=>{const R=T.clone(),k=new s.Matrix4;return k.makeBasis(a.localX,a.localY,a.localZ),R.applyMatrix4(k),R.add(a.pos)});d.push(v);const S=v[v.length-1];a.pos=S.clone();const P=b.B??0,D=b.C??0;if(P!==0){const T=new s.Matrix4().makeRotationAxis(a.localY,H(P));a.localX.applyMatrix4(T),a.localZ.applyMatrix4(T)}if(D>0){const T=H(D),R=new s.Matrix4().makeRotationAxis(a.localZ,T);a.localY.applyMatrix4(R),a.localX.applyMatrix4(R)}}}for(const i of d)i.length>1&&r.push(...i.slice(1));r.length<2&&r.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(r,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,r.length*4),n*Z,18,!1);V.geometry.dispose(),V.geometry=b}catch(i){console.error("管件更新失败",i)}}function xe(V,m,f,n=0){let g=V.slice(0,f+1);const h=V[f+1];if(h&&n>0){const a={...h,B:(h.B??0)*n,C:(h.C??0)*n};g.push(a)}const c=ke(g),C=Math.max(0,m-c),u=[];u.push(new s.Vector3(0,0,0));const _=new s.Vector3(0,C*Z,0);C>0&&u.push(_);let r={pos:_.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const p=[];for(let a=g.length-1;a>=0;a--){const d=g[a],i=Te(d);if(i.length>0){const b=i.map(P=>{const D=P.clone(),T=new s.Matrix4;return T.makeBasis(r.localX,r.localY,r.localZ),D.applyMatrix4(T),D.add(r.pos)});p.push(b);const E=b[b.length-1];r.pos=E.clone();const v=d.B??0,S=d.C??0;if(v!==0){const P=new s.Matrix4().makeRotationAxis(r.localY,H(v));r.localX.applyMatrix4(P),r.localZ.applyMatrix4(P)}if(S>0){const P=H(S),D=new s.Matrix4().makeRotationAxis(r.localZ,P);r.localY.applyMatrix4(D),r.localX.applyMatrix4(D)}}}for(const a of p)a.length>1&&u.push(...a.slice(1));return u.length<2&&u.push(new s.Vector3(0,.001,0)),u}function Ee(V,m,f,n,g,h,c,C=0,u=0){const _=g-u,r=xe(n,_,c,C);let a=xe(f,u,c,C);a.forEach(i=>i.y=-i.y),a.reverse();const d=[...a,...r];try{const i=new s.CatmullRomCurve3(d,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,d.length*4),h*Z,18,!1);m.geometry.dispose(),V.geometry.dispose(),m.parent&&m.parent.remove(m),V.geometry=b}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},ze={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ie={class:"progress-bar"},Ue={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(V,{expose:m,emit:f}){const n=V,g=f,h=e.ref(),c=e.ref();e.watch(()=>n.threeData,l=>{const t=l==null?void 0:l.data;c.value=t==null?void 0:t.type},{immediate:!0});const C=async()=>{if(!sessionStorage.getItem("systemKey")){g("getThreeData");return}let t={};c.value===X.robotMode.SINGLE&&(t=await Ce.fetchSingleRobotAnimationData()),c.value===X.robotMode.DOUBLE&&(t=await Ce.fetchDoubleRobotAnimationData());const{initialPipeLength:o=0,pipeRadius:y=0,clampLength:N=0,animationData:x}=t;D.value=o,T.value=y,R.value=N,h.value=x;const O=$.cloneDeep(h.value),K=ce(F.value),q=(O==null?void 0:O["输出(动画数据)"])||[];u.value=q.length?q:[K]},u=e.ref([]),_=e.ref(!1),r=e.ref(""),p=e.ref(!1),a=e.ref(0),d=e.ref(0),i=e.ref(1e3);let b=!1;const E=e.ref(null),v=e.shallowRef(null),S=e.shallowRef(null),P=e.shallowRef(null),D=e.ref(0),T=e.ref(12.5),R=e.ref(30),k=e.ref([]),w=e.ref(null),I=e.computed(()=>n.model?ne.getNonFixedJoints(n.model).map(o=>o.name):[]),G=e.ref(["Y","B","C","R"]),F=e.computed(()=>[...I.value,...G.value]),Y=e.computed(()=>F.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("./workpieceTreePanel-CMwRzaFj.cjs"),pe=require("./iconfont-nIq9TlPr.cjs"),$=require("./index-C8qRkCgn.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs");require("./index-BpPyaNFa.cjs");const Q=require("./index-BDur1jFN.cjs");require("./index.vue_vue_type_style_index_1_lang-Ckqvc1oN.cjs");require("./index-CkKrD8Sj.cjs");require("./index-H18D4EBa.cjs");const Ce=require("./animationData-Ba6obiMd.cjs"),ne=require("./urdfTree-77wdErmJ.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ee=require("./dataUtil-BxHv9-qc.cjs"),M=require("./svgIcon-CUM54R6L.cjs"),Z=.001,H=s.MathUtils.degToRad,Ne=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function Me(V=.005,m=64){const f=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),n=new s.TubeGeometry(f,m,V,16,!1),g=Ne;return new s.Mesh(n,g)}const ke=V=>V.reduce((m,f)=>{let n=0;const g=f.Y??0,h=f.C??0,c=f.R??0;return g>0&&(n+=g),h>0&&c>0&&(n+=c*H(h)),m+n},0),Te=V=>{const m=[],f=V.Y??0,n=V.B??0,g=V.C??0,h=V.R??0,c={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!f&&!g)return m;if(m.push(c.pos.clone()),n!==0){const C=new s.Matrix4().makeRotationAxis(c.localY,H(n));c.localX.applyMatrix4(C),c.localZ.applyMatrix4(C)}if(f>0&&(c.pos.add(c.localY.clone().multiplyScalar(f*Z)),m.push(c.pos.clone())),g>0&&h>0){const C=H(g),u=h*Z,_=c.pos.clone().add(c.localX.clone().multiplyScalar(-u)),r=Math.max(16,Math.ceil(g/5));for(let p=1;p<=r;p++){const a=C*p/r,d=new s.Matrix4().makeRotationAxis(c.localZ,a),b=c.localX.clone().multiplyScalar(u).applyMatrix4(d),E=_.clone().add(b);m.push(E)}}return m};function Se(V,m){const f=new s.Group;f.name="CompletePipe";const n={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let g=0,h=1;for(let c=0;c<V.length;c++){const C=V[c],u=C.Y??0,_=C.B??0,r=C.C??0,p=C.R??0;if(_!==0){const a=new s.Matrix4().makeRotationAxis(n.localY,H(_));n.localX.applyMatrix4(a),n.localZ.applyMatrix4(a)}if(u>0){const a=n.pos.clone();n.pos.add(n.localY.clone().multiplyScalar(u*Z));const d=n.pos.clone(),i=Pe(a,d,m*Z);i.userData={segmentType:"straight",segmentIndex:g,frameIndex:c,length:u,frame:{Y:u,B:_,C:r,R:p}},i.name=`直段_${g}`,f.add(i);const b=a.clone();De(f,h,b,m*Z),g++}if(r>0&&p>0){const a=H(r),d=p*Z,i=[];i.push(n.pos.clone());const b=n.pos.clone().add(n.localX.clone().multiplyScalar(-d)),E=Math.max(16,Math.ceil(r/5));for(let P=1;P<=E;P++){const D=a*P/E,T=new s.Matrix4().makeRotationAxis(n.localZ,D),k=n.localX.clone().multiplyScalar(d).applyMatrix4(T),w=b.clone().add(k);i.push(w)}const v=Re(i,m*Z);v.userData={segmentType:"bend",segmentIndex:g,frameIndex:c,angle:r,radius:p,centerPoint:b.toArray(),frame:{Y:u,B:_,C:r,R:p}},v.name=`弯段_${g}`,f.add(v),Math.floor(i.length/2),i[0],n.pos=i[i.length-1].clone();const S=new s.Matrix4().makeRotationAxis(n.localZ,a);n.localY.applyMatrix4(S),n.localX.applyMatrix4(S),g++,h++}}return f}function De(V,m,f,n){const g=new s.Vector3(0,n*2,n*5),h=f.clone().add(g),c=[f,h],C=new s.BufferGeometry().setFromPoints(c),u=new s.LineDashedMaterial({color:16711680,dashSize:n*.5,gapSize:n*.3,linewidth:1}),_=new s.Line(C,u);_.computeLineDistances(),V.add(_);const r=document.createElement("canvas"),p=r.getContext("2d");r.width=128,r.height=128,p.clearRect(0,0,128,128),p.fillStyle="#FF0000",p.font="bold 80px Arial",p.textAlign="center",p.textBaseline="middle",p.fillText(m.toString(),64,64);const a=new s.CanvasTexture(r),d=new s.SpriteMaterial({map:a,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(d),b=n*3;i.scale.set(b,b,1),i.position.copy(h),i.name=`Label_${m}`,i.userData={labelNumber:m},V.add(i)}function Pe(V,m,f){const n=new s.LineCurve3(V,m),g=new s.TubeGeometry(n,2,f,18,!1);return new s.Mesh(g,Ne)}function Re(V,m){const f=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),n=new s.TubeGeometry(f,Math.max(16,V.length*2),m,18,!1);return new s.Mesh(n,Ne)}function _e(V,m,f,n,g,h=0){let c=m.slice(0,g+1);const C=m[g+1];if(C&&h>0){const i={...C,B:(C.B??0)*h,C:(C.C??0)*h};c.push(i)}const u=ke(c),_=Math.max(0,f-u),r=[];r.push(new s.Vector3(0,0,0));const p=new s.Vector3(0,_*Z,0);_>0&&r.push(p);let a={pos:p.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const d=[];for(let i=c.length-1;i>=0;i--){const b=c[i],E=Te(b);if(E.length>0){const v=E.map(T=>{const R=T.clone(),k=new s.Matrix4;return k.makeBasis(a.localX,a.localY,a.localZ),R.applyMatrix4(k),R.add(a.pos)});d.push(v);const S=v[v.length-1];a.pos=S.clone();const P=b.B??0,D=b.C??0;if(P!==0){const T=new s.Matrix4().makeRotationAxis(a.localY,H(P));a.localX.applyMatrix4(T),a.localZ.applyMatrix4(T)}if(D>0){const T=H(D),R=new s.Matrix4().makeRotationAxis(a.localZ,T);a.localY.applyMatrix4(R),a.localX.applyMatrix4(R)}}}for(const i of d)i.length>1&&r.push(...i.slice(1));r.length<2&&r.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(r,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,r.length*4),n*Z,18,!1);V.geometry.dispose(),V.geometry=b}catch(i){console.error("管件更新失败",i)}}function xe(V,m,f,n=0){let g=V.slice(0,f+1);const h=V[f+1];if(h&&n>0){const a={...h,B:(h.B??0)*n,C:(h.C??0)*n};g.push(a)}const c=ke(g),C=Math.max(0,m-c),u=[];u.push(new s.Vector3(0,0,0));const _=new s.Vector3(0,C*Z,0);C>0&&u.push(_);let r={pos:_.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const p=[];for(let a=g.length-1;a>=0;a--){const d=g[a],i=Te(d);if(i.length>0){const b=i.map(P=>{const D=P.clone(),T=new s.Matrix4;return T.makeBasis(r.localX,r.localY,r.localZ),D.applyMatrix4(T),D.add(r.pos)});p.push(b);const E=b[b.length-1];r.pos=E.clone();const v=d.B??0,S=d.C??0;if(v!==0){const P=new s.Matrix4().makeRotationAxis(r.localY,H(v));r.localX.applyMatrix4(P),r.localZ.applyMatrix4(P)}if(S>0){const P=H(S),D=new s.Matrix4().makeRotationAxis(r.localZ,P);r.localY.applyMatrix4(D),r.localX.applyMatrix4(D)}}}for(const a of p)a.length>1&&u.push(...a.slice(1));return u.length<2&&u.push(new s.Vector3(0,.001,0)),u}function Ee(V,m,f,n,g,h,c,C=0,u=0){const _=g-u,r=xe(n,_,c,C);let a=xe(f,u,c,C);a.forEach(i=>i.y=-i.y),a.reverse();const d=[...a,...r];try{const i=new s.CatmullRomCurve3(d,!1,"catmullrom",.01),b=new s.TubeGeometry(i,Math.max(2,d.length*4),h*Z,18,!1);m.geometry.dispose(),V.geometry.dispose(),m.parent&&m.parent.remove(m),V.geometry=b}catch(i){console.error("管件更新失败",i)}}const Be={class:"panel-content"},ze={class:"action-bar"},Ae={class:"animation-controls"},$e={class:"control-row"},Fe={class:"control-row"},Ye={class:"frame-info"},Le={class:"control-row"},Ie={class:"progress-bar"},Ue={class:"dialog-footer"},je=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(V,{expose:m,emit:f}){const n=V,g=f,h=e.ref(),c=e.ref();e.watch(()=>n.threeData,l=>{const t=l==null?void 0:l.data;c.value=t==null?void 0:t.type},{immediate:!0});const C=async()=>{if(!sessionStorage.getItem("systemKey")){g("getThreeData");return}let t={};c.value===X.robotMode.SINGLE&&(t=await Ce.fetchSingleRobotAnimationData()),c.value===X.robotMode.DOUBLE&&(t=await Ce.fetchDoubleRobotAnimationData());const{initialPipeLength:o=0,pipeRadius:y=0,clampLength:N=0,animationData:x}=t;D.value=o,T.value=y,R.value=N,h.value=x;const O=$.cloneDeep(h.value),K=ce(F.value),q=(O==null?void 0:O["输出(动画数据)"])||[];u.value=q.length?q:[K]},u=e.ref([]),_=e.ref(!1),r=e.ref(""),p=e.ref(!1),a=e.ref(0),d=e.ref(0),i=e.ref(1e3);let b=!1;const E=e.ref(null),v=e.shallowRef(null),S=e.shallowRef(null),P=e.shallowRef(null),D=e.ref(0),T=e.ref(12.5),R=e.ref(30),k=e.ref([]),w=e.ref(null),I=e.computed(()=>n.model?ne.getNonFixedJoints(n.model).map(o=>o.name):[]),G=e.ref(["Y","B","C","R"]),F=e.computed(()=>[...I.value,...G.value]),Y=e.computed(()=>F.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
2
  ${F.value.join(" ")}
3
3
  0 0 0 ...
4
4
  1 2 3 ...`:"请先加载模型。"),J=()=>u.value.map(l=>({Y:parseFloat(l.Y)||0,B:parseFloat(l.B)||0,C:parseFloat(l.C)||0,R:parseFloat(l.R)||0})),U=()=>{const l=[],t=[];return u.value.forEach(o=>{const{Y1:y,B1:N,C1:x,R1:O,Y2:K,B2:q,C2:ie,R2:A}=o;l.push({Y:parseFloat(y)||0,B:parseFloat(N)||0,C:parseFloat(x)||0,R:parseFloat(O)||0}),t.push({Y:parseFloat(K)||0,B:parseFloat(q)||0,C:parseFloat(ie)||0,R:parseFloat(A)||0})}),{posPipeYbcr:l,negPipeYbcr:t}},L=(l=0,t=0)=>{if(v.value&&S.value){const o=U();Ee(v.value,S.value,o.posPipeYbcr,o.negPipeYbcr,D.value,T.value,l,t,R.value)}else if(v.value){const o=J();_e(v.value,o,D.value,T.value,l,t)}},W=l=>{if(l<0||l>=u.value.length){console.error(`帧索引 ${l} 超出范围`);return}const t=u.value[l];if(console.log(`应用第 ${l} 帧数据 ${t}`),a.value=l,E.value){const o={};I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value.setJointAngles(o)}L(l,0)},B=async()=>{if(u.value.length===0){$.ElMessage.error("无法播放动画:无数据");return}if(!p.value){p.value=!0,b=!1,u.value.length-1===a.value&&(a.value=0);try{for(let l=a.value+1;l<u.value.length&&!b;l++){a.value=l;const t=u.value[l],o={};E.value&&I.value.forEach(y=>{const N=parseFloat(t[y]);isNaN(N)||(o[y]=N)}),E.value?await E.value.animateToState(o,i.value,y=>{d.value=(l+y)/u.value.length*100,L(l-1,y)}):(await new Promise(y=>setTimeout(y,i.value)),d.value=(l+1)/u.value.length*100)}b||$.ElMessage.success("动画播放完成")}catch(l){console.error("动画播放出错:",l),$.ElMessage.error("动画播放出错")}finally{p.value=!1,d.value=0}}},z=()=>{b=!0,p.value=!1,d.value=0,$.ElMessage.info("动画已停止")},ae=()=>{a.value=0},j=()=>{if(v.value&&S.value){const l=U();Ee(v.value,S.value,l.posPipeYbcr,l.negPipeYbcr,D.value,T.value,-1,0,R.value)}else if(v.value){const l=J();_e(v.value,l,D.value,T.value,-1,0)}},oe=()=>{E.value&&E.value.resetToZero(),j(),ae(),$.ElMessage.success("机器人和管件已重置")},me=l=>`第 ${l+1} 帧`,ve=l=>{p.value&&z(),W(l)},fe=()=>{p.value&&z(),!(a.value+1>=u.value.length)&&W(a.value+1)},ge=()=>{p.value&&z(),a.value!==0&&W(a.value-1)},se=()=>{P.value&&(P.value.visible=!0),v.value&&v.value.parent&&v.value.parent.remove(v.value),P.value=null,v.value=null,S.value=null},ce=l=>l==null?void 0:l.reduce((t,o)=>(t[o]="0",t),{});e.watch(F,(l,t)=>{if(JSON.stringify(l)!==JSON.stringify(t))if(l.length>0){const o=ce(l);u.value=[o]}else u.value=[]},{immediate:!0});const re=e.ref(0),he=l=>{re.value=l},ue=(l,t)=>{if(!l||!t)return;const o=ne.getTargetJoint(l,t),y=Me();y.visible=!1,o==null||o.add(y)},te=l=>{E.value=new X.URDFRobotController(l),k.value=ne.getAllLinkName(l),w.value="Pipe_Joint"},le=()=>{E.value=null,k.value=[],w.value=null},Ve=l=>{te(l),ue(l,w.value),he(re.value+1),oe()};e.watch(()=>n.model,l=>{if(se(),l){Ve(l);return}le()},{immediate:!0});const de=l=>{var o,y;const t=new s.Mesh(l.geometry.clone(),l.material);return t.name="managed_pipe_clone",(y=(o=l==null?void 0:l.parent)==null?void 0:o.add)==null||y.call(o,t),t.position.copy(l.position),t.rotation.copy(l.rotation),t.scale.copy(l.scale),t};e.watch([w,R,D,re],([l,t])=>{if(se(),n.model&&l){const o=ne.getMeshFromJoint(n.model,l);if(console.log(o,"meshToReplace"),o&&o.parent){P.value=o,o.visible=!1;const y=de(o);if(c.value===X.robotMode.SINGLE&&(y.position.y-=t*.001),v.value=y,c.value===X.robotMode.DOUBLE){const N=de(o);S.value=N}L(0,0)}else l&&console.warn(`在 link '${l}' 中未找到可替换的网格或其没有父级。`)}});const be=async()=>{if(F.value.length===0){$.ElMessage.warning("没有可导出的表头");return}const l=F.value.join(" ");try{await navigator.clipboard.writeText(l),$.ElMessage.success("表头已成功复制到剪贴板!")}catch(t){console.error("复制失败:",t),$.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ye=()=>{if(!r.value.trim()){$.ElMessage.warning("导入内容不能为空");return}const l=r.value.trim().split(`
@@ -1,17 +1,17 @@
1
1
  import { defineComponent as Oe, ref as h, watch as se, shallowRef as ve, computed as we, onUnmounted as He, resolveComponent as O, createElementBlock as _e, openBlock as te, createElementVNode as n, createVNode as o, withCtx as T, createBlock as Ce, createCommentVNode as ye, unref as M, toDisplayString as me, onMounted as We, onBeforeUnmount as Ie, Fragment as et, renderList as tt, nextTick as lt, withDirectives as Q, vShow as re, renderSlot as de, isRef as Te, vModelRadio as Re } from "vue";
2
- import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-DtlsVo1q.js";
3
- import { u as Ke, a as it, b as rt } from "./iconfont-DCNS3tUf.js";
2
+ import { r as Ve, U as ot, s as je, u as nt, a as at, W as st } from "./workpieceTreePanel-27hu7whF.js";
3
+ import { u as Ke, a as it, b as rt } from "./iconfont-BI4Uo8yP.js";
4
4
  import { ag as ut, c as ct, E as X, aW as pt, aw as dt } from "./index-DsSA-OiE.js";
5
- import { R as Me, T as ke, V as F, O as H, Q as mt, U as vt, z as Se, Y as ft, Z as gt, _ as ht, $ as bt, a0 as yt, a1 as wt, a2 as _t, a3 as Ct, K as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
5
+ import { R as Me, T as ke, V as F, O as H, Q as mt, U as vt, z as Se, Y as ft, Z as gt, _ as ht, $ as bt, a0 as yt, a1 as wt, a2 as _t, a3 as Ct, K as kt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
6
6
  import "./index-BHtNKL1L.js";
7
- import { _ as ue, s as Pt } from "./index-CmPg86RO.js";
8
- import "./index.vue_vue_type_style_index_1_lang-Cu2BshsL.js";
7
+ import { _ as ue, s as Pt } from "./index-B4ekORH0.js";
8
+ import "./index.vue_vue_type_style_index_1_lang-CU-2e_BS.js";
9
9
  import "./index-Bbjcv84T.js";
10
10
  import "./index-l2JNYn9u.js";
11
- import { f as xt, a as Dt } from "./animationData-DGlw1Pwm.js";
12
- import { g as Tt, a as Rt, b as Vt, c as Mt, U as St, J as At } from "./urdfTree-DfcawAzu.js";
11
+ import { f as xt, a as Dt } from "./animationData-B5eOmRnz.js";
12
+ import { g as Tt, a as Rt, b as Vt, c as Mt, U as St, J as At } from "./urdfTree-C6zY5_p4.js";
13
13
  import { _ as Xe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- import { g as zt, a as Ee, d as $t, c as Ft, e as Yt, b as Lt } from "./dataUtil-yN0F9IZh.js";
14
+ import { g as zt, a as Ee, d as $t, c as Ft, e as Yt, b as Lt } from "./dataUtil-iQRU-HFQ.js";
15
15
  import { T as A } from "./svgIcon-D-_fXUBL.js";
16
16
  const q = 1e-3, ae = mt.degToRad, Ge = new ft({
17
17
  // 灰色
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as we, ref as u, computed as U, watch as Z, onUnmounted as He, resolveComponent as q, createElementBlock as M, openBlock as z, createElementVNode as l, createCommentVNode as G, createVNode as i, toDisplayString as B, Fragment as Ke, renderList as We, withCtx as ne, inject as he, shallowRef as ue, onMounted as Ye, nextTick as Ze, onBeforeUnmount as qe, withDirectives as $, vShow as W, renderSlot as Y, unref as d, createBlock as ye, isRef as re, vModelRadio as de } from "vue";
2
- import { b1 as Qe } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
3
- import { U as et, s as ke, u as tt, a as lt, W as at } from "./workpieceTreePanel-DtlsVo1q.js";
4
- import { u as nt, a as ot, b as st } from "./iconfont-DCNS3tUf.js";
2
+ import { b1 as Qe } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
3
+ import { U as et, s as ke, u as tt, a as lt, W as at } from "./workpieceTreePanel-27hu7whF.js";
4
+ import { u as nt, a as ot, b as st } from "./iconfont-BI4Uo8yP.js";
5
5
  import { c as it, E as y } from "./index-DsSA-OiE.js";
6
- import { _ as pe } from "./index-CmPg86RO.js";
7
- import { g as ut, b as rt, U as dt, J as ct, d as vt } from "./urdfTree-DfcawAzu.js";
6
+ import { _ as pe } from "./index-B4ekORH0.js";
7
+ import { g as ut, b as rt, U as dt, J as ct, d as vt } from "./urdfTree-C6zY5_p4.js";
8
8
  import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
9
9
  import { T as h } from "./svgIcon-D-_fXUBL.js";
10
- import { i as pt } from "./animationData-DGlw1Pwm.js";
11
- import { O as mt } from "./MTLLoader-S0-tgcId.js";
12
- import { L as ft, j as gt } from "./index-B_Tkvppm.js";
10
+ import { i as pt } from "./animationData-B5eOmRnz.js";
11
+ import { O as mt } from "./MTLLoader-Bp_zXJHj.js";
12
+ import { L as ft, j as gt } from "./index-CjlgPPLu.js";
13
13
  const bt = { class: "panel-content" }, ht = { class: "action-bar" }, yt = {
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"),Te=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs"),A=require("./workpieceTreePanel-XHkn5qFT.cjs"),Z=require("./iconfont-DIct6CCo.cjs"),p=require("./index-C8qRkCgn.cjs"),Q=require("./index-Cx2uJNrm.cjs"),G=require("./urdfTree-bqnyp0ks.cjs"),se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),g=require("./svgIcon-CUM54R6L.cjs"),De=require("./animationData-BI3PXunj.cjs"),Me=require("./MTLLoader-z5-t3xJP.cjs"),oe=require("./index-CbXglzHn.cjs"),$e={class:"panel-content"},Be={class:"action-bar"},ze={key:0,class:"animation-controls"},Le={class:"control-row"},Re={class:"control-row"},Ue={class:"frame-info"},je={class:"control-row"},Ae={key:1,class:"empty-state"},Ie={class:"dialog-footer"},Oe=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(B,{expose:I}){const k=B,o=e.ref([]),w=e.ref(!1),C=e.ref(""),v=e.ref("stopped"),c=e.ref(0),y=e.ref(0),z=e.ref(10),S=e.ref(null);let h=0;const O=e.ref([]),T=e.computed(()=>k.model?G.getNonFixedJoints(k.model).map(m=>m.name):[]),P=e.computed(()=>[...T.value]),W=e.computed(()=>P.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Te=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs"),A=require("./workpieceTreePanel-CMwRzaFj.cjs"),Z=require("./iconfont-nIq9TlPr.cjs"),p=require("./index-C8qRkCgn.cjs"),Q=require("./index-BDur1jFN.cjs"),G=require("./urdfTree-77wdErmJ.cjs"),se=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),g=require("./svgIcon-CUM54R6L.cjs"),De=require("./animationData-Ba6obiMd.cjs"),Me=require("./MTLLoader-CP_pjCVi.cjs"),oe=require("./index-CIasmB1I.cjs"),$e={class:"panel-content"},Be={class:"action-bar"},ze={key:0,class:"animation-controls"},Le={class:"control-row"},Re={class:"control-row"},Ue={class:"frame-info"},je={class:"control-row"},Ae={key:1,class:"empty-state"},Ie={class:"dialog-footer"},Oe=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(B,{expose:I}){const k=B,o=e.ref([]),w=e.ref(!1),C=e.ref(""),v=e.ref("stopped"),c=e.ref(0),y=e.ref(0),z=e.ref(10),S=e.ref(null);let h=0;const O=e.ref([]),T=e.computed(()=>k.model?G.getNonFixedJoints(k.model).map(m=>m.name):[]),P=e.computed(()=>[...T.value]),W=e.computed(()=>P.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
2
  ${P.value.join(" ")}
3
3
  0 0 0 ...
4
4
  1 2 3 ...`:"请先加载模型。"),R=e.computed(()=>o.value[c.value]||{});e.watch(()=>k.model,s=>{s?(S.value=new A.URDFRobotController(s),O.value=G.getAllLinkName(s),c.value=0):(S.value=null,O.value=[])},{immediate:!0});const U=s=>{if(s<0||s>=o.value.length){console.error(`帧索引 ${s} 超出范围`);return}const n=o.value[s];if(S.value){const m={};T.value.forEach(N=>{const i=parseFloat(n[N]);isNaN(i)||(m[N]=i)}),S.value.setJointAngles(m)}c.value=s,y.value=o.value.length>1?s/(o.value.length-1)*100:100},H=async s=>{try{for(let n=c.value;n<o.value.length;n++){if(s!==h)return;const m=o.value[n],N={};if(S.value)T.value.forEach(i=>{const r=parseFloat(m[i]);isNaN(r)||(N[i]=r)}),await S.value.animateToState(N,z.value,i=>{s===h&&(y.value=(n+i)/o.value.length*100)});else{if(await new Promise(i=>setTimeout(i,z.value)),s!==h)return;y.value=(n+1)/o.value.length*100}c.value=n}s===h&&(p.ElMessage.success("动画播放完成"),v.value="stopped",y.value=100)}catch(n){console.error("动画播放出错:",n),p.ElMessage.error("动画播放出错"),v.value="stopped"}},_=()=>{if(o.value.length===0){p.ElMessage.error("无动画数据");return}v.value==="stopped"&&(c.value=0,U(0)),v.value="playing",h++,H(h),p.ElMessage.info("动画播放中")},V=()=>{v.value==="playing"&&(h++,v.value="paused",p.ElMessage.info("动画已暂停"))},D=()=>{h++,v.value="stopped",c.value=0,y.value=0,U(0),p.ElMessage.info("动画已停止并重置")},E=()=>{v.value==="playing"?V():_()},F=s=>{h++,v.value="paused",U(s)},q=()=>{if(!C.value.trim()){p.ElMessage.warning("导入内容不能为空");return}const s=C.value.trim().split(`
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as Ve, ref as B, shallowRef as he, computed as $, watch as Ge, onMounted as He, onBeforeUnmount as Ne, resolveComponent as $e, createElementBlock as te, openBlock as X, createElementVNode as d, withDirectives as k, createCommentVNode as ne, createVNode as p, unref as b, renderSlot as ve, toDisplayString as ie, withCtx as ge, createBlock as Xe, isRef as Y, vModelRadio as Z, vShow as se } from "vue";
2
- import { u as Ye, a as Ze, b as qe, f as Je, d as Ke } from "./iconfont-DCNS3tUf.js";
3
- import { aT as Qe, aU as le, aV as de, aK as F, aW as et, B as ce, aS as Ce, V as P, aX as tt, aY as Q, aZ as _e, ab as Ue, a_ as ee, z as nt, a$ as G, b0 as it, O as st, Q as Ee, R as ot, _ as at, av as rt, aD as lt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
4
- import { r as dt } from "./fileUtil-Bev09uzf.js";
2
+ import { u as Ye, a as Ze, b as qe, f as Je, d as Ke } from "./iconfont-BI4Uo8yP.js";
3
+ import { aT as Qe, aU as le, aV as de, aK as F, aW as et, B as ce, aS as Ce, V as P, aX as tt, aY as Q, aZ as _e, ab as Ue, a_ as ee, z as nt, a$ as G, b0 as it, O as st, Q as Ee, R as ot, _ as at, av as rt, aD as lt } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
4
+ import { r as dt } from "./fileUtil-DtFX4qSS.js";
5
5
  import { E as ct } from "./index-DsSA-OiE.js";
6
- import { U as ut, J as ft } from "./urdfTree-DfcawAzu.js";
6
+ import { U as ut, J as ft } from "./urdfTree-C6zY5_p4.js";
7
7
  import { T as v } from "./svgIcon-D-_fXUBL.js";
8
8
  import { i as pt } from "./isString-RZ1z_1Z2.js";
9
9
  import { _ as mt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),D=require("./iconfont-DIct6CCo.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs"),ye=require("./fileUtil-CLjIZqTr.cjs"),we=require("./index-C8qRkCgn.cjs"),J=require("./urdfTree-bqnyp0ks.cjs"),v=require("./svgIcon-CUM54R6L.cjs"),Se=require("./isString--eJE54G5.cjs"),xe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),K=new s.Box3,R=new s.Vector3;class oe extends s.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new s.Float32BufferAttribute(e,3)),this.setAttribute("uv",new s.Float32BufferAttribute(i,2))}applyMatrix4(e){const i=this.attributes.instanceStart,o=this.attributes.instanceEnd;return i!==void 0&&(i.applyMatrix4(e),o.applyMatrix4(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new s.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceStart",new s.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new s.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new s.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceColorStart",new s.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new s.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new s.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new s.Box3);const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;e!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(e),K.setFromBufferAttribute(i),this.boundingBox.union(K))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new s.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(e!==void 0&&i!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let n=0;for(let c=0,d=e.count;c<d;c++)R.fromBufferAttribute(e,c),n=Math.max(n,o.distanceToSquared(R)),R.fromBufferAttribute(i,c),n=Math.max(n,o.distanceToSquared(R));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}s.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new s.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};s.ShaderLib.line={uniforms:s.UniformsUtils.merge([s.UniformsLib.common,s.UniformsLib.fog,s.UniformsLib.line]),vertexShader:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),D=require("./iconfont-nIq9TlPr.cjs"),s=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs"),ye=require("./fileUtil-DOKmUgX6.cjs"),we=require("./index-C8qRkCgn.cjs"),J=require("./urdfTree-77wdErmJ.cjs"),v=require("./svgIcon-CUM54R6L.cjs"),Se=require("./isString--eJE54G5.cjs"),xe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),K=new s.Box3,R=new s.Vector3;class oe extends s.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],i=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new s.Float32BufferAttribute(e,3)),this.setAttribute("uv",new s.Float32BufferAttribute(i,2))}applyMatrix4(e){const i=this.attributes.instanceStart,o=this.attributes.instanceEnd;return i!==void 0&&(i.applyMatrix4(e),o.applyMatrix4(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new s.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceStart",new s.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceEnd",new s.InterleavedBufferAttribute(o,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));const o=new s.InstancedInterleavedBuffer(i,6,1);return this.setAttribute("instanceColorStart",new s.InterleavedBufferAttribute(o,3,0)),this.setAttribute("instanceColorEnd",new s.InterleavedBufferAttribute(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new s.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const i=e.geometry;return this.setPositions(i.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new s.Box3);const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;e!==void 0&&i!==void 0&&(this.boundingBox.setFromBufferAttribute(e),K.setFromBufferAttribute(i),this.boundingBox.union(K))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new s.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(e!==void 0&&i!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let n=0;for(let c=0,d=e.count;c<d;c++)R.fromBufferAttribute(e,c),n=Math.max(n,o.distanceToSquared(R)),R.fromBufferAttribute(i,c),n=Math.max(n,o.distanceToSquared(R));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}s.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new s.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};s.ShaderLib.line={uniforms:s.UniformsUtils.merge([s.UniformsLib.common,s.UniformsLib.fog,s.UniformsLib.line]),vertexShader:`
2
2
  #include <common>
3
3
  #include <color_pars_vertex>
4
4
  #include <fog_pars_vertex>
@@ -1,7 +1,7 @@
1
1
  import { computed as _, defineComponent as Y, defineAsyncComponent as S, ref as B, watch as q, createElementBlock as O, openBlock as y, normalizeClass as J, createElementVNode as K, createBlock as P, createCommentVNode as L, renderSlot as p, unref as D, withCtx as T } from "vue";
2
2
  import { a as A, c3 as Q, p as N, s as H } from "./index-DsSA-OiE.js";
3
3
  import { u as z } from "./index-l2JNYn9u.js";
4
- import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
4
+ import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
5
5
  import { _ as X } from "./_plugin-vue_export-helper-CHgC5LLL.js";
6
6
  function ue(l) {
7
7
  const m = sessionStorage.getItem("loginToken") ?? "123456";
@@ -137,7 +137,7 @@ const te = { class: "top-menu" }, ne = {
137
137
  },
138
138
  emits: ["getThreeData"],
139
139
  setup(l, { emit: m }) {
140
- const v = S(() => import("./threeSceneView-CWbDj-33.js")), k = S(() => import("./threePreview-CJ3vTE2P.js")), f = S(() => import("./threeTrackPathView-SikIkQ4h.js")), E = S(() => import("./threeSceneViewForCPMPIP-GISXOGMC.js")), o = {
140
+ const v = S(() => import("./threeSceneView-DZs6WyDt.js")), k = S(() => import("./threePreview-Bo7UlxmA.js")), f = S(() => import("./threeTrackPathView-DVHETbx3.js")), E = S(() => import("./threeSceneViewForCPMPIP-BlOqsiB_.js")), o = {
141
141
  ROBOT_SCENE: "robot",
142
142
  // 机器人场景
143
143
  LATHE_SCENE: "latheScene",
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),f=require("./index-C8qRkCgn.cjs"),A=require("./index-H18D4EBa.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs");const H=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/uploadFile",method:"post",data:c,headers:{Authorization:m,"Content-Type":"multipart/form-data"}})}function B(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/downloadFile",method:"post",data:c,headers:{Authorization:m,Accept:"application/octet-stream"},responseType:"blob"})}function q(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/uploadFiles",method:"post",data:c,headers:{Authorization:m,"Content-Type":"multipart/form-data"}})}const I=f.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(c){this.data=c},getData(){return this.data}}});function R(){const c=A.useMenuState(f.pinia),{platform:m}=f.storeToRefs(c),v=I(f.pinia),b=e.computed(()=>{var n;return(n=v==null?void 0:v.data)==null?void 0:n.extension}),p=["uv","cpt","cyd"],y=["urdf"],s=["obj","stl"],o=[...p,...y,...s],F=n=>{if(!C())throw new Error("不是三维系统");v.setData(n)},h=()=>v.getData(),C=()=>m.value==="three",u=n=>{const i=n==null?void 0:n.toLowerCase(),l=i==null?void 0:i.lastIndexOf(".");let T=i;return l>=0&&(T=T==null?void 0:T.slice(l+1)),T},g=n=>{if(!n)return!1;const i=u(n);return o==null?void 0:o.includes(i)};return{getData:h,setData:F,isThreeSystem:C,isUrdf:n=>{if(!n)return!1;const i=u(n);return y==null?void 0:y.includes(i)},isGeneralFile:n=>{if(!n)return!1;const i=u(n);return s==null?void 0:s.includes(i)},isTrackPathFile:n=>{if(!n)return!1;const i=u(n);return p==null?void 0:p.includes(i)},isThreeFile:g,isUseBackdrop:n=>C()&&g(n),initTrackFileType:n=>{if(!n)return{isCpt:!1,isCyd:!1,isUv:!1};const i=u(n),l=p==null?void 0:p.find(k=>k===i);return{isCpt:l==="cpt",isCyd:l==="cyd",isUv:l==="uv"}},getFileExtension:u,extraExtension:b}}const L={class:"top-menu"},x={key:4,class:"loading"},z=e.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(c,{emit:m}){const v=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-4qe_PpyY.cjs"))),b=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-UGPvJ0Kr.cjs"))),p=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-C7GA97Vy.cjs"))),y=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-YOScA2Ku.cjs"))),s={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},o=c,F=A.useMenuState(f.pinia),{platName:h}=f.storeToRefs(F),{isGeneralFile:C,isUrdf:u,isTrackPathFile:g,extraExtension:D}=R(),w=e.computed(()=>(o==null?void 0:o.extension)||D.value),P=e.computed(()=>{var t,r;return(r=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:r.trackFileType}),E=e.computed(()=>{var r;if(o.componentType)switch(o.componentType){case"robot":return s.ROBOT_SCENE;case"latheScene":return s.LATHE_SCENE;case"cpmpip":return s.CPMPIP_SCENE;case"preview":return s.PREVIEW}const t=(r=o==null?void 0:o.fileUrls)==null?void 0:r[0];return C(t)?s.PREVIEW:(h==null?void 0:h.value)==="CPMPIP"&&(u(t)||u(w.value))?s.CPMPIP_SCENE:(h==null?void 0:h.value)==="SFRTubeBend"&&(u(t)||u(w.value))?s.ROBOT_SCENE:g(w.value)&&P.value?s.LATHE_SCENE:s.PREVIEW}),_=m,n=e.ref([]),i=e.ref(!1);function l(t){try{const r=new URL(t).pathname,d=r.substring(r.lastIndexOf("/")+1);return decodeURIComponent(d)}catch(r){return console.error("无法解析URL以提取文件名:",t,r),"未知文件名"}}async function T(t){let r,d;if(/^https?:\/\//.test(t))try{const a=await fetch(t);if(!a.ok)throw new Error(`下载文件失败: ${a.statusText} (URL: ${t})`);r=await a.blob(),d=l(t)}catch(a){throw console.error("使用 fetch 下载文件时出错:",a),a}else try{const a=await B({url:t});if(a.status!==200)throw new Error(`下载失败: ${a.status}`);const S=a.headers["content-disposition"];d=k(S)||"无文件名",r=a.data}catch(a){throw console.error("通过 API 下载文件时出错:",a),a}return new File([r],d,{type:r.type})}function k(t){if(!t)return;const r=t.match(/filename\*\s*=\s*([^;]+)/i);if(r){let a=r[1].trim();a=a.replace(/^"(.*)"$/,"$1");const S=a.split("''");if(S.length===2){const M=S[0].toUpperCase(),U=S[1];try{if(M==="UTF-8")return decodeURIComponent(U)}catch{}return U}try{return decodeURIComponent(a)}catch{return a}}const d=t.match(/filename\s*=\s*("?)([^";]+)\1/i);if(d)return d[2].trim()}async function N(t){if(!t||!t.length){n.value=[];return}i.value=!0;try{const r=await Promise.all(t.map(d=>T(d)));n.value=r}catch(r){console.error("文件下载时发生错误:",r),n.value=[]}finally{i.value=!1}}const $=()=>{_("getThreeData")};return e.watch(()=>o.fileUrls,async t=>{await N(t??[])},{immediate:!0,deep:!0}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.host==="electron"?"mv-electron":"mv-inline","three-platform"])},[e.createElementVNode("div",L,[e.renderSlot(t.$slots,"top-menu",{},void 0,!0)]),E.value===s.ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(v),{key:0,"file-blobs":n.value,"animation-data":t.animationData,onGetThreeData:$,threeData:o.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","animation-data","threeData"])):E.value===s.LATHE_SCENE?(e.openBlock(),e.createBlock(e.unref(p),{key:1,fileUrls:t.fileUrls,threeData:o.threeData,trackFileType:P.value},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileUrls","threeData","trackFileType"])):E.value===s.CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(y),{key:2,"file-blobs":n.value,threeData:o.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","threeData"])):E.value===s.PREVIEW?(e.openBlock(),e.createBlock(e.unref(b),{key:3,"file-blobs":n.value,"animation-data":t.animationData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","animation-data"])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("div",x," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)],2))}}),V=H._export_sfc(z,[["__scopeId","data-v-a4f0efb1"]]),W=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=V;exports.downloadAvatarApi=B;exports.threeViewerHost=W;exports.uploadAmountApi=q;exports.uploadFile=O;exports.useThreeState=I;exports.useThreeSystem=R;
1
+ "use strict";const e=require("vue"),f=require("./index-C8qRkCgn.cjs"),A=require("./index-H18D4EBa.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs");const H=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/uploadFile",method:"post",data:c,headers:{Authorization:m,"Content-Type":"multipart/form-data"}})}function B(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/downloadFile",method:"post",data:c,headers:{Authorization:m,Accept:"application/octet-stream"},responseType:"blob"})}function q(c){const m=sessionStorage.getItem("loginToken")??"123456";return f.service({url:"/api/sysFile/uploadFiles",method:"post",data:c,headers:{Authorization:m,"Content-Type":"multipart/form-data"}})}const I=f.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(c){this.data=c},getData(){return this.data}}});function R(){const c=A.useMenuState(f.pinia),{platform:m}=f.storeToRefs(c),v=I(f.pinia),b=e.computed(()=>{var n;return(n=v==null?void 0:v.data)==null?void 0:n.extension}),p=["uv","cpt","cyd"],y=["urdf"],s=["obj","stl"],o=[...p,...y,...s],F=n=>{if(!C())throw new Error("不是三维系统");v.setData(n)},h=()=>v.getData(),C=()=>m.value==="three",u=n=>{const i=n==null?void 0:n.toLowerCase(),l=i==null?void 0:i.lastIndexOf(".");let T=i;return l>=0&&(T=T==null?void 0:T.slice(l+1)),T},g=n=>{if(!n)return!1;const i=u(n);return o==null?void 0:o.includes(i)};return{getData:h,setData:F,isThreeSystem:C,isUrdf:n=>{if(!n)return!1;const i=u(n);return y==null?void 0:y.includes(i)},isGeneralFile:n=>{if(!n)return!1;const i=u(n);return s==null?void 0:s.includes(i)},isTrackPathFile:n=>{if(!n)return!1;const i=u(n);return p==null?void 0:p.includes(i)},isThreeFile:g,isUseBackdrop:n=>C()&&g(n),initTrackFileType:n=>{if(!n)return{isCpt:!1,isCyd:!1,isUv:!1};const i=u(n),l=p==null?void 0:p.find(k=>k===i);return{isCpt:l==="cpt",isCyd:l==="cyd",isUv:l==="uv"}},getFileExtension:u,extraExtension:b}}const L={class:"top-menu"},x={key:4,class:"loading"},z=e.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(c,{emit:m}){const v=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-D7n8nPfy.cjs"))),b=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-Do2o5OBN.cjs"))),p=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-D_mOz7ZU.cjs"))),y=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-jBfAtm1G.cjs"))),s={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},o=c,F=A.useMenuState(f.pinia),{platName:h}=f.storeToRefs(F),{isGeneralFile:C,isUrdf:u,isTrackPathFile:g,extraExtension:D}=R(),w=e.computed(()=>(o==null?void 0:o.extension)||D.value),P=e.computed(()=>{var t,r;return(r=(t=o==null?void 0:o.threeData)==null?void 0:t.data)==null?void 0:r.trackFileType}),E=e.computed(()=>{var r;if(o.componentType)switch(o.componentType){case"robot":return s.ROBOT_SCENE;case"latheScene":return s.LATHE_SCENE;case"cpmpip":return s.CPMPIP_SCENE;case"preview":return s.PREVIEW}const t=(r=o==null?void 0:o.fileUrls)==null?void 0:r[0];return C(t)?s.PREVIEW:(h==null?void 0:h.value)==="CPMPIP"&&(u(t)||u(w.value))?s.CPMPIP_SCENE:(h==null?void 0:h.value)==="SFRTubeBend"&&(u(t)||u(w.value))?s.ROBOT_SCENE:g(w.value)&&P.value?s.LATHE_SCENE:s.PREVIEW}),_=m,n=e.ref([]),i=e.ref(!1);function l(t){try{const r=new URL(t).pathname,d=r.substring(r.lastIndexOf("/")+1);return decodeURIComponent(d)}catch(r){return console.error("无法解析URL以提取文件名:",t,r),"未知文件名"}}async function T(t){let r,d;if(/^https?:\/\//.test(t))try{const a=await fetch(t);if(!a.ok)throw new Error(`下载文件失败: ${a.statusText} (URL: ${t})`);r=await a.blob(),d=l(t)}catch(a){throw console.error("使用 fetch 下载文件时出错:",a),a}else try{const a=await B({url:t});if(a.status!==200)throw new Error(`下载失败: ${a.status}`);const S=a.headers["content-disposition"];d=k(S)||"无文件名",r=a.data}catch(a){throw console.error("通过 API 下载文件时出错:",a),a}return new File([r],d,{type:r.type})}function k(t){if(!t)return;const r=t.match(/filename\*\s*=\s*([^;]+)/i);if(r){let a=r[1].trim();a=a.replace(/^"(.*)"$/,"$1");const S=a.split("''");if(S.length===2){const M=S[0].toUpperCase(),U=S[1];try{if(M==="UTF-8")return decodeURIComponent(U)}catch{}return U}try{return decodeURIComponent(a)}catch{return a}}const d=t.match(/filename\s*=\s*("?)([^";]+)\1/i);if(d)return d[2].trim()}async function N(t){if(!t||!t.length){n.value=[];return}i.value=!0;try{const r=await Promise.all(t.map(d=>T(d)));n.value=r}catch(r){console.error("文件下载时发生错误:",r),n.value=[]}finally{i.value=!1}}const $=()=>{_("getThreeData")};return e.watch(()=>o.fileUrls,async t=>{await N(t??[])},{immediate:!0,deep:!0}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.host==="electron"?"mv-electron":"mv-inline","three-platform"])},[e.createElementVNode("div",L,[e.renderSlot(t.$slots,"top-menu",{},void 0,!0)]),E.value===s.ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(v),{key:0,"file-blobs":n.value,"animation-data":t.animationData,onGetThreeData:$,threeData:o.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","animation-data","threeData"])):E.value===s.LATHE_SCENE?(e.openBlock(),e.createBlock(e.unref(p),{key:1,fileUrls:t.fileUrls,threeData:o.threeData,trackFileType:P.value},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileUrls","threeData","trackFileType"])):E.value===s.CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(y),{key:2,"file-blobs":n.value,threeData:o.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","threeData"])):E.value===s.PREVIEW?(e.openBlock(),e.createBlock(e.unref(b),{key:3,"file-blobs":n.value,"animation-data":t.animationData},{"button-left":e.withCtx(()=>[e.renderSlot(t.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(t.$slots,"management-page",{},void 0,!0)]),_:3},8,["file-blobs","animation-data"])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("div",x," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)],2))}}),V=H._export_sfc(z,[["__scopeId","data-v-a4f0efb1"]]),W=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=V;exports.downloadAvatarApi=B;exports.threeViewerHost=W;exports.uploadAmountApi=q;exports.uploadFile=O;exports.useThreeState=I;exports.useThreeSystem=R;
@@ -1 +1 @@
1
- "use strict";const t=require("vue"),x=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs"),J=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),E=(o,i)=>{if(!i)return null;const l=o.joints[i];return l||null},F=(o,i)=>{if(!i)return null;const l=E(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},N=(o,i)=>{if(!i)return null;const l=o.links[i];return l||null},L=(o,i)=>{if(!i)return null;const l=N(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},V=o=>{const i=o.joints;return Object.values(i)},M=o=>V(o).filter(u=>u.jointType!=="fixed"),w=o=>{const i=o.links;return Object.keys(i)},B={class:"panel-content"},b={key:0,class:"joints-list"},I={class:"joint-info-row"},S={class:"joint-left"},C={class:"joint-name"},D={class:"joint-range"},P={class:"joint-type"},T={key:0,class:"joint-control-row"},A={class:"slider-container"},U=["min","max","value","onInput"],R={class:"value-display"},q={class:"joint-value"},O={class:"unit"},K={key:1,class:"empty-state"},$=t.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:i}){const l=o,u=t.ref([]),c=t.ref(null),f=(s,p=!1)=>s==="revolute"?p?Math.PI:-Math.PI:s==="prismatic"?p?1:-1:0,_=s=>{if(!s||!s.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const p=[];return V(s).forEach(r=>{var n,d;if(r.jointType==="fixed")return;let a={lower:((n=r.limit)==null?void 0:n.lower)??f(r.jointType,!1),upper:((d=r.limit)==null?void 0:d.upper)??f(r.jointType,!0)};r.jointType==="continuous"&&(a={lower:-10*Math.PI,upper:10*Math.PI}),p.push({name:r.name,type:r.jointType||"unknown",limit:a,currentValue:r.angle||0,urdfJoint:r})}),p},m=(s,p)=>{var n;const e=u.value.find(d=>d.name===s);if(!e)return;const r=parseFloat(p),a=Math.max(e.limit.lower,Math.min(e.limit.upper,r));e.currentValue=a,(n=l.model)!=null&&n.setJointValue?l.model.setJointValue(s,a):e.urdfJoint.setJointValue(a)},v=()=>{u.value.forEach(s=>{(s.type==="revolute"||s.type==="continuous"||s.type==="prismatic")&&m(s.name,0)})},y=()=>{l.model&&u.value.forEach(s=>{s.urdfJoint.angle!==void 0&&s.currentValue!==s.urdfJoint.angle&&(s.currentValue=s.urdfJoint.angle)})},g=()=>{const s=()=>{y(),c.value=requestAnimationFrame(s)};s()},k=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return t.watch(()=>l.model,s=>{s?u.value=_(s):u.value=[]},{immediate:!0}),t.onMounted(()=>{g()}),t.onUnmounted(()=>{k()}),i({resetAllJoints:v}),(s,p)=>(t.openBlock(),t.createElementBlock("div",B,[u.value.length>0?(t.openBlock(),t.createElementBlock("div",b,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,e=>(t.openBlock(),t.createElementBlock("div",{key:e.name,class:"joint-item"},[t.createElementVNode("div",I,[t.createElementVNode("div",S,[t.createElementVNode("span",C,t.toDisplayString(e.name),1),t.createElementVNode("span",D," ["+t.toDisplayString(e.limit.lower.toFixed(2))+", "+t.toDisplayString(e.limit.upper.toFixed(2))+"] ",1)]),t.createElementVNode("span",P,t.toDisplayString(e.type),1)]),e.type==="revolute"||e.type==="prismatic"||e.type==="continuous"?(t.openBlock(),t.createElementBlock("div",T,[t.createElementVNode("div",A,[t.createElementVNode("input",{type:"range",min:e.limit.lower,max:e.limit.upper,step:"0.001",value:e.currentValue,onInput:r=>m(e.name,r.target.value),class:"joint-slider"},null,40,U)]),t.createElementVNode("div",R,[t.createElementVNode("span",q,t.toDisplayString(e.currentValue?Number(e.currentValue).toFixed(3):"0.000"),1),t.createElementVNode("span",O,t.toDisplayString(e.type==="prismatic"?"m":"rad"),1)])])):t.createCommentVNode("",!0)]))),128))])):(t.openBlock(),t.createElementBlock("div",K,p[0]||(p[0]=[t.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),H=J._export_sfc($,[["__scopeId","data-v-750b831d"]]),z={class:"panel-content"},G="id",Q={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)},extraNodes:{type:Array,default:[]}},emits:["nodeClick"],setup(o,{emit:i}){const l=o,u=i,c=t.ref([]),f={children:"children",label:"label"},_=e=>{u("nodeClick",e)},m=(e,r=0)=>{const a=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const d={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:r+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:m(n==null?void 0:n.children,r+1),path:n==null?void 0:n.name};a.push(d)}}),a},v=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}]:[],y=(e,r)=>{const a=[],n=[...e];for(;n.length>0&&a.length<r;){const d=n.shift();d.children&&d.children.length>0&&(a.push(d.id),n.push(...d.children))}return a},g=(e,r)=>{const a=[];return e.forEach(n=>{if(n.children&&n.children.length>0){a.push(n.id);const d=n.children.filter(h=>h.children&&h.children.length>0).slice(0,r).map(h=>h.id);a.push(...d)}}),a.slice(0,r+1)},k=t.computed(()=>!c.value||c.value.length===0?[]:l.expandStrategy==="firstLevel"?g(c.value,l.maxExpandCount):y(c.value,l.maxExpandCount)),s=t.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:l!=null&&l.model?v(l.model):[],path:"场景"}]),p=()=>{const e=l.extraNodes||[],r=e==null?void 0:e.map(a=>({...a,level:0}));c.value.push(...r)};return t.watch(s,e=>{c.value=JSON.parse(JSON.stringify(e)),p()},{immediate:!0}),(e,r)=>{const a=t.resolveComponent("el-tree");return t.openBlock(),t.createElementBlock("div",z,[t.createVNode(a,{data:c.value,props:f,"default-expanded-keys":k.value,"node-key":G,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},W=J._export_sfc(Q,[["__scopeId","data-v-7f54bf51"]]);exports.JointPanel=H;exports.UrdfTree=W;exports.getAllLinkName=w;exports.getMeshFromJoint=F;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=E;
1
+ "use strict";const t=require("vue"),x=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs"),J=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),E=(o,i)=>{if(!i)return null;const l=o.joints[i];return l||null},F=(o,i)=>{if(!i)return null;const l=E(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},N=(o,i)=>{if(!i)return null;const l=o.links[i];return l||null},L=(o,i)=>{if(!i)return null;const l=N(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},V=o=>{const i=o.joints;return Object.values(i)},M=o=>V(o).filter(u=>u.jointType!=="fixed"),w=o=>{const i=o.links;return Object.keys(i)},B={class:"panel-content"},b={key:0,class:"joints-list"},I={class:"joint-info-row"},S={class:"joint-left"},C={class:"joint-name"},D={class:"joint-range"},P={class:"joint-type"},T={key:0,class:"joint-control-row"},A={class:"slider-container"},U=["min","max","value","onInput"],R={class:"value-display"},q={class:"joint-value"},O={class:"unit"},K={key:1,class:"empty-state"},$=t.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:i}){const l=o,u=t.ref([]),c=t.ref(null),f=(s,p=!1)=>s==="revolute"?p?Math.PI:-Math.PI:s==="prismatic"?p?1:-1:0,_=s=>{if(!s||!s.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const p=[];return V(s).forEach(r=>{var n,d;if(r.jointType==="fixed")return;let a={lower:((n=r.limit)==null?void 0:n.lower)??f(r.jointType,!1),upper:((d=r.limit)==null?void 0:d.upper)??f(r.jointType,!0)};r.jointType==="continuous"&&(a={lower:-10*Math.PI,upper:10*Math.PI}),p.push({name:r.name,type:r.jointType||"unknown",limit:a,currentValue:r.angle||0,urdfJoint:r})}),p},m=(s,p)=>{var n;const e=u.value.find(d=>d.name===s);if(!e)return;const r=parseFloat(p),a=Math.max(e.limit.lower,Math.min(e.limit.upper,r));e.currentValue=a,(n=l.model)!=null&&n.setJointValue?l.model.setJointValue(s,a):e.urdfJoint.setJointValue(a)},v=()=>{u.value.forEach(s=>{(s.type==="revolute"||s.type==="continuous"||s.type==="prismatic")&&m(s.name,0)})},y=()=>{l.model&&u.value.forEach(s=>{s.urdfJoint.angle!==void 0&&s.currentValue!==s.urdfJoint.angle&&(s.currentValue=s.urdfJoint.angle)})},g=()=>{const s=()=>{y(),c.value=requestAnimationFrame(s)};s()},k=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return t.watch(()=>l.model,s=>{s?u.value=_(s):u.value=[]},{immediate:!0}),t.onMounted(()=>{g()}),t.onUnmounted(()=>{k()}),i({resetAllJoints:v}),(s,p)=>(t.openBlock(),t.createElementBlock("div",B,[u.value.length>0?(t.openBlock(),t.createElementBlock("div",b,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,e=>(t.openBlock(),t.createElementBlock("div",{key:e.name,class:"joint-item"},[t.createElementVNode("div",I,[t.createElementVNode("div",S,[t.createElementVNode("span",C,t.toDisplayString(e.name),1),t.createElementVNode("span",D," ["+t.toDisplayString(e.limit.lower.toFixed(2))+", "+t.toDisplayString(e.limit.upper.toFixed(2))+"] ",1)]),t.createElementVNode("span",P,t.toDisplayString(e.type),1)]),e.type==="revolute"||e.type==="prismatic"||e.type==="continuous"?(t.openBlock(),t.createElementBlock("div",T,[t.createElementVNode("div",A,[t.createElementVNode("input",{type:"range",min:e.limit.lower,max:e.limit.upper,step:"0.001",value:e.currentValue,onInput:r=>m(e.name,r.target.value),class:"joint-slider"},null,40,U)]),t.createElementVNode("div",R,[t.createElementVNode("span",q,t.toDisplayString(e.currentValue?Number(e.currentValue).toFixed(3):"0.000"),1),t.createElementVNode("span",O,t.toDisplayString(e.type==="prismatic"?"m":"rad"),1)])])):t.createCommentVNode("",!0)]))),128))])):(t.openBlock(),t.createElementBlock("div",K,p[0]||(p[0]=[t.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),H=J._export_sfc($,[["__scopeId","data-v-750b831d"]]),z={class:"panel-content"},G="id",Q={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)},extraNodes:{type:Array,default:[]}},emits:["nodeClick"],setup(o,{emit:i}){const l=o,u=i,c=t.ref([]),f={children:"children",label:"label"},_=e=>{u("nodeClick",e)},m=(e,r=0)=>{const a=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const d={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:r+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:m(n==null?void 0:n.children,r+1),path:n==null?void 0:n.name};a.push(d)}}),a},v=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}]:[],y=(e,r)=>{const a=[],n=[...e];for(;n.length>0&&a.length<r;){const d=n.shift();d.children&&d.children.length>0&&(a.push(d.id),n.push(...d.children))}return a},g=(e,r)=>{const a=[];return e.forEach(n=>{if(n.children&&n.children.length>0){a.push(n.id);const d=n.children.filter(h=>h.children&&h.children.length>0).slice(0,r).map(h=>h.id);a.push(...d)}}),a.slice(0,r+1)},k=t.computed(()=>!c.value||c.value.length===0?[]:l.expandStrategy==="firstLevel"?g(c.value,l.maxExpandCount):y(c.value,l.maxExpandCount)),s=t.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:l!=null&&l.model?v(l.model):[],path:"场景"}]),p=()=>{const e=l.extraNodes||[],r=e==null?void 0:e.map(a=>({...a,level:0}));c.value.push(...r)};return t.watch(s,e=>{c.value=JSON.parse(JSON.stringify(e)),p()},{immediate:!0}),(e,r)=>{const a=t.resolveComponent("el-tree");return t.openBlock(),t.createElementBlock("div",z,[t.createVNode(a,{data:c.value,props:f,"default-expanded-keys":k.value,"node-key":G,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},W=J._export_sfc(Q,[["__scopeId","data-v-7f54bf51"]]);exports.JointPanel=H;exports.UrdfTree=W;exports.getAllLinkName=w;exports.getMeshFromJoint=F;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=E;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as I, ref as L, watch as b, onMounted as C, onUnmounted as P, createElementBlock as m, openBlock as f, Fragment as T, renderList as N, createElementVNode as p, createCommentVNode as U, toDisplayString as h, computed as M, resolveComponent as A, createVNode as S } from "vue";
2
- import { z as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
2
+ import { z as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
3
3
  import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
4
  const D = (i, l) => {
5
5
  if (!l)
@@ -1,12 +1,12 @@
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 E = (b, l, t) => de(b, typeof l != "symbol" ? l + "" : l, t);
4
- import { U as me } from "./index.vue_vue_type_style_index_1_lang-Cu2BshsL.js";
5
- import { S as ve, M as pe, O as fe } from "./MTLLoader-S0-tgcId.js";
6
- import { g as re, f as F } from "./fileUtil-Bev09uzf.js";
7
- import { bB as be, U as J, J as we, z as he, B as _e, bC as ge, ab as ye, V as Le } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Bmw4uN_h.js";
4
+ import { U as me } from "./index.vue_vue_type_style_index_1_lang-CU-2e_BS.js";
5
+ import { S as ve, M as pe, O as fe } from "./MTLLoader-Bp_zXJHj.js";
6
+ import { g as re, f as F } from "./fileUtil-DtFX4qSS.js";
7
+ import { bB as be, U as J, J as we, z as he, B as _e, bC as ge, ab as ye, V as Le } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BHN6MuWN.js";
8
8
  import { ref as k, defineComponent as je, computed as O, watch as ue, resolveComponent as x, createElementBlock as P, openBlock as T, createVNode as U, createElementVNode as c, withCtx as $, createTextVNode as D, toDisplayString as S } from "vue";
9
- import { c as Re, e as Ue, g as Ce } from "./iconfont-DCNS3tUf.js";
9
+ import { c as Re, e as Ue, g as Ce } from "./iconfont-BI4Uo8yP.js";
10
10
  import { _ as Se } from "./_plugin-vue_export-helper-CHgC5LLL.js";
11
11
  const Me = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
12
12
  function Oe(b) {
@@ -1 +1 @@
1
- "use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const se=require("./index.vue_vue_type_style_index_1_lang-HFKqIlIz.cjs"),U=require("./MTLLoader-z5-t3xJP.cjs"),C=require("./fileUtil-CLjIZqTr.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-JMLqADEE.cjs"),e=require("vue"),D=require("./iconfont-DIct6CCo.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,i,w),p}function re(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,i,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=i=>`${o.endsWith("/")?o:o+"/"}${i}/`,m.loadMeshCb=(i,w,p)=>{const g=(()=>{const E=i.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",i).toString()}catch{const a=i.lastIndexOf("/");return a>=0?i.slice(0,a+1):i}})(),c=(()=>{var d;return(((d=i.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{re({objUrl:i,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(i,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(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}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(i,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(i,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${i})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:i=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(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 h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(i);ae({manager:f,baseFolderUrl:ie,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${i.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${i.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const i=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){i.value&&i.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),i.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,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){i.value&&(i.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=i.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=i.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:i,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),i=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-i,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,i=>{l&&l(m,i)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),i=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(r=>{if(!(r!=null&&r.isMesh)){const y={name:r==null?void 0:r.name,label:(r==null?void 0:r.name)||(r==null?void 0:r.type),show:!0,level:s+1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:w(r==null?void 0:r.children,s+1),path:r==null?void 0:r.name};_.push(y)}}),_},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:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],r=[...t];for(;r.length>0&&_.length<s;){const y=r.shift();y.children&&y.children.length>0&&(_.push(y.id),r.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(r=>{if(r.children&&r.children.length>0){_.push(r.id);const y=r.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(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,h=(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)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=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&&(i.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,K,H,Q,ee;const _=e.resolveComponent("el-divider"),r=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(r,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=i.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=i.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=i.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=i.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=i.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=i.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=i.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=i.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=i.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=i.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=i.value)==null?void 0:K.worldRotation)==null?void 0:H.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=i.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
1
+ "use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const se=require("./index.vue_vue_type_style_index_1_lang-Ckqvc1oN.cjs"),U=require("./MTLLoader-CP_pjCVi.cjs"),C=require("./fileUtil-DOKmUgX6.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BnVF9mg-.cjs"),e=require("vue"),D=require("./iconfont-nIq9TlPr.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,i,w),p}function re(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,i,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=i=>`${o.endsWith("/")?o:o+"/"}${i}/`,m.loadMeshCb=(i,w,p)=>{const g=(()=>{const E=i.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",i).toString()}catch{const a=i.lastIndexOf("/");return a>=0?i.slice(0,a+1):i}})(),c=(()=>{var d;return(((d=i.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{re({objUrl:i,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(i,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(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}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(i,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(i,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${i})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:i=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(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 h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(i);ae({manager:f,baseFolderUrl:ie,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${i.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${i.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const i=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){i.value&&i.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),i.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,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){i.value&&(i.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=i.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=i.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:i,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),i=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-i,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,i=>{l&&l(m,i)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),i=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(r=>{if(!(r!=null&&r.isMesh)){const y={name:r==null?void 0:r.name,label:(r==null?void 0:r.name)||(r==null?void 0:r.type),show:!0,level:s+1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:w(r==null?void 0:r.children,s+1),path:r==null?void 0:r.name};_.push(y)}}),_},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:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],r=[...t];for(;r.length>0&&_.length<s;){const y=r.shift();y.children&&y.children.length>0&&(_.push(y.id),r.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(r=>{if(r.children&&r.children.length>0){_.push(r.id);const y=r.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(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,h=(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)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=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&&(i.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,K,H,Q,ee;const _=e.resolveComponent("el-divider"),r=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(r,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=i.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=i.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=i.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=i.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=i.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=i.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=i.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=i.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=i.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=i.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=i.value)==null?void 0:K.worldRotation)==null?void 0:H.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=i.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ss-component-new",
3
3
  "private": false,
4
- "version": "1.2.44",
4
+ "version": "1.2.45",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",