ss-component-new 1.2.111 → 1.2.113
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/{MTLLoader-hWX_D7j7.js → MTLLoader-CxvMDUe0.js} +1 -1
- package/dist/{MTLLoader-BgOTItOM.cjs → MTLLoader-DGjQiY9j.cjs} +1 -1
- package/dist/{OBJLoader-C3tq7BYe.cjs → OBJLoader-DJpc8vUj.cjs} +1 -1
- package/dist/{OBJLoader-BukOM4Nu.js → OBJLoader-qAJoaDam.js} +1 -1
- package/dist/{OrbitControls-jkIlFyOy.js → OrbitControls-BMEUSilq.js} +1 -1
- package/dist/{OrbitControls-DKRnuekm.cjs → OrbitControls-Y0_MwO63.cjs} +1 -1
- package/dist/{URDFLoader-VSdgVBcE.js → URDFLoader-DFaB1rOB.js} +97 -97
- package/dist/{URDFLoader-CX_gwIob.cjs → URDFLoader-z_OD751c.cjs} +1 -1
- package/dist/{animationData-B6OrW5p6.js → animationData-Clde34ha.js} +7 -7
- package/dist/{animationData-C7dHVqYg.cjs → animationData-DcdD2uXH.cjs} +1 -1
- package/dist/{array-B_QF2OoW.js → array-DdC5qADi.js} +1 -1
- package/dist/{array-BgZ91brz.cjs → array-DyI9Z7da.cjs} +1 -1
- package/dist/{iconfont-BgB-_U_6.js → iconfont-BXKkx1g6.js} +88 -88
- package/dist/iconfont-Bi9FnKuf.cjs +1 -0
- package/dist/{index-d_PGJZkK.js → index-4PVKlafX.js} +1 -1
- package/dist/{index-CT0ojXx1.cjs → index-6hYePeg5.cjs} +1 -1
- package/dist/{index-cgzu94nF.cjs → index-B1DG30Df.cjs} +1 -1
- package/dist/{index-azgr74so.js → index-B8eH4yd_.js} +1 -1
- package/dist/{index-CUKZC4Nj.js → index-BAvTpFlb.js} +1 -1
- package/dist/{index-CbzP4t5J.cjs → index-BDUgsfdc.cjs} +1 -1
- package/dist/{index-DkTkLUFp.js → index-BGYM_yzB.js} +1 -1
- package/dist/index-BUC9msP6.cjs +1 -0
- package/dist/{index-9Bq99VYB.cjs → index-BWdy2G65.cjs} +1 -1
- package/dist/{index-BOfis0vA.js → index-BZBOlP5a.js} +3 -3
- package/dist/{index-Bx40M9YE.js → index-BfVijxl4.js} +1 -1
- package/dist/{index-CcCFQb0J.cjs → index-BgMxvBrj.cjs} +1 -1
- package/dist/{index-BheoHyAf.cjs → index-BsyhUS4V.cjs} +1 -1
- package/dist/{index-B2-FEPjF.js → index-BxrVd7R_.js} +1 -1
- package/dist/{index-BcQjNx-Q.cjs → index-C5pOxrIu.cjs} +1 -1
- package/dist/{index-Co-G3YR2.cjs → index-C6VrMmAM.cjs} +1 -1
- package/dist/{index-Cyq0NQxD.js → index-CH7VgZsg.js} +4 -4
- package/dist/{index-DTM9dTrs.js → index-CKtVnHqz.js} +1 -1
- package/dist/{index-D4M6WyOm.js → index-CL-M8PGp.js} +3422 -3421
- package/dist/{index-BPP3Oi4x.js → index-CNyI4C5D.js} +4 -4
- package/dist/{index-ClqfqYxq.cjs → index-CWUgMjDD.cjs} +1 -1
- package/dist/{index-C1XnW8VT.cjs → index-CXPAg3zi.cjs} +1 -1
- package/dist/{index-DPGM3-ZE.js → index-Cag9EKDi.js} +9 -9
- package/dist/{index-BNGaTEx5.cjs → index-Ce63svvK.cjs} +1 -1
- package/dist/{index-Dll9lcYi.js → index-Cfh6xox2.js} +1 -1
- package/dist/{index-D-h6ztpZ.cjs → index-CoVIQ7yB.cjs} +1 -1
- package/dist/{index-ygHebc1d.js → index-CrLgmQwX.js} +16 -16
- package/dist/{index-DaMyMwHq.js → index-Ct7FxVrb.js} +1 -1
- package/dist/{index-BKWeM8bu.js → index-D2J4nD2U.js} +3 -3
- package/dist/{index-CCixZ8x2.cjs → index-D6gzqbUQ.cjs} +1 -1
- package/dist/{index-DQW-r04P.js → index-D7uWgp_G.js} +1 -1
- package/dist/{index-Cs6-4hum.js → index-DZ6iK-To.js} +2 -2
- package/dist/{index-B_CKxC0N.cjs → index-Ddk7mQP9.cjs} +1 -1
- package/dist/{index-DbDdlA5q.js → index-Ddl5YPaT.js} +7 -7
- package/dist/{index-BE67ZntN.js → index-Dn7a-X3Y.js} +2 -2
- package/dist/index-DnoDETkE.cjs +1 -0
- package/dist/{index-9ASTWGRl.cjs → index-DvR7fcc6.cjs} +1 -1
- package/dist/{index-i-fwIxhy.cjs → index-Dw15nvpm.cjs} +1 -1
- package/dist/{index-DalbUyWu.cjs → index-DyLovBRT.cjs} +1 -1
- package/dist/{index-Cjs5dfSY.cjs → index-Md9bylWp.cjs} +1 -1
- package/dist/{index-Bnhk2Wum.js → index-OXqTOaYL.js} +1 -1
- package/dist/{index-6kcPKvxJ.cjs → index-PGBtNsFS.cjs} +1 -1
- package/dist/{index-VMUoElNW.js → index-bNwKGgV2.js} +4 -4
- package/dist/{index-Cf1Y1Sze.cjs → index-lOzwjQZi.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-BgpRnb6p.js → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-D1CNkdop.js} +9 -9
- package/dist/{index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-cYS0o50W.cjs → index.vue_vue_type_style_index_0_scoped_0b6f1a18_lang-DzZjQSCB.cjs} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dgy71NC0.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DV9lk-8w.js} +22 -31
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-o8Cf7V1D.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D_eVz0Sp.cjs} +149 -149
- package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-D5E2HyCn.cjs → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-Bo97w4bj.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_0_scoped_140f5e74_lang-BEM7doEB.js → index.vue_vue_type_style_index_0_scoped_140f5e74_lang-Deyo5lI4.js} +4 -4
- package/dist/{index.vue_vue_type_style_index_1_lang-C6g1KtOz.cjs → index.vue_vue_type_style_index_1_lang-BwsR7epS.cjs} +1 -1
- package/dist/{index.vue_vue_type_style_index_1_lang-Cqs4qqQV.js → index.vue_vue_type_style_index_1_lang-Duqg1WtV.js} +4 -4
- package/dist/{loaderUtil-BFbM8t6R.js → loaderUtil-1wRb28no.js} +1 -1
- package/dist/{loaderUtil-DWuLgv1P.cjs → loaderUtil-Cq8QCp9W.cjs} +1 -1
- package/dist/{main-BlxcR1aO.js → main-5e5sWLUD.js} +3 -3
- package/dist/{main-BIJA7Oyr.cjs → main-CBFpUWMt.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +9 -9
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +10 -10
- package/dist/{threeModel-wFgYGhPU.cjs → threeModel-BbUQzHU5.cjs} +1 -1
- package/dist/{threeModel-B8-8TvnY.js → threeModel-BqpIaxlN.js} +4 -4
- package/dist/{threePreview-vuENkCyX.cjs → threePreview-Aib1ZmEj.cjs} +1 -1
- package/dist/{threePreview-BgJvhDAL.js → threePreview-B-BL8PZx.js} +4 -4
- package/dist/{threeSceneView-D18FzdLv.js → threeSceneView-BVK89QUf.js} +8 -8
- package/dist/{threeSceneView-B7qSJrwR.cjs → threeSceneView-CLF-6z2y.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-RT8liwZe.js → threeSceneViewForCPMPIP-BjV_TpZd.js} +7 -7
- package/dist/{threeSceneViewForCPMPIP-9yi6jiex.cjs → threeSceneViewForCPMPIP-wW_fS1HP.cjs} +1 -1
- package/dist/threeTrackPathView-BwlIgu4k.js +605 -0
- package/dist/threeTrackPathView-CjpKhUbd.cjs +1 -0
- package/dist/{threeViewerHost-DeU3hwnv.js → threeViewerHost-D3LMGTE2.js} +2 -2
- package/dist/{threeViewerHost-LpwVv2oj.cjs → threeViewerHost-EljVz9SK.cjs} +1 -1
- package/dist/{urdfTree-DLpxOUSk.js → urdfTree-C1_9e3Ka.js} +1 -1
- package/dist/{urdfTree-DE-KsOZc.cjs → urdfTree-W9sGK4ua.cjs} +1 -1
- package/dist/{workpieceTreePanel-D2M5yIk2.js → workpieceTreePanel-B5YNWinu.js} +47 -47
- package/dist/{workpieceTreePanel-D0Y23OeS.cjs → workpieceTreePanel-DrSgMdW9.cjs} +1 -1
- package/package.json +1 -1
- package/dist/iconfont-DU9A12zM.cjs +0 -1
- package/dist/index-B-6muHKY.cjs +0 -1
- package/dist/index-CRIDwb3u.cjs +0 -1
- package/dist/threeTrackPathView-DWGdVtPl.js +0 -1458
- package/dist/threeTrackPathView-cB27_BKX.cjs +0 -370
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),h=require("./index-C8qRkCgn.cjs"),b=require("./index-DOCHgBta.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
"use strict";const e=require("vue"),h=require("./index-C8qRkCgn.cjs"),b=require("./index-DOCHgBta.cjs"),S=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D_eVz0Sp.cjs"),F=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),R={SINGLE:"单机",DOUBLE:"双机"},N={ROBOT:1,PIPECOMPARSION:2},i={ROBOT_SCENE:"robot",TRACK_PATH:"trackPath",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},I=h.defineStore("threeState",{state:()=>({data:{files:[],data:{}}}),actions:{setData(v){this.data=v},getData(){return this.data}}});function O(){const v=b.useMenuState(h.pinia),{platform:g}=h.storeToRefs(v),P=I(h.pinia),c=["uv","cyd","nc"],d=["urdf"],r=["obj","stl"],T=[...c,...d,...r],f=t=>{if(!C())throw new Error("不是三维系统");P.setData(t)},y=()=>P.getData(),C=()=>g.value==="three",l=t=>S.getFileExtension(t),m=t=>{if(!t)return!1;const o=l(t);return T==null?void 0:T.includes(o)},E=t=>{if(!t)return!1;const o=l(t);return r==null?void 0:r.includes(o)},p=t=>{if(!t)return!1;const o=l(t);return c==null?void 0:c.includes(o)},u=t=>{if(!t)return{isCpt:!1,isCyd:!1,isUv:!1,isNc:!1};const o=l(t),a=c==null?void 0:c.find(k=>k===o);return{isCpt:a==="cpt",isCyd:a==="cyd",isUv:a==="uv",isNc:a==="nc"}},_=t=>{if(!t)return!1;const o=l(t);return d==null?void 0:d.includes(o)},B=t=>C()&&m(t),n=t=>({url:t,extension:l(t)});return{getData:y,setData:f,isThreeSystem:C,isUrdf:_,isGeneralFile:E,isTrackPathFile:p,isThreeFile:m,isUseBackdrop:B,initTrackFileType:u,getFileExtension:l,getFileInfo:n,getFilesInfo:t=>{const o=[];for(let a=0;a<t.length;a++){const w=t[a],k=n(w);o.push(k)}return o}}}const V={class:"three-platform mv-inline"},A={class:"top-menu"},M={key:4,class:"loading"},H=e.defineComponent({__name:"threeViewerHost",props:{files:{default:()=>[]},threeData:{},componentType:{},width:{default:"100%"},height:{default:"100%"}},setup(v){const g=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-CLF-6z2y.cjs"))),P=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-Aib1ZmEj.cjs"))),c=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeTrackPathView-CjpKhUbd.cjs"))),d=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-wW_fS1HP.cjs"))),r=v,T=b.useMenuState(h.pinia),{platName:f}=h.storeToRefs(T),{isUrdf:y,isTrackPathFile:C}=O(),l=e.computed(()=>{var n;return(n=r==null?void 0:r.files)==null?void 0:n.map(s=>{const{url:t}=s;return t})}),m=e.computed(()=>{var t;const n=(t=r==null?void 0:r.files)==null?void 0:t[0];return(n==null?void 0:n.extension)||""}),E=e.computed(()=>{var n,s;return(s=(n=r==null?void 0:r.threeData)==null?void 0:n.data)==null?void 0:s.trackFileType}),p=e.computed(()=>{if(r.componentType)switch(r.componentType){case"robot":return i.ROBOT_SCENE;case"track":return i.TRACK_PATH;case"cpmpip":return i.CPMPIP_SCENE;case"preview":return i.PREVIEW}return(f==null?void 0:f.value)===S.platNameConstants.CPMPIP&&y(m.value)?i.CPMPIP_SCENE:(f==null?void 0:f.value)===S.platNameConstants.ROBOT&&y(m.value)?i.ROBOT_SCENE:C(m.value)&&E.value?i.TRACK_PATH:i.PREVIEW}),u=e.ref([]),_=e.ref(!1);async function B(n){if(!n||!n.length){u.value=[];return}_.value=!0;try{const s=await Promise.all(n.map(t=>S.downloadFile(t)));u.value=s}catch(s){console.error("文件下载时发生错误:",s),u.value=[]}finally{_.value=!1}}return e.watch(()=>l.value,async n=>{await B(n||[])},{immediate:!0,deep:!0}),(n,s)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("div",A,[e.renderSlot(n.$slots,"top-menu",{},void 0,!0)]),p.value===e.unref(i).ROBOT_SCENE?(e.openBlock(),e.createBlock(e.unref(g),{key:0,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).TRACK_PATH?(e.openBlock(),e.createBlock(e.unref(c),{key:1,fileBlobs:u.value,threeData:r.threeData,trackFileType:E.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData","trackFileType"])):p.value===e.unref(i).CPMPIP_SCENE?(e.openBlock(),e.createBlock(e.unref(d),{key:2,fileBlobs:u.value,threeData:r.threeData},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs","threeData"])):p.value===e.unref(i).PREVIEW?(e.openBlock(),e.createBlock(e.unref(P),{key:3,fileBlobs:u.value},{"button-left":e.withCtx(()=>[e.renderSlot(n.$slots,"management-menu",{},void 0,!0)]),"button-right":e.withCtx(()=>[e.renderSlot(n.$slots,"management-page",{},void 0,!0)]),_:3},8,["fileBlobs"])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",M," 文件下载中,请稍候... ")):e.createCommentVNode("",!0)]))}}),D=F._export_sfc(H,[["__scopeId","data-v-9798f55b"]]),$=Object.freeze(Object.defineProperty({__proto__:null,default:D},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=D;exports.robotMode=R;exports.sceneType=N;exports.threeViewerHost=$;exports.useThreeState=I;exports.useThreeSystem=O;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as I, ref as F, watch as M, onMounted as C, onUnmounted as E, createElementBlock as m, openBlock as f, Fragment as P, renderList as T, createElementVNode as d, createCommentVNode as U, toDisplayString as h, computed as L, resolveComponent as S, createVNode as A } from "vue";
|
|
2
|
-
import { ac as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
2
|
+
import { ac as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DV9lk-8w.js";
|
|
3
3
|
import { _ as b } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
4
|
const D = (i, a) => {
|
|
5
5
|
if (!a)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("vue"),k=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
"use strict";const n=require("vue"),k=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D_eVz0Sp.cjs"),x=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),J=(o,a)=>{if(!a)return null;const i=o.joints[a];return i||null},V=(o,a)=>{if(!a)return null;const i=J(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},F=(o,a)=>{if(!a)return null;const i=o.links[a];return i||null},L=(o,a)=>{if(!a)return null;const i=F(o,a);if(!i)return null;let u=null;return i.traverse(c=>{c instanceof k.Mesh&&!u&&(u=c)}),u},E=o=>{const a=o.joints;return Object.values(a)},M=o=>E(o).filter(u=>u.jointType!=="fixed"),N=o=>{const a=o.links;return Object.keys(a)},w={class:"panel-content"},B={key:0,class:"joints-list"},b={class:"joint-info-row"},I={class:"joint-left"},S={class:"joint-name"},C={class:"joint-range"},D={class:"joint-type"},P={key:0,class:"joint-control-row"},T={class:"slider-container"},U=["min","max","value","onInput"],A={class:"value-display"},R={class:"joint-value"},q={class:"unit"},O={key:1,class:"empty-state"},K=n.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:a}){const i=o,u=n.ref([]),c=n.ref(null),f=(r,e=!1)=>r==="revolute"?e?Math.PI:-Math.PI:r==="prismatic"?e?1:-1:0,h=r=>{if(!r||!r.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const e=[];return E(r).forEach(l=>{var d,p;if(l.jointType==="fixed")return;let t={lower:((d=l.limit)==null?void 0:d.lower)??f(l.jointType,!1),upper:((p=l.limit)==null?void 0:p.upper)??f(l.jointType,!0)};l.jointType==="continuous"&&(t={lower:-10*Math.PI,upper:10*Math.PI}),e.push({name:l.name,type:l.jointType||"unknown",limit:t,currentValue:l.angle||0,urdfJoint:l})}),e},m=(r,e)=>{var d;const s=u.value.find(p=>p.name===r);if(!s)return;const l=parseFloat(e),t=Math.max(s.limit.lower,Math.min(s.limit.upper,l));s.currentValue=t,(d=i.model)!=null&&d.setJointValue?i.model.setJointValue(r,t):s.urdfJoint.setJointValue(t)},_=()=>{u.value.forEach(r=>{(r.type==="revolute"||r.type==="continuous"||r.type==="prismatic")&&m(r.name,0)})},g=()=>{i.model&&u.value.forEach(r=>{r.urdfJoint.angle!==void 0&&r.currentValue!==r.urdfJoint.angle&&(r.currentValue=r.urdfJoint.angle)})},v=()=>{const r=()=>{g(),c.value=requestAnimationFrame(r)};r()},y=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return n.watch(()=>i.model,r=>{r?u.value=h(r):u.value=[]},{immediate:!0}),n.onMounted(()=>{v()}),n.onUnmounted(()=>{y()}),a({resetAllJoints:_}),(r,e)=>(n.openBlock(),n.createElementBlock("div",w,[u.value.length>0?(n.openBlock(),n.createElementBlock("div",B,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,s=>(n.openBlock(),n.createElementBlock("div",{key:s.name,class:"joint-item"},[n.createElementVNode("div",b,[n.createElementVNode("div",I,[n.createElementVNode("span",S,n.toDisplayString(s.name),1),n.createElementVNode("span",C," ["+n.toDisplayString(s.limit.lower.toFixed(2))+", "+n.toDisplayString(s.limit.upper.toFixed(2))+"] ",1)]),n.createElementVNode("span",D,n.toDisplayString(s.type),1)]),s.type==="revolute"||s.type==="prismatic"||s.type==="continuous"?(n.openBlock(),n.createElementBlock("div",P,[n.createElementVNode("div",T,[n.createElementVNode("input",{type:"range",min:s.limit.lower,max:s.limit.upper,step:"0.001",value:s.currentValue,onInput:l=>m(s.name,l.target.value),class:"joint-slider"},null,40,U)]),n.createElementVNode("div",A,[n.createElementVNode("span",R,n.toDisplayString(s.currentValue?Number(s.currentValue).toFixed(3):"0.000"),1),n.createElementVNode("span",q,n.toDisplayString(s.type==="prismatic"?"m":"rad"),1)])])):n.createCommentVNode("",!0)]))),128))])):(n.openBlock(),n.createElementBlock("div",O,e[0]||(e[0]=[n.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),$=x._export_sfc(K,[["__scopeId","data-v-750b831d"]]),H={class:"panel-content"},z="id",G={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)}},emits:["nodeClick"],setup(o,{emit:a}){const i=o,u=a,c=n.ref([]),f={children:"children",label:"label"},h=e=>{u("nodeClick",e)},m=(e,s=0)=>{const l=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(t=>{if(!(t!=null&&t.isMesh)&&((t==null?void 0:t.type)==="URDFJoint"||(t==null?void 0:t.type)==="URDFLink")){const d={name:t==null?void 0:t.name,label:t==null?void 0:t.name,show:!0,level:s+1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:m(t==null?void 0:t.children,s+1),path:t==null?void 0:t.name};l.push(d)}}),l},_=e=>e?[{name:e==null?void 0:e.name,label:e==null?void 0:e.name,show:!0,level:1,isPenultimate:!1,type:e==null?void 0:e.type,id:e==null?void 0:e.id,limit:(e==null?void 0:e.limit)??"",children:m(e==null?void 0:e.children,1)||[],path:e==null?void 0:e.name}]:[],g=(e,s)=>{const l=[],t=[...e];for(;t.length>0&&l.length<s;){const d=t.shift();d.children&&d.children.length>0&&(l.push(d.id),t.push(...d.children))}return l},v=(e,s)=>{const l=[];return e.forEach(t=>{if(t.children&&t.children.length>0){l.push(t.id);const d=t.children.filter(p=>p.children&&p.children.length>0).slice(0,s).map(p=>p.id);l.push(...d)}}),l.slice(0,s+1)},y=n.computed(()=>!c.value||c.value.length===0?[]:i.expandStrategy==="firstLevel"?v(c.value,i.maxExpandCount):g(c.value,i.maxExpandCount)),r=n.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:i!=null&&i.model?_(i.model):[],path:"场景"}]);return n.watch(r,e=>{c.value=JSON.parse(JSON.stringify(e))},{immediate:!0}),(e,s)=>{const l=n.resolveComponent("el-tree");return n.openBlock(),n.createElementBlock("div",H,[n.createVNode(l,{data:c.value,props:f,"default-expanded-keys":y.value,"node-key":z,onNodeClick:h},null,8,["data","default-expanded-keys"])])}}},Q=x._export_sfc(G,[["__scopeId","data-v-cfde50c3"]]);exports.JointPanel=$;exports.UrdfTree=Q;exports.getAllLinkName=N;exports.getMeshFromJoint=V;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=J;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var ce = Object.defineProperty;
|
|
2
2
|
var de = (b, l, t) => l in b ? ce(b, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : b[l] = t;
|
|
3
3
|
var J = (b, l, t) => de(b, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
-
import { U as me } from "./URDFLoader-
|
|
5
|
-
import { O as ve } from "./OBJLoader-
|
|
6
|
-
import { S as pe, M as fe } from "./MTLLoader-
|
|
7
|
-
import {
|
|
8
|
-
import { ref as
|
|
9
|
-
import { c as Re, e as $e, g as
|
|
10
|
-
import { _ as
|
|
11
|
-
const
|
|
4
|
+
import { U as me } from "./URDFLoader-DFaB1rOB.js";
|
|
5
|
+
import { O as ve } from "./OBJLoader-qAJoaDam.js";
|
|
6
|
+
import { S as pe, M as fe } from "./MTLLoader-CxvMDUe0.js";
|
|
7
|
+
import { bP as be, bQ as re, aK as O, ah as we, ac as he, bR as E, $ as _e, bS as ge, bb as je, _ as ye } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DV9lk-8w.js";
|
|
8
|
+
import { ref as T, defineComponent as Le, computed as M, watch as ue, resolveComponent as x, createElementBlock as k, openBlock as P, createVNode as $, createElementVNode as c, withCtx as F, createTextVNode as D, toDisplayString as U } from "vue";
|
|
9
|
+
import { c as Re, e as $e, g as Se } from "./iconfont-BXKkx1g6.js";
|
|
10
|
+
import { _ as Ue } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
11
|
+
const Ce = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
|
|
12
12
|
function Me(b) {
|
|
13
13
|
const { mtlUrl: l, manager: t, resourcePath: s, onLoad: m, onProgress: i, onError: h } = b, v = new fe(t);
|
|
14
14
|
return s && v.setResourcePath(s), v.load(l, m, i, h), v;
|
|
@@ -95,8 +95,8 @@ function mt(b, l, t, s) {
|
|
|
95
95
|
y = j || 0, _ = u || 0, s.value = y > 0 ? `开始下载资源: 0 / ${y}` : "开始下载资源...", t.value = !0;
|
|
96
96
|
}, f.onProgress = (n, u, j) => {
|
|
97
97
|
_ = u, y = j;
|
|
98
|
-
const
|
|
99
|
-
s.value =
|
|
98
|
+
const S = `正在加载 ${u} / ${j} 个文件: ${re(n)}`;
|
|
99
|
+
s.value = S, u === j && (s.value = "资源加载完成,正在处理模型...", setTimeout(() => {
|
|
100
100
|
if (r) {
|
|
101
101
|
r.updateMatrixWorld(!0);
|
|
102
102
|
const p = new _e().setFromObject(r);
|
|
@@ -113,15 +113,15 @@ function mt(b, l, t, s) {
|
|
|
113
113
|
console.warn(`LoadingManager 报告一个资源加载失败: ${n}。加载流程将继续。`);
|
|
114
114
|
};
|
|
115
115
|
const g = (n, u, j) => {
|
|
116
|
-
const
|
|
116
|
+
const S = re(n);
|
|
117
117
|
let p;
|
|
118
|
-
j && j > 0 ? p = `${
|
|
118
|
+
j && j > 0 ? p = `${S}(${E(u)} / ${E(j)})` : u && u > 0 ? p = `${S}(已下载 ${E(u)})` : p = `${S}`, s.value = `正在下载第 ${_ + 1} / ${y} 个文件: ${p}`;
|
|
119
119
|
};
|
|
120
120
|
try {
|
|
121
121
|
const n = URL.createObjectURL(i);
|
|
122
122
|
De({
|
|
123
123
|
manager: f,
|
|
124
|
-
baseFolderUrl:
|
|
124
|
+
baseFolderUrl: Ce,
|
|
125
125
|
onFileProgress: g
|
|
126
126
|
}).load(
|
|
127
127
|
n,
|
|
@@ -140,7 +140,7 @@ function mt(b, l, t, s) {
|
|
|
140
140
|
}
|
|
141
141
|
function vt(b, l, t, s = ["URDFVisual"]) {
|
|
142
142
|
let m = null;
|
|
143
|
-
const i =
|
|
143
|
+
const i = T(null), h = new ge(), v = new je(), y = /* @__PURE__ */ new Map();
|
|
144
144
|
function _() {
|
|
145
145
|
t.value.forEach((p) => {
|
|
146
146
|
p.traverse((d) => {
|
|
@@ -192,7 +192,7 @@ function vt(b, l, t, s = ["URDFVisual"]) {
|
|
|
192
192
|
const { axis: d, value: e } = p;
|
|
193
193
|
$e((o = i.value) == null ? void 0 : o.obj, d, e);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function S(p) {
|
|
196
196
|
var o;
|
|
197
197
|
const { axis: d, value: e } = p;
|
|
198
198
|
Re((o = i.value) == null ? void 0 : o.obj, d, e);
|
|
@@ -203,7 +203,7 @@ function vt(b, l, t, s = ["URDFVisual"]) {
|
|
|
203
203
|
selectedObject3D: i,
|
|
204
204
|
setSelectedObjVisible: u,
|
|
205
205
|
updatePosition: j,
|
|
206
|
-
updateRotation:
|
|
206
|
+
updateRotation: S
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
class pt {
|
|
@@ -308,7 +308,7 @@ class pt {
|
|
|
308
308
|
const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
309
309
|
key: 0,
|
|
310
310
|
class: "obj-base"
|
|
311
|
-
}, xe = ["title"], ke = ["title"],
|
|
311
|
+
}, xe = ["title"], ke = ["title"], Pe = { key: 1 }, Te = { class: "obj-position" }, Ve = { class: "coord-item" }, ze = { class: "coord-item" }, Ae = { class: "coord-item" }, Ie = { class: "obj-rotation" }, Be = { class: "coord-item" }, Ne = { class: "coord-item" }, We = { class: "coord-item" }, qe = { class: "world" }, Ke = { class: "coord-line" }, Xe = { class: "coord-text" }, Ye = { class: "world-position-item" }, Ze = { class: "world-position-item" }, Ge = { class: "world-position-item" }, Qe = { class: "coord-line" }, He = { class: "coord-text" }, et = { class: "world-rotation-item" }, tt = { class: "world-rotation-item" }, ot = { class: "world-rotation-item" }, st = /* @__PURE__ */ Le({
|
|
312
312
|
__name: "workpieceTreePanel",
|
|
313
313
|
props: {
|
|
314
314
|
model: {},
|
|
@@ -317,7 +317,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
317
317
|
},
|
|
318
318
|
emits: ["nodeClick", "visibleChange", "updatePosition", "updateRotation"],
|
|
319
319
|
setup(b, { emit: l }) {
|
|
320
|
-
const t = b, s = l, m =
|
|
320
|
+
const t = b, s = l, m = T([]), i = T({}), h = (e, o = 0) => {
|
|
321
321
|
const w = [];
|
|
322
322
|
return Array.isArray(e) && (e == null ? void 0 : e.length) > 0 && e.forEach((a) => {
|
|
323
323
|
if (!(a != null && a.isMesh)) {
|
|
@@ -359,7 +359,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
359
359
|
return e.forEach((a) => {
|
|
360
360
|
if (a.children && a.children.length > 0) {
|
|
361
361
|
w.push(a.id);
|
|
362
|
-
const L = a.children.filter((
|
|
362
|
+
const L = a.children.filter((C) => C.children && C.children.length > 0).slice(0, o).map((C) => C.id);
|
|
363
363
|
w.push(...L);
|
|
364
364
|
}
|
|
365
365
|
}), w.slice(0, o + 1);
|
|
@@ -379,7 +379,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
379
379
|
});
|
|
380
380
|
}, u = (e) => {
|
|
381
381
|
s("visibleChange", e);
|
|
382
|
-
}, j = M(() => t != null && t.model ? v(t.model) : []),
|
|
382
|
+
}, j = M(() => t != null && t.model ? v(t.model) : []), S = M(() => {
|
|
383
383
|
var e, o;
|
|
384
384
|
return ((e = t == null ? void 0 : t.model) == null ? void 0 : e.name) || ((o = t == null ? void 0 : t.model) == null ? void 0 : o.type);
|
|
385
385
|
}), p = M(() => {
|
|
@@ -390,7 +390,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
390
390
|
return (e = t == null ? void 0 : t.model) == null ? void 0 : e.visible;
|
|
391
391
|
});
|
|
392
392
|
return ue(() => t.model, () => {
|
|
393
|
-
t.model && (i.value =
|
|
393
|
+
t.model && (i.value = Se(t.model));
|
|
394
394
|
}, {
|
|
395
395
|
deep: !0,
|
|
396
396
|
immediate: !0
|
|
@@ -401,9 +401,9 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
401
401
|
},
|
|
402
402
|
{ immediate: !0 }
|
|
403
403
|
), (e, o) => {
|
|
404
|
-
var
|
|
404
|
+
var C, V, z, A, I, B, N, W, q, K, X, Y, Z, G, Q, H, ee, te, oe, se, ie, le, ae, ne;
|
|
405
405
|
const w = x("el-divider"), a = x("el-switch"), L = x("el-input-number");
|
|
406
|
-
return
|
|
406
|
+
return P(), k("div", Je, [
|
|
407
407
|
$(w, null, {
|
|
408
408
|
default: F(() => o[6] || (o[6] = [
|
|
409
409
|
D("对象")
|
|
@@ -412,16 +412,16 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
412
412
|
__: [6]
|
|
413
413
|
}),
|
|
414
414
|
c("div", Oe, [
|
|
415
|
-
t.model ? (
|
|
415
|
+
t.model ? (P(), k("div", Ee, [
|
|
416
416
|
c("div", {
|
|
417
417
|
class: "obj-name",
|
|
418
|
-
title:
|
|
419
|
-
},
|
|
418
|
+
title: S.value
|
|
419
|
+
}, U(S.value), 9, xe),
|
|
420
420
|
c("div", {
|
|
421
421
|
class: "obj-type",
|
|
422
422
|
title: p.value
|
|
423
|
-
}, "[" +
|
|
424
|
-
])) : (
|
|
423
|
+
}, "[" + U(p.value) + "]", 9, ke)
|
|
424
|
+
])) : (P(), k("div", Pe, "空")),
|
|
425
425
|
$(a, {
|
|
426
426
|
"model-value": d.value,
|
|
427
427
|
onChange: u
|
|
@@ -434,11 +434,11 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
434
434
|
_: 1,
|
|
435
435
|
__: [7]
|
|
436
436
|
}),
|
|
437
|
-
c("div",
|
|
438
|
-
c("div",
|
|
437
|
+
c("div", Te, [
|
|
438
|
+
c("div", Ve, [
|
|
439
439
|
o[8] || (o[8] = c("span", { class: "axis-label" }, "X", -1)),
|
|
440
440
|
$(L, {
|
|
441
|
-
"model-value": r((
|
|
441
|
+
"model-value": r((V = (C = i.value) == null ? void 0 : C.position) == null ? void 0 : V.x),
|
|
442
442
|
onChange: o[0] || (o[0] = (R) => g(R, "x")),
|
|
443
443
|
size: "small",
|
|
444
444
|
class: "coord-input-compact",
|
|
@@ -448,10 +448,10 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
448
448
|
"controls-position": "right"
|
|
449
449
|
}, null, 8, ["model-value"])
|
|
450
450
|
]),
|
|
451
|
-
c("div",
|
|
451
|
+
c("div", ze, [
|
|
452
452
|
o[9] || (o[9] = c("span", { class: "axis-label" }, "Y", -1)),
|
|
453
453
|
$(L, {
|
|
454
|
-
"model-value": r((A = (
|
|
454
|
+
"model-value": r((A = (z = i.value) == null ? void 0 : z.position) == null ? void 0 : A.y),
|
|
455
455
|
onChange: o[1] || (o[1] = (R) => g(R, "y")),
|
|
456
456
|
size: "small",
|
|
457
457
|
class: "coord-input-compact",
|
|
@@ -499,7 +499,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
499
499
|
c("div", Ne, [
|
|
500
500
|
o[13] || (o[13] = c("span", { class: "axis-label" }, "Y°", -1)),
|
|
501
501
|
$(L, {
|
|
502
|
-
"model-value": f((
|
|
502
|
+
"model-value": f((K = (q = i.value) == null ? void 0 : q.rotation) == null ? void 0 : K.y),
|
|
503
503
|
onChange: o[4] || (o[4] = (R) => n(R, "y")),
|
|
504
504
|
size: "small",
|
|
505
505
|
class: "coord-input-compact",
|
|
@@ -512,7 +512,7 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
512
512
|
c("div", We, [
|
|
513
513
|
o[14] || (o[14] = c("span", { class: "axis-label" }, "Z°", -1)),
|
|
514
514
|
$(L, {
|
|
515
|
-
"model-value": f((
|
|
515
|
+
"model-value": f((Y = (X = i.value) == null ? void 0 : X.rotation) == null ? void 0 : Y.z),
|
|
516
516
|
onChange: o[5] || (o[5] = (R) => n(R, "z")),
|
|
517
517
|
size: "small",
|
|
518
518
|
class: "coord-input-compact",
|
|
@@ -530,28 +530,28 @@ const Je = { class: "panel-content" }, Oe = { class: "obj" }, Ee = {
|
|
|
530
530
|
_: 1,
|
|
531
531
|
__: [15]
|
|
532
532
|
}),
|
|
533
|
-
c("div",
|
|
534
|
-
c("div",
|
|
533
|
+
c("div", qe, [
|
|
534
|
+
c("div", Ke, [
|
|
535
535
|
o[16] || (o[16] = c("span", { class: "coord-label" }, "世界位置:", -1)),
|
|
536
|
-
c("span",
|
|
537
|
-
c("div",
|
|
538
|
-
c("div",
|
|
539
|
-
c("div", Ge,
|
|
536
|
+
c("span", Xe, [
|
|
537
|
+
c("div", Ye, U(r((G = (Z = i.value) == null ? void 0 : Z.worldPosition) == null ? void 0 : G.x)) + ", ", 1),
|
|
538
|
+
c("div", Ze, U(r((H = (Q = i.value) == null ? void 0 : Q.worldPosition) == null ? void 0 : H.y)) + ", ", 1),
|
|
539
|
+
c("div", Ge, U(r((te = (ee = i.value) == null ? void 0 : ee.worldPosition) == null ? void 0 : te.z)), 1)
|
|
540
540
|
])
|
|
541
541
|
]),
|
|
542
|
-
c("div",
|
|
542
|
+
c("div", Qe, [
|
|
543
543
|
o[17] || (o[17] = c("span", { class: "coord-label" }, "世界旋转:", -1)),
|
|
544
|
-
c("span",
|
|
545
|
-
c("div", et,
|
|
546
|
-
c("div", tt,
|
|
547
|
-
c("div", ot,
|
|
544
|
+
c("span", He, [
|
|
545
|
+
c("div", et, U(f((se = (oe = i.value) == null ? void 0 : oe.worldRotation) == null ? void 0 : se.x)) + "°, ", 1),
|
|
546
|
+
c("div", tt, U(f((le = (ie = i.value) == null ? void 0 : ie.worldRotation) == null ? void 0 : le.y)) + "°, ", 1),
|
|
547
|
+
c("div", ot, U(f((ne = (ae = i.value) == null ? void 0 : ae.worldRotation) == null ? void 0 : ne.z)) + "° ", 1)
|
|
548
548
|
])
|
|
549
549
|
])
|
|
550
550
|
])
|
|
551
551
|
]);
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
}), ft = /* @__PURE__ */
|
|
554
|
+
}), ft = /* @__PURE__ */ Ue(st, [["__scopeId", "data-v-00d48931"]]);
|
|
555
555
|
export {
|
|
556
556
|
pt as U,
|
|
557
557
|
ft as W,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ee=Object.defineProperty;var te=(b,i,o)=>i in b?ee(b,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[i]=o;var C=(b,i,o)=>te(b,typeof i!="symbol"?i+"":i,o);const oe=require("./URDFLoader-CX_gwIob.cjs"),se=require("./OBJLoader-C3tq7BYe.cjs"),Q=require("./MTLLoader-BgOTItOM.cjs"),N=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-o8Cf7V1D.cjs"),e=require("vue"),D=require("./iconfont-DU9A12zM.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ie(b){const{mtlUrl:i,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:_}=b,p=new Q.MTLLoader(o);return l&&p.setResourcePath(l),p.load(i,m,r,_),p}function ne(b){const{objUrl:i,manager:o,materials:l,onLoad:m,onProgress:r,onError:_}=b,p=new se.OBJLoader(o);return l&&p.setMaterials(l),p.load(i,m,r,_),p}function ae(b){const{manager:i,baseFolderUrl:o,onFileProgress:l}=b,m=new oe.URDFLoader(i);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,_,p)=>{const g=(()=>{const h=r.split("?")[0].split("#")[0],c=h.lastIndexOf(".");return c>=0?h.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const h=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${h}${c}.mtl`,V=a=>{ne({objUrl:r,manager:_,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new N.Group)}})};ie({mtlUrl:f,manager:_,resourcePath:h,onLoad:a=>{try{a.preload()}catch{}V(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),V(void 0)}});break}case"stl":{new Q.STLLoader(_).load(r,c=>{const f=new N.MeshPhongMaterial({color:12303291,shininess:30}),V=new N.Mesh(c,f);V.castShadow=!0,V.receiveShadow=!0,p(V)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new N.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new N.Group)}},m}function ce(b,i,o,l){return{loadSceneFromFile:r=>new Promise((_,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,h=0,c=null;const f=new N.LoadingManager;f.onStart=(a,d,E)=>{g=E||0,h=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,E)=>{h=d,g=E;const R=`正在加载 ${d} / ${E} 个文件: ${N.getFilenameFromUrl(a)}`;l.value=R,d===E&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new N.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),_(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const V=(a,d,E)=>{const R=N.getFilenameFromUrl(a);let v;E&&E>0?v=`${R}(${N.formatBytes(d)} / ${N.formatBytes(E)})`:d&&d>0?v=`${R}(已下载 ${N.formatBytes(d)})`:v=`${R}`,l.value=`正在下载第 ${h+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ae({manager:f,baseFolderUrl:re,onFileProgress:V}).load(a,E=>{c=E},void 0,E=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,E),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,i,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),_=new N.Raycaster,p=new N.Vector2,g=new Map;function h(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new N.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,_.setFromCamera(p,m);const t=_.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,w=null;for(;s;){if(g.has(s.id)){w=g.get(s.id);break}s=s.parent}w&&c(w)}function V(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=i();m=u,h(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function E(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function R(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:V,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:E,updateRotation:R}}class ue{constructor(i){C(this,"robot");C(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(_=>{const p=()=>{const g=Date.now()-r,h=Math.min(g/o,1),c=this.easeInOutCubic(h),f={};Object.keys(i).forEach(V=>{const a=m[V]||0,d=i[V];f[V]=a+(d-a)*c}),this.setJointAngles(f),l&&l(h),h<1?requestAnimationFrame(p):_()};p()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,r=>{l&&l(m,r)})}}const me={class:"panel-content"},pe={class:"obj"},ve={key:0,class:"obj-base"},fe=["title"],be=["title"],we={key:1},_e={class:"obj-position"},he={class:"coord-item"},Ve={class:"coord-item"},Ee={class:"coord-item"},ge={class:"obj-rotation"},ye={class:"coord-item"},Ne={class:"coord-item"},Le={class:"coord-item"},Re={class:"world"},je={class:"coord-line"},Ce={class:"coord-text"},De={class:"world-position-item"},Se={class:"world-position-item"},Ue={class:"world-position-item"},Fe={class:"coord-line"},$e={class:"coord-text"},Me={class:"world-rotation-item"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Oe=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:i}){const o=b,l=i,m=e.ref([]),r=e.ref({}),_=(t,s=0)=>{const w=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(n=>{if(!(n!=null&&n.isMesh)){const y={name:n==null?void 0:n.name,label:(n==null?void 0:n.name)||(n==null?void 0:n.type),show:!0,level:s+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:_(n==null?void 0:n.children,s+1),path:n==null?void 0:n.name};w.push(y)}}),w},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:_(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const w=[],n=[...t];for(;n.length>0&&w.length<s;){const y=n.shift();y.children&&y.children.length>0&&(w.push(y.id),n.push(...y.children))}return w},h=(t,s)=>{const w=[];return t.forEach(n=>{if(n.children&&n.children.length>0){w.push(n.id);const y=n.children.filter(j=>j.children&&j.children.length>0).slice(0,s).map(j=>j.id);w.push(...y)}}),w.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?h(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,V=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},E=e.computed(()=>o!=null&&o.model?p(o.model):[]),R=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(E,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var j,S,U,F,$,M,x,J,O,k,T,B,P,z,q,A,I,W,G,X,Y,Z,K,H;const w=e.resolveComponent("el-divider"),n=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",me,[e.createVNode(w,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",pe,[o.model?(e.openBlock(),e.createElementBlock("div",ve,[e.createElementVNode("div",{class:"obj-name",title:R.value},e.toDisplayString(R.value),9,fe),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,be)])):(e.openBlock(),e.createElementBlock("div",we,"空")),e.createVNode(n,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(w,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",he,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((S=(j=r.value)==null?void 0:j.position)==null?void 0:S.x),onChange:s[0]||(s[0]=L=>V(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ve,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c((F=(U=r.value)==null?void 0:U.position)==null?void 0:F.y),onChange:s[1]||(s[1]=L=>V(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ee,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((M=($=r.value)==null?void 0:$.position)==null?void 0:M.z),onChange:s[2]||(s[2]=L=>V(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ge,[e.createElementVNode("div",ye,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(x=r.value)==null?void 0:x.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=L=>a(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((k=(O=r.value)==null?void 0:O.rotation)==null?void 0:k.y),onChange:s[4]||(s[4]=L=>a(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Le,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((B=(T=r.value)==null?void 0:T.rotation)==null?void 0:B.z),onChange:s[5]||(s[5]=L=>a(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Re,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",Ce,[e.createElementVNode("div",De,e.toDisplayString(c((z=(P=r.value)==null?void 0:P.worldPosition)==null?void 0:z.x))+", ",1),e.createElementVNode("div",Se,e.toDisplayString(c((A=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:A.y))+", ",1),e.createElementVNode("div",Ue,e.toDisplayString(c((W=(I=r.value)==null?void 0:I.worldPosition)==null?void 0:W.z)),1)])]),e.createElementVNode("div",Fe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",$e,[e.createElementVNode("div",Me,e.toDisplayString(f((X=(G=r.value)==null?void 0:G.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=r.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=r.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),ke=le._export_sfc(Oe,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=ue;exports.WorkpieceTreePanel=ke;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var ee=Object.defineProperty;var te=(b,i,o)=>i in b?ee(b,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[i]=o;var C=(b,i,o)=>te(b,typeof i!="symbol"?i+"":i,o);const oe=require("./URDFLoader-z_OD751c.cjs"),se=require("./OBJLoader-DJpc8vUj.cjs"),Q=require("./MTLLoader-DGjQiY9j.cjs"),N=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D_eVz0Sp.cjs"),e=require("vue"),D=require("./iconfont-Bi9FnKuf.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ie(b){const{mtlUrl:i,manager:o,resourcePath:l,onLoad:m,onProgress:r,onError:_}=b,p=new Q.MTLLoader(o);return l&&p.setResourcePath(l),p.load(i,m,r,_),p}function ne(b){const{objUrl:i,manager:o,materials:l,onLoad:m,onProgress:r,onError:_}=b,p=new se.OBJLoader(o);return l&&p.setMaterials(l),p.load(i,m,r,_),p}function ae(b){const{manager:i,baseFolderUrl:o,onFileProgress:l}=b,m=new oe.URDFLoader(i);return m.packages=r=>`${o.endsWith("/")?o:o+"/"}${r}/`,m.loadMeshCb=(r,_,p)=>{const g=(()=>{const h=r.split("?")[0].split("#")[0],c=h.lastIndexOf(".");return c>=0?h.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const h=(()=>{try{return new URL(".",r).toString()}catch{const a=r.lastIndexOf("/");return a>=0?r.slice(0,a+1):r}})(),c=(()=>{var d;return(((d=r.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${h}${c}.mtl`,V=a=>{ne({objUrl:r,manager:_,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(r,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${r}`,d),p(new N.Group)}})};ie({mtlUrl:f,manager:_,resourcePath:h,onLoad:a=>{try{a.preload()}catch{}V(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),V(void 0)}});break}case"stl":{new Q.STLLoader(_).load(r,c=>{const f=new N.MeshPhongMaterial({color:12303291,shininess:30}),V=new N.Mesh(c,f);V.castShadow=!0,V.receiveShadow=!0,p(V)},c=>l==null?void 0:l(r,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${r}`,c),p(new N.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${r})`),p(new N.Group)}},m}function ce(b,i,o,l){return{loadSceneFromFile:r=>new Promise((_,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,h=0,c=null;const f=new N.LoadingManager;f.onStart=(a,d,E)=>{g=E||0,h=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,E)=>{h=d,g=E;const R=`正在加载 ${d} / ${E} 个文件: ${N.getFilenameFromUrl(a)}`;l.value=R,d===E&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new N.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),_(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const V=(a,d,E)=>{const R=N.getFilenameFromUrl(a);let v;E&&E>0?v=`${R}(${N.formatBytes(d)} / ${N.formatBytes(E)})`:d&&d>0?v=`${R}(已下载 ${N.formatBytes(d)})`:v=`${R}`,l.value=`正在下载第 ${h+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(r);ae({manager:f,baseFolderUrl:re,onFileProgress:V}).load(a,E=>{c=E},void 0,E=>{console.error(`加载 URDF 文件 (${r.name}) 时发生致命错误:`,E),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${r.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,i,o,l=["URDFVisual"]){let m=null;const r=e.ref(null),_=new N.Raycaster,p=new N.Vector2,g=new Map;function h(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new N.Vector3(1,0,0),limits:u.limits})})})}function c(v){r.value&&r.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),r.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,_.setFromCamera(p,m);const t=_.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,w=null;for(;s;){if(g.has(s.id)){w=g.get(s.id);break}s=s.parent}w&&c(w)}function V(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=i();m=u,h(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){r.value&&(r.value.obj.visible=v)}function E(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=r.value)==null?void 0:s.obj,u,t)}function R(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=r.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:V,selectedObject3D:r,setSelectedObjVisible:d,updatePosition:E,updateRotation:R}}class ue{constructor(i){C(this,"robot");C(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),r=Date.now();return new Promise(_=>{const p=()=>{const g=Date.now()-r,h=Math.min(g/o,1),c=this.easeInOutCubic(h),f={};Object.keys(i).forEach(V=>{const a=m[V]||0,d=i[V];f[V]=a+(d-a)*c}),this.setJointAngles(f),l&&l(h),h<1?requestAnimationFrame(p):_()};p()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,r=>{l&&l(m,r)})}}const me={class:"panel-content"},pe={class:"obj"},ve={key:0,class:"obj-base"},fe=["title"],be=["title"],we={key:1},_e={class:"obj-position"},he={class:"coord-item"},Ve={class:"coord-item"},Ee={class:"coord-item"},ge={class:"obj-rotation"},ye={class:"coord-item"},Ne={class:"coord-item"},Le={class:"coord-item"},Re={class:"world"},je={class:"coord-line"},Ce={class:"coord-text"},De={class:"world-position-item"},Se={class:"world-position-item"},Ue={class:"world-position-item"},Fe={class:"coord-line"},$e={class:"coord-text"},Me={class:"world-rotation-item"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Oe=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:i}){const o=b,l=i,m=e.ref([]),r=e.ref({}),_=(t,s=0)=>{const w=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(n=>{if(!(n!=null&&n.isMesh)){const y={name:n==null?void 0:n.name,label:(n==null?void 0:n.name)||(n==null?void 0:n.type),show:!0,level:s+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:_(n==null?void 0:n.children,s+1),path:n==null?void 0:n.name};w.push(y)}}),w},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:_(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const w=[],n=[...t];for(;n.length>0&&w.length<s;){const y=n.shift();y.children&&y.children.length>0&&(w.push(y.id),n.push(...y.children))}return w},h=(t,s)=>{const w=[];return t.forEach(n=>{if(n.children&&n.children.length>0){w.push(n.id);const y=n.children.filter(j=>j.children&&j.children.length>0).slice(0,s).map(j=>j.id);w.push(...y)}}),w.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?h(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,V=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},E=e.computed(()=>o!=null&&o.model?p(o.model):[]),R=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(r.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(E,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var j,S,U,F,$,M,x,J,O,k,T,B,P,z,q,A,I,W,G,X,Y,Z,K,H;const w=e.resolveComponent("el-divider"),n=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",me,[e.createVNode(w,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",pe,[o.model?(e.openBlock(),e.createElementBlock("div",ve,[e.createElementVNode("div",{class:"obj-name",title:R.value},e.toDisplayString(R.value),9,fe),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,be)])):(e.openBlock(),e.createElementBlock("div",we,"空")),e.createVNode(n,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(w,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",he,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((S=(j=r.value)==null?void 0:j.position)==null?void 0:S.x),onChange:s[0]||(s[0]=L=>V(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ve,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c((F=(U=r.value)==null?void 0:U.position)==null?void 0:F.y),onChange:s[1]||(s[1]=L=>V(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ee,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((M=($=r.value)==null?void 0:$.position)==null?void 0:M.z),onChange:s[2]||(s[2]=L=>V(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ge,[e.createElementVNode("div",ye,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(x=r.value)==null?void 0:x.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=L=>a(L,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((k=(O=r.value)==null?void 0:O.rotation)==null?void 0:k.y),onChange:s[4]||(s[4]=L=>a(L,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Le,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((B=(T=r.value)==null?void 0:T.rotation)==null?void 0:B.z),onChange:s[5]||(s[5]=L=>a(L,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(w,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Re,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",Ce,[e.createElementVNode("div",De,e.toDisplayString(c((z=(P=r.value)==null?void 0:P.worldPosition)==null?void 0:z.x))+", ",1),e.createElementVNode("div",Se,e.toDisplayString(c((A=(q=r.value)==null?void 0:q.worldPosition)==null?void 0:A.y))+", ",1),e.createElementVNode("div",Ue,e.toDisplayString(c((W=(I=r.value)==null?void 0:I.worldPosition)==null?void 0:W.z)),1)])]),e.createElementVNode("div",Fe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",$e,[e.createElementVNode("div",Me,e.toDisplayString(f((X=(G=r.value)==null?void 0:G.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=r.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=r.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),ke=le._export_sfc(Oe,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=ue;exports.WorkpieceTreePanel=ke;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|