ss-component-new 1.2.4 → 1.2.6
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/{animationData-CfT99nMO.cjs → animationData-B0K2ghu6.cjs} +1 -1
- package/dist/{animationData-9n1X4UvO.js → animationData-GqECkAbz.js} +4 -4
- package/dist/{array-pg68Qbs1.js → array-D65aMM6H.js} +1 -1
- package/dist/{array-BPHS7JFA.cjs → array-DMPAgNcb.cjs} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-bj8hK6Pe.js → index--rLSLEk3.js} +2 -2
- package/dist/{index-B8J_v2Ky.cjs → index-67QO-qDa.cjs} +1 -1
- package/dist/{index-DOlPMLvf.cjs → index-87kRWJv8.cjs} +1 -1
- package/dist/{index-CdPbJekh.js → index-8Dyi4QCI.js} +185 -186
- package/dist/{index-CK_O7QdV.cjs → index-8yRiF_z8.cjs} +1 -1
- package/dist/{index-B5srJr0o.js → index-9zEdW6xv.js} +2 -2
- package/dist/{index-CAHYTZ1Q.cjs → index-B14iwpkN.cjs} +1 -1
- package/dist/{index-DJ1PTHpx.cjs → index-B7hLDNQ6.cjs} +1 -1
- package/dist/{index-DBScQH7L.js → index-BEoEUXZe.js} +166 -166
- package/dist/{index-BOVdAFDH.cjs → index-BHJ-tVLT.cjs} +1 -1
- package/dist/{index-Dk8D9SRm.js → index-BMMYAqF1.js} +1 -1
- package/dist/{index-DFg-bhPI.js → index-BNOx3XL5.js} +1 -1
- package/dist/{index-CMlYJD5U.cjs → index-BNvpuVyw.cjs} +1 -1
- package/dist/{index-d6tSWKtY.cjs → index-BOJUyAaV.cjs} +2 -2
- package/dist/{index-B5vIeQUq.cjs → index-BYUPvuvs.cjs} +1 -1
- package/dist/{index-LXb5DfDE.cjs → index-BaRkv5oc.cjs} +1 -1
- package/dist/{index-Bx4qIiIa.cjs → index-BpR7F1Fp.cjs} +1 -1
- package/dist/{index-BjXcyVvp.js → index-Bs2K1FVH.js} +2 -2
- package/dist/{index-Bsdjuxq1.cjs → index-BsM9qdbC.cjs} +1 -1
- package/dist/{index-CyP2hcVu.js → index-BsfJJu0R.js} +6 -6
- package/dist/{index-BAj0dyBF.js → index-Bw_JtuzR.js} +3 -3
- package/dist/{index-BuKHInQb.js → index-C1FOuBuy.js} +1 -1
- package/dist/{index-NFCeQcv4.cjs → index-C5CKSB0e.cjs} +1 -1
- package/dist/{index-CCsSOTaB.js → index-C8UOMPgt.js} +2 -2
- package/dist/{index-CCIJ-P3X.cjs → index-CA-FC_OL.cjs} +1 -1
- package/dist/{index-CDXq3gs4.js → index-CArSUfnV.js} +19 -19
- package/dist/{index-8CcD03tl.js → index-CBuqdsPh.js} +6 -6
- package/dist/{index---6UATT0.js → index-CMCrQ36H.js} +3 -3
- package/dist/{index-CpE8hbs0.js → index-CRj9VM12.js} +6 -6
- package/dist/{index-C1lB8apW.js → index-CRrAiL5l.js} +4 -4
- package/dist/{index-BNNxPuEV.js → index-CShBWCYm.js} +1 -1
- package/dist/{index-FxX6NP0J.js → index-CTkF2kl_.js} +1 -1
- package/dist/{index-DCf7Tz40.cjs → index-CZaBF851.cjs} +1 -1
- package/dist/{index-Y7MUJdPv.js → index-CbA74tCL.js} +2 -2
- package/dist/{index-B5gNufYw.js → index-CbDu4gfZ.js} +2 -2
- package/dist/{index-zQVJFawn.cjs → index-CePZE-QA.cjs} +1 -1
- package/dist/{index-Bi7yv8jC.cjs → index-CedgKpsz.cjs} +1 -1
- package/dist/{index-C0HHmjrg.cjs → index-Cm3z0Vmi.cjs} +1 -1
- package/dist/{index-BEJOd_29.js → index-D-WcrLQv.js} +4 -4
- package/dist/{index-D-r_YKrq.cjs → index-D6mwkqWY.cjs} +2 -2
- package/dist/index-D8510-YQ.cjs +1 -0
- package/dist/{index-DPyzaxnq.cjs → index-D9oqICYV.cjs} +1 -1
- package/dist/{index-DSsZtYMz.js → index-DGepdvRW.js} +2 -2
- package/dist/{index-D0_4keB8.js → index-DGi-ANHr.js} +5 -5
- package/dist/{index-CLtFz5gE.js → index-DJGsDpDp.js} +3 -3
- package/dist/{index-B9nZeing.cjs → index-DPBmAgEA.cjs} +1 -1
- package/dist/{index-xHEf6hcO.js → index-DPWc4No_.js} +2 -2
- package/dist/{index-BrsIZVyD.cjs → index-DSchKIyh.cjs} +1 -1
- package/dist/{index-UN4JU0ly.js → index-DV_ZZQBO.js} +2 -2
- package/dist/{index-1DtctdYW.cjs → index-DVmoPvzr.cjs} +1 -1
- package/dist/{index-BKhDFqMM.cjs → index-DWs7-g1h.cjs} +1 -1
- package/dist/{index-DszzdQnM.cjs → index-DZ8a7BZ1.cjs} +1 -1
- package/dist/{index-nUEWiqy9.cjs → index-DcUUpSE1.cjs} +1 -1
- package/dist/{index-DsHRVZ0E.js → index-DvpVQvAe.js} +2 -2
- package/dist/{index-DPaTtF3h.cjs → index-FK1YYpjN.cjs} +1 -1
- package/dist/{index-DEwcUkb-.js → index-HvKjB6_P.js} +3 -3
- package/dist/{index-PIEkAjRf.js → index-LADv0t0E.js} +11 -11
- package/dist/{index-DS5z17Mc.js → index-_66uQhcl.js} +7 -7
- package/dist/{index-CxNBcsll.cjs → index-_uyv24Pt.cjs} +1 -1
- package/dist/{index-pLeOyTaj.js → index-g4qw0jRy.js} +6 -6
- package/dist/{index-C-AOuDkl.cjs → index-mtuIEfrj.cjs} +1 -1
- package/dist/{index-CmlXlH2b.cjs → index-tttYIzsn.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-C795GAHK.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-D2VLEzGB.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-Bg_c-oAL.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-D58IzjOR.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Bn5qXF4J.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BnNwKutS.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-9kDr7Iek.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CJCvJvBM.js} +13 -13
- package/dist/{index.vue_vue_type_style_index_1_lang-Exyt6qTf.js → index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js} +31 -25
- package/dist/{index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs → index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs → index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs} +2 -2
- package/dist/{index.vue_vue_type_style_index_1_lang-D1n_3_F6.js → index.vue_vue_type_style_index_1_lang-hBa3nAgx.js} +3 -3
- package/dist/{isString-BAN9KLwf.js → isString--ZVOCy4V.js} +1 -1
- package/dist/{isString-ChvWbctO.cjs → isString-CELwppr9.cjs} +1 -1
- package/dist/{main-BUEuCNq-.cjs → main-C6Iw-pcH.cjs} +1 -1
- package/dist/{main-Dk3BZDsa.js → main-CygliYyN.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/{threeLatheView-DfSxRY8B.cjs → threeLatheView-CdUoB0Te.cjs} +1 -1
- package/dist/{threeLatheView-DcuDjVv0.js → threeLatheView-DzpPpdDr.js} +2 -2
- package/dist/{threeModel-DjjtL0-a.cjs → threeModel-BUCLJlE5.cjs} +1 -1
- package/dist/{threeModel-YRFvkgXU.js → threeModel-BfMMeZCc.js} +3 -3
- package/dist/{threePreview-CyYfnbB6.js → threePreview-BEqzg370.js} +1 -1
- package/dist/{threePreview-ByUYJkts.cjs → threePreview-C-JW_pcY.cjs} +1 -1
- package/dist/threeSceneView-BTsG2QJg.cjs +5 -0
- package/dist/threeSceneView-DV5dsTZZ.js +1471 -0
- package/dist/{threeSceneViewForCPMPIP-axjwKt9X.js → threeSceneViewForCPMPIP-Bexwqkry.js} +7 -7
- package/dist/{threeSceneViewForCPMPIP-DA-twBdG.cjs → threeSceneViewForCPMPIP-DwLWGNUd.cjs} +1 -1
- package/dist/{threeViewerHost-B02OtfCk.cjs → threeViewerHost-CRqcYbJE.cjs} +1 -1
- package/dist/{threeViewerHost-D7L1FW__.js → threeViewerHost-CTjd2V1D.js} +4 -4
- package/dist/{useRayCaster-CAqupK7D.js → useRayCaster-D0_7oJan.js} +1 -1
- package/dist/{useRayCaster-ClcofJkf.cjs → useRayCaster-DN56HpNP.cjs} +1 -1
- package/package.json +1 -1
- package/public/config.js +1 -1
- package/dist/index-5hLZZ6t-.cjs +0 -1
- package/dist/threeSceneView-mhrcH0WG.cjs +0 -5
- package/dist/threeSceneView-zvyCHrp1.js +0 -1469
|
@@ -1,15 +1,15 @@
|
|
|
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 { c as rt, E as y, p as be, s as ye, u as ct } from "./index-
|
|
3
|
-
import { j as dt, a as vt, u as pt, aD as mt } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import { U as ft, s as ke, u as gt, a as ht, W as bt } from "./useRayCaster-
|
|
2
|
+
import { c as rt, E as y, p as be, s as ye, u as ct } from "./index-DV_ZZQBO.js";
|
|
3
|
+
import { j as dt, a as vt, u as pt, aD as mt } from "./index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js";
|
|
4
|
+
import { U as ft, s as ke, u as gt, a as ht, W as bt } from "./useRayCaster-D0_7oJan.js";
|
|
5
5
|
import { u as yt, a as kt, b as Pt, S as h } from "./iconfont-ljBfzBSE.js";
|
|
6
|
-
import { _ as Pe } from "./index-
|
|
7
|
-
import "./index.vue_vue_type_style_index_1_lang-
|
|
6
|
+
import { _ as Pe } from "./index-BMMYAqF1.js";
|
|
7
|
+
import "./index.vue_vue_type_style_index_1_lang-hBa3nAgx.js";
|
|
8
8
|
import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
9
9
|
import { U as Ct, J as wt } from "./urdfTree-BuTtRGdl.js";
|
|
10
|
-
import { i as _t } from "./animationData-
|
|
10
|
+
import { i as _t } from "./animationData-GqECkAbz.js";
|
|
11
11
|
import { O as xt } from "./STLLoader-DmGTF0Nv.js";
|
|
12
|
-
import { t as Tt, h as $t } from "./index-
|
|
12
|
+
import { t as Tt, h as $t } from "./index-8Dyi4QCI.js";
|
|
13
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,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("./index-BOJUyAaV.cjs"),Q=require("./index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs"),R=require("./useRayCaster-DN56HpNP.cjs"),m=require("./iconfont-t5epssvu.cjs"),ne=require("./index-8yRiF_z8.cjs");require("./index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs");const de=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re=require("./urdfTree-CCktg0FK.cjs"),Le=require("./animationData-B0K2ghu6.cjs"),Ue=require("./STLLoader-RU7KqloS.cjs"),ue=require("./index-D8510-YQ.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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),m=require("./index-
|
|
1
|
+
"use strict";const t=require("vue"),m=require("./index-BOJUyAaV.cjs"),B=require("./index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.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-BTsG2QJg.cjs"))),F=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-C-JW_pcY.cjs"))),p=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-CdUoB0Te.cjs"))),v=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-DwLWGNUd.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-DV_ZZQBO.js";
|
|
3
|
+
import { u as H } from "./index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.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-DV5dsTZZ.js")), D = S(() => import("./threePreview-BEqzg370.js")), f = S(() => import("./threeLatheView-DzpPpdDr.js")), T = S(() => import("./threeSceneViewForCPMPIP-Bexwqkry.js")), o = {
|
|
129
129
|
ROBOT_SCENE: "robot",
|
|
130
130
|
// 机器人场景
|
|
131
131
|
LATHE_SCENE: "latheScene",
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { U as pe } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
+
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-hBa3nAgx.js";
|
|
5
5
|
import { S as ve, M as fe, O as be } from "./STLLoader-DmGTF0Nv.js";
|
|
6
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";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
package/package.json
CHANGED
package/public/config.js
CHANGED
|
@@ -4,7 +4,7 @@ window.__env__ = {
|
|
|
4
4
|
"VITE_OPEN_CDN": "false",
|
|
5
5
|
"VITE_PUBLIC_PATH": "",
|
|
6
6
|
"VITE_SM_PUBLIC_KEY": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312",
|
|
7
|
-
"VITE_API_URL": "http://222.92.178.198:
|
|
7
|
+
"VITE_API_URL": "http://222.92.178.198:62001",
|
|
8
8
|
"VITE_DEFAULT_USER": "",
|
|
9
9
|
"VITE_DEFAULT_USER_PASSWORD": ""
|
|
10
10
|
}
|