ss-component-new 1.2.23 → 1.2.25
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-AqmsmIp6.cjs +6 -0
- package/dist/MTLLoader-DJNdEDx2.js +609 -0
- package/dist/OrbitControls-Bj5caXhQ.js +419 -0
- package/dist/OrbitControls-rTIa-2s-.cjs +1 -0
- package/dist/{animationData-Bwh55Xw6.cjs → animationData-Bc9LlHz0.cjs} +1 -1
- package/dist/{animationData-D0TJ-9dd.js → animationData-Ca4l4roD.js} +4 -4
- package/dist/array-Baxi4C30.cjs +11 -0
- package/dist/array-Ca6KqnNx.js +1142 -0
- package/dist/{dataUtil-i5X2xhin.cjs → dataUtil-Cg2dZbrV.cjs} +1 -1
- package/dist/{dataUtil-gEKo7CEq.js → dataUtil-DUI9Vz64.js} +2 -2
- package/dist/{fileUtil-GIRXMs25.cjs → fileUtil-CTTbs0aJ.cjs} +1 -1
- package/dist/{fileUtil-CN00xr9W.js → fileUtil-CWt--rV-.js} +1 -1
- package/dist/{iconfont-C9-pGpAJ.cjs → iconfont-BaUxcJrk.cjs} +1 -1
- package/dist/{iconfont-DTSZW2AU.js → iconfont-D886hAXy.js} +2 -2
- package/dist/icons/svg//345/215/225/345/205/203/345/272/223.svg +1 -0
- package/dist/icons/svg//346/250/241/345/236/213/347/256/241/347/220/206.svg +1 -0
- package/dist/icons/svg//346/265/201/347/250/213/345/272/223.svg +1 -0
- package/dist/icons/svg//347/225/214/351/235/242/344/277/256/346/224/271.svg +1 -0
- package/dist/{index-BOJUyAaV.cjs → index-1z9RrjZc.cjs} +1 -1
- package/dist/{index-DSlPg3dk.cjs → index-9wWF5fgR.cjs} +1 -1
- package/dist/index-B-I7BsZI.js +2570 -0
- package/dist/{index-CqYUVCh5.js → index-B-p8m73c.js} +12 -12
- package/dist/{index-CK54pscx.cjs → index-B1qlTlfX.cjs} +1 -1
- package/dist/{index-BD5yZDAq.js → index-B5iT5NR0.js} +2 -2
- package/dist/{index-BkIFY0hK.cjs → index-B8MyAHnT.cjs} +1 -1
- package/dist/{index-7oJ8Ile4.js → index-BLW6fsom.js} +1 -1
- package/dist/{index-DbCNaQ87.cjs → index-BMK703KG.cjs} +1 -1
- package/dist/{index-eH9RMVXv.cjs → index-BNYCmfv9.cjs} +1 -1
- package/dist/{index-ThNNBX7h.js → index-BQkk6yoU.js} +1 -1
- package/dist/index-BQq7Cw_K.cjs +1 -0
- package/dist/{index-pmcRbjPd.cjs → index-BZENxsjL.cjs} +1 -1
- package/dist/{index-BNYeBPmi.cjs → index-BZoOaP9C.cjs} +1 -1
- package/dist/{index-G_cKl_J4.js → index-B_jnPuBE.js} +275 -270
- package/dist/{index-XXKsLOYd.js → index-Bke5IOmW.js} +2 -2
- package/dist/{index-DrWIUUZK.cjs → index-BtfS9ULE.cjs} +1 -1
- package/dist/{index-CvC2498b.js → index-BuLPXgWU.js} +5 -5
- package/dist/index-BxXOWAHT.cjs +1 -0
- package/dist/{index-2fqHNrPg.js → index-C8OFJprL.js} +4 -4
- package/dist/{index-CtXpoEg0.cjs → index-C9OPT3q5.cjs} +1 -1
- package/dist/{index-D8Y3imz9.cjs → index-CEV2ULrI.cjs} +1 -1
- package/dist/{index-BTTpV9o2.js → index-CTRrKUtw.js} +14 -14
- package/dist/{index-CptCatmL.js → index-CYmHP5Ky.js} +48 -32
- package/dist/{index-Dfwm0xPp.cjs → index-Cb0d2cT8.cjs} +1 -1
- package/dist/{index-Cl6HMOao.js → index-CeeMzEXY.js} +1 -1
- package/dist/{index-tttYIzsn.cjs → index-CjI5pDiU.cjs} +1 -1
- package/dist/{index-DEs8s152.js → index-CmUjrEkz.js} +6 -6
- package/dist/index-CtE7IIJq.js +7297 -0
- package/dist/{index-DSchKIyh.cjs → index-CxnH4vfV.cjs} +1 -1
- package/dist/index-CyY9deE5.cjs +1 -0
- package/dist/{index-DlIkbsRf.js → index-Cyk3pWtk.js} +6 -6
- package/dist/index-D-eD7QhS.js +654 -0
- package/dist/{index-NlkdTb--.js → index-D0odjY-X.js} +4 -4
- package/dist/{index-B0dydZDW.js → index-D1cjMjid.js} +1 -1
- package/dist/index-D5gT6DCZ.cjs +1 -0
- package/dist/{index-CvrBt7bU.js → index-D7GiDyDn.js} +6 -6
- package/dist/index-D88kGgy-.cjs +1 -0
- package/dist/{index-DMbCaqEC.cjs → index-DEExEFRs.cjs} +13 -13
- package/dist/{index-DllJulGH.cjs → index-DFMKBytS.cjs} +1 -1
- package/dist/{index-Dm_WlV6R.js → index-DNe_JGg0.js} +1 -1
- package/dist/{index-Bvk4OpkL.js → index-DTCPY-4V.js} +2 -2
- package/dist/{index-BTfg83yY.cjs → index-DTuCopl-.cjs} +1 -1
- package/dist/{index-BwEfrokO.js → index-DVSVJAdn.js} +2 -2
- package/dist/{index-7Ru3e632.cjs → index-DYr8VySV.cjs} +1 -1
- package/dist/{index-BQBxzTyE.js → index-DkA_gjlb.js} +2 -2
- package/dist/{index-7gU0r1We.cjs → index-Dkoh6zZr.cjs} +1 -1
- package/dist/{index-DNs9XPOG.js → index-DpE6q48b.js} +2 -2
- package/dist/{index-BVFL7Z_0.js → index-DqAAn-WP.js} +5 -5
- package/dist/{index-DHp714Ep.cjs → index-DrgssxCP.cjs} +1 -1
- package/dist/{index-Bt2MaT2G.js → index-J98IKvqx.js} +6 -6
- package/dist/{index-C6C5VWbs.cjs → index-PNi4RMPc.cjs} +1 -1
- package/dist/index-XXEzSATd.js +158 -0
- package/dist/{index-CADH_aSQ.cjs → index-clFmHtGU.cjs} +1 -1
- package/dist/{index-Be1LJMUR.js → index-pFuDv6dx.js} +2 -2
- package/dist/{index-BuSsSHAY.js → index-sk7jYyaG.js} +2301 -2282
- package/dist/{index-DQ3y1xkr.cjs → index-vmURlfDn.cjs} +1 -1
- package/dist/{index-BXEOQo2c.cjs → index-yyc7_nsV.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BCjeeJqj.cjs +5675 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CtycIAIT.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js} +41519 -48931
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-De0avjy5.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Dv39W1q4.js} +6 -6
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DhMDLOg8.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-OXHjy9ED.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-C4gG2WxT.cjs +56 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CEcxaThh.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CEIVtyL9.js} +10702 -10654
- package/dist/index.vue_vue_type_style_index_1_lang-D0ileuYo.cjs +32 -0
- package/dist/index.vue_vue_type_style_index_1_lang-DOP0uVOd.cjs +5 -0
- package/dist/index.vue_vue_type_style_index_1_lang-DSKzPKLD.js +8262 -0
- package/dist/{index.vue_vue_type_style_index_1_lang-DzZEPkuk.js → index.vue_vue_type_style_index_1_lang-DkkdpQbZ.js} +1368 -1456
- package/dist/{isString-CELwppr9.cjs → isString-BmAegMGI.cjs} +1 -1
- package/dist/{isString-DvY0kl3S.js → isString-CohCsKzS.js} +1 -1
- package/dist/{main-DQXqHTYg.js → main-B4gwcsBp.js} +5 -5
- package/dist/{main-yiUkyrA7.cjs → main-HIDJ5ncj.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +11 -11
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +12 -12
- package/dist/{threeModel-BiWZCOOI.js → threeModel-LJMbJaUb.js} +5 -5
- package/dist/{threeModel-Cva5i9Dy.cjs → threeModel-tRhkTPHD.cjs} +1 -1
- package/dist/threePreview-CeCm5KTT.cjs +1 -0
- package/dist/{threePreview-CjFKHY3_.js → threePreview-CqWnM1XW.js} +442 -541
- package/dist/{threeSceneView-DM8uof_D.cjs → threeSceneView-CTChIfwR.cjs} +1 -1
- package/dist/{threeSceneView-DPTQ_xR-.js → threeSceneView-D2mX_5N9.js} +11 -11
- package/dist/{threeSceneViewForCPMPIP-D5jl1r-h.cjs → threeSceneViewForCPMPIP-C_MBwi1O.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-Bqb44i-c.js → threeSceneViewForCPMPIP-CpVcogbP.js} +10 -10
- package/dist/{threeTrackPathView-BvxoafSz.js → threeTrackPathView-DMTpRQTP.js} +172 -354
- package/dist/threeTrackPathView-Deim_dX7.cjs +371 -0
- package/dist/threeViewerHost-BMrWNnGK.cjs +1 -0
- package/dist/{threeViewerHost-CKmZPGir.js → threeViewerHost-WXqI_L3g.js} +91 -78
- package/dist/{urdfTree-BxuavyNQ.js → urdfTree-BX92weHU.js} +1 -1
- package/dist/{urdfTree-wR2vnG4s.cjs → urdfTree-CbDb_7PZ.cjs} +1 -1
- package/dist/{workpieceTreePanel-C2BXrv3k.cjs → workpieceTreePanel-CbTolK6t.cjs} +1 -1
- package/dist/{workpieceTreePanel-CSKzSdIt.js → workpieceTreePanel-Q4S9btz3.js} +18 -18
- package/package.json +1 -1
- package/public/icons/svg//345/215/225/345/205/203/345/272/223.svg +1 -0
- package/public/icons/svg//346/250/241/345/236/213/347/256/241/347/220/206.svg +1 -0
- package/public/icons/svg//346/265/201/347/250/213/345/272/223.svg +1 -0
- package/public/icons/svg//347/225/214/351/235/242/344/277/256/346/224/271.svg +1 -0
- package/dist/MTLLoader-B8MnfNfT.cjs +0 -6
- package/dist/MTLLoader-BD3cbBAW.js +0 -657
- package/dist/OrbitControls-2UHRU9Fu.cjs +0 -1
- package/dist/OrbitControls-D1pz0uFI.js +0 -458
- package/dist/array-DMPAgNcb.cjs +0 -11
- package/dist/array-DTXrs6ZK.js +0 -1207
- package/dist/index-BLwwxnzs.cjs +0 -1
- package/dist/index-BVdolwlx.js +0 -7293
- package/dist/index-Bm3FE_ss.js +0 -504
- package/dist/index-BpTrDbkf.js +0 -22
- package/dist/index-C54wX50t.cjs +0 -1
- package/dist/index-CFriKZ-T.cjs +0 -1
- package/dist/index-CsOz5vsv.cjs +0 -1
- package/dist/index-D4pN9YmB.js +0 -144
- package/dist/index-DOhvzke2.js +0 -24
- package/dist/index-DPX3w6cO.js +0 -2643
- package/dist/index-DR9beXhk.cjs +0 -1
- package/dist/index-Do8zI4DM.cjs +0 -1
- package/dist/index-dwX_BHyo.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D6X3fCNs.cjs +0 -5677
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-DLuOs1IZ.cjs +0 -56
- package/dist/index.vue_vue_type_style_index_1_lang-B0l6QIWy.js +0 -7806
- package/dist/index.vue_vue_type_style_index_1_lang-CC1o5rIu.cjs +0 -32
- package/dist/index.vue_vue_type_style_index_1_lang-Chzrrthw.cjs +0 -6
- package/dist/threePreview-BNvDY6xx.cjs +0 -1
- package/dist/threeTrackPathView-DgnuPrBe.cjs +0 -370
- package/dist/threeViewerHost-D80V4Cfh.cjs +0 -1
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
import { computed as _, defineComponent as Y, defineAsyncComponent as S, ref as
|
|
2
|
-
import { a as
|
|
3
|
-
import { u as
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
import { computed as _, defineComponent as Y, defineAsyncComponent as S, ref as B, watch as q, createElementBlock as O, openBlock as y, normalizeClass as J, createElementVNode as K, createBlock as P, createCommentVNode as L, renderSlot as p, unref as D, withCtx as T } from "vue";
|
|
2
|
+
import { a as $, b$ as Q, p as N, s as H } from "./index-DNe_JGg0.js";
|
|
3
|
+
import { u as z } from "./index.vue_vue_type_style_index_1_lang-DSKzPKLD.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js";
|
|
5
5
|
import { _ as X } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
-
function ue(
|
|
7
|
-
const
|
|
8
|
-
return
|
|
6
|
+
function ue(l) {
|
|
7
|
+
const m = sessionStorage.getItem("loginToken") ?? "123456";
|
|
8
|
+
return $({
|
|
9
9
|
url: "/api/sysFile/uploadFile",
|
|
10
10
|
method: "post",
|
|
11
|
-
data:
|
|
11
|
+
data: l,
|
|
12
12
|
headers: {
|
|
13
|
-
Authorization:
|
|
13
|
+
Authorization: m,
|
|
14
14
|
"Content-Type": "multipart/form-data"
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function Z(
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
function Z(l) {
|
|
19
|
+
const m = sessionStorage.getItem("loginToken") ?? "123456";
|
|
20
|
+
return $({
|
|
21
21
|
url: "/api/sysFile/downloadFile",
|
|
22
22
|
method: "post",
|
|
23
|
-
data:
|
|
23
|
+
data: l,
|
|
24
24
|
headers: {
|
|
25
|
-
Authorization:
|
|
25
|
+
Authorization: m,
|
|
26
26
|
Accept: "application/octet-stream"
|
|
27
27
|
// 明确要求返回二进制流
|
|
28
28
|
},
|
|
29
29
|
responseType: "blob"
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
function me(l) {
|
|
33
|
+
const m = sessionStorage.getItem("loginToken") ?? "123456";
|
|
34
|
+
return $({
|
|
35
|
+
url: "/api/sysFile/uploadFiles",
|
|
36
|
+
method: "post",
|
|
37
|
+
data: l,
|
|
38
|
+
headers: {
|
|
39
|
+
Authorization: m,
|
|
40
|
+
"Content-Type": "multipart/form-data"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
32
44
|
const x = Q("threeState", {
|
|
33
45
|
state: () => ({
|
|
34
46
|
data: {
|
|
@@ -40,8 +52,8 @@ const x = Q("threeState", {
|
|
|
40
52
|
}
|
|
41
53
|
}),
|
|
42
54
|
actions: {
|
|
43
|
-
setData(
|
|
44
|
-
this.data =
|
|
55
|
+
setData(l) {
|
|
56
|
+
this.data = l;
|
|
45
57
|
},
|
|
46
58
|
getData() {
|
|
47
59
|
return this.data;
|
|
@@ -49,47 +61,47 @@ const x = Q("threeState", {
|
|
|
49
61
|
}
|
|
50
62
|
});
|
|
51
63
|
function ee() {
|
|
52
|
-
const
|
|
64
|
+
const l = z(N), { platform: m } = H(l), v = x(N), k = _(() => {
|
|
53
65
|
var t;
|
|
54
66
|
return (t = v == null ? void 0 : v.data) == null ? void 0 : t.extension;
|
|
55
|
-
}),
|
|
67
|
+
}), f = ["uv", "cpt", "cyd"], E = ["urdf"], o = ["obj", "stl"], r = [...f, ...E, ...o], U = (t) => {
|
|
56
68
|
if (!g())
|
|
57
69
|
throw new Error("不是三维系统");
|
|
58
70
|
v.setData(t);
|
|
59
|
-
}, d = () => v.getData(), g = () =>
|
|
71
|
+
}, d = () => v.getData(), g = () => m.value === "three", c = (t) => {
|
|
60
72
|
const s = t == null ? void 0 : t.toLowerCase(), i = s == null ? void 0 : s.lastIndexOf(".");
|
|
61
|
-
let
|
|
62
|
-
return i >= 0 && (
|
|
63
|
-
},
|
|
73
|
+
let h = s;
|
|
74
|
+
return i >= 0 && (h = h == null ? void 0 : h.slice(i + 1)), h;
|
|
75
|
+
}, F = (t) => {
|
|
64
76
|
if (!t)
|
|
65
77
|
return !1;
|
|
66
|
-
const s =
|
|
78
|
+
const s = c(t);
|
|
67
79
|
return r == null ? void 0 : r.includes(s);
|
|
68
80
|
};
|
|
69
81
|
return {
|
|
70
82
|
getData: d,
|
|
71
|
-
setData:
|
|
83
|
+
setData: U,
|
|
72
84
|
isThreeSystem: g,
|
|
73
85
|
isUrdf: (t) => {
|
|
74
86
|
if (!t)
|
|
75
87
|
return !1;
|
|
76
|
-
const s =
|
|
88
|
+
const s = c(t);
|
|
77
89
|
return E == null ? void 0 : E.includes(s);
|
|
78
90
|
},
|
|
79
91
|
isGeneralFile: (t) => {
|
|
80
92
|
if (!t)
|
|
81
93
|
return !1;
|
|
82
|
-
const s =
|
|
94
|
+
const s = c(t);
|
|
83
95
|
return o == null ? void 0 : o.includes(s);
|
|
84
96
|
},
|
|
85
97
|
isTrackPathFile: (t) => {
|
|
86
98
|
if (!t)
|
|
87
99
|
return !1;
|
|
88
|
-
const s =
|
|
89
|
-
return
|
|
100
|
+
const s = c(t);
|
|
101
|
+
return f == null ? void 0 : f.includes(s);
|
|
90
102
|
},
|
|
91
|
-
isThreeFile:
|
|
92
|
-
isUseBackdrop: (t) => g() &&
|
|
103
|
+
isThreeFile: F,
|
|
104
|
+
isUseBackdrop: (t) => g() && F(t),
|
|
93
105
|
initTrackFileType: (t) => {
|
|
94
106
|
if (!t)
|
|
95
107
|
return {
|
|
@@ -97,15 +109,15 @@ function ee() {
|
|
|
97
109
|
isCyd: !1,
|
|
98
110
|
isUv: !1
|
|
99
111
|
};
|
|
100
|
-
const s =
|
|
112
|
+
const s = c(t), i = f == null ? void 0 : f.find((R) => R === s);
|
|
101
113
|
return {
|
|
102
114
|
isCpt: i === "cpt",
|
|
103
115
|
isCyd: i === "cyd",
|
|
104
116
|
isUv: i === "uv"
|
|
105
117
|
};
|
|
106
118
|
},
|
|
107
|
-
getFileExtension:
|
|
108
|
-
extraExtension:
|
|
119
|
+
getFileExtension: c,
|
|
120
|
+
extraExtension: k
|
|
109
121
|
};
|
|
110
122
|
}
|
|
111
123
|
const te = { class: "top-menu" }, ne = {
|
|
@@ -124,8 +136,8 @@ const te = { class: "top-menu" }, ne = {
|
|
|
124
136
|
componentType: {}
|
|
125
137
|
},
|
|
126
138
|
emits: ["getThreeData"],
|
|
127
|
-
setup(
|
|
128
|
-
const v = S(() => import("./threeSceneView-
|
|
139
|
+
setup(l, { emit: m }) {
|
|
140
|
+
const v = S(() => import("./threeSceneView-D2mX_5N9.js")), k = S(() => import("./threePreview-CqWnM1XW.js")), f = S(() => import("./threeTrackPathView-DMTpRQTP.js")), E = S(() => import("./threeSceneViewForCPMPIP-CpVcogbP.js")), o = {
|
|
129
141
|
ROBOT_SCENE: "robot",
|
|
130
142
|
// 机器人场景
|
|
131
143
|
LATHE_SCENE: "latheScene",
|
|
@@ -134,7 +146,7 @@ const te = { class: "top-menu" }, ne = {
|
|
|
134
146
|
// 重大专项场景
|
|
135
147
|
PREVIEW: "preview"
|
|
136
148
|
// 预览模式
|
|
137
|
-
}, r =
|
|
149
|
+
}, r = l, U = z(N), { platName: d } = H(U), { isGeneralFile: g, isUrdf: c, isTrackPathFile: F, extraExtension: A } = ee(), w = _(() => (r == null ? void 0 : r.extension) || A.value), I = _(() => {
|
|
138
150
|
var e, n;
|
|
139
151
|
return (n = (e = r == null ? void 0 : r.threeData) == null ? void 0 : e.data) == null ? void 0 : n.trackFileType;
|
|
140
152
|
}), b = _(() => {
|
|
@@ -151,24 +163,24 @@ const te = { class: "top-menu" }, ne = {
|
|
|
151
163
|
return o.PREVIEW;
|
|
152
164
|
}
|
|
153
165
|
const e = (n = r == null ? void 0 : r.fileUrls) == null ? void 0 : n[0];
|
|
154
|
-
return g(e) ? o.PREVIEW : (d == null ? void 0 : d.value) === "CPMPIP" && (
|
|
155
|
-
}), V =
|
|
166
|
+
return g(e) ? o.PREVIEW : (d == null ? void 0 : d.value) === "CPMPIP" && (c(e) || c(w.value)) ? o.CPMPIP_SCENE : (d == null ? void 0 : d.value) === "SFRTubeBend" && (c(e) || c(w.value)) ? o.ROBOT_SCENE : F(w.value) && I.value ? o.LATHE_SCENE : o.PREVIEW;
|
|
167
|
+
}), V = m, t = B([]), s = B(!1);
|
|
156
168
|
function i(e) {
|
|
157
169
|
try {
|
|
158
|
-
const n = new URL(e).pathname,
|
|
159
|
-
return decodeURIComponent(
|
|
170
|
+
const n = new URL(e).pathname, u = n.substring(n.lastIndexOf("/") + 1);
|
|
171
|
+
return decodeURIComponent(u);
|
|
160
172
|
} catch (n) {
|
|
161
173
|
return console.error("无法解析URL以提取文件名:", e, n), "未知文件名";
|
|
162
174
|
}
|
|
163
175
|
}
|
|
164
|
-
async function
|
|
165
|
-
let n,
|
|
176
|
+
async function h(e) {
|
|
177
|
+
let n, u;
|
|
166
178
|
if (/^https?:\/\//.test(e))
|
|
167
179
|
try {
|
|
168
180
|
const a = await fetch(e);
|
|
169
181
|
if (!a.ok)
|
|
170
182
|
throw new Error(`下载文件失败: ${a.statusText} (URL: ${e})`);
|
|
171
|
-
n = await a.blob(),
|
|
183
|
+
n = await a.blob(), u = i(e);
|
|
172
184
|
} catch (a) {
|
|
173
185
|
throw console.error("使用 fetch 下载文件时出错:", a), a;
|
|
174
186
|
}
|
|
@@ -178,11 +190,11 @@ const te = { class: "top-menu" }, ne = {
|
|
|
178
190
|
if (a.status !== 200)
|
|
179
191
|
throw new Error(`下载失败: ${a.status}`);
|
|
180
192
|
const C = a.headers["content-disposition"];
|
|
181
|
-
|
|
193
|
+
u = R(C) || "无文件名", n = a.data;
|
|
182
194
|
} catch (a) {
|
|
183
195
|
throw console.error("通过 API 下载文件时出错:", a), a;
|
|
184
196
|
}
|
|
185
|
-
return new File([n],
|
|
197
|
+
return new File([n], u, { type: n.type });
|
|
186
198
|
}
|
|
187
199
|
function R(e) {
|
|
188
200
|
if (!e) return;
|
|
@@ -192,13 +204,13 @@ const te = { class: "top-menu" }, ne = {
|
|
|
192
204
|
a = a.replace(/^"(.*)"$/, "$1");
|
|
193
205
|
const C = a.split("''");
|
|
194
206
|
if (C.length === 2) {
|
|
195
|
-
const j = C[0].toUpperCase(),
|
|
207
|
+
const j = C[0].toUpperCase(), M = C[1];
|
|
196
208
|
try {
|
|
197
209
|
if (j === "UTF-8")
|
|
198
|
-
return decodeURIComponent(
|
|
210
|
+
return decodeURIComponent(M);
|
|
199
211
|
} catch {
|
|
200
212
|
}
|
|
201
|
-
return
|
|
213
|
+
return M;
|
|
202
214
|
}
|
|
203
215
|
try {
|
|
204
216
|
return decodeURIComponent(a);
|
|
@@ -206,18 +218,18 @@ const te = { class: "top-menu" }, ne = {
|
|
|
206
218
|
return a;
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
221
|
+
const u = e.match(/filename\s*=\s*("?)([^";]+)\1/i);
|
|
222
|
+
if (u)
|
|
223
|
+
return u[2].trim();
|
|
212
224
|
}
|
|
213
|
-
async function
|
|
225
|
+
async function W(e) {
|
|
214
226
|
if (!e || !e.length) {
|
|
215
227
|
t.value = [];
|
|
216
228
|
return;
|
|
217
229
|
}
|
|
218
230
|
s.value = !0;
|
|
219
231
|
try {
|
|
220
|
-
const n = await Promise.all(e.map((
|
|
232
|
+
const n = await Promise.all(e.map((u) => h(u)));
|
|
221
233
|
t.value = n;
|
|
222
234
|
} catch (n) {
|
|
223
235
|
console.error("文件下载时发生错误:", n), t.value = [];
|
|
@@ -231,14 +243,14 @@ const te = { class: "top-menu" }, ne = {
|
|
|
231
243
|
return q(
|
|
232
244
|
() => r.fileUrls,
|
|
233
245
|
async (e) => {
|
|
234
|
-
await
|
|
246
|
+
await W(e ?? []);
|
|
235
247
|
},
|
|
236
248
|
{ immediate: !0, deep: !0 }
|
|
237
|
-
), (e, n) => (y(),
|
|
249
|
+
), (e, n) => (y(), O("div", {
|
|
238
250
|
class: J([r.host === "electron" ? "mv-electron" : "mv-inline", "three-platform"])
|
|
239
251
|
}, [
|
|
240
252
|
K("div", te, [
|
|
241
|
-
|
|
253
|
+
p(e.$slots, "top-menu", {}, void 0, !0)
|
|
242
254
|
]),
|
|
243
255
|
b.value === o.ROBOT_SCENE ? (y(), P(D(v), {
|
|
244
256
|
key: 0,
|
|
@@ -247,24 +259,24 @@ const te = { class: "top-menu" }, ne = {
|
|
|
247
259
|
onGetThreeData: G,
|
|
248
260
|
threeData: r.threeData
|
|
249
261
|
}, {
|
|
250
|
-
"button-left":
|
|
251
|
-
|
|
262
|
+
"button-left": T(() => [
|
|
263
|
+
p(e.$slots, "management-menu", {}, void 0, !0)
|
|
252
264
|
]),
|
|
253
|
-
"button-right":
|
|
254
|
-
|
|
265
|
+
"button-right": T(() => [
|
|
266
|
+
p(e.$slots, "management-page", {}, void 0, !0)
|
|
255
267
|
]),
|
|
256
268
|
_: 3
|
|
257
|
-
}, 8, ["file-blobs", "animation-data", "threeData"])) : b.value === o.LATHE_SCENE ? (y(), P(D(
|
|
269
|
+
}, 8, ["file-blobs", "animation-data", "threeData"])) : b.value === o.LATHE_SCENE ? (y(), P(D(f), {
|
|
258
270
|
key: 1,
|
|
259
271
|
fileUrls: e.fileUrls,
|
|
260
272
|
threeData: r.threeData,
|
|
261
273
|
trackFileType: I.value
|
|
262
274
|
}, {
|
|
263
|
-
"button-left":
|
|
264
|
-
|
|
275
|
+
"button-left": T(() => [
|
|
276
|
+
p(e.$slots, "management-menu", {}, void 0, !0)
|
|
265
277
|
]),
|
|
266
|
-
"button-right":
|
|
267
|
-
|
|
278
|
+
"button-right": T(() => [
|
|
279
|
+
p(e.$slots, "management-page", {}, void 0, !0)
|
|
268
280
|
]),
|
|
269
281
|
_: 3
|
|
270
282
|
}, 8, ["fileUrls", "threeData", "trackFileType"])) : b.value === o.CPMPIP_SCENE ? (y(), P(D(E), {
|
|
@@ -272,30 +284,30 @@ const te = { class: "top-menu" }, ne = {
|
|
|
272
284
|
"file-blobs": t.value,
|
|
273
285
|
threeData: r.threeData
|
|
274
286
|
}, {
|
|
275
|
-
"button-left":
|
|
276
|
-
|
|
287
|
+
"button-left": T(() => [
|
|
288
|
+
p(e.$slots, "management-menu", {}, void 0, !0)
|
|
277
289
|
]),
|
|
278
|
-
"button-right":
|
|
279
|
-
|
|
290
|
+
"button-right": T(() => [
|
|
291
|
+
p(e.$slots, "management-page", {}, void 0, !0)
|
|
280
292
|
]),
|
|
281
293
|
_: 3
|
|
282
|
-
}, 8, ["file-blobs", "threeData"])) : b.value === o.PREVIEW ? (y(), P(D(
|
|
294
|
+
}, 8, ["file-blobs", "threeData"])) : b.value === o.PREVIEW ? (y(), P(D(k), {
|
|
283
295
|
key: 3,
|
|
284
296
|
"file-blobs": t.value,
|
|
285
297
|
"animation-data": e.animationData
|
|
286
298
|
}, {
|
|
287
|
-
"button-left":
|
|
288
|
-
|
|
299
|
+
"button-left": T(() => [
|
|
300
|
+
p(e.$slots, "management-menu", {}, void 0, !0)
|
|
289
301
|
]),
|
|
290
|
-
"button-right":
|
|
291
|
-
|
|
302
|
+
"button-right": T(() => [
|
|
303
|
+
p(e.$slots, "management-page", {}, void 0, !0)
|
|
292
304
|
]),
|
|
293
305
|
_: 3
|
|
294
|
-
}, 8, ["file-blobs", "animation-data"])) :
|
|
295
|
-
s.value ? (y(),
|
|
306
|
+
}, 8, ["file-blobs", "animation-data"])) : L("", !0),
|
|
307
|
+
s.value ? (y(), O("div", ne, " 文件下载中,请稍候... ")) : L("", !0)
|
|
296
308
|
], 2));
|
|
297
309
|
}
|
|
298
|
-
}), ae = /* @__PURE__ */ X(re, [["__scopeId", "data-v-a4f0efb1"]]),
|
|
310
|
+
}), ae = /* @__PURE__ */ X(re, [["__scopeId", "data-v-a4f0efb1"]]), fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
299
311
|
__proto__: null,
|
|
300
312
|
default: ae
|
|
301
313
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -303,7 +315,8 @@ export {
|
|
|
303
315
|
ae as T,
|
|
304
316
|
ee as a,
|
|
305
317
|
ue as b,
|
|
318
|
+
me as c,
|
|
306
319
|
Z as d,
|
|
307
|
-
|
|
320
|
+
fe as t,
|
|
308
321
|
x as u
|
|
309
322
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as I, ref as L, watch as b, onMounted as C, onUnmounted as P, createElementBlock as m, openBlock as f, Fragment as T, renderList as N, createElementVNode as p, createCommentVNode as U, toDisplayString as h, computed as M, resolveComponent as A, createVNode as S } from "vue";
|
|
2
|
-
import { k as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
2
|
+
import { k as V } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js";
|
|
3
3
|
import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
4
|
const D = (i, l) => {
|
|
5
5
|
if (!l)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),x=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
"use strict";const t=require("vue"),x=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BCjeeJqj.cjs"),J=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),E=(o,i)=>{if(!i)return null;const l=o.joints[i];return l||null},F=(o,i)=>{if(!i)return null;const l=E(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},N=(o,i)=>{if(!i)return null;const l=o.links[i];return l||null},L=(o,i)=>{if(!i)return null;const l=N(o,i);if(!l)return null;let u=null;return l.traverse(c=>{c instanceof x.Mesh&&!u&&(u=c)}),u},V=o=>{const i=o.joints;return Object.values(i)},M=o=>V(o).filter(u=>u.jointType!=="fixed"),w=o=>{const i=o.links;return Object.keys(i)},B={class:"panel-content"},b={key:0,class:"joints-list"},I={class:"joint-info-row"},S={class:"joint-left"},C={class:"joint-name"},D={class:"joint-range"},P={class:"joint-type"},T={key:0,class:"joint-control-row"},A={class:"slider-container"},U=["min","max","value","onInput"],R={class:"value-display"},q={class:"joint-value"},O={class:"unit"},K={key:1,class:"empty-state"},$=t.defineComponent({__name:"urdfJointPanel",props:{model:{}},setup(o,{expose:i}){const l=o,u=t.ref([]),c=t.ref(null),f=(s,p=!1)=>s==="revolute"?p?Math.PI:-Math.PI:s==="prismatic"?p?1:-1:0,_=s=>{if(!s||!s.joints)return console.warn("URDF模型无效或不包含关节信息"),[];const p=[];return V(s).forEach(r=>{var n,d;if(r.jointType==="fixed")return;let a={lower:((n=r.limit)==null?void 0:n.lower)??f(r.jointType,!1),upper:((d=r.limit)==null?void 0:d.upper)??f(r.jointType,!0)};r.jointType==="continuous"&&(a={lower:-10*Math.PI,upper:10*Math.PI}),p.push({name:r.name,type:r.jointType||"unknown",limit:a,currentValue:r.angle||0,urdfJoint:r})}),p},m=(s,p)=>{var n;const e=u.value.find(d=>d.name===s);if(!e)return;const r=parseFloat(p),a=Math.max(e.limit.lower,Math.min(e.limit.upper,r));e.currentValue=a,(n=l.model)!=null&&n.setJointValue?l.model.setJointValue(s,a):e.urdfJoint.setJointValue(a)},v=()=>{u.value.forEach(s=>{(s.type==="revolute"||s.type==="continuous"||s.type==="prismatic")&&m(s.name,0)})},y=()=>{l.model&&u.value.forEach(s=>{s.urdfJoint.angle!==void 0&&s.currentValue!==s.urdfJoint.angle&&(s.currentValue=s.urdfJoint.angle)})},g=()=>{const s=()=>{y(),c.value=requestAnimationFrame(s)};s()},k=()=>{c.value&&(cancelAnimationFrame(c.value),c.value=null)};return t.watch(()=>l.model,s=>{s?u.value=_(s):u.value=[]},{immediate:!0}),t.onMounted(()=>{g()}),t.onUnmounted(()=>{k()}),i({resetAllJoints:v}),(s,p)=>(t.openBlock(),t.createElementBlock("div",B,[u.value.length>0?(t.openBlock(),t.createElementBlock("div",b,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,e=>(t.openBlock(),t.createElementBlock("div",{key:e.name,class:"joint-item"},[t.createElementVNode("div",I,[t.createElementVNode("div",S,[t.createElementVNode("span",C,t.toDisplayString(e.name),1),t.createElementVNode("span",D," ["+t.toDisplayString(e.limit.lower.toFixed(2))+", "+t.toDisplayString(e.limit.upper.toFixed(2))+"] ",1)]),t.createElementVNode("span",P,t.toDisplayString(e.type),1)]),e.type==="revolute"||e.type==="prismatic"||e.type==="continuous"?(t.openBlock(),t.createElementBlock("div",T,[t.createElementVNode("div",A,[t.createElementVNode("input",{type:"range",min:e.limit.lower,max:e.limit.upper,step:"0.001",value:e.currentValue,onInput:r=>m(e.name,r.target.value),class:"joint-slider"},null,40,U)]),t.createElementVNode("div",R,[t.createElementVNode("span",q,t.toDisplayString(e.currentValue?Number(e.currentValue).toFixed(3):"0.000"),1),t.createElementVNode("span",O,t.toDisplayString(e.type==="prismatic"?"m":"rad"),1)])])):t.createCommentVNode("",!0)]))),128))])):(t.openBlock(),t.createElementBlock("div",K,p[0]||(p[0]=[t.createElementVNode("p",null,"未检测到可控制的关节",-1)])))]))}}),H=J._export_sfc($,[["__scopeId","data-v-750b831d"]]),z={class:"panel-content"},G="id",Q={__name:"urdfTree",props:{model:Object,maxExpandCount:{type:Number,default:10},expandStrategy:{type:String,default:"breadth",validator:o=>["breadth","firstLevel"].includes(o)},extraNodes:{type:Array,default:[]}},emits:["nodeClick"],setup(o,{emit:i}){const l=o,u=i,c=t.ref([]),f={children:"children",label:"label"},_=e=>{u("nodeClick",e)},m=(e,r=0)=>{const a=[];return Array.isArray(e)&&(e==null?void 0:e.length)>0&&e.forEach(n=>{if(!(n!=null&&n.isMesh)&&((n==null?void 0:n.type)==="URDFJoint"||(n==null?void 0:n.type)==="URDFLink")){const d={name:n==null?void 0:n.name,label:n==null?void 0:n.name,show:!0,level:r+1,isPenultimate:!1,type:n==null?void 0:n.type,id:n==null?void 0:n.id,limit:(n==null?void 0:n.limit)??"",children:m(n==null?void 0:n.children,r+1),path:n==null?void 0:n.name};a.push(d)}}),a},v=e=>e?[{name:e==null?void 0:e.name,label:e==null?void 0:e.name,show:!0,level:1,isPenultimate:!1,type:e==null?void 0:e.type,id:e==null?void 0:e.id,limit:(e==null?void 0:e.limit)??"",children:m(e==null?void 0:e.children,1)||[],path:e==null?void 0:e.name}]:[],y=(e,r)=>{const a=[],n=[...e];for(;n.length>0&&a.length<r;){const d=n.shift();d.children&&d.children.length>0&&(a.push(d.id),n.push(...d.children))}return a},g=(e,r)=>{const a=[];return e.forEach(n=>{if(n.children&&n.children.length>0){a.push(n.id);const d=n.children.filter(h=>h.children&&h.children.length>0).slice(0,r).map(h=>h.id);a.push(...d)}}),a.slice(0,r+1)},k=t.computed(()=>!c.value||c.value.length===0?[]:l.expandStrategy==="firstLevel"?g(c.value,l.maxExpandCount):y(c.value,l.maxExpandCount)),s=t.computed(()=>[{name:"场景",label:"场景",show:!0,level:1,isPenultimate:!1,type:"场景",id:"场景",children:l!=null&&l.model?v(l.model):[],path:"场景"}]),p=()=>{const e=l.extraNodes||[],r=e==null?void 0:e.map(a=>({...a,level:0}));c.value.push(...r)};return t.watch(s,e=>{c.value=JSON.parse(JSON.stringify(e)),p()},{immediate:!0}),(e,r)=>{const a=t.resolveComponent("el-tree");return t.openBlock(),t.createElementBlock("div",z,[t.createVNode(a,{data:c.value,props:f,"default-expanded-keys":k.value,"node-key":G,onNodeClick:_},null,8,["data","default-expanded-keys"])])}}},W=J._export_sfc(Q,[["__scopeId","data-v-7f54bf51"]]);exports.JointPanel=H;exports.UrdfTree=W;exports.getAllLinkName=w;exports.getMeshFromJoint=F;exports.getMeshFromLink=L;exports.getNonFixedJoints=M;exports.getTargetJoint=E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const se=require("./index.vue_vue_type_style_index_1_lang-Chzrrthw.cjs"),U=require("./MTLLoader-B8MnfNfT.cjs"),C=require("./fileUtil-GIRXMs25.cjs"),R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-D6X3fCNs.cjs"),e=require("vue"),D=require("./iconfont-C9-pGpAJ.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,i,w),p}function re(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,i,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=i=>`${o.endsWith("/")?o:o+"/"}${i}/`,m.loadMeshCb=(i,w,p)=>{const g=(()=>{const E=i.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",i).toString()}catch{const a=i.lastIndexOf("/");return a>=0?i.slice(0,a+1):i}})(),c=(()=>{var d;return(((d=i.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{re({objUrl:i,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(i,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(i,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(i,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${i})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:i=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(i);ae({manager:f,baseFolderUrl:ie,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${i.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${i.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const i=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){i.value&&i.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),i.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){i.value&&(i.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=i.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=i.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:i,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),i=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-i,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,i=>{l&&l(m,i)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),i=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(r=>{if(!(r!=null&&r.isMesh)){const y={name:r==null?void 0:r.name,label:(r==null?void 0:r.name)||(r==null?void 0:r.type),show:!0,level:s+1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:w(r==null?void 0:r.children,s+1),path:r==null?void 0:r.name};_.push(y)}}),_},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],r=[...t];for(;r.length>0&&_.length<s;){const y=r.shift();y.children&&y.children.length>0&&(_.push(y.id),r.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(r=>{if(r.children&&r.children.length>0){_.push(r.id);const y=r.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,h=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(i.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,K,H,Q,ee;const _=e.resolveComponent("el-divider"),r=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(r,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=i.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=i.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=i.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=i.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=i.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=i.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=i.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=i.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=i.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=i.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=i.value)==null?void 0:K.worldRotation)==null?void 0:H.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=i.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(b,n,o)=>n in b?te(b,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):b[n]=o;var j=(b,n,o)=>oe(b,typeof n!="symbol"?n+"":n,o);const R=require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BCjeeJqj.cjs"),se=require("./index.vue_vue_type_style_index_1_lang-DOP0uVOd.cjs"),U=require("./MTLLoader-AqmsmIp6.cjs"),C=require("./fileUtil-CTTbs0aJ.cjs"),e=require("vue"),D=require("./iconfont-BaUxcJrk.cjs"),le=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ie="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function ne(b){const{mtlUrl:n,manager:o,resourcePath:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.MTLLoader(o);return l&&p.setResourcePath(l),p.load(n,m,i,w),p}function re(b){const{objUrl:n,manager:o,materials:l,onLoad:m,onProgress:i,onError:w}=b,p=new U.OBJLoader(o);return l&&p.setMaterials(l),p.load(n,m,i,w),p}function ae(b){const{manager:n,baseFolderUrl:o,onFileProgress:l}=b,m=new se.URDFLoader(n);return m.packages=i=>`${o.endsWith("/")?o:o+"/"}${i}/`,m.loadMeshCb=(i,w,p)=>{const g=(()=>{const E=i.split("?")[0].split("#")[0],c=E.lastIndexOf(".");return c>=0?E.slice(c+1).toLowerCase():void 0})();switch(g){case"obj":{const E=(()=>{try{return new URL(".",i).toString()}catch{const a=i.lastIndexOf("/");return a>=0?i.slice(0,a+1):i}})(),c=(()=>{var d;return(((d=i.split("/").pop())==null?void 0:d.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${E}${c}.mtl`,h=a=>{re({objUrl:i,manager:w,materials:a,onLoad:d=>p(d),onProgress:d=>l==null?void 0:l(i,d==null?void 0:d.loaded,d==null?void 0:d.total),onError:d=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`,d),p(new R.Group)}})};ne({mtlUrl:f,manager:w,resourcePath:E,onLoad:a=>{try{a.preload()}catch{}h(a)},onProgress:a=>l==null?void 0:l(f,a==null?void 0:a.loaded,a==null?void 0:a.total),onError:a=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),h(void 0)}});break}case"stl":{new U.STLLoader(w).load(i,c=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),h=new R.Mesh(c,f);h.castShadow=!0,h.receiveShadow=!0,p(h)},c=>l==null?void 0:l(i,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`,c),p(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${i})`),p(new R.Group)}},m}function ce(b,n,o,l){return{loadSceneFromFile:i=>new Promise((w,p)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,E=0,c=null;const f=new R.LoadingManager;f.onStart=(a,d,V)=>{g=V||0,E=d||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(a,d,V)=>{E=d,g=V;const L=`正在加载 ${d} / ${V} 个文件: ${C.getFilenameFromUrl(a)}`;l.value=L,d===V&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(c){c.updateMatrixWorld(!0);const v=new R.Box3().setFromObject(c);v.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),c.userData.boundingBox=v,c.traverse(u=>{u.isMesh&&(u.castShadow=!0,u.receiveShadow=!0)}),w(c)}else p(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=a=>{console.warn(`LoadingManager 报告一个资源加载失败: ${a}。加载流程将继续。`)};const h=(a,d,V)=>{const L=C.getFilenameFromUrl(a);let v;V&&V>0?v=`${L}(${C.formatBytes(d)} / ${C.formatBytes(V)})`:d&&d>0?v=`${L}(已下载 ${C.formatBytes(d)})`:v=`${L}`,l.value=`正在下载第 ${E+1} / ${g} 个文件: ${v}`};try{const a=URL.createObjectURL(i);ae({manager:f,baseFolderUrl:ie,onFileProgress:h}).load(a,V=>{c=V},void 0,V=>{console.error(`加载 URDF 文件 (${i.name}) 时发生致命错误:`,V),l.value="URDF 文件解析失败",o.value=!1,p(new Error(`加载 URDF 文件失败: ${i.name}`))})}catch(a){console.error("初始化 URDF 加载时发生致命错误:",a),l.value="模型加载失败",o.value=!1,p(a)}})}}function de(b,n,o,l=["URDFVisual"]){let m=null;const i=e.ref(null),w=new R.Raycaster,p=new R.Vector2,g=new Map;function E(){o.value.forEach(v=>{v.traverse(u=>{l!=null&&l.includes(u.type)&&g.set(u.id,{obj:u,axis:u.axis||new R.Vector3(1,0,0),limits:u.limits})})})}function c(v){i.value&&i.value.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(0))}),i.value=v,v.obj.traverse(u=>{var t;u.material&&((t=u.material.emissive)==null||t.set(65280))})}function f(v){const u=b.value.getBoundingClientRect();p.x=(v.clientX-u.left)/u.width*2-1,p.y=-((v.clientY-u.top)/u.height)*2+1,w.setFromCamera(p,m);const t=w.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,_=null;for(;s;){if(g.has(s.id)){_=g.get(s.id);break}s=s.parent}_&&c(_)}function h(){b.value&&b.value.removeEventListener("click",f,!1)}function a(){const{scene:v,camera:u}=n();m=u,E(),b.value&&b.value.addEventListener("click",f,!1)}function d(v){i.value&&(i.value.obj.visible=v)}function V(v){var s;const{axis:u,value:t}=v;D.updateObjectPosition((s=i.value)==null?void 0:s.obj,u,t)}function L(v){var s;const{axis:u,value:t}=v;D.updateObjectRotation((s=i.value)==null?void 0:s.obj,u,t)}return{initRaycaster:a,dispose:h,selectedObject3D:i,setSelectedObjVisible:d,updatePosition:V,updateRotation:L}}const ue={SINGLE:"单机",DOUBLE:"双机"},me={ROBOT:1,PIPECOMPARSION:2};class pe{constructor(n){j(this,"robot");j(this,"movableJoints");this.robot=n,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(n=>n.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(n=>n.name)}setJointAngle(n,o){const l=this.robot.joints[n];if(!l||l.jointType==="fixed")return console.warn(`关节 ${n} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${n} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(n){Object.entries(n).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const n={};return this.movableJoints.forEach(o=>{n[o.name]=o.angle||0}),n}resetToZero(){this.movableJoints.forEach(n=>{n.setJointValue(0)})}getJointLimits(n){const o=this.robot.joints[n];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(n,o=1e3,l){const m=this.getCurrentJointStates(),i=Date.now();return new Promise(w=>{const p=()=>{const g=Date.now()-i,E=Math.min(g/o,1),c=this.easeInOutCubic(E),f={};Object.keys(n).forEach(h=>{const a=m[h]||0,d=n[h];f[h]=a+(d-a)*c}),this.setJointAngles(f),l&&l(E),E<1?requestAnimationFrame(p):w()};p()})}easeInOutCubic(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}async playSequence(n,o=1e3,l){for(let m=0;m<n.length;m++)await this.animateToState(n[m],o,i=>{l&&l(m,i)})}}const ve={class:"panel-content"},fe={class:"obj"},be={key:0,class:"obj-base"},_e=["title"],we=["title"],Ee={key:1},he={class:"obj-position"},Ve={class:"coord-item"},ge={class:"coord-item"},ye={class:"coord-item"},Ne={class:"obj-rotation"},Le={class:"coord-item"},Re={class:"coord-item"},Se={class:"coord-item"},Ce={class:"world"},je={class:"coord-line"},De={class:"coord-text"},Ue={class:"world-position-item"},Me={class:"world-position-item"},Fe={class:"world-position-item"},$e={class:"coord-line"},Oe={class:"coord-text"},xe={class:"world-rotation-item"},Je={class:"world-rotation-item"},Te={class:"world-rotation-item"},ke=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(b,{emit:n}){const o=b,l=n,m=e.ref([]),i=e.ref({}),w=(t,s=0)=>{const _=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(r=>{if(!(r!=null&&r.isMesh)){const y={name:r==null?void 0:r.name,label:(r==null?void 0:r.name)||(r==null?void 0:r.type),show:!0,level:s+1,isPenultimate:!1,type:r==null?void 0:r.type,id:r==null?void 0:r.id,limit:(r==null?void 0:r.limit)??"",children:w(r==null?void 0:r.children,s+1),path:r==null?void 0:r.name};_.push(y)}}),_},p=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:w(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const _=[],r=[...t];for(;r.length>0&&_.length<s;){const y=r.shift();y.children&&y.children.length>0&&(_.push(y.id),r.push(...y.children))}return _},E=(t,s)=>{const _=[];return t.forEach(r=>{if(r.children&&r.children.length>0){_.push(r.id);const y=r.children.filter(S=>S.children&&S.children.length>0).slice(0,s).map(S=>S.id);_.push(...y)}}),_.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?E(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const c=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,h=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},a=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},d=t=>{l("visibleChange",t)},V=e.computed(()=>o!=null&&o.model?p(o.model):[]),L=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),v=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),u=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(i.value=D.getObject3DData(o.model))},{deep:!0,immediate:!0}),e.watch(V,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var S,M,F,$,O,x,J,T,k,P,B,z,I,A,q,W,G,X,Y,Z,K,H,Q,ee;const _=e.resolveComponent("el-divider"),r=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(_,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",be,[e.createElementVNode("div",{class:"obj-name",title:L.value},e.toDisplayString(L.value),9,_e),e.createElementVNode("div",{class:"obj-type",title:v.value},"["+e.toDisplayString(v.value)+"]",9,we)])):(e.openBlock(),e.createElementBlock("div",Ee,"空")),e.createVNode(r,{"model-value":u.value,onChange:d},null,8,["model-value"])]),e.createVNode(_,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",he,[e.createElementVNode("div",Ve,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":c((M=(S=i.value)==null?void 0:S.position)==null?void 0:M.x),onChange:s[0]||(s[0]=N=>h(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":c(($=(F=i.value)==null?void 0:F.position)==null?void 0:$.y),onChange:s[1]||(s[1]=N=>h(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ye,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":c((x=(O=i.value)==null?void 0:O.position)==null?void 0:x.z),onChange:s[2]||(s[2]=N=>h(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",Ne,[e.createElementVNode("div",Le,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((T=(J=i.value)==null?void 0:J.rotation)==null?void 0:T.x),onChange:s[3]||(s[3]=N=>a(N,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Re,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((P=(k=i.value)==null?void 0:k.rotation)==null?void 0:P.y),onChange:s[4]||(s[4]=N=>a(N,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((z=(B=i.value)==null?void 0:B.rotation)==null?void 0:z.z),onChange:s[5]||(s[5]=N=>a(N,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(_,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",Ce,[e.createElementVNode("div",je,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",De,[e.createElementVNode("div",Ue,e.toDisplayString(c((A=(I=i.value)==null?void 0:I.worldPosition)==null?void 0:A.x))+", ",1),e.createElementVNode("div",Me,e.toDisplayString(c((W=(q=i.value)==null?void 0:q.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Fe,e.toDisplayString(c((X=(G=i.value)==null?void 0:G.worldPosition)==null?void 0:X.z)),1)])]),e.createElementVNode("div",$e,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Oe,[e.createElementVNode("div",xe,e.toDisplayString(f((Z=(Y=i.value)==null?void 0:Y.worldRotation)==null?void 0:Z.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((H=(K=i.value)==null?void 0:K.worldRotation)==null?void 0:H.y))+"°, ",1),e.createElementVNode("div",Te,e.toDisplayString(f((ee=(Q=i.value)==null?void 0:Q.worldRotation)==null?void 0:ee.z))+"° ",1)])])])])}}}),Pe=le._export_sfc(ke,[["__scopeId","data-v-00d48931"]]);exports.URDFRobotController=pe;exports.WorkpieceTreePanel=Pe;exports.robotMode=ue;exports.sceneType=me;exports.useRaycaster=de;exports.useUrdfLoader=ce;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var ce = Object.defineProperty;
|
|
2
2
|
var de = (b, l, o) => l in b ? ce(b, l, { enumerable: !0, configurable: !0, writable: !0, value: o }) : b[l] = o;
|
|
3
3
|
var E = (b, l, o) => de(b, typeof l != "symbol" ? l + "" : l, o);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { aZ as me, u as F, o as ve, k as pe, B as fe, a_ as be, Y as we, V as he } from "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-aFJhRTyx.js";
|
|
5
|
+
import { U as _e } from "./index.vue_vue_type_style_index_1_lang-DkkdpQbZ.js";
|
|
6
|
+
import { S as ge, M as ye, O as Le } from "./MTLLoader-DJNdEDx2.js";
|
|
7
|
+
import { g as re, f as J } from "./fileUtil-CWt--rV-.js";
|
|
8
8
|
import { ref as T, defineComponent as je, computed as O, watch as ue, resolveComponent as x, createElementBlock as k, openBlock as P, createVNode as S, createElementVNode as c, withCtx as $, createTextVNode as D, toDisplayString as C } from "vue";
|
|
9
|
-
import { c as Re, e as Se, g as Ue } from "./iconfont-
|
|
9
|
+
import { c as Re, e as Se, g as Ue } from "./iconfont-D886hAXy.js";
|
|
10
10
|
import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
11
11
|
const Me = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
|
|
12
12
|
function Oe(b) {
|
|
13
|
-
const { mtlUrl: l, manager: o, resourcePath: s, onLoad: m, onProgress: i, onError: h } = b, v = new
|
|
13
|
+
const { mtlUrl: l, manager: o, resourcePath: s, onLoad: m, onProgress: i, onError: h } = b, v = new ye(o);
|
|
14
14
|
return s && v.setResourcePath(s), v.load(l, m, i, h), v;
|
|
15
15
|
}
|
|
16
16
|
function $e(b) {
|
|
17
|
-
const { objUrl: l, manager: o, materials: s, onLoad: m, onProgress: i, onError: h } = b, v = new
|
|
17
|
+
const { objUrl: l, manager: o, materials: s, onLoad: m, onProgress: i, onError: h } = b, v = new Le(o);
|
|
18
18
|
return s && v.setMaterials(s), v.load(l, m, i, h), v;
|
|
19
19
|
}
|
|
20
20
|
function De(b) {
|
|
21
|
-
const { manager: l, baseFolderUrl: o, onFileProgress: s } = b, m = new
|
|
21
|
+
const { manager: l, baseFolderUrl: o, onFileProgress: s } = b, m = new _e(l);
|
|
22
22
|
return m.packages = (i) => `${o.endsWith("/") ? o : o + "/"}${i}/`, m.loadMeshCb = (i, h, v) => {
|
|
23
23
|
const L = (() => {
|
|
24
24
|
const _ = i.split("?")[0].split("#")[0], r = _.lastIndexOf(".");
|
|
@@ -45,7 +45,7 @@ function De(b) {
|
|
|
45
45
|
onLoad: (u) => v(u),
|
|
46
46
|
onProgress: (u) => s == null ? void 0 : s(i, u == null ? void 0 : u.loaded, u == null ? void 0 : u.total),
|
|
47
47
|
onError: (u) => {
|
|
48
|
-
console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`, u), v(new
|
|
48
|
+
console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${i}`, u), v(new F());
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
};
|
|
@@ -68,21 +68,21 @@ function De(b) {
|
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
case "stl": {
|
|
71
|
-
new
|
|
71
|
+
new ge(h).load(
|
|
72
72
|
i,
|
|
73
73
|
(r) => {
|
|
74
|
-
const f = new
|
|
74
|
+
const f = new ve({ color: 12303291, shininess: 30 }), g = new pe(r, f);
|
|
75
75
|
g.castShadow = !0, g.receiveShadow = !0, v(g);
|
|
76
76
|
},
|
|
77
77
|
(r) => s == null ? void 0 : s(i, r == null ? void 0 : r.loaded, r == null ? void 0 : r.total),
|
|
78
78
|
(r) => {
|
|
79
|
-
console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`, r), v(new
|
|
79
|
+
console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${i}`, r), v(new F());
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
default:
|
|
85
|
-
console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${L} (路径: ${i})`), v(new
|
|
85
|
+
console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${L} (路径: ${i})`), v(new F());
|
|
86
86
|
}
|
|
87
87
|
}, m;
|
|
88
88
|
}
|
|
@@ -90,7 +90,7 @@ function vo(b, l, o, s) {
|
|
|
90
90
|
return { loadSceneFromFile: (i) => new Promise((h, v) => {
|
|
91
91
|
o.value = !0, s.value = "正在初始化 URDF 加载器...";
|
|
92
92
|
let L = 0, _ = 0, r = null;
|
|
93
|
-
const f = new
|
|
93
|
+
const f = new me();
|
|
94
94
|
f.onStart = (n, u, y) => {
|
|
95
95
|
L = y || 0, _ = u || 0, s.value = L > 0 ? `开始下载资源: 0 / ${L}` : "开始下载资源...", o.value = !0;
|
|
96
96
|
}, f.onProgress = (n, u, y) => {
|
|
@@ -99,7 +99,7 @@ function vo(b, l, o, s) {
|
|
|
99
99
|
s.value = U, u === y && (s.value = "资源加载完成,正在处理模型...", setTimeout(() => {
|
|
100
100
|
if (r) {
|
|
101
101
|
r.updateMatrixWorld(!0);
|
|
102
|
-
const p = new
|
|
102
|
+
const p = new fe().setFromObject(r);
|
|
103
103
|
p.isEmpty() && console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"), r.userData.boundingBox = p, r.traverse((d) => {
|
|
104
104
|
d.isMesh && (d.castShadow = !0, d.receiveShadow = !0);
|
|
105
105
|
}), h(r);
|
|
@@ -115,7 +115,7 @@ function vo(b, l, o, s) {
|
|
|
115
115
|
const g = (n, u, y) => {
|
|
116
116
|
const U = re(n);
|
|
117
117
|
let p;
|
|
118
|
-
y && y > 0 ? p = `${U}(${
|
|
118
|
+
y && y > 0 ? p = `${U}(${J(u)} / ${J(y)})` : u && u > 0 ? p = `${U}(已下载 ${J(u)})` : p = `${U}`, s.value = `正在下载第 ${_ + 1} / ${L} 个文件: ${p}`;
|
|
119
119
|
};
|
|
120
120
|
try {
|
|
121
121
|
const n = URL.createObjectURL(i);
|
|
@@ -140,13 +140,13 @@ function vo(b, l, o, s) {
|
|
|
140
140
|
}
|
|
141
141
|
function po(b, l, o, s = ["URDFVisual"]) {
|
|
142
142
|
let m = null;
|
|
143
|
-
const i = T(null), h = new
|
|
143
|
+
const i = T(null), h = new be(), v = new we(), L = /* @__PURE__ */ new Map();
|
|
144
144
|
function _() {
|
|
145
145
|
o.value.forEach((p) => {
|
|
146
146
|
p.traverse((d) => {
|
|
147
147
|
s != null && s.includes(d.type) && L.set(d.id, {
|
|
148
148
|
obj: d,
|
|
149
|
-
axis: d.axis || new
|
|
149
|
+
axis: d.axis || new he(1, 0, 0),
|
|
150
150
|
// URDF 里的 <axis>
|
|
151
151
|
limits: d.limits
|
|
152
152
|
});
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1762327333106" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3725" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M250.88 69.632h515.584c3.584 0 7.168 1.536 10.752 3.584l34.816 27.136c12.8 9.728 5.632 30.72-10.752 30.72H222.208c-16.384 0-23.04-20.48-10.752-30.72 0.512 0 39.424-30.72 39.424-30.72z" fill="#72B02D" p-id="3726"></path><path d="M867.84 710.144h-711.68c-9.728 0-16.896 7.68-16.896 16.896v209.92c0 9.728 7.68 16.896 16.896 16.896h729.088V727.04c0-9.728-8.192-16.896-17.408-16.896z m-185.856 166.4c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896v-27.136c0-9.728-7.68-16.896-16.896-16.896H393.216c-9.216 0-16.896 7.168-16.384 16.384v27.136c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896V819.2c0-9.728 7.68-16.896 16.896-16.896h305.152c9.728 0 16.896 7.68 16.896 16.896v57.344zM867.84 435.712h-711.68c-9.728 0-16.896 7.68-16.896 16.896v209.92c0 9.728 7.68 16.896 16.896 16.896h729.088V453.12c0-9.728-8.192-17.408-17.408-17.408z m-185.856 166.4c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896v-27.136c0-9.728-7.68-16.896-16.896-16.896H393.216c-9.216 0-16.896 7.68-16.384 16.896v27.136c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896v-57.856c0-9.728 7.68-16.896 16.896-16.896h305.152c9.728 0 16.896 7.68 16.896 16.896v57.856zM867.84 161.28h-711.68c-9.728 0-16.896 7.68-16.896 16.896v209.92c0 9.728 7.68 16.896 16.896 16.896h729.088V178.176c0-9.728-8.192-16.896-17.408-16.896z m-185.856 165.888c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896v-27.136c0-9.728-7.68-16.896-16.896-16.896H393.216c-9.216 0-16.896 7.68-16.384 16.896v27.136c0 9.728-7.68 16.896-16.896 16.896-9.728 0-16.896-7.68-16.896-16.896V269.824c0-9.728 7.68-16.896 16.896-16.896h305.152c9.728 0 16.896 7.68 16.896 16.896v57.344z" fill="#AAAAAA" p-id="3727"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1762327338380" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3871" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M445.44 59.904c19.968-12.288 46.08-12.288 66.56 0L851.968 250.88c22.016 12.288 34.304 34.304 34.304 60.416v227.328c-41.984-24.064-88.576-36.352-136.704-36.352-46.08 0-88.576 10.24-124.416 30.208L509.952 464.384V279.04c-2.048-15.872-15.872-28.16-32.256-28.16-17.92 0-32.256 15.872-32.256 34.304v179.2l-188.928 110.592-4.096 4.096c-12.288 10.24-13.824 28.16-6.144 41.984l4.096 4.096c10.24 12.288 28.16 15.872 40.448 8.192l188.928-112.64 86.528 52.224c-56.32 52.224-86.528 124.416-86.528 199.168 0 58.368 17.92 110.592 48.128 154.624l-15.872 10.24c-19.968 12.288-46.08 12.288-66.56 0l-341.504-189.44c-19.968-12.288-34.304-36.352-34.304-60.416V311.296c0-24.064 13.824-48.128 34.304-60.416L445.44 59.904z" fill="#AAAAAA" p-id="3872"></path><path d="M924.16 770.048c0-17.92 12.288-32.256 30.208-38.4-10.24-44.032-34.304-84.48-68.608-114.688-12.288 12.288-34.304 13.824-50.176 6.144-15.872-8.192-24.064-26.112-17.92-44.032-22.016-6.144-46.08-12.288-68.608-12.288-24.064 0-46.08 2.048-68.608 12.288 6.144 17.92-4.096 36.352-17.92 44.032-15.872 8.192-36.352 6.144-50.176-6.144-34.304 30.208-58.368 68.608-68.608 114.688 17.92 2.048 30.208 19.968 30.208 38.4s-12.288 32.256-30.208 38.4c10.24 44.032 34.304 84.48 68.608 114.688 12.288-12.288 34.304-13.824 50.176-6.144 15.872 8.192 24.064 26.112 17.92 44.032 22.016 6.144 46.08 12.288 68.608 12.288 24.064 0 46.08-2.048 68.608-12.288-6.144-17.92 4.096-36.352 17.92-44.032 15.872-8.192 36.352-6.144 50.176 6.144 34.304-30.208 58.368-68.608 68.608-114.688-17.92-4.608-30.208-20.48-30.208-38.4m-177.152 84.48c-50.176 0-90.624-38.4-90.624-86.528 0-48.128 40.448-86.528 90.624-86.528s90.624 38.4 90.624 86.528c0 48.128-39.936 86.528-90.624 86.528" fill="#72B02D" p-id="3873"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1762327329102" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3579" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M695.808 298.496H334.848c-18.944 0-34.304-17.408-34.304-38.912V129.024c0-21.504 15.36-38.912 34.304-38.912H696.32c18.944 0 34.304 17.408 34.304 38.912v130.56c0 22.016-15.36 38.912-34.816 38.912zM695.808 615.936H334.848c-18.944 0-34.304-17.408-34.304-38.912V446.464c0-21.504 15.36-38.912 34.304-38.912H696.32c18.944 0 34.304 17.408 34.304 38.912v130.56c0 22.016-15.36 38.912-34.816 38.912zM695.808 933.888H334.848c-18.944 0-34.304-17.408-34.304-38.912v-130.56c0-21.504 15.36-38.912 34.304-38.912H696.32c18.944 0 34.304 17.408 34.304 38.912v130.56c0 21.504-15.36 38.912-34.816 38.912z" fill="#AAAAAA" p-id="3580"></path><path d="M232.96 855.04h-37.376c-91.136 0-165.376-83.968-165.376-186.88S104.448 481.28 195.584 481.28h37.376c18.944 0 34.304 17.408 34.304 38.912 0 21.504-15.36 38.912-34.304 38.912h-37.376c-53.248 0-96.256 49.152-96.256 109.568 0 60.416 43.52 109.056 96.256 109.056h37.376c9.216 0 18.432 4.096 24.576 11.264 6.656 7.68 10.24 17.408 10.24 27.648 0 10.24-3.584 20.48-10.24 27.648-6.144 6.144-15.36 10.24-24.576 10.752zM828.416 543.232h-37.376c-18.944 0-34.304-17.408-34.304-38.912 0-21.504 15.36-38.912 34.304-38.912h37.376c53.248 0 96.768-49.152 96.768-109.568s-43.52-109.568-96.768-109.568h-37.376c-18.944 0-34.304-17.408-34.304-38.912 0-21.504 15.36-38.912 34.304-38.912h37.376c91.136 0 165.376 83.968 165.376 187.392 0 103.936-74.24 187.392-165.376 187.392z" fill="#72B02D" p-id="3581"></path></svg>
|