ss-component-new 1.2.12 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OrbitControls-BoyGapft.js +419 -0
- package/dist/OrbitControls-D1lM0xvz.cjs +1 -0
- package/dist/STLLoader-BBRISxpD.js +609 -0
- package/dist/STLLoader-KxFIlfhN.cjs +6 -0
- package/dist/{animationData-CyP8-u7i.cjs → animationData-82Fw-zug.cjs} +1 -1
- package/dist/{animationData-C_gV7XAN.js → animationData-CVzu3q7-.js} +2 -2
- package/dist/{iconfont-pt17sMx3.js → iconfont-B9HCA4uh.js} +2 -2
- package/dist/{iconfont-t5epssvu.cjs → iconfont-CsuwJCas.cjs} +1 -1
- package/dist/{index-Dwr4RHei.cjs → index-6tUa2D9P.cjs} +1 -1
- package/dist/{index-DJMHw-xb.js → index-6zoxugAS.js} +7 -7
- package/dist/{index-C40ofXP7.cjs → index-B6h8Kdsz.cjs} +1 -1
- package/dist/{index-BQ4Rjf8F.js → index-B6t23GGZ.js} +3 -3
- package/dist/{index-7eyGTvr0.cjs → index-BZJCScX4.cjs} +1 -1
- package/dist/{index-DQZ_oAyj.js → index-Bafw9B9F.js} +3 -3
- package/dist/{index-ESNVepXU.js → index-BlNTaxba.js} +3 -3
- package/dist/{index-CAewC69j.cjs → index-C85eyyuX.cjs} +1 -1
- package/dist/{index-BMYtLkw8.js → index-CA_ygidl.js} +3 -3
- package/dist/{index-CVDv-Zz-.js → index-CCA-lJNu.js} +14 -14
- package/dist/{index-CApZYDIm.cjs → index-CEi2ZplO.cjs} +1 -1
- package/dist/{index-H_3u1NA_.js → index-CG28BBGh.js} +1 -1
- package/dist/{index-DGBDGLOK.cjs → index-CTOqmp6o.cjs} +1 -1
- package/dist/{index-CoVAbxHN.js → index-CU2AYT-o.js} +1 -1
- package/dist/{index-BAOnUk_J.cjs → index-CXT_ri7C.cjs} +1 -1
- package/dist/{index-CN29uy_G.js → index-CZrlCt19.js} +6 -6
- package/dist/{index-DTkAIcvV.js → index-Cas62aFl.js} +1 -1
- package/dist/{index-CTRmgnKQ.js → index-ChlZgZzn.js} +5 -5
- package/dist/{index-DHQH1rlQ.js → index-Cne-8ofR.js} +1 -1
- package/dist/{index-B7g38Yte.js → index-Cq2pDYGK.js} +1 -1
- package/dist/{index-i50hp6po.cjs → index-CrD_T8_i.cjs} +1 -1
- package/dist/{index-DnU2slQv.cjs → index-CrH5xDEc.cjs} +1 -1
- package/dist/{index-DfKkN76b.js → index-CsOVkfJs.js} +150 -150
- package/dist/{index-D5ShC3zu.cjs → index-CuPtpGC-.cjs} +1 -1
- package/dist/{index-2nEz-J89.js → index-D2puM6vk.js} +2 -2
- package/dist/{index-DDhAMgrO.js → index-D6_JNPhy.js} +1 -1
- package/dist/{index-ecVCII_e.js → index-D7tU_Vmu.js} +1 -1
- package/dist/{index-D9l1Z4TO.cjs → index-D8NHvYsq.cjs} +1 -1
- package/dist/{index-CkA2IZJB.js → index-D9MBiU6x.js} +1 -1
- package/dist/{index-QkDZ18PI.cjs → index-DR5VU4-m.cjs} +1 -1
- package/dist/{index-B9OZcnHm.cjs → index-DvYKkz_M.cjs} +1 -1
- package/dist/{index-B_ZGJtId.js → index-Dvaz3uPH.js} +1 -1
- package/dist/{index-BJBNtx2b.cjs → index-Dy5yN3zf.cjs} +1 -1
- package/dist/{index-CKLBlQoK.js → index-DzopeJWR.js} +3 -3
- package/dist/{index-C5gPrwPs.cjs → index-Ez9VvZ1_.cjs} +1 -1
- package/dist/{index-CVadHkfS.cjs → index-JyPuO9N5.cjs} +1 -1
- package/dist/{index-BUUEqGRN.cjs → index-NU04ABjS.cjs} +1 -1
- package/dist/{index-BDaeo6qO.js → index-YWDxEpkt.js} +1 -1
- package/dist/{index-B_mFQujY.cjs → index-Yc43ZpIg.cjs} +1 -1
- package/dist/{index-DP7rcz4I.cjs → index-d5IX5LQw.cjs} +1 -1
- package/dist/{index-DsQ-qtQ9.cjs → index-dPS3R0YJ.cjs} +1 -1
- package/dist/{index-DkG4A3iE.cjs → index-hKtCBiTZ.cjs} +1 -1
- package/dist/{index-Adqs5vHH.cjs → index-iXcYsTKr.cjs} +1 -1
- package/dist/{index-D4CVC2Sk.js → index-nmkuI4hH.js} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dwdjsitu.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BKTlb5a7.cjs} +56 -56
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BRxOMo6y.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dkl1cH-C.js} +1713 -1718
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-e_PTrAf6.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-BeE2rxjq.js} +3 -3
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DfqsvuRy.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-RjUkBHAd.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BqmMCEyN.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-B1G9k32g.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-7HSISF9c.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CBxXCho0.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-CsY5rIO4.js → index.vue_vue_type_style_index_1_lang-Cl6e-PP2.js} +5012 -5100
- package/dist/{index.vue_vue_type_style_index_1_lang-DOjFqzi3.cjs → index.vue_vue_type_style_index_1_lang-NCxR30Hn.cjs} +45 -46
- package/dist/{main-DIbH2rlN.js → main-BZIvGaGC.js} +2 -2
- package/dist/{main-CVaemyhm.cjs → main-Bmym9xf7.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/three-viewport-gizmo-BlxFLyPm.js +18587 -0
- package/dist/three-viewport-gizmo-CwaL5sMV.cjs +4195 -0
- package/dist/{threeLatheView-CZdorls1.cjs → threeLatheView-BsuPsR7B.cjs} +1 -1
- package/dist/{threeLatheView-Bp0kjo_V.js → threeLatheView-DZZ-1LxL.js} +3 -3
- package/dist/{threeModel-C0Jdw2O3.cjs → threeModel-C7W6Z6bA.cjs} +1 -1
- package/dist/{threeModel-27sl0tTS.js → threeModel-WY_j9cKP.js} +4 -4
- package/dist/threePreview-Cy7NY-gw.cjs +1 -0
- package/dist/threePreview-DKlyIJKv.js +1873 -0
- package/dist/{threeSceneView-CEpBvJSV.cjs → threeSceneView-BfpO8VDG.cjs} +1 -1
- package/dist/{threeSceneView-ZDXqO8ZA.js → threeSceneView-L7mPphX4.js} +23 -23
- package/dist/{threeSceneViewForCPMPIP-BPPWM68P.js → threeSceneViewForCPMPIP-K0nm7l_H.js} +26 -26
- package/dist/{threeSceneViewForCPMPIP-B0VPmBWd.cjs → threeSceneViewForCPMPIP-zkgB6OW3.cjs} +2 -2
- package/dist/{threeViewerHost-CKE2a4PV.js → threeViewerHost-Wcy-3BQ6.js} +2 -2
- package/dist/{threeViewerHost-yHvsk7TK.cjs → threeViewerHost-pddFZ8Z9.cjs} +1 -1
- package/dist/{urdfTree-BuTtRGdl.js → urdfTree-Dnh2rJyF.js} +2 -2
- package/dist/urdfTree-bbDs2Fhg.cjs +1 -0
- package/dist/{useRayCaster-BM9XKGKx.js → useRayCaster-O1MYiDpT.js} +12 -12
- package/dist/{useRayCaster-1DNcSYPR.cjs → useRayCaster-h-sWQwPj.cjs} +1 -1
- package/package.json +1 -1
- package/dist/OrbitControls-C0QRmW6_.js +0 -458
- package/dist/OrbitControls-Co_9huz0.cjs +0 -1
- package/dist/STLLoader-CiUjaQtA.js +0 -657
- package/dist/STLLoader-RU7KqloS.cjs +0 -6
- package/dist/obj/model.mtl +0 -42
- package/dist/obj/model.obj +0 -26110
- package/dist/three-viewport-gizmo-BV37JzRa.cjs +0 -4197
- package/dist/three-viewport-gizmo-CkQ98n-T.js +0 -26015
- package/dist/threePreview-C_mY_TBC.cjs +0 -1
- package/dist/threePreview-DFFjm93P.js +0 -1972
- package/dist/urdfTree-CCktg0FK.cjs +0 -1
- package/public/obj/model.mtl +0 -42
- 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"),J=require("./useRayCaster-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),J=require("./useRayCaster-h-sWQwPj.cjs"),S=require("./iconfont-CsuwJCas.cjs"),a=require("./three-viewport-gizmo-CwaL5sMV.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BKTlb5a7.cjs");const T=require("./index-1z9RrjZc.cjs");require("./index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs");require("./index-BpPyaNFa.cjs");const te=require("./index-D55zzS4D.cjs");require("./index.vue_vue_type_style_index_1_lang-NCxR30Hn.cjs");require("./index-CKt6cj9f.cjs");const Ne=require("./animationData-82Fw-zug.cjs"),we=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),_e=require("./urdfTree-bbDs2Fhg.cjs"),q=.001,oe=a.MathUtils.degToRad,Ce=new a.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:a.DoubleSide});function Re(V=.005,v=64){const w=new a.CatmullRomCurve3([new a.Vector3(0,0,0),new a.Vector3(0,0,0)]),s=new a.TubeGeometry(w,v,V,16,!1),h=Ce;return new a.Mesh(s,h)}const Se=V=>V.reduce((v,w)=>{let s=0;const h=w.Y??0,E=w.C??0,d=w.R??0;return h>0&&(s+=h),E>0&&d>0&&(s+=d*oe(E)),v+s},0),ke=V=>{const v=[],w=V.Y??0,s=V.B??0,h=V.C??0,E=V.R??0,d={pos:new a.Vector3(0,0,0),localY:new a.Vector3(0,1,0),localX:new a.Vector3(1,0,0),localZ:new a.Vector3(0,0,1)};if(!w&&!h)return v;if(v.push(d.pos.clone()),s!==0){const _=new a.Matrix4().makeRotationAxis(d.localY,oe(s));d.localX.applyMatrix4(_),d.localZ.applyMatrix4(_)}if(w>0&&(d.pos.add(d.localY.clone().multiplyScalar(w*q)),v.push(d.pos.clone())),h>0&&E>0){const _=oe(h),x=E*q,u=d.pos.clone().add(d.localX.clone().multiplyScalar(-x)),i=Math.max(16,Math.ceil(h/5));for(let f=1;f<=i;f++){const l=_*f/i,p=new a.Matrix4().makeRotationAxis(d.localZ,l),y=d.localX.clone().multiplyScalar(x).applyMatrix4(p),C=u.clone().add(y);v.push(C)}}return v};function De(V,v){const w=new a.Group;w.name="CompletePipe";const s={pos:new a.Vector3(0,0,0),localX:new a.Vector3(1,0,0),localY:new a.Vector3(0,1,0),localZ:new a.Vector3(0,0,1)};let h=0,E=1;for(let d=0;d<V.length;d++){const _=V[d],x=_.Y??0,u=_.B??0,i=_.C??0,f=_.R??0;if(u!==0){const l=new a.Matrix4().makeRotationAxis(s.localY,oe(u));s.localX.applyMatrix4(l),s.localZ.applyMatrix4(l)}if(x>0){const l=s.pos.clone();s.pos.add(s.localY.clone().multiplyScalar(x*q));const p=s.pos.clone(),c=Te(l,p,v*q);c.userData={segmentType:"straight",segmentIndex:h,frameIndex:d,length:x,frame:{Y:x,B:u,C:i,R:f}},c.name=`直段_${h}`,w.add(c);const y=l.clone();Pe(w,E,y,v*q),h++}if(i>0&&f>0){const l=oe(i),p=f*q,c=[];c.push(s.pos.clone());const y=s.pos.clone().add(s.localX.clone().multiplyScalar(-p)),C=Math.max(16,Math.ceil(i/5));for(let R=1;R<=C;R++){const F=l*R/C,k=new a.Matrix4().makeRotationAxis(s.localZ,F),L=s.localX.clone().multiplyScalar(p).applyMatrix4(k),W=y.clone().add(L);c.push(W)}const b=$e(c,v*q);b.userData={segmentType:"bend",segmentIndex:h,frameIndex:d,angle:i,radius:f,centerPoint:y.toArray(),frame:{Y:x,B:u,C:i,R:f}},b.name=`弯段_${h}`,w.add(b),Math.floor(c.length/2),c[0],s.pos=c[c.length-1].clone();const M=new a.Matrix4().makeRotationAxis(s.localZ,l);s.localY.applyMatrix4(M),s.localX.applyMatrix4(M),h++,E++}}return w}function Pe(V,v,w,s){const h=new a.Vector3(0,s*2,s*5),E=w.clone().add(h),d=[w,E],_=new a.BufferGeometry().setFromPoints(d),x=new a.LineDashedMaterial({color:16711680,dashSize:s*.5,gapSize:s*.3,linewidth:1}),u=new a.Line(_,x);u.computeLineDistances(),V.add(u);const i=document.createElement("canvas"),f=i.getContext("2d");i.width=128,i.height=128,f.clearRect(0,0,128,128),f.fillStyle="#FF0000",f.font="bold 80px Arial",f.textAlign="center",f.textBaseline="middle",f.fillText(v.toString(),64,64);const l=new a.CanvasTexture(i),p=new a.SpriteMaterial({map:l,transparent:!0,depthTest:!1,depthWrite:!1}),c=new a.Sprite(p),y=s*3;c.scale.set(y,y,1),c.position.copy(E),c.name=`Label_${v}`,c.userData={labelNumber:v},V.add(c)}function Te(V,v,w){const s=new a.LineCurve3(V,v),h=new a.TubeGeometry(s,2,w,18,!1);return new a.Mesh(h,Ce)}function $e(V,v){const w=new a.CatmullRomCurve3(V,!1,"catmullrom",.01),s=new a.TubeGeometry(w,Math.max(16,V.length*2),v,18,!1);return new a.Mesh(s,Ce)}function Ee(V,v,w,s,h,E=0){let d=v.slice(0,h+1);const _=v[h+1];if(_&&E>0){const c={..._,B:(_.B??0)*E,C:(_.C??0)*E};d.push(c)}const x=Se(d),u=Math.max(0,w-x),i=[];i.push(new a.Vector3(0,0,0));const f=new a.Vector3(0,u*q,0);u>0&&i.push(f);let l={pos:f.clone(),localY:new a.Vector3(0,1,0),localX:new a.Vector3(1,0,0),localZ:new a.Vector3(0,0,1)};const p=[];for(let c=d.length-1;c>=0;c--){const y=d[c],C=ke(y);if(C.length>0){const b=C.map(k=>{const D=k.clone(),L=new a.Matrix4;return L.makeBasis(l.localX,l.localY,l.localZ),D.applyMatrix4(L),D.add(l.pos)});p.push(b);const M=b[b.length-1];l.pos=M.clone();const R=y.B??0,F=y.C??0;if(R!==0){const k=new a.Matrix4().makeRotationAxis(l.localY,oe(R));l.localX.applyMatrix4(k),l.localZ.applyMatrix4(k)}if(F>0){const k=oe(F),D=new a.Matrix4().makeRotationAxis(l.localZ,k);l.localY.applyMatrix4(D),l.localX.applyMatrix4(D)}}}for(const c of p)c.length>1&&i.push(...c.slice(1));i.length<2&&i.push(new a.Vector3(0,.001,0));try{const c=new a.CatmullRomCurve3(i,!1,"catmullrom",.01),y=new a.TubeGeometry(c,Math.max(2,i.length*4),s*q,18,!1);V.geometry.dispose(),V.geometry=y}catch(c){console.error("管件更新失败",c)}}function xe(V,v,w,s=0){let h=V.slice(0,w+1);const E=V[w+1];if(E&&s>0){const l={...E,B:(E.B??0)*s,C:(E.C??0)*s};h.push(l)}const d=Se(h),_=Math.max(0,v-d),x=[];x.push(new a.Vector3(0,0,0));const u=new a.Vector3(0,_*q,0);_>0&&x.push(u);let i={pos:u.clone(),localY:new a.Vector3(0,1,0),localX:new a.Vector3(1,0,0),localZ:new a.Vector3(0,0,1)};const f=[];for(let l=h.length-1;l>=0;l--){const p=h[l],c=ke(p);if(c.length>0){const y=c.map(R=>{const F=R.clone(),k=new a.Matrix4;return k.makeBasis(i.localX,i.localY,i.localZ),F.applyMatrix4(k),F.add(i.pos)});f.push(y);const C=y[y.length-1];i.pos=C.clone();const b=p.B??0,M=p.C??0;if(b!==0){const R=new a.Matrix4().makeRotationAxis(i.localY,oe(b));i.localX.applyMatrix4(R),i.localZ.applyMatrix4(R)}if(M>0){const R=oe(M),F=new a.Matrix4().makeRotationAxis(i.localZ,R);i.localY.applyMatrix4(F),i.localX.applyMatrix4(F)}}}for(const l of f)l.length>1&&x.push(...l.slice(1));return x.length<2&&x.push(new a.Vector3(0,.001,0)),x}function Me(V,v,w,s,h,E,d,_=0,x=0){const u=h-x,i=xe(s,u,d,_);let l=xe(w,x,d,_);l.forEach(c=>c.y=-c.y),l.reverse();const p=[...l,...i];try{const c=new a.CatmullRomCurve3(p,!1,"catmullrom",.01),y=new a.TubeGeometry(c,Math.max(2,p.length*4),E*q,18,!1);v.geometry.dispose(),V.geometry.dispose(),v.parent&&v.parent.remove(v),V.geometry=y}catch(c){console.error("管件更新失败",c)}}const ze={class:"panel-content"},Be={class:"action-bar"},Ae={class:"animation-controls"},Fe={class:"control-row"},Ye={class:"control-row"},Ie={class:"frame-info"},Le={class:"control-row"},je={class:"progress-bar"},Ue={class:"dialog-footer"},Oe=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(V,{expose:v,emit:w}){const s=V,h=w,E=e.ref(),d=e.ref(),_=e.ref();e.watch(()=>s.threeData,t=>{const o=t==null?void 0:t.data;_.value=o==null?void 0:o.type},{immediate:!0});const x=async()=>{if(!sessionStorage.getItem("systemKey")){h("getThreeData");return}let o={};_.value===J.robotMode.SINGLE&&(o=await Ne.fetchSingleRobotAnimationData()),_.value===J.robotMode.DOUBLE&&(o=await Ne.fetchDoubleRobotAnimationData());const{initialPipeLength:n=0,pipeRadius:N=0,clampLength:B=0,animationData:U}=o;k.value=n,D.value=N,L.value=B,E.value=U;const O=T.cloneDeep(E.value),ee=re(A.value),K=(O==null?void 0:O["输出(动画数据)"])||[];u.value=K.length?K:[ee];let ne=(O==null?void 0:O["输出(动画数据)Content"])??[];ne&&(d.value=ne)},u=e.ref([]),i=e.ref(!1),f=e.ref(""),l=e.ref(!1),p=e.ref(0),c=e.ref(0),y=e.ref(1e3);let C=!1;const b=e.ref(null),M=e.shallowRef(null),R=e.shallowRef(null),F=e.shallowRef(null),k=e.ref(0),D=e.ref(12.5),L=e.ref(30),W=e.ref([]),P=e.ref(null),g=e.computed(()=>s.model?Object.values(s.model.joints).filter(t=>t.jointType!=="fixed").map(t=>t.name):[]),I=e.ref(["Y","B","C","R"]),A=e.computed(()=>[...g.value,...I.value]),j=e.computed(()=>A.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${A.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),X=()=>u.value.map(t=>({Y:parseFloat(t.Y)||0,B:parseFloat(t.B)||0,C:parseFloat(t.C)||0,R:parseFloat(t.R)||0})),H=()=>{const t=[],o=[];return u.value.forEach(n=>{const{Y1:N,B1:B,C1:U,R1:O,Y2:ee,B2:K,C2:ne,R2:Y}=n;t.push({Y:parseFloat(N)||0,B:parseFloat(B)||0,C:parseFloat(U)||0,R:parseFloat(O)||0}),o.push({Y:parseFloat(ee)||0,B:parseFloat(K)||0,C:parseFloat(ne)||0,R:parseFloat(Y)||0})}),{posPipeYbcr:t,negPipeYbcr:o}},Q=(t=0,o=0)=>{if(M.value&&R.value){const n=H();Me(M.value,R.value,n.posPipeYbcr,n.negPipeYbcr,k.value,D.value,t,o,L.value)}else if(M.value){const n=X();Ee(M.value,n,k.value,D.value,t,o)}},G=t=>{if(t<0||t>=u.value.length){console.error(`帧索引 ${t} 超出范围`);return}const o=u.value[t];if(console.log(`应用第 ${t} 帧数据 ${o}`),p.value=t,b.value){const n={};g.value.forEach(N=>{const B=parseFloat(o[N]);isNaN(B)||(n[N]=B)}),b.value.setJointAngles(n)}Q(t,0)},$=async()=>{if(u.value.length===0){T.ElMessage.error("无法播放动画:无数据");return}if(!l.value){l.value=!0,C=!1,u.value.length-1===p.value&&(p.value=0);try{for(let t=p.value+1;t<u.value.length&&!C;t++){p.value=t;const o=u.value[t],n={};b.value&&g.value.forEach(N=>{const B=parseFloat(o[N]);isNaN(B)||(n[N]=B)}),b.value?await b.value.animateToState(n,y.value,N=>{c.value=(t+N)/u.value.length*100,Q(t-1,N)}):(await new Promise(N=>setTimeout(N,y.value)),c.value=(t+1)/u.value.length*100)}C||T.ElMessage.success("动画播放完成")}catch(t){console.error("动画播放出错:",t),T.ElMessage.error("动画播放出错")}finally{l.value=!1,c.value=0}}},Z=()=>{C=!0,l.value=!1,c.value=0,T.ElMessage.info("动画已停止")},z=()=>{p.value=0},ue=()=>{if(M.value&&R.value){const t=H();Me(M.value,R.value,t.posPipeYbcr,t.negPipeYbcr,k.value,D.value,-1,0,L.value)}else if(M.value){const t=X();Ee(M.value,t,k.value,D.value,-1,0)}},ie=()=>{b.value&&b.value.resetToZero(),ue(),z(),T.ElMessage.success("机器人和管件已重置")},de=t=>`第 ${t+1} 帧`,pe=t=>{l.value&&Z(),G(t)},me=()=>{l.value&&Z(),!(p.value+1>=u.value.length)&&G(p.value+1)},ve=()=>{l.value&&Z(),p.value!==0&&G(p.value-1)},fe=(t,o)=>{if(!o)return null;const n=t.joints[o];if(!n)return console.warn(`在模型中未找到名为 '${o}' 的 Joint`),null;let N=null;return n.traverse(B=>{B instanceof a.Mesh&&!N&&(N=B)}),N||console.warn(`在 Joint '${o}' 中未找到可用的 Mesh 对象`),N},ge=(t,o)=>{if(!o)return null;const n=t.joints[o];return n||(console.warn(`在模型中未找到名为 '${o}' 的 Joint`),console.log("可用的链接:",Object.keys(t.links)),null)},se=()=>{F.value&&(F.value.visible=!0),M.value&&M.value.parent&&M.value.parent.remove(M.value),F.value=null,M.value=null,R.value=null},re=t=>t==null?void 0:t.reduce((o,n)=>(o[n]="0",o),{});e.watch(A,(t,o)=>{if(JSON.stringify(t)!==JSON.stringify(o))if(t.length>0){const n=re(t);u.value=[n]}else u.value=[]},{immediate:!0});const le=e.ref(0),ae=t=>{le.value=t},he=(t,o)=>{if(!t||!o)return;const n=ge(t,o),N=Re();N.visible=!1,n==null||n.add(N)},Ve=t=>{b.value=new J.URDFRobotController(t),W.value=Object.keys(t.links),P.value="Pipe_Joint"},ye=()=>{b.value=null,W.value=[],P.value=null},be=t=>{Ve(t),he(t,P.value),ae(le.value+1),ie()};e.watch(()=>s.model,t=>{if(se(),t){be(t);return}ye()},{immediate:!0});const ce=t=>{var n,N;const o=new a.Mesh(t.geometry.clone(),t.material);return o.name="managed_pipe_clone",(N=(n=t==null?void 0:t.parent)==null?void 0:n.add)==null||N.call(n,o),o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o};e.watch([P,L,k,le],([t,o])=>{if(se(),s.model&&t){const n=fe(s.model,t);if(console.log(n,"meshToReplace"),n&&n.parent){F.value=n,n.visible=!1;const N=ce(n);if(_.value===J.robotMode.SINGLE&&(N.position.y-=o*.001),M.value=N,_.value===J.robotMode.DOUBLE){const B=ce(n);R.value=B}Q(0,0)}else t&&console.warn(`在 link '${t}' 中未找到可替换的网格或其没有父级。`)}});const m=async()=>{if(A.value.length===0){T.ElMessage.warning("没有可导出的表头");return}const t=A.value.join(" ");try{await navigator.clipboard.writeText(t),T.ElMessage.success("表头已成功复制到剪贴板!")}catch(o){console.error("复制失败:",o),T.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},r=()=>{if(!f.value.trim()){T.ElMessage.warning("导入内容不能为空");return}const t=f.value.trim().split(`
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { defineComponent as Ze, ref as f, watch as de, shallowRef as he, computed as we, onUnmounted as et, resolveComponent as Z, createElementBlock as Ce, openBlock as ie, createElementVNode as o, createVNode as l, withCtx as V, createBlock as De, createCommentVNode as ge, unref as S, toDisplayString as ve, onBeforeUnmount as Ke, createTextVNode as tt, onMounted as lt, nextTick as ot, withDirectives as Q, vShow as me, renderSlot as _e, isRef as Re, vModelRadio as Me } from "vue";
|
|
2
|
-
import { r as Ve, U as nt, s as Xe, u as at, a as st, W as it } from "./useRayCaster-
|
|
3
|
-
import { u as qe, a as rt, b as ut, S as F } from "./iconfont-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
2
|
+
import { r as Ve, U as nt, s as Xe, u as at, a as st, W as it } from "./useRayCaster-O1MYiDpT.js";
|
|
3
|
+
import { u as qe, a as rt, b as ut, S as F } from "./iconfont-B9HCA4uh.js";
|
|
4
|
+
import { m as Se, T as Pe, V as j, k as te, l as ct, n as pt, e as ke, o as dt, L as mt, p as vt, q as ft, r as gt, s as ht, t as bt, u as yt, i as _t } from "./three-viewport-gizmo-BlxFLyPm.js";
|
|
5
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dkl1cH-C.js";
|
|
6
|
+
import { a9 as wt, c as Ct, E as X, a as kt, aM as Pt, ao as xt } from "./index-CYp77kPp.js";
|
|
6
7
|
import "./index.vue_vue_type_style_index_1_lang-Ds1cd7yg.js";
|
|
7
8
|
import "./index-BHtNKL1L.js";
|
|
8
|
-
import { _ as pe, s as
|
|
9
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
10
|
-
import { m as Se, T as Pe, V as j, k as te, l as gt, n as ht, e as ke, o as bt, L as yt, p as _t, q as wt, r as Ct, s as kt, t as Pt, u as xt, i as Tt } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
9
|
+
import { _ as pe, s as Tt } from "./index-C-c1pt-2.js";
|
|
10
|
+
import "./index.vue_vue_type_style_index_1_lang-Cl6e-PP2.js";
|
|
11
11
|
import "./index-qu3KI1yZ.js";
|
|
12
|
-
import { f as Rt, a as Mt } from "./animationData-
|
|
12
|
+
import { f as Rt, a as Mt } from "./animationData-CVzu3q7-.js";
|
|
13
13
|
import { _ as Je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
|
-
import { U as Vt, J as Dt } from "./urdfTree-
|
|
15
|
-
const ee = 1e-3, re =
|
|
14
|
+
import { U as Vt, J as Dt } from "./urdfTree-Dnh2rJyF.js";
|
|
15
|
+
const ee = 1e-3, re = ct.degToRad, Ge = new dt({
|
|
16
16
|
// 灰色
|
|
17
17
|
color: 13421772,
|
|
18
18
|
metalness: 0.3,
|
|
19
19
|
roughness: 0.6,
|
|
20
|
-
side:
|
|
20
|
+
side: _t
|
|
21
21
|
});
|
|
22
22
|
function St(y = 5e-3, v = 64) {
|
|
23
23
|
const C = new Se([new j(0, 0, 0), new j(0, 0, 0)]), s = new Pe(C, v, y, 16, !1), b = Ge;
|
|
@@ -49,7 +49,7 @@ const He = (y) => y.reduce((v, C) => {
|
|
|
49
49
|
return v;
|
|
50
50
|
};
|
|
51
51
|
function $t(y, v) {
|
|
52
|
-
const C = new
|
|
52
|
+
const C = new pt();
|
|
53
53
|
C.name = "CompletePipe";
|
|
54
54
|
const s = {
|
|
55
55
|
pos: new j(0, 0, 0),
|
|
@@ -103,25 +103,25 @@ function $t(y, v) {
|
|
|
103
103
|
return C;
|
|
104
104
|
}
|
|
105
105
|
function zt(y, v, C, s) {
|
|
106
|
-
const b = new j(0, s * 2, s * 5), T = C.clone().add(b), p = [C, T], x = new
|
|
106
|
+
const b = new j(0, s * 2, s * 5), T = C.clone().add(b), p = [C, T], x = new vt().setFromPoints(p), R = new ft({
|
|
107
107
|
color: 16711680,
|
|
108
108
|
dashSize: s * 0.5,
|
|
109
109
|
gapSize: s * 0.3,
|
|
110
110
|
linewidth: 1
|
|
111
|
-
}), c = new
|
|
111
|
+
}), c = new gt(x, R);
|
|
112
112
|
c.computeLineDistances(), y.add(c);
|
|
113
113
|
const r = document.createElement("canvas"), g = r.getContext("2d");
|
|
114
114
|
r.width = 128, r.height = 128, g.clearRect(0, 0, 128, 128), g.fillStyle = "#FF0000", g.font = "bold 80px Arial", g.textAlign = "center", g.textBaseline = "middle", g.fillText(v.toString(), 64, 64);
|
|
115
|
-
const n = new
|
|
115
|
+
const n = new ht(r), d = new bt({
|
|
116
116
|
map: n,
|
|
117
117
|
transparent: !0,
|
|
118
118
|
depthTest: !1,
|
|
119
119
|
depthWrite: !1
|
|
120
|
-
}), u = new
|
|
120
|
+
}), u = new yt(d), _ = s * 3;
|
|
121
121
|
u.scale.set(_, _, 1), u.position.copy(T), u.name = `Label_${v}`, u.userData = { labelNumber: v }, y.add(u);
|
|
122
122
|
}
|
|
123
123
|
function At(y, v, C) {
|
|
124
|
-
const s = new
|
|
124
|
+
const s = new mt(y, v), b = new Pe(s, 2, C, 18, !1);
|
|
125
125
|
return new ke(b, Ge);
|
|
126
126
|
}
|
|
127
127
|
function Ft(y, v) {
|
|
@@ -273,7 +273,7 @@ const Yt = { class: "panel-content" }, Bt = { class: "action-bar" }, Lt = { clas
|
|
|
273
273
|
animationData: N
|
|
274
274
|
} = t;
|
|
275
275
|
D.value = a, z.value = P, G.value = L, T.value = N;
|
|
276
|
-
const W =
|
|
276
|
+
const W = Ct(T.value), se = ye(U.value), le = (W == null ? void 0 : W["输出(动画数据)"]) || [];
|
|
277
277
|
c.value = le.length ? le : [se];
|
|
278
278
|
let ce = (W == null ? void 0 : W["输出(动画数据)Content"]) ?? [];
|
|
279
279
|
ce && (p.value = ce);
|
|
@@ -541,7 +541,7 @@ ${U.value.join(" ")}
|
|
|
541
541
|
class: "is-loading"
|
|
542
542
|
}, {
|
|
543
543
|
default: V(() => [
|
|
544
|
-
l(S(
|
|
544
|
+
l(S(wt))
|
|
545
545
|
]),
|
|
546
546
|
_: 1
|
|
547
547
|
})) : ge("", !0)
|
|
@@ -694,7 +694,7 @@ ${U.value.join(" ")}
|
|
|
694
694
|
}
|
|
695
695
|
}), Gt = /* @__PURE__ */ Je(Jt, [["__scopeId", "data-v-9bf9331d"]]), It = "http://139.196.154.85:20018";
|
|
696
696
|
function Nt(y, v = !1) {
|
|
697
|
-
return console.log(y, "data"),
|
|
697
|
+
return console.log(y, "data"), kt({
|
|
698
698
|
url: `${It}/api/pipeBendingTraditional/pipeAnsys/${v}`,
|
|
699
699
|
method: "post",
|
|
700
700
|
data: y
|
|
@@ -791,7 +791,7 @@ const Wt = { class: "pipe-analysis-dialog-header" }, Kt = { class: "header-right
|
|
|
791
791
|
window.removeEventListener("resize", p), x();
|
|
792
792
|
}), v({ openDialog: oe }), (A, h) => {
|
|
793
793
|
const J = Z("el-icon"), U = Z("el-button"), I = Z("el-form-item"), K = Z("el-form"), ne = Z("el-option"), ae = Z("el-select"), q = Z("el-input"), Y = Z("el-table-column"), H = Z("el-table");
|
|
794
|
-
return ie(), De(
|
|
794
|
+
return ie(), De(Tt, {
|
|
795
795
|
class: "pipe-analysis-dialog",
|
|
796
796
|
visible: z.value,
|
|
797
797
|
onBeforeDestroy: A.onDestroy,
|
|
@@ -807,13 +807,13 @@ const Wt = { class: "pipe-analysis-dialog-header" }, Kt = { class: "header-right
|
|
|
807
807
|
o("div", Kt, [
|
|
808
808
|
l(J, null, {
|
|
809
809
|
default: V(() => [
|
|
810
|
-
l(S(
|
|
810
|
+
l(S(Pt), { onClick: D })
|
|
811
811
|
]),
|
|
812
812
|
_: 1
|
|
813
813
|
}),
|
|
814
814
|
l(J, null, {
|
|
815
815
|
default: V(() => [
|
|
816
|
-
l(S(
|
|
816
|
+
l(S(xt), { onClick: G })
|
|
817
817
|
]),
|
|
818
818
|
_: 1
|
|
819
819
|
})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defineComponent as ze, ref as u, computed as T, watch as H, onUnmounted as at, resolveComponent as K, createElementBlock as O, openBlock as j, createElementVNode as l, createCommentVNode as I, createVNode as i, toDisplayString as R, Fragment as nt, renderList as ot, withCtx as ne, inject as ve, shallowRef as pe, onMounted as st, nextTick as it, onBeforeUnmount as ut, withDirectives as x, vShow as F, renderSlot as ae, unref as d, createBlock as $e, isRef as me, vModelRadio as fe } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { e as rt } from "./three-viewport-gizmo-BlxFLyPm.js";
|
|
3
|
+
import { c as ct, E as y, p as be, s as ye, u as dt } from "./index-CYp77kPp.js";
|
|
4
|
+
import { j as vt, a as pt, u as mt, aD as ft } from "./index.vue_vue_type_style_index_1_lang-Ds1cd7yg.js";
|
|
5
|
+
import { U as gt, s as ke, u as ht, a as bt, W as yt } from "./useRayCaster-O1MYiDpT.js";
|
|
6
|
+
import { u as kt, a as Pt, b as Ct, S as h } from "./iconfont-B9HCA4uh.js";
|
|
6
7
|
import { _ as Pe } from "./index-C-c1pt-2.js";
|
|
7
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
8
|
+
import "./index.vue_vue_type_style_index_1_lang-Cl6e-PP2.js";
|
|
8
9
|
import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
|
-
import { U as
|
|
10
|
-
import { i as
|
|
11
|
-
import { O as
|
|
12
|
-
import { t as
|
|
13
|
-
import { e as jt } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
10
|
+
import { U as wt, J as _t } from "./urdfTree-Dnh2rJyF.js";
|
|
11
|
+
import { i as xt } from "./animationData-CVzu3q7-.js";
|
|
12
|
+
import { O as Tt } from "./STLLoader-BBRISxpD.js";
|
|
13
|
+
import { t as $t, h as jt } from "./index-CZrlCt19.js";
|
|
14
14
|
const zt = { class: "panel-content" }, Ut = { class: "action-bar" }, Vt = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "animation-controls"
|
|
@@ -32,7 +32,7 @@ ${B.value.join(" ")}
|
|
|
32
32
|
0 0 0 ...
|
|
33
33
|
1 2 3 ...` : "请先加载模型。"), V = T(() => o.value[C.value] || {});
|
|
34
34
|
H(() => z.model, (s) => {
|
|
35
|
-
s ? (w.value = new
|
|
35
|
+
s ? (w.value = new gt(s), U.value = Object.keys(s.links), C.value = 0) : (w.value = null, U.value = []);
|
|
36
36
|
}, { immediate: !0 });
|
|
37
37
|
const S = (s) => {
|
|
38
38
|
if (s < 0 || s >= o.value.length) {
|
|
@@ -118,7 +118,7 @@ ${B.value.join(" ")}
|
|
|
118
118
|
c.length > 0 ? (o.value = c, y.success(`成功导入 ${c.length} 行数据!`), M.value = !1, J.value = "", Z()) : y.error("未能解析到有效数据,请检查格式。");
|
|
119
119
|
};
|
|
120
120
|
H(() => z.xyzbcList, () => {
|
|
121
|
-
z.xyzbcList && (o.value =
|
|
121
|
+
z.xyzbcList && (o.value = ct(z.xyzbcList));
|
|
122
122
|
}, {
|
|
123
123
|
immediate: !0
|
|
124
124
|
});
|
|
@@ -216,7 +216,7 @@ ${B.value.join(" ")}
|
|
|
216
216
|
]);
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
-
}), je = /* @__PURE__ */ Ue(Mt, [["__scopeId", "data-v-0833d9bc"]]), Nt = async (W) => await new
|
|
219
|
+
}), je = /* @__PURE__ */ Ue(Mt, [["__scopeId", "data-v-0833d9bc"]]), Nt = async (W) => await new Tt().loadAsync(W), Et = { class: "obj-viewer-container" }, Bt = { class: "pipe-comparison" }, Ft = {
|
|
220
220
|
ref: "pipe1",
|
|
221
221
|
class: "pipe-container"
|
|
222
222
|
}, It = {
|
|
@@ -238,9 +238,9 @@ ${B.value.join(" ")}
|
|
|
238
238
|
},
|
|
239
239
|
emits: ["getAnimationData", "getThreeData"],
|
|
240
240
|
setup(W, { emit: oe }) {
|
|
241
|
-
const z = oe, o = W, M =
|
|
242
|
-
|
|
243
|
-
const k =
|
|
241
|
+
const z = oe, o = W, M = vt(be), { originalPath: J } = ye(M);
|
|
242
|
+
pt(be);
|
|
243
|
+
const k = mt(), { activeMenuPath: C } = ye(k), N = dt(be), { loginUserInfo: Y } = ye(N), w = ve("managementPageVisible"), g = ve("setManagementPageTitle"), U = ve("setManagementPageVisible"), E = ve("setPositionType"), B = () => {
|
|
244
244
|
U == null || U(!(w != null && w.value));
|
|
245
245
|
}, G = T(() => {
|
|
246
246
|
var e, n;
|
|
@@ -253,10 +253,10 @@ ${B.value.join(" ")}
|
|
|
253
253
|
return (n = (e = o == null ? void 0 : o.threeData) == null ? void 0 : e.data) == null ? void 0 : n.knife;
|
|
254
254
|
}), se = u([]), ie = async (t) => {
|
|
255
255
|
!t || !t.isExtra || (await ue(t), E == null || E("right"), g == null || g(t == null ? void 0 : t.pageName), U == null || U(!0));
|
|
256
|
-
}, ue =
|
|
257
|
-
await
|
|
256
|
+
}, ue = $t(async (t) => {
|
|
257
|
+
await jt();
|
|
258
258
|
const { mainKey: e, baseMenuPath: n } = t || {};
|
|
259
|
-
|
|
259
|
+
ft(n, e);
|
|
260
260
|
}, 500);
|
|
261
261
|
H(
|
|
262
262
|
() => [G.value, V.value, S.value],
|
|
@@ -330,7 +330,7 @@ ${B.value.join(" ")}
|
|
|
330
330
|
});
|
|
331
331
|
H(() => X.value, async () => {
|
|
332
332
|
if (console.log("three data", o == null ? void 0 : o.threeData), console.log("csvUrl", X.value), X.value) {
|
|
333
|
-
const t = await
|
|
333
|
+
const t = await xt(X.value);
|
|
334
334
|
Z.value = t;
|
|
335
335
|
}
|
|
336
336
|
}, {
|
|
@@ -349,12 +349,12 @@ ${B.value.join(" ")}
|
|
|
349
349
|
setModels: _e,
|
|
350
350
|
axesHelperVisible: De,
|
|
351
351
|
toggleAxesVisibility: Oe
|
|
352
|
-
} =
|
|
352
|
+
} = kt(Q), { loadSceneFromFile: Re } = bt(
|
|
353
353
|
le,
|
|
354
354
|
de,
|
|
355
355
|
s,
|
|
356
356
|
a
|
|
357
|
-
), { isAnimating: xe, toggleAnimation: Me, stopAnimation: Ne } =
|
|
357
|
+
), { isAnimating: xe, toggleAnimation: Me, stopAnimation: Ne } = Pt(le, de), { isClipping: Ee, activeClippingAxis: P, toggleClipping: Be, updateClippingPlanes: A } = Ct(le, de), { initRaycaster: Fe, selectedObject3D: Ie, setSelectedObjVisible: Je, updatePosition: Ge, updateRotation: Xe, dispose: He } = ht(Q, le, de), Ke = () => {
|
|
358
358
|
Oe();
|
|
359
359
|
}, We = T(() => re.value === ke.ROBOT), Ye = T(() => re.value === ke.PIPECOMPARSION), Ze = (t) => {
|
|
360
360
|
$.value = t, v.value = !0;
|
|
@@ -379,7 +379,7 @@ ${B.value.join(" ")}
|
|
|
379
379
|
return console.warn(`在模型中未找到名为 '${e}' 的 link`), console.log("可用的链接:", Object.keys(t.links)), null;
|
|
380
380
|
let L = null;
|
|
381
381
|
return n.traverse((D) => {
|
|
382
|
-
D instanceof
|
|
382
|
+
D instanceof rt && !L && (L = D);
|
|
383
383
|
}), L || console.warn(`在 link '${e}' 中未找到可用的 Mesh 对象`), L;
|
|
384
384
|
}, lt = async (t) => {
|
|
385
385
|
const e = tt(t, ee.value);
|
|
@@ -570,7 +570,7 @@ ${B.value.join(" ")}
|
|
|
570
570
|
default: ne(() => {
|
|
571
571
|
var b;
|
|
572
572
|
return [
|
|
573
|
-
p.value === "场景树" ? (j(), $e(
|
|
573
|
+
p.value === "场景树" ? (j(), $e(wt, {
|
|
574
574
|
key: 0,
|
|
575
575
|
model: _.value,
|
|
576
576
|
extraNodes: se.value,
|
|
@@ -632,7 +632,7 @@ ${B.value.join(" ")}
|
|
|
632
632
|
])
|
|
633
633
|
])
|
|
634
634
|
])) : I("", !0),
|
|
635
|
-
p.value === "工件树" ? (j(), $e(
|
|
635
|
+
p.value === "工件树" ? (j(), $e(yt, {
|
|
636
636
|
key: 2,
|
|
637
637
|
model: (b = d(Ie)) == null ? void 0 : b.obj,
|
|
638
638
|
onVisibleChange: d(Je),
|
|
@@ -658,7 +658,7 @@ ${B.value.join(" ")}
|
|
|
658
658
|
l("div", rl, [
|
|
659
659
|
i(n, { height: "100%" }, {
|
|
660
660
|
default: ne(() => [
|
|
661
|
-
x(i(
|
|
661
|
+
x(i(_t, { model: _.value }, null, 8, ["model"]), [
|
|
662
662
|
[F, r.value === "机床控制"]
|
|
663
663
|
]),
|
|
664
664
|
x(i(je, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-1z9RrjZc.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs"),R=require("./useRayCaster-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Le=require("./three-viewport-gizmo-CwaL5sMV.cjs"),u=require("./index-1z9RrjZc.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs"),R=require("./useRayCaster-h-sWQwPj.cjs"),m=require("./iconfont-CsuwJCas.cjs"),ne=require("./index-D55zzS4D.cjs");require("./index.vue_vue_type_style_index_1_lang-NCxR30Hn.cjs");const de=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./urdfTree-bbDs2Fhg.cjs"),Ue=require("./animationData-82Fw-zug.cjs"),Ae=require("./STLLoader-KxFIlfhN.cjs"),ue=require("./index-JyPuO9N5.cjs"),Oe={class:"panel-content"},Ie={class:"action-bar"},qe={key:0,class:"animation-controls"},Fe={class:"control-row"},Ge={class:"control-row"},Je={class:"frame-info"},He={class:"control-row"},Xe={key:1,class:"empty-state"},Ke={class:"dialog-footer"},We=e.defineComponent({__name:"urdfAnimationPanel",props:{model:{},scene:{},xyzbcList:{}},setup(L,{expose:J}){const w=L,a=e.ref([]),D=e.ref(!1),$=e.ref(""),h=e.ref("stopped"),b=e.ref(0),T=e.ref(0),U=e.ref(10),N=e.ref(null);let f=0;const k=e.ref([]),M=e.computed(()=>w.model?Object.values(w.model.joints).filter(s=>s.jointType!=="fixed").map(s=>s.name):[]),j=e.computed(()=>[...M.value]),z=e.computed(()=>j.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${j.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),C=e.computed(()=>a.value[b.value]||{});e.watch(()=>w.model,s=>{s?(N.value=new R.URDFRobotController(s),k.value=Object.keys(s.links),b.value=0):(N.value=null,k.value=[])},{immediate:!0});const S=s=>{if(s<0||s>=a.value.length){console.error(`帧索引 ${s} 超出范围`);return}const l=a.value[s];if(N.value){const p={};M.value.forEach(d=>{const r=parseFloat(l[d]);isNaN(r)||(p[d]=r)}),N.value.setJointAngles(p)}b.value=s,T.value=a.value.length>1?s/(a.value.length-1)*100:100},H=async s=>{try{for(let l=b.value;l<a.value.length;l++){if(s!==f)return;const p=a.value[l],d={};if(N.value)M.value.forEach(r=>{const i=parseFloat(p[r]);isNaN(i)||(d[r]=i)}),await N.value.animateToState(d,U.value,r=>{s===f&&(T.value=(l+r)/a.value.length*100)});else{if(await new Promise(r=>setTimeout(r,U.value)),s!==f)return;T.value=(l+1)/a.value.length*100}b.value=l}s===f&&(u.ElMessage.success("动画播放完成"),h.value="stopped",T.value=100)}catch(l){console.error("动画播放出错:",l),u.ElMessage.error("动画播放出错"),h.value="stopped"}},X=()=>{if(a.value.length===0){u.ElMessage.error("无动画数据");return}h.value==="stopped"&&(b.value=0,S(0)),h.value="playing",f++,H(f),u.ElMessage.info("动画播放中")},K=()=>{h.value==="playing"&&(f++,h.value="paused",u.ElMessage.info("动画已暂停"))},A=()=>{f++,h.value="stopped",b.value=0,T.value=0,S(0),u.ElMessage.info("动画已停止并重置")},B=()=>{h.value==="playing"?K():X()},O=s=>{f++,h.value="paused",S(s)},W=()=>{if(!$.value.trim()){u.ElMessage.warning("导入内容不能为空");return}const s=$.value.trim().split(`
|
|
5
|
-
`).filter(i=>i.trim()!=="");if(s.length<2){u.ElMessage.error("导入数据至少需要包含表头行和一行数据");return}const l=s[0].split(" ").map(i=>i.trim()),p={};if(l.forEach((i,c)=>{j.value.includes(i)&&(p[c]=i)}),Object.keys(p).length===0){u.ElMessage.error("没有找到匹配的表头,请检查表头名称是否正确");return}const r=s.slice(1).map(i=>{const c=i.split(" "),E={};return j.value.forEach(y=>{E[y]="0"}),Object.entries(p).forEach(([y,q])=>{const F=c[parseInt(y)];F!==void 0&&F.trim()!==""&&(E[q]=F.trim())}),E});r.length>0?(a.value=r,u.ElMessage.success(`成功导入 ${r.length} 行数据!`),D.value=!1,$.value="",A()):u.ElMessage.error("未能解析到有效数据,请检查格式。")};e.watch(()=>w.xyzbcList,()=>{w.xyzbcList&&(a.value=u.cloneDeep(w.xyzbcList))},{immediate:!0});const I=s=>`第 ${s+1} 帧`;return J({handlePlayPause:B,playAnimation:X,pauseAnimation:K,stopAnimation:A}),e.onUnmounted(()=>{f++}),(s,l)=>{const p=e.resolveComponent("el-input-number"),d=e.resolveComponent("el-slider"),r=e.resolveComponent("el-input"),i=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ie,[e.createVNode(ne._sfc_main,{onClick:l[0]||(l[0]=c=>D.value=!0),disabled:j.value.length===0,modelValue:"导入数据"},null,8,["disabled"])]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",qe,[e.createElementVNode("div",Fe,[l[6]||(l[6]=e.createElementVNode("label",null,"帧间隔 (ms):",-1)),e.createVNode(p,{modelValue:U.value,"onUpdate:modelValue":l[1]||(l[1]=c=>U.value=c),min:10,max:5e3,step:100,size:"small",style:{width:"120px"}},null,8,["modelValue"])]),e.createElementVNode("div",Ge,[l[7]||(l[7]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",Je,e.toDisplayString(b.value+1)+" / "+e.toDisplayString(a.value.length),1)]),e.createElementVNode("div",He,[l[8]||(l[8]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode(d,{modelValue:b.value,"onUpdate:modelValue":l[2]||(l[2]=c=>b.value=c),min:0,max:a.value.length>0?a.value.length-1:0,step:1,"format-tooltip":I,onInput:O,disabled:a.value.length===0||h.value==="playing",style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])]),e.createElementVNode("div",null,[l[9]||(l[9]=e.createElementVNode("label",null,"当前帧数据:",-1)),e.createElementVNode("div",null,[C.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(C.value,(c,E)=>(e.openBlock(),e.createElementBlock("div",{key:E},e.toDisplayString(E)+": "+e.toDisplayString(c),1))),128)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Xe,l[10]||(l[10]=[e.createElementVNode("p",null,"请先导入数据",-1)]))):e.createCommentVNode("",!0),e.createVNode(i,{modelValue:D.value,"onUpdate:modelValue":l[5]||(l[5]=c=>D.value=c),title:"导入数据",width:"500px"},{footer:e.withCtx(()=>[e.createElementVNode("span",Ke,[e.createVNode(ne._sfc_main,{modelValue:"取消",onClick:l[4]||(l[4]=c=>D.value=!1)}),e.createVNode(ne._sfc_main,{modelValue:"确认导入",onClick:W,type:"primary"})])]),default:e.withCtx(()=>[l[11]||(l[11]=e.createElementVNode("p",{class:"import-instructions"}," 请从Excel或CSV中复制数据 (首行为表头, Tab分隔) ",-1)),e.createVNode(r,{modelValue:$.value,"onUpdate:modelValue":l[3]||(l[3]=c=>$.value=c),type:"textarea",rows:10,placeholder:z.value},null,8,["modelValue","placeholder"])]),_:1,__:[11]},8,["modelValue"])])}}}),ce=de._export_sfc(We,[["__scopeId","data-v-0833d9bc"]]),Ye=async L=>await new Ue.OBJLoader().loadAsync(L),Ze={class:"obj-viewer-container"},Qe={class:"pipe-comparison"},et={ref:"pipe1",class:"pipe-container"},tt={ref:"pipe2",class:"pipe-container"},nt={class:"buttonGroup-top"},lt={class:"buttonGroup-topLeft"},ot={class:"buttonGroup-left"},at={class:"buttonGroup-right"},st={class:"buttonGroup-bottom"},it={class:"top-panel"},rt={class:"panel-header"},ut={class:"panel-body"},ct={class:"left-panel"},dt={class:"panel-header"},vt={class:"panel-body"},pt={key:1,class:"clipping-content"},mt={class:"radio-group"},ft={class:"radio-label"},gt={class:"radio-label"},ht={class:"radio-label"},Vt={class:"radio-label"},bt={class:"right-panel"},Nt={class:"panel-header"},yt={class:"panel-body"},Et={key:0,class:"loading-overlay"},wt=e.defineComponent({__name:"threeSceneViewForCPMPIP",props:{fileBlobs:{default:()=>[]},animationData:{default:()=>({})},threeData:{},isSelfWindow:{type:Boolean}},emits:["getAnimationData","getThreeData"],setup(L,{emit:J}){const w=J,a=L,D=Q.useOriginalState(u.pinia),{originalPath:$}=u.storeToRefs(D);Q.useModelComp(u.pinia);const h=Q.useMenuState(),{activeMenuPath:b}=u.storeToRefs(h),T=u.useLoginState(u.pinia),{loginUserInfo:U}=u.storeToRefs(T),N=e.inject("managementPageVisible"),f=e.inject("setManagementPageTitle"),k=e.inject("setManagementPageVisible"),M=e.inject("setPositionType"),j=()=>{k==null||k(!(N!=null&&N.value))},z=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.machine}),C=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.workpieceInfo}),S=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.knife}),H=e.ref([]),X=async n=>{!n||!n.isExtra||(await K(n),M==null||M("right"),f==null||f(n==null?void 0:n.pageName),k==null||k(!0))},K=ue.debounce(async n=>{await ue.onPageBack();const{mainKey:t,baseMenuPath:o}=n||{};Q.copyAdd(o,t)},500);e.watch(()=>[z.value,C.value,S.value],()=>{var x,g,v,ie;const n=[],t={pageName:"机床",name:"机床",label:"机床",type:"机床",id:"机床",path:"机床",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};z.value&&t.children.push({isExtra:!0,pageName:"机床",mainKey:z.value,label:z.value,baseMenuPath:"设备库/机床"});const o={pageName:"工件",name:"工件",label:"工件",type:"工件",id:"工件",path:"工件",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};C.value&&o.children.push({isExtra:!0,type:(x=C.value)==null?void 0:x.type,pageName:"工件",mainKey:(g=C.value)==null?void 0:g.name,label:(v=C.value)==null?void 0:v.name,baseMenuPath:`工件库/${(ie=C.value)==null?void 0:ie.type}`});const P={pageName:"刀具",name:"刀具",label:"刀具",type:"刀具",id:"刀具",path:"刀具",children:[],show:!0,isPenultimate:!1};S.value&&P.children.push({isExtra:!0,pageName:"刀具",mainKey:S.value,label:S.value,baseMenuPath:"设备库/刀具"}),n.push(t,o,P),H.value=n},{immediate:!0});const A=e.ref([]),B=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.csvUrl});e.watch(()=>B.value,async()=>{if(console.log("three data",a==null?void 0:a.threeData),console.log("csvUrl",B.value),B.value){const n=await Le.initXYZBCList(B.value);A.value=n}},{immediate:!0});const O=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.bladeObjUrl}),W=e.ref(R.sceneType.ROBOT),I=e.ref(null),s=e.ref(!1),l=e.ref(""),p=e.ref(!1),d=e.ref(""),r=e.ref(!1),i=e.ref(""),c=e.ref(!1),E=e.ref(""),y=e.shallowRef(null),q=e.ref("叶片模型"),F=e.shallowRef(null),ve=e.shallowRef(null),le=e.shallowRef(null),Y=e.ref(ce),{currentModels:Z,resetView:pe,initThreeJS:me,handleResize:oe,getThreeJSObjects:G,cleanup:fe,setModels:ae,axesHelperVisible:ge,toggleAxesVisibility:he}=m.useThreeJS(I),{loadSceneFromFile:Ve}=R.useUrdfLoader(G,Z,s,l),{isAnimating:se,toggleAnimation:be,stopAnimation:Ne}=m.useAnimation(G,Z),{isClipping:ye,activeClippingAxis:V,toggleClipping:Ee,updateClippingPlanes:_}=m.useClipping(G,Z),{initRaycaster:we,selectedObject3D:ke,setSelectedObjVisible:Ce,updatePosition:Pe,updateRotation:Se,dispose:_e}=R.useRaycaster(I,G,Z),xe=()=>{he()},De=e.computed(()=>W.value===R.sceneType.ROBOT),Te=e.computed(()=>W.value===R.sceneType.PIPECOMPARSION),Me=n=>{E.value=n,c.value=!0},ee=n=>{p.value=!0,d.value=n,n==="剖面视图"&&!ye.value&&Ee()},te=n=>{r.value=!0,i.value=n,n==="动画仿真"&&w("getAnimationData")},je=()=>{var n;(n=Y.value)==null||n.handlePlayPause()},Re=()=>{var n;(n=Y.value)==null||n.pauseAnimation()},$e=()=>{var n;(n=Y.value)==null||n.stopAnimation()},ze=(n,t)=>{if(!t)return null;const o=n.links[t];if(!o)return console.warn(`在模型中未找到名为 '${t}' 的 link`),console.log("可用的链接:",Object.keys(n.links)),null;let P=null;return o.traverse(x=>{x instanceof Ae.Mesh&&!P&&(P=x)}),P||console.warn(`在 link '${t}' 中未找到可用的 Mesh 对象`),P},Be=async n=>{const t=ze(n,q.value);if(ve.value=t,console.log("bladeObjUrl",O.value),t&&t.parent&&O.value){const o=await Ye(O.value);o.name="blade_clone",t.parent.add(o),o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),t.visible=!1,F.value=o}else q.value&&console.warn(`在 Blade '${q.value}' 中未找到可替换的网格或其没有父级。`)};return e.watch(()=>a.fileBlobs,n=>{if(n&&n.length>0){const t=n[0];if(!t.name.toLowerCase().endsWith(".urdf"))return;Ve(t).then(o=>{y.value=o,o&&Be(o)}).catch(o=>{console.error("加载URDF文件时发生错误:",o),u.ElMessage.error("加载urdf模型失败"),y.value=null})}else y.value=null},{immediate:!0,deep:!0}),e.watch(y,n=>{ae(n?[n]:[]),we()}),e.onMounted(async()=>{await e.nextTick();try{me(),window.addEventListener("resize",oe);const n=G();le.value=n.scene}catch(n){console.error("Three.js 初始化失败:",n),u.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{d.value="",i.value="",window.removeEventListener("resize",oe),se.value&&Ne(),fe(),_e()}),(n,t)=>{var x;const o=e.resolveComponent("el-scrollbar"),P=e.resolveComponent("PipeAnalysisPanel");return e.openBlock(),e.createElementBlock("div",Ze,[e.withDirectives(e.createElementVNode("div",{ref_key:"threejsContainer",ref:I,class:"threejs-container"},null,512),[[e.vShow,De.value]]),e.withDirectives(e.createElementVNode("div",Qe,[e.createElementVNode("div",et,null,512),e.createElementVNode("div",tt,null,512)],512),[[e.vShow,Te.value]]),e.createElementVNode("div",nt,[e.renderSlot(n.$slots,"button-top",{switchTopPanel:Me},void 0,!0),e.renderSlot(n.$slots,"logout",{},void 0,!0)]),e.createElementVNode("div",lt,[e.createVNode(m.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(pe),title:"重置"},null,8,["onClick"]),e.createVNode(m.SvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(m.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(m.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(be),title:e.unref(se)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(m.SvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(ge),onClick:xe,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",ot,[e.createVNode(m.SvgIcon,{name:"jiegoushu",size:"24",onClick:t[0]||(t[0]=g=>ee("场景树")),active:p.value&&d.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"clipping",size:"24",onClick:t[1]||(t[1]=g=>ee("剖面视图")),active:p.value&&d.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[2]||(t[2]=g=>ee("工件树")),active:p.value&&d.value==="工件树"},null,8,["active"])]),e.createElementVNode("div",at,[e.renderSlot(n.$slots,"button-right",{switchRightPanel:te},void 0,!0),e.createVNode(m.SvgIcon,{name:"yemian",size:"24",onClick:j,active:(x=e.unref(N))==null?void 0:x.value,title:"数据管理"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"jichuangxuanze",size:"24",onClick:t[3]||(t[3]=g=>te("机床控制")),active:r.value&&i.value==="机床控制",title:"机床控制"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[4]||(t[4]=g=>te("动画仿真")),active:r.value&&i.value==="动画仿真"},null,8,["active"])]),e.createElementVNode("div",st,[e.createVNode(m.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:je}),e.createVNode(m.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Re}),e.createVNode(m.SvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:$e})]),e.withDirectives(e.createElementVNode("div",it,[e.createElementVNode("div",rt,[e.createElementVNode("span",null,e.toDisplayString(E.value),1),e.createElementVNode("span",{class:"close",onClick:t[5]||(t[5]=g=>c.value=!1)}," X ")]),e.createElementVNode("div",ut,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"top-panel",{topPanelType:E.value},void 0,!0)]),_:3})])],512),[[e.vShow,c.value]]),e.withDirectives(e.createElementVNode("div",ct,[e.createElementVNode("div",dt,[e.createElementVNode("span",null,e.toDisplayString(d.value),1),e.createElementVNode("span",{class:"close",onClick:t[6]||(t[6]=g=>p.value=!1)}," X ")]),e.createElementVNode("div",vt,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>{var g;return[d.value==="场景树"?(e.openBlock(),e.createBlock(re.UrdfTree,{key:0,model:y.value,extraNodes:H.value,onNodeClick:X},null,8,["model","extraNodes"])):e.createCommentVNode("",!0),d.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",pt,[e.createElementVNode("div",mt,[e.createElementVNode("label",ft,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[7]||(t[7]=v=>e.isRef(V)?V.value=v:null),onChange:t[8]||(t[8]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[16]||(t[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",gt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[9]||(t[9]=v=>e.isRef(V)?V.value=v:null),onChange:t[10]||(t[10]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[17]||(t[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",ht,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[11]||(t[11]=v=>e.isRef(V)?V.value=v:null),onChange:t[12]||(t[12]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[18]||(t[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",Vt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[13]||(t[13]=v=>e.isRef(V)?V.value=v:null),onChange:t[14]||(t[14]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[19]||(t[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0),d.value==="工件树"?(e.openBlock(),e.createBlock(R.WorkpieceTreePanel,{key:2,model:(g=e.unref(ke))==null?void 0:g.obj,onVisibleChange:e.unref(Ce),onUpdatePosition:e.unref(Pe),onUpdateRotation:e.unref(Se)},null,8,["model","onVisibleChange","onUpdatePosition","onUpdateRotation"])):e.createCommentVNode("",!0)]}),_:1})])],512),[[e.vShow,p.value]]),e.withDirectives(e.createElementVNode("div",bt,[e.createElementVNode("div",Nt,[e.createElementVNode("span",null,e.toDisplayString(i.value),1),e.createElementVNode("span",{class:"close",onClick:t[15]||(t[15]=g=>r.value=!1)}," X ")]),e.createElementVNode("div",yt,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(re.JointPanel,{model:y.value},null,8,["model"]),[[e.vShow,i.value==="机床控制"]]),e.withDirectives(e.createVNode(ce,{model:y.value,scene:le.value,xyzbcList:A.value,ref_key:"urdfAnimationPanelRef",ref:Y},null,8,["model","scene","xyzbcList"]),[[e.vShow,i.value==="动画仿真"]]),e.renderSlot(n.$slots,"right-panel",{rightPanelType:i.value},void 0,!0)]),_:3})])],512),[[e.vShow,r.value]]),s.value?(e.openBlock(),e.createElementBlock("div",Et,[t[20]||(t[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(l.value),1)])):e.createCommentVNode("",!0),e.createVNode(P,{ref:"pipeAnalysisPanelRef"},null,512)])}}}),kt=de._export_sfc(wt,[["__scopeId","data-v-d9156359"]]);exports.default=kt;
|
|
5
|
+
`).filter(i=>i.trim()!=="");if(s.length<2){u.ElMessage.error("导入数据至少需要包含表头行和一行数据");return}const l=s[0].split(" ").map(i=>i.trim()),p={};if(l.forEach((i,c)=>{j.value.includes(i)&&(p[c]=i)}),Object.keys(p).length===0){u.ElMessage.error("没有找到匹配的表头,请检查表头名称是否正确");return}const r=s.slice(1).map(i=>{const c=i.split(" "),E={};return j.value.forEach(y=>{E[y]="0"}),Object.entries(p).forEach(([y,q])=>{const F=c[parseInt(y)];F!==void 0&&F.trim()!==""&&(E[q]=F.trim())}),E});r.length>0?(a.value=r,u.ElMessage.success(`成功导入 ${r.length} 行数据!`),D.value=!1,$.value="",A()):u.ElMessage.error("未能解析到有效数据,请检查格式。")};e.watch(()=>w.xyzbcList,()=>{w.xyzbcList&&(a.value=u.cloneDeep(w.xyzbcList))},{immediate:!0});const I=s=>`第 ${s+1} 帧`;return J({handlePlayPause:B,playAnimation:X,pauseAnimation:K,stopAnimation:A}),e.onUnmounted(()=>{f++}),(s,l)=>{const p=e.resolveComponent("el-input-number"),d=e.resolveComponent("el-slider"),r=e.resolveComponent("el-input"),i=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ie,[e.createVNode(ne._sfc_main,{onClick:l[0]||(l[0]=c=>D.value=!0),disabled:j.value.length===0,modelValue:"导入数据"},null,8,["disabled"])]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",qe,[e.createElementVNode("div",Fe,[l[6]||(l[6]=e.createElementVNode("label",null,"帧间隔 (ms):",-1)),e.createVNode(p,{modelValue:U.value,"onUpdate:modelValue":l[1]||(l[1]=c=>U.value=c),min:10,max:5e3,step:100,size:"small",style:{width:"120px"}},null,8,["modelValue"])]),e.createElementVNode("div",Ge,[l[7]||(l[7]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",Je,e.toDisplayString(b.value+1)+" / "+e.toDisplayString(a.value.length),1)]),e.createElementVNode("div",He,[l[8]||(l[8]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode(d,{modelValue:b.value,"onUpdate:modelValue":l[2]||(l[2]=c=>b.value=c),min:0,max:a.value.length>0?a.value.length-1:0,step:1,"format-tooltip":I,onInput:O,disabled:a.value.length===0||h.value==="playing",style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])]),e.createElementVNode("div",null,[l[9]||(l[9]=e.createElementVNode("label",null,"当前帧数据:",-1)),e.createElementVNode("div",null,[C.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(C.value,(c,E)=>(e.openBlock(),e.createElementBlock("div",{key:E},e.toDisplayString(E)+": "+e.toDisplayString(c),1))),128)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Xe,l[10]||(l[10]=[e.createElementVNode("p",null,"请先导入数据",-1)]))):e.createCommentVNode("",!0),e.createVNode(i,{modelValue:D.value,"onUpdate:modelValue":l[5]||(l[5]=c=>D.value=c),title:"导入数据",width:"500px"},{footer:e.withCtx(()=>[e.createElementVNode("span",Ke,[e.createVNode(ne._sfc_main,{modelValue:"取消",onClick:l[4]||(l[4]=c=>D.value=!1)}),e.createVNode(ne._sfc_main,{modelValue:"确认导入",onClick:W,type:"primary"})])]),default:e.withCtx(()=>[l[11]||(l[11]=e.createElementVNode("p",{class:"import-instructions"}," 请从Excel或CSV中复制数据 (首行为表头, Tab分隔) ",-1)),e.createVNode(r,{modelValue:$.value,"onUpdate:modelValue":l[3]||(l[3]=c=>$.value=c),type:"textarea",rows:10,placeholder:z.value},null,8,["modelValue","placeholder"])]),_:1,__:[11]},8,["modelValue"])])}}}),ce=de._export_sfc(We,[["__scopeId","data-v-0833d9bc"]]),Ye=async L=>await new Ae.OBJLoader().loadAsync(L),Ze={class:"obj-viewer-container"},Qe={class:"pipe-comparison"},et={ref:"pipe1",class:"pipe-container"},tt={ref:"pipe2",class:"pipe-container"},nt={class:"buttonGroup-top"},lt={class:"buttonGroup-topLeft"},ot={class:"buttonGroup-left"},at={class:"buttonGroup-right"},st={class:"buttonGroup-bottom"},it={class:"top-panel"},rt={class:"panel-header"},ut={class:"panel-body"},ct={class:"left-panel"},dt={class:"panel-header"},vt={class:"panel-body"},pt={key:1,class:"clipping-content"},mt={class:"radio-group"},ft={class:"radio-label"},gt={class:"radio-label"},ht={class:"radio-label"},Vt={class:"radio-label"},bt={class:"right-panel"},Nt={class:"panel-header"},yt={class:"panel-body"},Et={key:0,class:"loading-overlay"},wt=e.defineComponent({__name:"threeSceneViewForCPMPIP",props:{fileBlobs:{default:()=>[]},animationData:{default:()=>({})},threeData:{},isSelfWindow:{type:Boolean}},emits:["getAnimationData","getThreeData"],setup(L,{emit:J}){const w=J,a=L,D=Q.useOriginalState(u.pinia),{originalPath:$}=u.storeToRefs(D);Q.useModelComp(u.pinia);const h=Q.useMenuState(),{activeMenuPath:b}=u.storeToRefs(h),T=u.useLoginState(u.pinia),{loginUserInfo:U}=u.storeToRefs(T),N=e.inject("managementPageVisible"),f=e.inject("setManagementPageTitle"),k=e.inject("setManagementPageVisible"),M=e.inject("setPositionType"),j=()=>{k==null||k(!(N!=null&&N.value))},z=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.machine}),C=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.workpieceInfo}),S=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.knife}),H=e.ref([]),X=async n=>{!n||!n.isExtra||(await K(n),M==null||M("right"),f==null||f(n==null?void 0:n.pageName),k==null||k(!0))},K=ue.debounce(async n=>{await ue.onPageBack();const{mainKey:t,baseMenuPath:o}=n||{};Q.copyAdd(o,t)},500);e.watch(()=>[z.value,C.value,S.value],()=>{var x,g,v,ie;const n=[],t={pageName:"机床",name:"机床",label:"机床",type:"机床",id:"机床",path:"机床",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};z.value&&t.children.push({isExtra:!0,pageName:"机床",mainKey:z.value,label:z.value,baseMenuPath:"设备库/机床"});const o={pageName:"工件",name:"工件",label:"工件",type:"工件",id:"工件",path:"工件",baseMenuPath:"设备库/机床",children:[],show:!0,isPenultimate:!1};C.value&&o.children.push({isExtra:!0,type:(x=C.value)==null?void 0:x.type,pageName:"工件",mainKey:(g=C.value)==null?void 0:g.name,label:(v=C.value)==null?void 0:v.name,baseMenuPath:`工件库/${(ie=C.value)==null?void 0:ie.type}`});const P={pageName:"刀具",name:"刀具",label:"刀具",type:"刀具",id:"刀具",path:"刀具",children:[],show:!0,isPenultimate:!1};S.value&&P.children.push({isExtra:!0,pageName:"刀具",mainKey:S.value,label:S.value,baseMenuPath:"设备库/刀具"}),n.push(t,o,P),H.value=n},{immediate:!0});const A=e.ref([]),B=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.csvUrl});e.watch(()=>B.value,async()=>{if(console.log("three data",a==null?void 0:a.threeData),console.log("csvUrl",B.value),B.value){const n=await Ue.initXYZBCList(B.value);A.value=n}},{immediate:!0});const O=e.computed(()=>{var t,o;return(o=(t=a==null?void 0:a.threeData)==null?void 0:t.data)==null?void 0:o.bladeObjUrl}),W=e.ref(R.sceneType.ROBOT),I=e.ref(null),s=e.ref(!1),l=e.ref(""),p=e.ref(!1),d=e.ref(""),r=e.ref(!1),i=e.ref(""),c=e.ref(!1),E=e.ref(""),y=e.shallowRef(null),q=e.ref("叶片模型"),F=e.shallowRef(null),ve=e.shallowRef(null),le=e.shallowRef(null),Y=e.ref(ce),{currentModels:Z,resetView:pe,initThreeJS:me,handleResize:oe,getThreeJSObjects:G,cleanup:fe,setModels:ae,axesHelperVisible:ge,toggleAxesVisibility:he}=m.useThreeJS(I),{loadSceneFromFile:Ve}=R.useUrdfLoader(G,Z,s,l),{isAnimating:se,toggleAnimation:be,stopAnimation:Ne}=m.useAnimation(G,Z),{isClipping:ye,activeClippingAxis:V,toggleClipping:Ee,updateClippingPlanes:_}=m.useClipping(G,Z),{initRaycaster:we,selectedObject3D:ke,setSelectedObjVisible:Ce,updatePosition:Pe,updateRotation:Se,dispose:_e}=R.useRaycaster(I,G,Z),xe=()=>{he()},De=e.computed(()=>W.value===R.sceneType.ROBOT),Te=e.computed(()=>W.value===R.sceneType.PIPECOMPARSION),Me=n=>{E.value=n,c.value=!0},ee=n=>{p.value=!0,d.value=n,n==="剖面视图"&&!ye.value&&Ee()},te=n=>{r.value=!0,i.value=n,n==="动画仿真"&&w("getAnimationData")},je=()=>{var n;(n=Y.value)==null||n.handlePlayPause()},Re=()=>{var n;(n=Y.value)==null||n.pauseAnimation()},$e=()=>{var n;(n=Y.value)==null||n.stopAnimation()},ze=(n,t)=>{if(!t)return null;const o=n.links[t];if(!o)return console.warn(`在模型中未找到名为 '${t}' 的 link`),console.log("可用的链接:",Object.keys(n.links)),null;let P=null;return o.traverse(x=>{x instanceof Le.Mesh&&!P&&(P=x)}),P||console.warn(`在 link '${t}' 中未找到可用的 Mesh 对象`),P},Be=async n=>{const t=ze(n,q.value);if(ve.value=t,console.log("bladeObjUrl",O.value),t&&t.parent&&O.value){const o=await Ye(O.value);o.name="blade_clone",t.parent.add(o),o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),t.visible=!1,F.value=o}else q.value&&console.warn(`在 Blade '${q.value}' 中未找到可替换的网格或其没有父级。`)};return e.watch(()=>a.fileBlobs,n=>{if(n&&n.length>0){const t=n[0];if(!t.name.toLowerCase().endsWith(".urdf"))return;Ve(t).then(o=>{y.value=o,o&&Be(o)}).catch(o=>{console.error("加载URDF文件时发生错误:",o),u.ElMessage.error("加载urdf模型失败"),y.value=null})}else y.value=null},{immediate:!0,deep:!0}),e.watch(y,n=>{ae(n?[n]:[]),we()}),e.onMounted(async()=>{await e.nextTick();try{me(),window.addEventListener("resize",oe);const n=G();le.value=n.scene}catch(n){console.error("Three.js 初始化失败:",n),u.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{d.value="",i.value="",window.removeEventListener("resize",oe),se.value&&Ne(),fe(),_e()}),(n,t)=>{var x;const o=e.resolveComponent("el-scrollbar"),P=e.resolveComponent("PipeAnalysisPanel");return e.openBlock(),e.createElementBlock("div",Ze,[e.withDirectives(e.createElementVNode("div",{ref_key:"threejsContainer",ref:I,class:"threejs-container"},null,512),[[e.vShow,De.value]]),e.withDirectives(e.createElementVNode("div",Qe,[e.createElementVNode("div",et,null,512),e.createElementVNode("div",tt,null,512)],512),[[e.vShow,Te.value]]),e.createElementVNode("div",nt,[e.renderSlot(n.$slots,"button-top",{switchTopPanel:Me},void 0,!0),e.renderSlot(n.$slots,"logout",{},void 0,!0)]),e.createElementVNode("div",lt,[e.createVNode(m.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(pe),title:"重置"},null,8,["onClick"]),e.createVNode(m.SvgIcon,{name:"fangda",size:"24",title:"放大"}),e.createVNode(m.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),e.createVNode(m.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(be),title:e.unref(se)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(m.SvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(ge),onClick:xe,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",ot,[e.createVNode(m.SvgIcon,{name:"jiegoushu",size:"24",onClick:t[0]||(t[0]=g=>ee("场景树")),active:p.value&&d.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"clipping",size:"24",onClick:t[1]||(t[1]=g=>ee("剖面视图")),active:p.value&&d.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[2]||(t[2]=g=>ee("工件树")),active:p.value&&d.value==="工件树"},null,8,["active"])]),e.createElementVNode("div",at,[e.renderSlot(n.$slots,"button-right",{switchRightPanel:te},void 0,!0),e.createVNode(m.SvgIcon,{name:"yemian",size:"24",onClick:j,active:(x=e.unref(N))==null?void 0:x.value,title:"数据管理"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"jichuangxuanze",size:"24",onClick:t[3]||(t[3]=g=>te("机床控制")),active:r.value&&i.value==="机床控制",title:"机床控制"},null,8,["active"]),e.createVNode(m.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[4]||(t[4]=g=>te("动画仿真")),active:r.value&&i.value==="动画仿真"},null,8,["active"])]),e.createElementVNode("div",st,[e.createVNode(m.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:je}),e.createVNode(m.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:Re}),e.createVNode(m.SvgIcon,{name:"zhongzhi",size:"24",backgroundColor:"#ffffff",title:"停止",onClick:$e})]),e.withDirectives(e.createElementVNode("div",it,[e.createElementVNode("div",rt,[e.createElementVNode("span",null,e.toDisplayString(E.value),1),e.createElementVNode("span",{class:"close",onClick:t[5]||(t[5]=g=>c.value=!1)}," X ")]),e.createElementVNode("div",ut,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"top-panel",{topPanelType:E.value},void 0,!0)]),_:3})])],512),[[e.vShow,c.value]]),e.withDirectives(e.createElementVNode("div",ct,[e.createElementVNode("div",dt,[e.createElementVNode("span",null,e.toDisplayString(d.value),1),e.createElementVNode("span",{class:"close",onClick:t[6]||(t[6]=g=>p.value=!1)}," X ")]),e.createElementVNode("div",vt,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>{var g;return[d.value==="场景树"?(e.openBlock(),e.createBlock(re.UrdfTree,{key:0,model:y.value,extraNodes:H.value,onNodeClick:X},null,8,["model","extraNodes"])):e.createCommentVNode("",!0),d.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",pt,[e.createElementVNode("div",mt,[e.createElementVNode("label",ft,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[7]||(t[7]=v=>e.isRef(V)?V.value=v:null),onChange:t[8]||(t[8]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[16]||(t[16]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",gt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[9]||(t[9]=v=>e.isRef(V)?V.value=v:null),onChange:t[10]||(t[10]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[17]||(t[17]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",ht,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[11]||(t[11]=v=>e.isRef(V)?V.value=v:null),onChange:t[12]||(t[12]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[18]||(t[18]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",Vt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[13]||(t[13]=v=>e.isRef(V)?V.value=v:null),onChange:t[14]||(t[14]=(...v)=>e.unref(_)&&e.unref(_)(...v))},null,544),[[e.vModelRadio,e.unref(V)]]),t[19]||(t[19]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0),d.value==="工件树"?(e.openBlock(),e.createBlock(R.WorkpieceTreePanel,{key:2,model:(g=e.unref(ke))==null?void 0:g.obj,onVisibleChange:e.unref(Ce),onUpdatePosition:e.unref(Pe),onUpdateRotation:e.unref(Se)},null,8,["model","onVisibleChange","onUpdatePosition","onUpdateRotation"])):e.createCommentVNode("",!0)]}),_:1})])],512),[[e.vShow,p.value]]),e.withDirectives(e.createElementVNode("div",bt,[e.createElementVNode("div",Nt,[e.createElementVNode("span",null,e.toDisplayString(i.value),1),e.createElementVNode("span",{class:"close",onClick:t[15]||(t[15]=g=>r.value=!1)}," X ")]),e.createElementVNode("div",yt,[e.createVNode(o,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(re.JointPanel,{model:y.value},null,8,["model"]),[[e.vShow,i.value==="机床控制"]]),e.withDirectives(e.createVNode(ce,{model:y.value,scene:le.value,xyzbcList:A.value,ref_key:"urdfAnimationPanelRef",ref:Y},null,8,["model","scene","xyzbcList"]),[[e.vShow,i.value==="动画仿真"]]),e.renderSlot(n.$slots,"right-panel",{rightPanelType:i.value},void 0,!0)]),_:3})])],512),[[e.vShow,r.value]]),s.value?(e.openBlock(),e.createElementBlock("div",Et,[t[20]||(t[20]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(l.value),1)])):e.createCommentVNode("",!0),e.createVNode(P,{ref:"pipeAnalysisPanelRef"},null,512)])}}}),kt=de._export_sfc(wt,[["__scopeId","data-v-d9156359"]]);exports.default=kt;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed as _, defineComponent as z, defineAsyncComponent as S, ref as A, watch as G, createElementBlock as M, openBlock as E, normalizeClass as j, createBlock as b, createCommentVNode as B, unref as P } from "vue";
|
|
2
2
|
import { a as L, b$ as Y, p as I, s as O } from "./index-CYp77kPp.js";
|
|
3
3
|
import { u as H } from "./index.vue_vue_type_style_index_1_lang-Ds1cd7yg.js";
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dkl1cH-C.js";
|
|
5
5
|
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
6
|
function se(u) {
|
|
7
7
|
const d = sessionStorage.getItem("loginToken") ?? "123456";
|
|
@@ -125,7 +125,7 @@ const X = {
|
|
|
125
125
|
},
|
|
126
126
|
emits: ["getThreeData"],
|
|
127
127
|
setup(u, { emit: d }) {
|
|
128
|
-
const h = S(() => import("./threeSceneView-
|
|
128
|
+
const h = S(() => import("./threeSceneView-L7mPphX4.js")), D = S(() => import("./threePreview-DKlyIJKv.js")), f = S(() => import("./threeLatheView-DZZ-1LxL.js")), T = S(() => import("./threeSceneViewForCPMPIP-K0nm7l_H.js")), o = {
|
|
129
129
|
ROBOT_SCENE: "robot",
|
|
130
130
|
// 机器人场景
|
|
131
131
|
LATHE_SCENE: "latheScene",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),m=require("./index-1z9RrjZc.cjs"),B=require("./index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
"use strict";const t=require("vue"),m=require("./index-1z9RrjZc.cjs"),B=require("./index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BKTlb5a7.cjs");const L=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(f){const T=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:f,headers:{Authorization:T,"Content-Type":"multipart/form-data"}})}function R(f){const T=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:f,headers:{Authorization:T,Accept:"application/octet-stream"},responseType:"blob"})}const I=m.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(f){this.data=f},getData(){return this.data}}});function A(){const f=B.useMenuState(m.pinia),{platform:T}=m.storeToRefs(f),y=I(m.pinia),F=t.computed(()=>{var e;return(e=y==null?void 0:y.data)==null?void 0:e.extension}),p=["uv","cpt","cyd"],v=["urdf"],s=["obj","stl"],o=[...p,...v,...s],P=e=>{if(!E())throw new Error("不是三维系统");y.setData(e)},d=()=>y.getData(),E=()=>T.value==="three",l=e=>{const i=e==null?void 0:e.toLowerCase(),c=i==null?void 0:i.lastIndexOf(".");let h=i;return c>=0&&(h=h==null?void 0:h.slice(c+1)),h},w=e=>{if(!e)return!1;const i=l(e);return o==null?void 0:o.includes(i)};return{getData:d,setData:P,isThreeSystem:E,isUrdf:e=>{if(!e)return!1;const i=l(e);return v==null?void 0:v.includes(i)},isGeneralFile:e=>{if(!e)return!1;const i=l(e);return s==null?void 0:s.includes(i)},isTrackPathFile:e=>{if(!e)return!1;const i=l(e);return p==null?void 0:p.includes(i)},isThreeFile:w,isUseBackdrop:e=>E()&&w(e),initTrackFileType:e=>{if(!e)return{isCpt:!1,isCyd:!1,isUv:!1};const i=l(e),c=p==null?void 0:p.find(b=>b===i);return{isCpt:c==="cpt",isCyd:c==="cyd",isUv:c==="uv"}},getFileExtension:l,extraExtension:F}}const q={key:4,class:"loading"},x=t.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(f,{emit:T}){const y=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-BfpO8VDG.cjs"))),F=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-Cy7NY-gw.cjs"))),p=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-BsuPsR7B.cjs"))),v=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-zkgB6OW3.cjs"))),s={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},o=f,P=B.useMenuState(m.pinia),{platName:d}=m.storeToRefs(P),{isGeneralFile:E,isUrdf:l,isTrackPathFile:w,extraExtension:D}=A(),S=t.computed(()=>(o==null?void 0:o.extension)||D.value),k=t.computed(()=>{var r,n;return(n=(r=o==null?void 0:o.threeData)==null?void 0:r.data)==null?void 0:n.trackFileType}),C=t.computed(()=>{var n;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 r=(n=o==null?void 0:o.fileUrls)==null?void 0:n[0];return E(r)?s.PREVIEW:(d==null?void 0:d.value)==="CPMPIP"&&(l(r)||l(S.value))?s.CPMPIP_SCENE:(d==null?void 0:d.value)==="SFRTubeBend"&&(l(r)||l(S.value))?s.ROBOT_SCENE:w(S.value)&&k.value?s.LATHE_SCENE:s.PREVIEW}),g=T,e=t.ref([]),i=t.ref(!1);function c(r){try{const n=new URL(r).pathname,u=n.substring(n.lastIndexOf("/")+1);return decodeURIComponent(u)}catch(n){return console.error("无法解析URL以提取文件名:",r,n),"未知文件名"}}async function h(r){let n,u;if(/^https?:\/\//.test(r))try{const a=await fetch(r);if(!a.ok)throw new Error(`下载文件失败: ${a.statusText} (URL: ${r})`);n=await a.blob(),u=c(r)}catch(a){throw console.error("使用 fetch 下载文件时出错:",a),a}else try{const a=await R({url:r});if(a.status!==200)throw new Error(`下载失败: ${a.status}`);const _=a.headers["content-disposition"];u=b(_)||"无文件名",n=a.data}catch(a){throw console.error("通过 API 下载文件时出错:",a),a}return new File([n],u,{type:n.type})}function b(r){if(!r)return;const n=r.match(/filename\*\s*=\s*([^;]+)/i);if(n){let a=n[1].trim();a=a.replace(/^"(.*)"$/,"$1");const _=a.split("''");if(_.length===2){const H=_[0].toUpperCase(),U=_[1];try{if(H==="UTF-8")return decodeURIComponent(U)}catch{}return U}try{return decodeURIComponent(a)}catch{return a}}const u=r.match(/filename\s*=\s*("?)([^";]+)\1/i);if(u)return u[2].trim()}async function N(r){if(!r||!r.length){e.value=[];return}i.value=!0;try{const n=await Promise.all(r.map(u=>h(u)));e.value=n}catch(n){console.error("文件下载时发生错误:",n),e.value=[]}finally{i.value=!1}}const M=()=>{g("getThreeData")};return t.watch(()=>o.fileUrls,async r=>{await N(r??[])},{immediate:!0,deep:!0}),(r,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([o.host==="electron"?"mv-electron":"mv-inline","three-platform"])},[C.value===s.ROBOT_SCENE?(t.openBlock(),t.createBlock(t.unref(y),{key:0,"file-blobs":e.value,"animation-data":r.animationData,onGetThreeData:M,threeData:o.threeData},null,8,["file-blobs","animation-data","threeData"])):C.value===s.LATHE_SCENE?(t.openBlock(),t.createBlock(t.unref(p),{key:1,fileUrls:r.fileUrls,threeData:o.threeData,trackFileType:k.value},null,8,["fileUrls","threeData","trackFileType"])):C.value===s.CPMPIP_SCENE?(t.openBlock(),t.createBlock(t.unref(v),{key:2,"file-blobs":e.value,threeData:o.threeData},null,8,["file-blobs","threeData"])):C.value===s.PREVIEW?(t.openBlock(),t.createBlock(t.unref(F),{key:3,"file-blobs":e.value,"animation-data":r.animationData},null,8,["file-blobs","animation-data"])):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createElementBlock("div",q," 文件下载中,请稍候... ")):t.createCommentVNode("",!0)],2))}}),V=L._export_sfc(x,[["__scopeId","data-v-5e37b1fe"]]),W=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=V;exports.downloadAvatarApi=R;exports.threeViewerHost=W;exports.uploadFile=O;exports.useThreeState=I;exports.useThreeSystem=A;
|
|
@@ -92,7 +92,7 @@ const A = { class: "panel-content" }, D = {
|
|
|
92
92
|
type: "range",
|
|
93
93
|
min: e.limit.lower,
|
|
94
94
|
max: e.limit.upper,
|
|
95
|
-
step: "0.
|
|
95
|
+
step: "0.001",
|
|
96
96
|
value: e.currentValue,
|
|
97
97
|
onInput: (t) => f(e.name, t.target.value),
|
|
98
98
|
class: "joint-slider"
|
|
@@ -109,7 +109,7 @@ const A = { class: "panel-content" }, D = {
|
|
|
109
109
|
])))
|
|
110
110
|
]));
|
|
111
111
|
}
|
|
112
|
-
}), ae = /* @__PURE__ */ C(X, [["__scopeId", "data-v-
|
|
112
|
+
}), ae = /* @__PURE__ */ C(X, [["__scopeId", "data-v-41bcea28"]]), Y = { class: "panel-content" }, Z = "id", j = {
|
|
113
113
|
__name: "urdfTree",
|
|
114
114
|
props: {
|
|
115
115
|
model: Object,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),E=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),V={class:"panel-content"},x={key:0,class:"joints-list"},J={class:"joint-info-row"},N={class:"joint-left"},w={class:"joint-name"},B={class:"joint-range"},F={class:"joint-type"},b={key:0,class:"joint-control-row"},C={class:"slider-container"},I=["min","max","value","onInput"],L={class:"value-display"},S={class:"joint-value"},D={class:"unit"},P={key:1,class:"empty-state"},M=t.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(d,{expose:f}){const r=d,c=t.ref([]),o=t.ref(null),m=(a,u=!1)=>a==="revolute"?u?Math.PI:-Math.PI:a==="prismatic"?u?1:-1:0,_=a=>{if(!a||!a.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const u=[];return Object.keys(a.joints).forEach(e=>{var l,i;const s=a.joints[e];if(s.jointType==="fixed")return;let n={lower:((l=s.limit)==null?void 0:l.lower)??m(s.jointType,!1),upper:((i=s.limit)==null?void 0:i.upper)??m(s.jointType,!0)};s.jointType==="continuous"&&(n={lower:-10*Math.PI,upper:10*Math.PI}),u.push({name:e,type:s.jointType||"unknown",limit:n,currentValue:s.angle||0,urdfJoint:s})}),u.sort((e,s)=>e.name.localeCompare(s.name))},p=(a,u)=>{var l;const e=c.value.find(i=>i.name===a);if(!e)return;const s=parseFloat(u),n=Math.max(e.limit.lower,Math.min(e.limit.upper,s));e.currentValue=n,(l=r.model)!=null&&l.setJointValue?r.model.setJointValue(a,n):e.urdfJoint.setJointValue(n)},y=()=>{c.value.forEach(a=>{(a.type==="revolute"||a.type==="continuous"||a.type==="prismatic")&&p(a.name,0)})},v=()=>{r.model&&c.value.forEach(a=>{a.urdfJoint.angle!==void 0&&a.currentValue!==a.urdfJoint.angle&&(a.currentValue=a.urdfJoint.angle)})},g=()=>{const a=()=>{v(),o.value=requestAnimationFrame(a)};a()},k=()=>{o.value&&(cancelAnimationFrame(o.value),o.value=null)};return t.watch(()=>r.model,a=>{a?c.value=_(a):c.value=[]},{immediate:!0}),t.onMounted(()=>{g()}),t.onUnmounted(()=>{k()}),f({resetAllJoints:y}),(a,u)=>(t.openBlock(),t.createElementBlock("div",V,[c.value.length>0?(t.openBlock(),t.createElementBlock("div",x,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,e=>(t.openBlock(),t.createElementBlock("div",{key:e.name,class:"joint-item"},[t.createElementVNode("div",J,[t.createElementVNode("div",N,[t.createElementVNode("span",w,t.toDisplayString(e.name),1),t.createElementVNode("span",B," ["+t.toDisplayString(e.limit.lower.toFixed(2))+", "+t.toDisplayString(e.limit.upper.toFixed(2))+"] ",1)]),t.createElementVNode("span",F,t.toDisplayString(e.type),1)]),e.type==="revolute"||e.type==="prismatic"||e.type==="continuous"?(t.openBlock(),t.createElementBlock("div",b,[t.createElementVNode("div",C,[t.createElementVNode("input",{type:"range",min:e.limit.lower,max:e.limit.upper,step:"0.001",value:e.currentValue,onInput:s=>p(e.name,s.target.value),class:"joint-slider"},null,40,I)]),t.createElementVNode("div",L,[t.createElementVNode("span",S,t.toDisplayString(e.currentValue?Number(e.currentValue).toFixed(3):"0.000"),1),t.createElementVNode("span",D,t.toDisplayString(e.type==="prismatic"?"m":"rad"),1)])])):t.createCommentVNode("",!0)]))),128))])):(t.openBlock(),t.createElementBlock("div",P,u[0]||(u[0]=[t.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),U=E._export_sfc(M,[["__scopeId","data-v-41bcea28"]]),T={class:"panel-content"},A="id",R={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:d=>["breadth","firstLevel"].includes(d)},extraNodes:{type:Array,default:[]}},emits:["nodeClick"],setup(d,{emit:f}){const r=d,c=f,o=t.ref([]),m={children:"children",label:"label"},_=e=>{c("nodeClick",e)},p=(e,s=0)=>{const n=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(l=>{if(!(l!=null&&l.isMesh)&&((l==null?void 0:l.type)==="URDFJoint"||(l==null?void 0:l.type)==="URDFLink")){const i={name:l==null?void 0:l.name,label:l==null?void 0:l.name,show:!0,level:s+1,isPenultimate:!1,type:l==null?void 0:l.type,id:l==null?void 0:l.id,limit:(l==null?void 0:l.limit)??"",children:p(l==null?void 0:l.children,s+1),path:l==null?void 0:l.name};n.push(i)}}),n},y=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:p(e==null?void 0:e.children,1)||[],path:e==null?void 0:e.name}]:[],v=(e,s)=>{const n=[],l=[...e];for(;l.length>0&&n.length<s;){const i=l.shift();i.children&&i.children.length>0&&(n.push(i.id),l.push(...i.children))}return n},g=(e,s)=>{const n=[];return e.forEach(l=>{if(l.children&&l.children.length>0){n.push(l.id);const i=l.children.filter(h=>h.children&&h.children.length>0).slice(0,s).map(h=>h.id);n.push(...i)}}),n.slice(0,s+1)},k=t.computed(()=>!o.value||o.value.length===0?[]:r.expandStrategy==="firstLevel"?g(o.value,r.maxExpandCount):v(o.value,r.maxExpandCount)),a=t.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:r!=null&&r.model?y(r.model):[],path:"场景"}]),u=()=>{const e=r.extraNodes||[],s=e==null?void 0:e.map(n=>({...n,level:0}));o.value.push(...s)};return t.watch(a,e=>{o.value=JSON.parse(JSON.stringify(e)),u()},{immediate:!0}),(e,s)=>{const n=t.resolveComponent("el-tree");return t.openBlock(),t.createElementBlock("div",T,[t.createVNode(n,{data:o.value,props:m,"default-expanded-keys":k.value,"node-key":A,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},q=E._export_sfc(R,[["__scopeId","data-v-3503cf34"]]);exports.JointPanel=U;exports.UrdfTree=q;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var de = Object.defineProperty;
|
|
2
2
|
var me = (n, s, t) => s in n ? de(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
|
|
3
3
|
var x = (n, s, t) => me(n, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { ay as pe, n as E, h as ve, e as fe, B as be, V as z, Q as we, E as he, az as _e, J as ge } from "./three-viewport-gizmo-BlxFLyPm.js";
|
|
5
|
+
import { U as Me } from "./index.vue_vue_type_style_index_1_lang-Cl6e-PP2.js";
|
|
6
|
+
import { S as ye, M as Re, O as Se } from "./STLLoader-BBRISxpD.js";
|
|
7
7
|
import { defineComponent as $e, ref as V, computed as D, watch as ue, resolveComponent as J, createElementBlock as j, openBlock as I, createVNode as F, createElementVNode as c, withCtx as L, createTextVNode as U, toDisplayString as C } from "vue";
|
|
8
8
|
import { _ as Fe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
9
|
const ct = {
|
|
@@ -29,7 +29,7 @@ function ce(n) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function Oe(n) {
|
|
32
|
-
const { manager: s, baseFolderUrl: t, onFileProgress: i } = n, m = new
|
|
32
|
+
const { manager: s, baseFolderUrl: t, onFileProgress: i } = n, m = new Me(s);
|
|
33
33
|
return m.packages = (l) => `${t.endsWith("/") ? t : t + "/"}${l}/`, m.loadMeshCb = (l, y, h) => {
|
|
34
34
|
const R = (() => {
|
|
35
35
|
const g = l.split("?")[0].split("#")[0], u = g.lastIndexOf(".");
|
|
@@ -49,7 +49,7 @@ function Oe(n) {
|
|
|
49
49
|
var v;
|
|
50
50
|
return (((v = l.split("/").pop()) == null ? void 0 : v.split("?")[0].split("#")[0]) ?? "").replace(/\.[^/.?#]+$/, "");
|
|
51
51
|
})(), f = `${g}${u}.mtl`, M = (r) => {
|
|
52
|
-
const v = new
|
|
52
|
+
const v = new Se(y);
|
|
53
53
|
r && v.setMaterials(r), v.load(
|
|
54
54
|
l,
|
|
55
55
|
(w) => h(w),
|
|
@@ -58,7 +58,7 @@ function Oe(n) {
|
|
|
58
58
|
console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${l}`, w), h(new E());
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
}, b = new
|
|
61
|
+
}, b = new Re(y);
|
|
62
62
|
b.setResourcePath(g), b.load(
|
|
63
63
|
f,
|
|
64
64
|
(r) => {
|
|
@@ -76,10 +76,10 @@ function Oe(n) {
|
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "stl": {
|
|
79
|
-
new
|
|
79
|
+
new ye(y).load(
|
|
80
80
|
l,
|
|
81
81
|
(u) => {
|
|
82
|
-
const f = new
|
|
82
|
+
const f = new ve({ color: 12303291, shininess: 30 }), M = new fe(u, f);
|
|
83
83
|
M.castShadow = !0, M.receiveShadow = !0, h(M);
|
|
84
84
|
},
|
|
85
85
|
(u) => i == null ? void 0 : i(l, u == null ? void 0 : u.loaded, u == null ? void 0 : u.total),
|
|
@@ -98,7 +98,7 @@ function mt(n, s, t, i) {
|
|
|
98
98
|
return { loadSceneFromFile: (l) => new Promise((y, h) => {
|
|
99
99
|
t.value = !0, i.value = "正在初始化 URDF 加载器...";
|
|
100
100
|
let R = 0, g = 0, u = null;
|
|
101
|
-
const f = new
|
|
101
|
+
const f = new pe();
|
|
102
102
|
f.onStart = (b, r, v) => {
|
|
103
103
|
R = v || 0, g = r || 0, i.value = R > 0 ? `开始下载资源: 0 / ${R}` : "开始下载资源...", t.value = !0;
|
|
104
104
|
}, f.onProgress = (b, r, v) => {
|
|
@@ -107,7 +107,7 @@ function mt(n, s, t, i) {
|
|
|
107
107
|
i.value = w, r === v && (i.value = "资源加载完成,正在处理模型...", setTimeout(() => {
|
|
108
108
|
if (u) {
|
|
109
109
|
u.updateMatrixWorld(!0);
|
|
110
|
-
const p = new
|
|
110
|
+
const p = new be().setFromObject(u);
|
|
111
111
|
p.isEmpty() && console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"), u.userData.boundingBox = p, u.traverse((d) => {
|
|
112
112
|
d.isMesh && (d.castShadow = !0, d.receiveShadow = !0);
|
|
113
113
|
}), y(u);
|
|
@@ -246,7 +246,7 @@ class pt {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
const De = (n, s = "YZX") => {
|
|
249
|
-
const t = new z(), i = new
|
|
249
|
+
const t = new z(), i = new we(), m = new z(), l = new he();
|
|
250
250
|
n.getWorldPosition(t), n.getWorldQuaternion(i), n.getWorldScale(m), l.setFromQuaternion(i, s);
|
|
251
251
|
const y = {
|
|
252
252
|
x: n.rotation.x * 180 / Math.PI,
|
|
@@ -520,7 +520,7 @@ const De = (n, s = "YZX") => {
|
|
|
520
520
|
}), vt = /* @__PURE__ */ Fe(st, [["__scopeId", "data-v-00d48931"]]);
|
|
521
521
|
function ft(n, s, t, i = ["URDFVisual"]) {
|
|
522
522
|
let m = null;
|
|
523
|
-
const l = V(null), y = new
|
|
523
|
+
const l = V(null), y = new _e(), h = new ge(), R = /* @__PURE__ */ new Map();
|
|
524
524
|
function g() {
|
|
525
525
|
t.value.forEach((p) => {
|
|
526
526
|
p.traverse((d) => {
|