ss-component-new 1.2.2 → 1.2.4
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-Co_9huz0.cjs +1 -0
- package/dist/OrbitControls-DA4VpOM_.js +458 -0
- package/dist/STLLoader-DmGTF0Nv.js +657 -0
- package/dist/STLLoader-RU7KqloS.cjs +6 -0
- package/dist/{animationData-BDq02_ir.js → animationData-9n1X4UvO.js} +4 -4
- package/dist/{animationData-BRDoJBuV.cjs → animationData-CfT99nMO.cjs} +1 -1
- package/dist/{array-BtZq8qON.cjs → array-BPHS7JFA.cjs} +1 -1
- package/dist/{array-A59WrroX.js → array-pg68Qbs1.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{iconfont-7cEds3Xj.js → iconfont-ljBfzBSE.js} +2 -2
- package/dist/{iconfont-CsuwJCas.cjs → iconfont-t5epssvu.cjs} +1 -1
- package/dist/{index-wq8KZGnQ.js → index---6UATT0.js} +3 -3
- package/dist/{index-D8S0DVkq.cjs → index-1DtctdYW.cjs} +1 -1
- package/dist/index-5hLZZ6t-.cjs +1 -0
- package/dist/{index-DygW4mGC.js → index-8CcD03tl.js} +6 -6
- package/dist/{index-C6Uddqal.js → index-B5gNufYw.js} +2 -2
- package/dist/{index-BgJn4mlV.js → index-B5srJr0o.js} +2 -2
- package/dist/{index-B_k7wRBo.cjs → index-B5vIeQUq.cjs} +1 -1
- package/dist/{index-DS3OziT5.cjs → index-B8J_v2Ky.cjs} +1 -1
- package/dist/{index-DQTI3BuS.cjs → index-B9nZeing.cjs} +1 -1
- package/dist/{index-BeqNCviq.js → index-BAj0dyBF.js} +152 -152
- package/dist/{index-BeTQ6ief.js → index-BEJOd_29.js} +4 -4
- package/dist/{index-Dn9I5-1H.cjs → index-BKhDFqMM.cjs} +1 -1
- package/dist/{index-Cz03X-rX.js → index-BNNxPuEV.js} +1 -1
- package/dist/{index-DmwVXfrE.cjs → index-BOVdAFDH.cjs} +1 -1
- package/dist/{index-Crd4LGue.cjs → index-Bi7yv8jC.cjs} +1 -1
- package/dist/{index-CFg3-0Tk.js → index-BjXcyVvp.js} +2 -2
- package/dist/{index-CxnH4vfV.cjs → index-BrsIZVyD.cjs} +1 -1
- package/dist/{index-BB6zZsmY.cjs → index-Bsdjuxq1.cjs} +1 -1
- package/dist/{index-C461j30b.js → index-BuKHInQb.js} +1 -1
- package/dist/{index-CJzA3AAO.cjs → index-Bx4qIiIa.cjs} +1 -1
- package/dist/{index-HFf3Z0Ft.cjs → index-C-AOuDkl.cjs} +1 -1
- package/dist/{index-C3CD2NW8.cjs → index-C0HHmjrg.cjs} +1 -1
- package/dist/{index-BTrjEMt1.js → index-C1lB8apW.js} +4 -4
- package/dist/{index-DqquxuCt.cjs → index-CAHYTZ1Q.cjs} +1 -1
- package/dist/{index-BdL8I_2i.cjs → index-CCIJ-P3X.cjs} +1 -1
- package/dist/{index-B9j8fCyS.js → index-CCsSOTaB.js} +2 -2
- package/dist/{index-YQnrEK_K.js → index-CDXq3gs4.js} +21 -21
- package/dist/{index-CrWFG4Wb.cjs → index-CK_O7QdV.cjs} +1 -1
- package/dist/{index-N7dEiXLQ.js → index-CLtFz5gE.js} +3 -3
- package/dist/{index-6t33eejU.cjs → index-CMlYJD5U.cjs} +1 -1
- package/dist/{index-BxPnA2or.js → index-CdPbJekh.js} +448 -448
- package/dist/{index-CjI5pDiU.cjs → index-CmlXlH2b.cjs} +1 -1
- package/dist/{index-C_VamYcq.js → index-CpE8hbs0.js} +6 -6
- package/dist/{index-CNJzNn6z.cjs → index-CxNBcsll.cjs} +1 -1
- package/dist/{index-BqCCREh3.js → index-CyP2hcVu.js} +6 -6
- package/dist/{index-gjDjqhNq.cjs → index-D-r_YKrq.cjs} +2 -2
- package/dist/{index-C23iUpXa.js → index-D0_4keB8.js} +5 -5
- package/dist/{index-db5CgGrA.js → index-DBScQH7L.js} +13 -13
- package/dist/{index-Cx302rHQ.cjs → index-DCf7Tz40.cjs} +1 -1
- package/dist/{index-DNE4QDIf.js → index-DEwcUkb-.js} +3 -3
- package/dist/{index-qoqka5Nb.js → index-DFg-bhPI.js} +1 -1
- package/dist/{index-CtPy-3S1.cjs → index-DJ1PTHpx.cjs} +1 -1
- package/dist/{index-DqaA5Rvx.cjs → index-DOlPMLvf.cjs} +1 -1
- package/dist/{index-Kg96Vvn5.cjs → index-DPaTtF3h.cjs} +1 -1
- package/dist/{index-CVl84S8B.cjs → index-DPyzaxnq.cjs} +1 -1
- package/dist/{index-DH0dVg0N.js → index-DS5z17Mc.js} +7 -7
- package/dist/{index-B35e4i9n.js → index-DSsZtYMz.js} +2 -2
- package/dist/{index-DVvt9_w0.js → index-Dk8D9SRm.js} +1 -1
- package/dist/{index-wHil9Fox.js → index-DsHRVZ0E.js} +2 -2
- package/dist/{index-DmB0dlGH.cjs → index-DszzdQnM.cjs} +1 -1
- package/dist/{index-BwjuTBrR.js → index-FxX6NP0J.js} +1 -1
- package/dist/{index-CtG-uyjY.cjs → index-LXb5DfDE.cjs} +1 -1
- package/dist/{index-byBdKAky.cjs → index-NFCeQcv4.cjs} +1 -1
- package/dist/{index-BvPC1LSv.js → index-PIEkAjRf.js} +12 -12
- package/dist/{index-CYp77kPp.js → index-UN4JU0ly.js} +1 -1
- package/dist/{index-CvEj4aiY.js → index-Y7MUJdPv.js} +2 -2
- package/dist/{index-aneoZx5F.js → index-bj8hK6Pe.js} +2 -2
- package/dist/{index-1z9RrjZc.cjs → index-d6tSWKtY.cjs} +1 -1
- package/dist/{index-DIm3MBK_.cjs → index-nUEWiqy9.cjs} +1 -1
- package/dist/{index-dqBbhGfy.js → index-pLeOyTaj.js} +6 -6
- package/dist/{index-nq9fleOT.js → index-xHEf6hcO.js} +2 -2
- package/dist/{index-XQxaEXgz.cjs → index-zQVJFawn.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dmm4yqcc.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CzcK5mCc.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-B0Ivzvcp.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Bg_c-oAL.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-xm0hMPwT.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-C795GAHK.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Czu5g16A.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-9kDr7Iek.js} +13 -13
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CMx9TLjC.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Bn5qXF4J.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-CXwGS60-.cjs → index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs} +46 -45
- package/dist/{index.vue_vue_type_style_index_1_lang-BxEXAMMV.js → index.vue_vue_type_style_index_1_lang-D1n_3_F6.js} +5100 -5012
- package/dist/{index.vue_vue_type_style_index_1_lang-AXp5rRSK.js → index.vue_vue_type_style_index_1_lang-Exyt6qTf.js} +525 -525
- package/dist/{index.vue_vue_type_style_index_1_lang-j5HrYuvy.cjs → index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs} +2 -2
- package/dist/{isString-BNK38WbE.js → isString-BAN9KLwf.js} +1 -1
- package/dist/{isString-BmAegMGI.cjs → isString-ChvWbctO.cjs} +1 -1
- package/dist/{main-BgpAXuSa.cjs → main-BUEuCNq-.cjs} +1 -1
- package/dist/{main-t7yIujwl.js → main-Dk3BZDsa.js} +5 -5
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +11 -11
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +12 -12
- package/dist/three-viewport-gizmo-BHznJ6W3.js +26015 -0
- package/dist/three-viewport-gizmo-BV37JzRa.cjs +4197 -0
- package/dist/{threeLatheView-sTBlm0tt.js → threeLatheView-DcuDjVv0.js} +4 -4
- package/dist/{threeLatheView-BzHB-t_G.cjs → threeLatheView-DfSxRY8B.cjs} +1 -1
- package/dist/{threeModel-BudPgWiX.cjs → threeModel-DjjtL0-a.cjs} +1 -1
- package/dist/{threeModel-11Yk8w2d.js → threeModel-YRFvkgXU.js} +5 -5
- package/dist/threePreview-ByUYJkts.cjs +1 -0
- package/dist/threePreview-CyYfnbB6.js +1972 -0
- package/dist/{threeSceneView-DT-STxuj.cjs → threeSceneView-mhrcH0WG.cjs} +1 -1
- package/dist/{threeSceneView-Bwed326O.js → threeSceneView-zvyCHrp1.js} +24 -24
- package/dist/{threeSceneViewForCPMPIP-RRDb_tZ0.cjs → threeSceneViewForCPMPIP-DA-twBdG.cjs} +2 -2
- package/dist/{threeSceneViewForCPMPIP-PgPPGBxu.js → threeSceneViewForCPMPIP-axjwKt9X.js} +27 -27
- package/dist/{threeViewerHost-Brgx-J3Q.cjs → threeViewerHost-B02OtfCk.cjs} +1 -1
- package/dist/{threeViewerHost-k5I66uBW.js → threeViewerHost-D7L1FW__.js} +4 -4
- package/dist/{useRayCaster-TCYe6KMI.js → useRayCaster-CAqupK7D.js} +12 -12
- package/dist/{useRayCaster-CLcetetd.cjs → useRayCaster-ClcofJkf.cjs} +1 -1
- package/package.json +1 -1
- package/public/config.js +1 -1
- package/dist/OrbitControls-D1lM0xvz.cjs +0 -1
- package/dist/OrbitControls-DI8fa9gz.js +0 -419
- package/dist/STLLoader-KxFIlfhN.cjs +0 -6
- package/dist/STLLoader-memlq1bT.js +0 -609
- package/dist/index-TXrydBPq.cjs +0 -1
- package/dist/three-viewport-gizmo-BxFHxv_x.js +0 -18587
- package/dist/three-viewport-gizmo-CwaL5sMV.cjs +0 -4195
- package/dist/threePreview-Cy7NY-gw.cjs +0 -1
- package/dist/threePreview-DPyqhBkJ.js +0 -1873
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("./useRayCaster-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("./useRayCaster-ClcofJkf.cjs"),T=require("./iconfont-t5epssvu.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.cjs");const Y=require("./index-d6tSWKtY.cjs");require("./index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs");require("./index-BpPyaNFa.cjs");const W=require("./index-CK_O7QdV.cjs");require("./index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs");const a=require("./three-viewport-gizmo-BV37JzRa.cjs");require("./index-DJ1PTHpx.cjs");const he=require("./animationData-CfT99nMO.cjs"),fe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Ve=require("./urdfTree-CCktg0FK.cjs"),J=.001,te=a.MathUtils.degToRad,ge=new a.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:a.DoubleSide});function Ne(C=.005,g=64){const E=new a.CatmullRomCurve3([new a.Vector3(0,0,0),new a.Vector3(0,0,0)]),s=new a.TubeGeometry(E,g,C,16,!1),N=ge;return new a.Mesh(s,N)}const be=C=>C.reduce((g,E)=>{let s=0;const N=E.Y??0,S=E.C??0,f=E.R??0;return N>0&&(s+=N),S>0&&f>0&&(s+=f*te(S)),g+s},0),we=C=>{const g=[],E=C.Y??0,s=C.B??0,N=C.C??0,S=C.R??0,f={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(!E&&!N)return g;if(g.push(f.pos.clone()),s!==0){const M=new a.Matrix4().makeRotationAxis(f.localY,te(s));f.localX.applyMatrix4(M),f.localZ.applyMatrix4(M)}if(E>0&&(f.pos.add(f.localY.clone().multiplyScalar(E*J)),g.push(f.pos.clone())),N>0&&S>0){const M=te(N),P=S*J,d=f.pos.clone().add(f.localX.clone().multiplyScalar(-P)),c=Math.max(16,Math.ceil(N/5));for(let V=1;V<=c;V++){const n=M*V/c,y=new a.Matrix4().makeRotationAxis(f.localZ,n),b=f.localX.clone().multiplyScalar(P).applyMatrix4(y),h=d.clone().add(b);g.push(h)}}return g};function Ce(C,g){const E=new a.Group;E.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 N=0,S=1;for(let f=0;f<C.length;f++){const M=C[f],P=M.Y??0,d=M.B??0,c=M.C??0,V=M.R??0;if(d!==0){const n=new a.Matrix4().makeRotationAxis(s.localY,te(d));s.localX.applyMatrix4(n),s.localZ.applyMatrix4(n)}if(P>0){const n=s.pos.clone();s.pos.add(s.localY.clone().multiplyScalar(P*J));const y=s.pos.clone(),r=Ee(n,y,g*J);r.userData={segmentType:"straight",segmentIndex:N,frameIndex:f,length:P,frame:{Y:P,B:d,C:c,R:V}},r.name=`直段_${N}`,E.add(r);const b=n.clone();_e(E,S,b,g*J),N++}if(c>0&&V>0){const n=te(c),y=V*J,r=[];r.push(s.pos.clone());const b=s.pos.clone().add(s.localX.clone().multiplyScalar(-y)),h=Math.max(16,Math.ceil(c/5));for(let k=1;k<=h;k++){const I=n*k/h,D=new a.Matrix4().makeRotationAxis(s.localZ,I),j=s.localX.clone().multiplyScalar(y).applyMatrix4(D),Q=b.clone().add(j);r.push(Q)}const x=xe(r,g*J);x.userData={segmentType:"bend",segmentIndex:N,frameIndex:f,angle:c,radius:V,centerPoint:b.toArray(),frame:{Y:P,B:d,C:c,R:V}},x.name=`弯段_${N}`,E.add(x),Math.floor(r.length/2),r[0],s.pos=r[r.length-1].clone();const m=new a.Matrix4().makeRotationAxis(s.localZ,n);s.localY.applyMatrix4(m),s.localX.applyMatrix4(m),N++,S++}}return E}function _e(C,g,E,s){const N=new a.Vector3(0,s*2,s*5),S=E.clone().add(N),f=[E,S],M=new a.BufferGeometry().setFromPoints(f),P=new a.LineDashedMaterial({color:16711680,dashSize:s*.5,gapSize:s*.3,linewidth:1}),d=new a.Line(M,P);d.computeLineDistances(),C.add(d);const c=document.createElement("canvas"),V=c.getContext("2d");c.width=128,c.height=128,V.clearRect(0,0,128,128),V.fillStyle="#FF0000",V.font="bold 80px Arial",V.textAlign="center",V.textBaseline="middle",V.fillText(g.toString(),64,64);const n=new a.CanvasTexture(c),y=new a.SpriteMaterial({map:n,transparent:!0,depthTest:!1,depthWrite:!1}),r=new a.Sprite(y),b=s*3;r.scale.set(b,b,1),r.position.copy(S),r.name=`Label_${g}`,r.userData={labelNumber:g},C.add(r)}function Ee(C,g,E){const s=new a.LineCurve3(C,g),N=new a.TubeGeometry(s,2,E,18,!1);return new a.Mesh(N,ge)}function xe(C,g){const E=new a.CatmullRomCurve3(C,!1,"catmullrom",.01),s=new a.TubeGeometry(E,Math.max(16,C.length*2),g,18,!1);return new a.Mesh(s,ge)}function re(C,g,E,s,N,S=0){let f=g.slice(0,N+1);const M=g[N+1];if(M&&S>0){const r={...M,B:(M.B??0)*S,C:(M.C??0)*S};f.push(r)}const P=be(f),d=Math.max(0,E-P),c=[];c.push(new a.Vector3(0,0,0));const V=new a.Vector3(0,d*J,0);d>0&&c.push(V);let n={pos:V.clone(),localY:new a.Vector3(0,1,0),localX:new a.Vector3(1,0,0),localZ:new a.Vector3(0,0,1)};const y=[];for(let r=f.length-1;r>=0;r--){const b=f[r],h=we(b);if(h.length>0){const x=h.map(D=>{const R=D.clone(),j=new a.Matrix4;return j.makeBasis(n.localX,n.localY,n.localZ),R.applyMatrix4(j),R.add(n.pos)});y.push(x);const m=x[x.length-1];n.pos=m.clone();const k=b.B??0,I=b.C??0;if(k!==0){const D=new a.Matrix4().makeRotationAxis(n.localY,te(k));n.localX.applyMatrix4(D),n.localZ.applyMatrix4(D)}if(I>0){const D=te(I),R=new a.Matrix4().makeRotationAxis(n.localZ,D);n.localY.applyMatrix4(R),n.localX.applyMatrix4(R)}}}for(const r of y)r.length>1&&c.push(...r.slice(1));c.length<2&&c.push(new a.Vector3(0,.001,0));try{const r=new a.CatmullRomCurve3(c,!1,"catmullrom",.01),b=new a.TubeGeometry(r,Math.max(2,c.length*4),s*J,18,!1);C.geometry.dispose(),C.geometry=b}catch(r){console.error("管件更新失败",r)}}function ye(C,g,E,s=0){let N=C.slice(0,E+1);const S=C[E+1];if(S&&s>0){const n={...S,B:(S.B??0)*s,C:(S.C??0)*s};N.push(n)}const f=be(N),M=Math.max(0,g-f),P=[];P.push(new a.Vector3(0,0,0));const d=new a.Vector3(0,M*J,0);M>0&&P.push(d);let c={pos:d.clone(),localY:new a.Vector3(0,1,0),localX:new a.Vector3(1,0,0),localZ:new a.Vector3(0,0,1)};const V=[];for(let n=N.length-1;n>=0;n--){const y=N[n],r=we(y);if(r.length>0){const b=r.map(k=>{const I=k.clone(),D=new a.Matrix4;return D.makeBasis(c.localX,c.localY,c.localZ),I.applyMatrix4(D),I.add(c.pos)});V.push(b);const h=b[b.length-1];c.pos=h.clone();const x=y.B??0,m=y.C??0;if(x!==0){const k=new a.Matrix4().makeRotationAxis(c.localY,te(x));c.localX.applyMatrix4(k),c.localZ.applyMatrix4(k)}if(m>0){const k=te(m),I=new a.Matrix4().makeRotationAxis(c.localZ,k);c.localY.applyMatrix4(I),c.localX.applyMatrix4(I)}}}for(const n of V)n.length>1&&P.push(...n.slice(1));return P.length<2&&P.push(new a.Vector3(0,.001,0)),P}function ne(C,g,E,s,N,S,f,M=0,P=0){const d=N-P,c=ye(s,d,f,M);let n=ye(E,P,f,M);n.forEach(r=>r.y=-r.y),n.reverse();const y=[...n,...c];try{const r=new a.CatmullRomCurve3(y,!1,"catmullrom",.01),b=new a.TubeGeometry(r,Math.max(2,y.length*4),S*J,18,!1);g.geometry.dispose(),C.geometry.dispose(),g.parent&&g.parent.remove(g),C.geometry=b}catch(r){console.error("管件更新失败",r)}}const Me={class:"panel-content"},Se={class:"action-bar"},ke={key:0,class:"animation-controls"},Pe={class:"control-row"},De={class:"control-row"},Re={class:"frame-info"},Te={class:"control-row"},$e={class:"progress-bar"},Be={class:"dialog-footer"},Ae=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(C,{expose:g,emit:E}){const s=C,N=E,S=e.ref(),f=e.ref(),M=e.ref();e.watch(()=>s.threeData,o=>{const t=o==null?void 0:o.data;M.value=t==null?void 0:t.type},{immediate:!0});const P=async()=>{if(!sessionStorage.getItem("systemKey")){N("getThreeData");return}let t={};M.value===Z.robotMode.SINGLE&&(t=await he.fetchSingleRobotAnimationData()),M.value===Z.robotMode.DOUBLE&&(t=await he.fetchDoubleRobotAnimationData());const{initialPipeLength:u=0,pipeRadius:_=0,clampLength:p=0,animationData:$}=t;D.value=u,R.value=_,j.value=p,S.value=$;const F=Y.cloneDeep(S.value);d.value=(F==null?void 0:F["输出(动画数据)"])||[];let i=(F==null?void 0:F["输出(动画数据)Content"])??[];i&&(f.value=i)},d=e.ref([]),c=e.ref(!1),V=e.ref(""),n=e.ref(!1),y=e.ref(0),r=e.ref(0),b=e.ref(1e3),h=e.ref(null);let x=!1;const m=e.shallowRef(null),k=e.shallowRef(null),I=e.shallowRef(null),D=e.ref(1302),R=e.ref(12.5),j=e.ref(30),Q=e.ref([]),A=e.ref(null),w=e.computed(()=>s.model?Object.values(s.model.joints).filter(o=>o.jointType!=="fixed").map(o=>o.name):[]),X=e.ref(["Y","B","C","R"]),L=e.computed(()=>[...w.value,...X.value]),G=e.computed(()=>L.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
|
|
2
2
|
${L.value.join(" ")}
|
|
3
3
|
0 0 0 ...
|
|
4
4
|
1 2 3 ...`:"请先加载模型。"),q=(o,t)=>{if(!t)return null;const u=o.joints[t];if(!u)return console.warn(`在模型中未找到名为 '${t}' 的 Joint`),null;let _=null;return u.traverse(p=>{p instanceof a.Mesh&&!_&&(_=p)}),_||console.warn(`在 Joint '${t}' 中未找到可用的 Mesh 对象`),_},oe=(o,t)=>{if(!t)return null;const u=o.joints[t];return u||(console.warn(`在模型中未找到名为 '${t}' 的 Joint`),console.log("可用的链接:",Object.keys(o.links)),null)},ee=()=>{I.value&&(I.value.visible=!0),m.value&&m.value.parent&&m.value.parent.remove(m.value),I.value=null,m.value=null,k.value=null};e.watch(L,(o,t)=>{if(JSON.stringify(o)!==JSON.stringify(t))if(o.length>0){const u=o.reduce((_,p)=>(_[p]="0",_),{});d.value=[u]}else d.value=[]},{immediate:!0});const H=(o,t)=>{const u=oe(o,t),_=Ne();_.visible=!1,u==null||u.add(_)};e.watch(()=>s.model,o=>{ee(),o?(h.value=new Z.URDFRobotController(o),Q.value=Object.keys(o.links),A.value="Pipe_Joint",H(o,A.value)):(h.value=null,Q.value=[],A.value=null)},{immediate:!0}),e.watch([A,j],([o,t])=>{if(ee(),s.model&&o){const u=q(s.model,o);if(console.log(u,"meshToReplace"),u&&u.parent){I.value=u;const _=new a.Mesh(u.geometry.clone(),u.material);if(_.name="managed_pipe_clone",u.parent.add(_),_.position.copy(u.position),_.rotation.copy(u.rotation),_.scale.copy(u.scale),u.visible=!1,M.value===Z.robotMode.SINGLE&&(_.position.y-=t*.001),m.value=_,M.value===Z.robotMode.DOUBLE){const p=new a.Mesh(u.geometry.clone(),u.material);p.name="managed_oppsite_pipe_clone",p.position.copy(u.position),p.rotation.copy(u.rotation),p.scale.copy(u.scale),u.parent.add(p),k.value=p}m.value&&k.value&&ne(m.value,k.value,[],[],D.value,R.value,0,0,j.value)}else o&&console.warn(`在 link '${o}' 中未找到可替换的网格或其没有父级。`)}});const z=()=>d.value.map(o=>({Y:parseFloat(o.Y)||0,B:parseFloat(o.B)||0,C:parseFloat(o.C)||0,R:parseFloat(o.R)||0})),K=()=>{const o=[],t=[];return d.value.forEach(u=>{const{Y1:_,B1:p,C1:$,R1:F,Y2:i,B2:l,C2:O,R2:v}=u;o.push({Y:parseFloat(_)||0,B:parseFloat(p)||0,C:parseFloat($)||0,R:parseFloat(F)||0}),t.push({Y:parseFloat(i)||0,B:parseFloat(l)||0,C:parseFloat(O)||0,R:parseFloat(v)||0})}),{posPipeYbcr:o,negPipeYbcr:t}},B=o=>{if(o<0||o>=d.value.length){console.error(`帧索引 ${o} 超出范围`);return}const t=d.value[o];if(console.log(`应用第 ${o} 帧数据 ${t}`),y.value=o,h.value){const u={};w.value.forEach(_=>{const p=parseFloat(t[_]);isNaN(p)||(u[_]=p)}),h.value.setJointAngles(u)}if(m.value&&k.value){const u=K();console.log("ybcr数据:",u),ne(m.value,k.value,u.posPipeYbcr,u.negPipeYbcr,D.value,R.value,o,0,j.value);return}if(m.value){const u=z();console.log("ybcr数据:",u),re(m.value,u,D.value,R.value,o,0);return}},ae=async()=>{if(d.value.length===0){Y.ElMessage.error("无法播放动画:无数据");return}n.value=!0,x=!1;const o=m.value?z():[];try{for(let t=y.value+1;t<d.value.length&&!x;t++){y.value=t;const u=d.value[t],_={};h.value&&w.value.forEach(p=>{const $=parseFloat(u[p]);isNaN($)||(_[p]=$)}),h.value?await h.value.animateToState(_,b.value,p=>{if(r.value=(t+p)/d.value.length*100,m.value&&k.value){const $=K();console.log("ybcr数据:",o),ne(m.value,k.value,$.posPipeYbcr,$.negPipeYbcr,D.value,R.value,t-1,p,j.value)}else m.value&&re(m.value,o,D.value,R.value,t-1,p)}):m.value&&k.value?await new Promise(p=>{const $=performance.now();let F;const i=l=>{if(x){cancelAnimationFrame(F),p();return}const O=l-$,v=Math.min(O/b.value,1);r.value=(t+v)/d.value.length*100;const U=K();ne(m.value,k.value,U.posPipeYbcr,U.negPipeYbcr,D.value,R.value,t-1,v,j.value),v<1?F=requestAnimationFrame(i):p()};F=requestAnimationFrame(i)}):m.value?await new Promise(p=>{const $=performance.now();let F;const i=l=>{if(x){cancelAnimationFrame(F),p();return}const O=l-$,v=Math.min(O/b.value,1);r.value=(t+v)/d.value.length*100,re(m.value,o,D.value,R.value,t-1,v),v<1?F=requestAnimationFrame(i):p()};F=requestAnimationFrame(i)}):(await new Promise(p=>setTimeout(p,b.value)),r.value=(t+1)/d.value.length*100)}x||Y.ElMessage.success("动画播放完成")}catch(t){console.error("动画播放出错:",t),Y.ElMessage.error("动画播放出错")}finally{n.value=!1,r.value=0}},le=()=>{x=!0,n.value=!1,r.value=0,Y.ElMessage.info("动画已停止")},ie=()=>{if(h.value&&h.value.resetToZero(),console.log("pipeMesh.value",m.value),m.value&&k.value){const o=K();ne(m.value,k.value,o.posPipeYbcr,o.negPipeYbcr,D.value,R.value,-1,0,j.value)}else if(m.value){const o=z();re(m.value,o,D.value,R.value,-1,0)}y.value=0,Y.ElMessage.success("机器人和管件已重置")},ce=()=>{console.log("当前管件Mesh:",m.value)},ue=o=>{n.value&&le(),B(o)},de=()=>{n.value&&le(),!(y.value+1>=d.value.length)&&B(y.value+1)},pe=()=>{n.value&&le(),y.value!==0&&B(y.value-1)},me=async()=>{if(L.value.length===0){Y.ElMessage.warning("没有可导出的表头");return}const o=L.value.join(" ");try{await navigator.clipboard.writeText(o),Y.ElMessage.success("表头已成功复制到剪贴板!")}catch(t){console.error("复制失败:",t),Y.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ve=()=>{if(!V.value.trim()){Y.ElMessage.warning("导入内容不能为空");return}const o=V.value.trim().split(`
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { defineComponent as Le, ref as C, watch as ce, shallowRef as fe, computed as _e, onUnmounted as Ge, resolveComponent as N, createElementBlock as ge, openBlock as ne, createElementVNode as o, createCommentVNode as me, createVNode as e, withCtx as z, createBlock as De, unref as B, toDisplayString as ve, onBeforeUnmount as Oe, createTextVNode as Ie, onMounted as Ne, nextTick as qe, withDirectives as Q, vShow as de, renderSlot as be, isRef as ke, vModelRadio as xe } from "vue";
|
|
2
|
-
import { U as He, r as Te, s as Be, u as We, a as Ke, W as Qe } from "./useRayCaster-
|
|
3
|
-
import { u as Xe, a as et, b as tt, S as E } from "./iconfont-
|
|
4
|
-
import
|
|
5
|
-
import "./index
|
|
6
|
-
import
|
|
7
|
-
import "./index.vue_vue_type_style_index_1_lang-AXp5rRSK.js";
|
|
2
|
+
import { U as He, r as Te, s as Be, u as We, a as Ke, W as Qe } from "./useRayCaster-CAqupK7D.js";
|
|
3
|
+
import { u as Xe, a as et, b as tt, S as E } from "./iconfont-ljBfzBSE.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.js";
|
|
5
|
+
import { a9 as lt, c as ot, E as J, a as nt, aM as at, ao as st } from "./index-UN4JU0ly.js";
|
|
6
|
+
import "./index.vue_vue_type_style_index_1_lang-Exyt6qTf.js";
|
|
8
7
|
import "./index-BHtNKL1L.js";
|
|
9
|
-
import { _ as ie, s as
|
|
10
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
11
|
-
import "./
|
|
12
|
-
import
|
|
8
|
+
import { _ as ie, s as it } from "./index-Dk8D9SRm.js";
|
|
9
|
+
import "./index.vue_vue_type_style_index_1_lang-D1n_3_F6.js";
|
|
10
|
+
import { m as Ve, T as we, V as O, e as he, n as rt, k as te, l as ut, o as ct, i as pt, L as dt, p as mt, q as vt, r as ft, s as gt, t as ht, u as bt } from "./three-viewport-gizmo-BHznJ6W3.js";
|
|
11
|
+
import "./index-B5gNufYw.js";
|
|
12
|
+
import { f as yt, a as _t } from "./animationData-9n1X4UvO.js";
|
|
13
13
|
import { _ as je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
14
14
|
import { U as wt, J as Ct } from "./urdfTree-BuTtRGdl.js";
|
|
15
|
-
const ee = 1e-3, re =
|
|
15
|
+
const ee = 1e-3, re = ut.degToRad, Ue = new rt({
|
|
16
16
|
// 灰色
|
|
17
17
|
color: 13421772,
|
|
18
18
|
metalness: 0.3,
|
|
19
19
|
roughness: 0.6,
|
|
20
|
-
side:
|
|
20
|
+
side: pt
|
|
21
21
|
});
|
|
22
22
|
function Pt(k = 5e-3, g = 64) {
|
|
23
23
|
const T = new Ve([new O(0, 0, 0), new O(0, 0, 0)]), s = new we(T, g, k, 16, !1), P = Ue;
|
|
@@ -49,7 +49,7 @@ const Ze = (k) => k.reduce((g, T) => {
|
|
|
49
49
|
return g;
|
|
50
50
|
};
|
|
51
51
|
function kt(k, g) {
|
|
52
|
-
const T = new
|
|
52
|
+
const T = new ct();
|
|
53
53
|
T.name = "CompletePipe";
|
|
54
54
|
const s = {
|
|
55
55
|
pos: new O(0, 0, 0),
|
|
@@ -103,25 +103,25 @@ function kt(k, g) {
|
|
|
103
103
|
return T;
|
|
104
104
|
}
|
|
105
105
|
function xt(k, g, T, s) {
|
|
106
|
-
const P = new O(0, s * 2, s * 5), V = T.clone().add(P), f = [T, V], D = new
|
|
106
|
+
const P = new O(0, s * 2, s * 5), V = T.clone().add(P), f = [T, V], D = new mt().setFromPoints(f), S = new vt({
|
|
107
107
|
color: 16711680,
|
|
108
108
|
dashSize: s * 0.5,
|
|
109
109
|
gapSize: s * 0.3,
|
|
110
110
|
linewidth: 1
|
|
111
|
-
}), p = new
|
|
111
|
+
}), p = new ft(D, S);
|
|
112
112
|
p.computeLineDistances(), k.add(p);
|
|
113
113
|
const u = document.createElement("canvas"), b = u.getContext("2d");
|
|
114
114
|
u.width = 128, u.height = 128, b.clearRect(0, 0, 128, 128), b.fillStyle = "#FF0000", b.font = "bold 80px Arial", b.textAlign = "center", b.textBaseline = "middle", b.fillText(g.toString(), 64, 64);
|
|
115
|
-
const a = new
|
|
115
|
+
const a = new gt(u), y = new ht({
|
|
116
116
|
map: a,
|
|
117
117
|
transparent: !0,
|
|
118
118
|
depthTest: !1,
|
|
119
119
|
depthWrite: !1
|
|
120
|
-
}), i = new
|
|
120
|
+
}), i = new bt(y), _ = s * 3;
|
|
121
121
|
i.scale.set(_, _, 1), i.position.copy(V), i.name = `Label_${g}`, i.userData = { labelNumber: g }, k.add(i);
|
|
122
122
|
}
|
|
123
123
|
function Tt(k, g, T) {
|
|
124
|
-
const s = new
|
|
124
|
+
const s = new dt(k, g), P = new we(s, 2, T, 18, !1);
|
|
125
125
|
return new he(P, Ue);
|
|
126
126
|
}
|
|
127
127
|
function Mt(k, g) {
|
|
@@ -276,7 +276,7 @@ const Dt = { class: "panel-content" }, Vt = { class: "action-bar" }, Rt = {
|
|
|
276
276
|
animationData: F
|
|
277
277
|
} = t;
|
|
278
278
|
$.value = c, A.value = x, G.value = d, V.value = F;
|
|
279
|
-
const U =
|
|
279
|
+
const U = ot(V.value);
|
|
280
280
|
p.value = (U == null ? void 0 : U["输出(动画数据)"]) || [];
|
|
281
281
|
let r = (U == null ? void 0 : U["输出(动画数据)Content"]) ?? [];
|
|
282
282
|
r && (f.value = r);
|
|
@@ -592,7 +592,7 @@ ${Z.value.join(" ")}
|
|
|
592
592
|
class: "is-loading"
|
|
593
593
|
}, {
|
|
594
594
|
default: z(() => [
|
|
595
|
-
e(B(
|
|
595
|
+
e(B(lt))
|
|
596
596
|
]),
|
|
597
597
|
_: 1
|
|
598
598
|
})) : me("", !0)
|
|
@@ -750,7 +750,7 @@ ${Z.value.join(" ")}
|
|
|
750
750
|
}
|
|
751
751
|
}), Lt = /* @__PURE__ */ je(Bt, [["__scopeId", "data-v-e955dfd2"]]), jt = "http://139.196.154.85:20018";
|
|
752
752
|
function Ut(k, g = !1) {
|
|
753
|
-
return console.log(k, "data"),
|
|
753
|
+
return console.log(k, "data"), nt({
|
|
754
754
|
url: `${jt}/api/pipeBendingTraditional/pipeAnsys/${g}`,
|
|
755
755
|
method: "post",
|
|
756
756
|
data: k
|
|
@@ -847,7 +847,7 @@ const Et = { class: "pipe-analysis-dialog-header" }, Ot = { class: "header-right
|
|
|
847
847
|
window.removeEventListener("resize", f), D();
|
|
848
848
|
}), g({ openDialog: ae }), (L, w) => {
|
|
849
849
|
const H = N("el-icon"), Z = N("el-button"), W = N("el-form-item"), K = N("el-form"), ue = N("el-option"), se = N("el-select"), le = N("el-input"), j = N("el-table-column"), oe = N("el-table");
|
|
850
|
-
return ne(), De(
|
|
850
|
+
return ne(), De(it, {
|
|
851
851
|
class: "pipe-analysis-dialog",
|
|
852
852
|
visible: A.value,
|
|
853
853
|
onBeforeDestroy: L.onDestroy,
|
|
@@ -863,13 +863,13 @@ const Et = { class: "pipe-analysis-dialog-header" }, Ot = { class: "header-right
|
|
|
863
863
|
o("div", Ot, [
|
|
864
864
|
e(H, null, {
|
|
865
865
|
default: z(() => [
|
|
866
|
-
e(B(
|
|
866
|
+
e(B(at), { onClick: $ })
|
|
867
867
|
]),
|
|
868
868
|
_: 1
|
|
869
869
|
}),
|
|
870
870
|
e(H, null, {
|
|
871
871
|
default: z(() => [
|
|
872
|
-
e(B(
|
|
872
|
+
e(B(st), { onClick: G })
|
|
873
873
|
]),
|
|
874
874
|
_: 1
|
|
875
875
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-d6tSWKtY.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs"),R=require("./useRayCaster-ClcofJkf.cjs"),m=require("./iconfont-t5epssvu.cjs"),ne=require("./index-CK_O7QdV.cjs");require("./index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs");const de=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./urdfTree-CCktg0FK.cjs"),Le=require("./animationData-CfT99nMO.cjs"),Ue=require("./STLLoader-RU7KqloS.cjs"),ue=require("./index-5hLZZ6t-.cjs"),Ae=require("./three-viewport-gizmo-BV37JzRa.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 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;
|
|
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;
|
|
@@ -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 {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "./index.vue_vue_type_style_index_1_lang-BxEXAMMV.js";
|
|
2
|
+
import { c as rt, E as y, p as be, s as ye, u as ct } from "./index-UN4JU0ly.js";
|
|
3
|
+
import { j as dt, a as vt, u as pt, aD as mt } from "./index.vue_vue_type_style_index_1_lang-Exyt6qTf.js";
|
|
4
|
+
import { U as ft, s as ke, u as gt, a as ht, W as bt } from "./useRayCaster-CAqupK7D.js";
|
|
5
|
+
import { u as yt, a as kt, b as Pt, S as h } from "./iconfont-ljBfzBSE.js";
|
|
6
|
+
import { _ as Pe } from "./index-Dk8D9SRm.js";
|
|
7
|
+
import "./index.vue_vue_type_style_index_1_lang-D1n_3_F6.js";
|
|
9
8
|
import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
10
|
-
import { U as
|
|
11
|
-
import { i as
|
|
12
|
-
import { O as
|
|
13
|
-
import { t as
|
|
9
|
+
import { U as Ct, J as wt } from "./urdfTree-BuTtRGdl.js";
|
|
10
|
+
import { i as _t } from "./animationData-9n1X4UvO.js";
|
|
11
|
+
import { O as xt } from "./STLLoader-DmGTF0Nv.js";
|
|
12
|
+
import { t as Tt, h as $t } from "./index-CdPbJekh.js";
|
|
13
|
+
import { e as jt } from "./three-viewport-gizmo-BHznJ6W3.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 ft(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 = rt(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 xt().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 = dt(be), { originalPath: J } = ye(M);
|
|
242
|
+
vt(be);
|
|
243
|
+
const k = pt(), { activeMenuPath: C } = ye(k), N = ct(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 = Tt(async (t) => {
|
|
257
|
+
await $t();
|
|
258
258
|
const { mainKey: e, baseMenuPath: n } = t || {};
|
|
259
|
-
|
|
259
|
+
mt(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 _t(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
|
+
} = yt(Q), { loadSceneFromFile: Re } = ht(
|
|
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 } = kt(le, de), { isClipping: Ee, activeClippingAxis: P, toggleClipping: Be, updateClippingPlanes: A } = Pt(le, de), { initRaycaster: Fe, selectedObject3D: Ie, setSelectedObjVisible: Je, updatePosition: Ge, updateRotation: Xe, dispose: He } = gt(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 jt && !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(Ct, {
|
|
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(bt, {
|
|
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(wt, { model: _.value }, null, 8, ["model"]), [
|
|
662
662
|
[F, r.value === "机床控制"]
|
|
663
663
|
]),
|
|
664
664
|
x(i(je, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),m=require("./index-
|
|
1
|
+
"use strict";const t=require("vue"),m=require("./index-d6tSWKtY.cjs"),B=require("./index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.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-mhrcH0WG.cjs"))),F=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-ByUYJkts.cjs"))),p=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-DfSxRY8B.cjs"))),v=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-DA-twBdG.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;
|
|
@@ -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
|
-
import { a as L, b$ as Y, p as I, s as O } from "./index-
|
|
3
|
-
import { u as H } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
2
|
+
import { a as L, b$ as Y, p as I, s as O } from "./index-UN4JU0ly.js";
|
|
3
|
+
import { u as H } from "./index.vue_vue_type_style_index_1_lang-Exyt6qTf.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.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-zvyCHrp1.js")), D = S(() => import("./threePreview-CyYfnbB6.js")), f = S(() => import("./threeLatheView-DcuDjVv0.js")), T = S(() => import("./threeSceneViewForCPMPIP-axjwKt9X.js")), o = {
|
|
129
129
|
ROBOT_SCENE: "robot",
|
|
130
130
|
// 机器人场景
|
|
131
131
|
LATHE_SCENE: "latheScene",
|
|
@@ -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 { U as pe } from "./index.vue_vue_type_style_index_1_lang-D1n_3_F6.js";
|
|
5
|
+
import { S as ve, M as fe, O as be } from "./STLLoader-DmGTF0Nv.js";
|
|
6
|
+
import { ay as we, o as E, h as he, e as _e, B as ge, V as z, Q as Me, E as ye, az as Re, J as Se } from "./three-viewport-gizmo-BHznJ6W3.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 pe(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 be(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 fe(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 ve(y).load(
|
|
80
80
|
l,
|
|
81
81
|
(u) => {
|
|
82
|
-
const f = new
|
|
82
|
+
const f = new he({ color: 12303291, shininess: 30 }), M = new _e(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 we();
|
|
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 ge().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 Me(), m = new z(), l = new ye();
|
|
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 Re(), h = new Se(), R = /* @__PURE__ */ new Map();
|
|
524
524
|
function g() {
|
|
525
525
|
t.value.forEach((p) => {
|
|
526
526
|
p.traverse((d) => {
|