ss-component-new 1.2.12 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{animationData-CyP8-u7i.cjs → animationData-Bk1470H5.cjs} +1 -1
- package/dist/{animationData-C_gV7XAN.js → animationData-DGFKjCYk.js} +3 -3
- package/dist/array-B35bAMlG.js +1142 -0
- package/dist/array-aAE_wKnd.cjs +11 -0
- package/dist/{index-DQZ_oAyj.js → index-0F2eUVxy.js} +5 -5
- package/dist/{index-B9OZcnHm.cjs → index-AaBAxV_V.cjs} +13 -13
- package/dist/{index-ESNVepXU.js → index-B5XUqnF_.js} +5 -5
- package/dist/{index-qu3KI1yZ.js → index-B5u0jviA.js} +5 -5
- package/dist/{index-C40ofXP7.cjs → index-B67hAD7m.cjs} +1 -1
- package/dist/{index-Adqs5vHH.cjs → index-B9sRVMVL.cjs} +1 -1
- package/dist/{index-CoVAbxHN.js → index-BFKsm0Yx.js} +1 -1
- package/dist/index-BIfQaEzZ.cjs +1 -0
- package/dist/{index-DGBDGLOK.cjs → index-BQqFFNAa.cjs} +1 -1
- package/dist/{index-BUUEqGRN.cjs → index-BaIFwPts.cjs} +1 -1
- package/dist/{index-C68Hri2v.cjs → index-BlK2PVMx.cjs} +1 -1
- package/dist/index-Bma_mFLH.js +158 -0
- package/dist/{index-CRiovRyR.js → index-Bn5MBUdF.js} +1 -1
- package/dist/{index-DHQH1rlQ.js → index-ByAR0Idl.js} +2 -2
- package/dist/{index-B7g38Yte.js → index-C2ubyp3H.js} +1 -1
- package/dist/{index-BDaeo6qO.js → index-C5WwpGNi.js} +2 -2
- package/dist/{index-QkDZ18PI.cjs → index-C9aN-VrN.cjs} +1 -1
- package/dist/{index-CjB5ZP_P.js → index-CC9pH_f2.js} +1 -1
- package/dist/{index-D4CVC2Sk.js → index-CCF9d9aS.js} +2 -2
- package/dist/{index-DfKkN76b.js → index-CF--cUKb.js} +2 -2
- package/dist/{index-CAewC69j.cjs → index-CKqCzMnZ.cjs} +1 -1
- package/dist/index-COqXf8zH.cjs +1 -0
- package/dist/{index-7eyGTvr0.cjs → index-COuendLk.cjs} +1 -1
- package/dist/index-CSLbHDxo.js +2567 -0
- package/dist/{index-D9l1Z4TO.cjs → index-CSbITu5d.cjs} +1 -1
- package/dist/{index-Dwr4RHei.cjs → index-Cjbn2UBR.cjs} +1 -1
- package/dist/{index-DTkAIcvV.js → index-Cq6fzImq.js} +13 -13
- package/dist/{index-i50hp6po.cjs → index-CstB7vYe.cjs} +1 -1
- package/dist/{index-C5gPrwPs.cjs → index-CuQDWf5p.cjs} +1 -1
- package/dist/{index-D55zzS4D.cjs → index-CyZ2cmp8.cjs} +1 -1
- package/dist/{index-DnU2slQv.cjs → index-Cyt7LP0u.cjs} +1 -1
- package/dist/{index-C-c1pt-2.js → index-D5fAObhh.js} +1 -1
- package/dist/{index-ecVCII_e.js → index-DD9OzBSS.js} +4 -4
- package/dist/{index-CkA2IZJB.js → index-DLHscTIu.js} +5 -5
- package/dist/{index-B_ZGJtId.js → index-DNdAK9Jn.js} +1 -1
- package/dist/{index-DJMHw-xb.js → index-DS9Dbxhr.js} +10 -10
- package/dist/{index-BMYtLkw8.js → index-DfPRUqS4.js} +3 -3
- package/dist/{index-CKt6cj9f.cjs → index-DleM0Iie.cjs} +1 -1
- package/dist/{index-t6--MDLB.cjs → index-Dlfn0JHU.cjs} +1 -1
- package/dist/{index-DsQ-qtQ9.cjs → index-Dqvc_EHA.cjs} +1 -1
- package/dist/{index-DkG4A3iE.cjs → index-Dr40ZJEX.cjs} +1 -1
- package/dist/{index-BbI9_JbX.js → index-Drb6aHQr.js} +48 -32
- package/dist/index-DzUvkDw2.cjs +1 -0
- package/dist/{index-CVDv-Zz-.js → index-EHmVdU_u.js} +18 -18
- package/dist/{index-B_mFQujY.cjs → index-JiTvtugz.cjs} +1 -1
- package/dist/{index-BQ4Rjf8F.js → index-VfaCGVFD.js} +5 -5
- package/dist/index-a1HKV1_g.cjs +1 -0
- package/dist/index-a9bB4rFY.js +7290 -0
- package/dist/{index-BJBNtx2b.cjs → index-gzUDXR5p.cjs} +1 -1
- package/dist/{index-D5ShC3zu.cjs → index-hbliXkku.cjs} +1 -1
- package/dist/{index-H_3u1NA_.js → index-kOyJPwsW.js} +1 -1
- package/dist/{index-CKLBlQoK.js → index-kn9Z3Spm.js} +2129 -2122
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BRxOMo6y.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DfPAhslf.js} +8765 -8749
- package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Dwdjsitu.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-_G53poH8.cjs} +108 -108
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-e_PTrAf6.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-Brscnsyu.js} +5 -5
- package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-DfqsvuRy.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-CmDr-Cyv.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CGmzewC_.cjs +56 -0
- package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BqmMCEyN.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-D9q4Jzwb.js} +12692 -12647
- package/dist/{index.vue_vue_type_style_index_1_lang-CsY5rIO4.js → index.vue_vue_type_style_index_1_lang-BcKOWs1s.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_1_lang-DOjFqzi3.cjs → index.vue_vue_type_style_index_1_lang-CbS7EB3k.cjs} +1 -1
- package/dist/index.vue_vue_type_style_index_1_lang-Iut1fhDN.js +8161 -0
- package/dist/index.vue_vue_type_style_index_1_lang-sTxwz1W3.cjs +32 -0
- package/dist/{main-DIbH2rlN.js → main-D90k9E9J.js} +4 -4
- package/dist/{main-CVaemyhm.cjs → main-DXm7KzRN.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +2 -2
- package/dist/ss-component.js +10 -10
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +11 -11
- package/dist/{threeModel-C0Jdw2O3.cjs → threeModel-C-6_vaGX.cjs} +1 -1
- package/dist/{threeModel-27sl0tTS.js → threeModel-V3QSg295.js} +2 -2
- package/dist/{threeSceneView-ZDXqO8ZA.js → threeSceneView-Bklnz7S8.js} +7 -7
- package/dist/{threeSceneView-CEpBvJSV.cjs → threeSceneView-FVcVEW7a.cjs} +1 -1
- package/dist/{threeSceneViewForCPMPIP-BPPWM68P.js → threeSceneViewForCPMPIP-B3G_-YBW.js} +6 -6
- package/dist/{threeSceneViewForCPMPIP-B0VPmBWd.cjs → threeSceneViewForCPMPIP-BoeTb3Fi.cjs} +1 -1
- package/dist/{threeViewerHost-CKE2a4PV.js → threeViewerHost-Bc0cuY8h.js} +78 -65
- package/dist/threeViewerHost-fPCTBYzC.cjs +1 -0
- package/dist/{useRayCaster-BM9XKGKx.js → useRayCaster-CcQBZs7h.js} +1 -1
- package/dist/{useRayCaster-1DNcSYPR.cjs → useRayCaster-ClCyvaxW.cjs} +1 -1
- package/package.json +1 -1
- package/dist/array-A59WrroX.js +0 -1207
- package/dist/array-BtZq8qON.cjs +0 -11
- package/dist/index-2nEz-J89.js +0 -24
- package/dist/index-BAOnUk_J.cjs +0 -1
- package/dist/index-BeYNgEHV.js +0 -144
- package/dist/index-CApZYDIm.cjs +0 -1
- package/dist/index-CN29uy_G.js +0 -7293
- package/dist/index-CTRmgnKQ.js +0 -2643
- package/dist/index-CVadHkfS.cjs +0 -1
- package/dist/index-CwhX2vaq.cjs +0 -1
- package/dist/index-DDhAMgrO.js +0 -22
- package/dist/index-DP7rcz4I.cjs +0 -1
- package/dist/index-RVDLy1iy.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-7HSISF9c.cjs +0 -56
- package/dist/index.vue_vue_type_style_index_1_lang-DQUFi_Vi.cjs +0 -32
- package/dist/index.vue_vue_type_style_index_1_lang-Ds1cd7yg.js +0 -7806
- package/dist/threeViewerHost-yHvsk7TK.cjs +0 -1
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
import { computed as _, defineComponent as
|
|
2
|
-
import { a as
|
|
3
|
-
import { u as H } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
-
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-
|
|
1
|
+
import { computed as _, defineComponent as W, defineAsyncComponent as S, ref as M, watch as G, createElementBlock as B, openBlock as y, normalizeClass as j, createBlock as b, createCommentVNode as L, unref as P } from "vue";
|
|
2
|
+
import { a as R, b$ as Y, p as I, s as O } from "./index-CYp77kPp.js";
|
|
3
|
+
import { u as H } from "./index.vue_vue_type_style_index_1_lang-Iut1fhDN.js";
|
|
4
|
+
import "./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DfPAhslf.js";
|
|
5
5
|
import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
-
function se(
|
|
7
|
-
const
|
|
8
|
-
return
|
|
6
|
+
function se(c) {
|
|
7
|
+
const f = sessionStorage.getItem("loginToken") ?? "123456";
|
|
8
|
+
return R({
|
|
9
9
|
url: "/api/sysFile/uploadFile",
|
|
10
10
|
method: "post",
|
|
11
|
-
data:
|
|
11
|
+
data: c,
|
|
12
12
|
headers: {
|
|
13
|
-
Authorization:
|
|
13
|
+
Authorization: f,
|
|
14
14
|
"Content-Type": "multipart/form-data"
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function J(
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
function J(c) {
|
|
19
|
+
const f = sessionStorage.getItem("loginToken") ?? "123456";
|
|
20
|
+
return R({
|
|
21
21
|
url: "/api/sysFile/downloadFile",
|
|
22
22
|
method: "post",
|
|
23
|
-
data:
|
|
23
|
+
data: c,
|
|
24
24
|
headers: {
|
|
25
|
-
Authorization:
|
|
25
|
+
Authorization: f,
|
|
26
26
|
Accept: "application/octet-stream"
|
|
27
27
|
// 明确要求返回二进制流
|
|
28
28
|
},
|
|
29
29
|
responseType: "blob"
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
function ie(c) {
|
|
33
|
+
const f = sessionStorage.getItem("loginToken") ?? "123456";
|
|
34
|
+
return R({
|
|
35
|
+
url: "/api/sysFile/uploadFiles",
|
|
36
|
+
method: "post",
|
|
37
|
+
data: c,
|
|
38
|
+
headers: {
|
|
39
|
+
Authorization: f,
|
|
40
|
+
"Content-Type": "multipart/form-data"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
32
44
|
const K = Y("threeState", {
|
|
33
45
|
state: () => ({
|
|
34
46
|
data: {
|
|
@@ -40,8 +52,8 @@ const K = Y("threeState", {
|
|
|
40
52
|
}
|
|
41
53
|
}),
|
|
42
54
|
actions: {
|
|
43
|
-
setData(
|
|
44
|
-
this.data =
|
|
55
|
+
setData(c) {
|
|
56
|
+
this.data = c;
|
|
45
57
|
},
|
|
46
58
|
getData() {
|
|
47
59
|
return this.data;
|
|
@@ -49,47 +61,47 @@ const K = Y("threeState", {
|
|
|
49
61
|
}
|
|
50
62
|
});
|
|
51
63
|
function Q() {
|
|
52
|
-
const
|
|
64
|
+
const c = H(I), { platform: f } = O(c), h = K(I), g = _(() => {
|
|
53
65
|
var e;
|
|
54
66
|
return (e = h == null ? void 0 : h.data) == null ? void 0 : e.extension;
|
|
55
|
-
}),
|
|
56
|
-
if (!
|
|
67
|
+
}), p = ["uv", "cpt", "cyd"], T = ["urdf"], o = ["obj", "stl"], n = [...p, ...T, ...o], D = (e) => {
|
|
68
|
+
if (!E())
|
|
57
69
|
throw new Error("不是三维系统");
|
|
58
70
|
h.setData(e);
|
|
59
|
-
},
|
|
71
|
+
}, m = () => h.getData(), E = () => f.value === "three", l = (e) => {
|
|
60
72
|
const s = e == null ? void 0 : e.toLowerCase(), i = s == null ? void 0 : s.lastIndexOf(".");
|
|
61
|
-
let
|
|
62
|
-
return i >= 0 && (
|
|
63
|
-
},
|
|
73
|
+
let d = s;
|
|
74
|
+
return i >= 0 && (d = d == null ? void 0 : d.slice(i + 1)), d;
|
|
75
|
+
}, F = (e) => {
|
|
64
76
|
if (!e)
|
|
65
77
|
return !1;
|
|
66
|
-
const s =
|
|
78
|
+
const s = l(e);
|
|
67
79
|
return n == null ? void 0 : n.includes(s);
|
|
68
80
|
};
|
|
69
81
|
return {
|
|
70
|
-
getData:
|
|
71
|
-
setData:
|
|
72
|
-
isThreeSystem:
|
|
82
|
+
getData: m,
|
|
83
|
+
setData: D,
|
|
84
|
+
isThreeSystem: E,
|
|
73
85
|
isUrdf: (e) => {
|
|
74
86
|
if (!e)
|
|
75
87
|
return !1;
|
|
76
|
-
const s =
|
|
88
|
+
const s = l(e);
|
|
77
89
|
return T == null ? void 0 : T.includes(s);
|
|
78
90
|
},
|
|
79
91
|
isGeneralFile: (e) => {
|
|
80
92
|
if (!e)
|
|
81
93
|
return !1;
|
|
82
|
-
const s =
|
|
94
|
+
const s = l(e);
|
|
83
95
|
return o == null ? void 0 : o.includes(s);
|
|
84
96
|
},
|
|
85
97
|
isTrackPathFile: (e) => {
|
|
86
98
|
if (!e)
|
|
87
99
|
return !1;
|
|
88
|
-
const s =
|
|
89
|
-
return
|
|
100
|
+
const s = l(e);
|
|
101
|
+
return p == null ? void 0 : p.includes(s);
|
|
90
102
|
},
|
|
91
|
-
isThreeFile:
|
|
92
|
-
isUseBackdrop: (e) =>
|
|
103
|
+
isThreeFile: F,
|
|
104
|
+
isUseBackdrop: (e) => E() && F(e),
|
|
93
105
|
initTrackFileType: (e) => {
|
|
94
106
|
if (!e)
|
|
95
107
|
return {
|
|
@@ -97,21 +109,21 @@ function Q() {
|
|
|
97
109
|
isCyd: !1,
|
|
98
110
|
isUv: !1
|
|
99
111
|
};
|
|
100
|
-
const s =
|
|
112
|
+
const s = l(e), i = p == null ? void 0 : p.find((k) => k === 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: l,
|
|
120
|
+
extraExtension: g
|
|
109
121
|
};
|
|
110
122
|
}
|
|
111
123
|
const X = {
|
|
112
124
|
key: 4,
|
|
113
125
|
class: "loading"
|
|
114
|
-
}, Z = /* @__PURE__ */
|
|
126
|
+
}, Z = /* @__PURE__ */ W({
|
|
115
127
|
__name: "threeViewerHost",
|
|
116
128
|
props: {
|
|
117
129
|
fileUrls: { default: () => [] },
|
|
@@ -124,8 +136,8 @@ const X = {
|
|
|
124
136
|
componentType: {}
|
|
125
137
|
},
|
|
126
138
|
emits: ["getThreeData"],
|
|
127
|
-
setup(
|
|
128
|
-
const h = S(() => import("./threeSceneView-
|
|
139
|
+
setup(c, { emit: f }) {
|
|
140
|
+
const h = S(() => import("./threeSceneView-Bklnz7S8.js")), g = S(() => import("./threePreview-DFFjm93P.js")), p = S(() => import("./threeLatheView-Bp0kjo_V.js")), T = S(() => import("./threeSceneViewForCPMPIP-B3G_-YBW.js")), o = {
|
|
129
141
|
ROBOT_SCENE: "robot",
|
|
130
142
|
// 机器人场景
|
|
131
143
|
LATHE_SCENE: "latheScene",
|
|
@@ -134,7 +146,7 @@ const X = {
|
|
|
134
146
|
// 重大专项场景
|
|
135
147
|
PREVIEW: "preview"
|
|
136
148
|
// 预览模式
|
|
137
|
-
}, n =
|
|
149
|
+
}, n = c, D = H(I), { platName: m } = O(D), { isGeneralFile: E, isUrdf: l, isTrackPathFile: F, extraExtension: A } = Q(), w = _(() => (n == null ? void 0 : n.extension) || A.value), U = _(() => {
|
|
138
150
|
var t, r;
|
|
139
151
|
return (r = (t = n == null ? void 0 : n.threeData) == null ? void 0 : t.data) == null ? void 0 : r.trackFileType;
|
|
140
152
|
}), v = _(() => {
|
|
@@ -151,24 +163,24 @@ const X = {
|
|
|
151
163
|
return o.PREVIEW;
|
|
152
164
|
}
|
|
153
165
|
const t = (r = n == null ? void 0 : n.fileUrls) == null ? void 0 : r[0];
|
|
154
|
-
return
|
|
155
|
-
}), N =
|
|
166
|
+
return E(t) ? o.PREVIEW : (m == null ? void 0 : m.value) === "CPMPIP" && (l(t) || l(w.value)) ? o.CPMPIP_SCENE : (m == null ? void 0 : m.value) === "SFRTubeBend" && (l(t) || l(w.value)) ? o.ROBOT_SCENE : F(w.value) && U.value ? o.LATHE_SCENE : o.PREVIEW;
|
|
167
|
+
}), N = f, e = M([]), s = M(!1);
|
|
156
168
|
function i(t) {
|
|
157
169
|
try {
|
|
158
|
-
const r = new URL(t).pathname,
|
|
159
|
-
return decodeURIComponent(
|
|
170
|
+
const r = new URL(t).pathname, u = r.substring(r.lastIndexOf("/") + 1);
|
|
171
|
+
return decodeURIComponent(u);
|
|
160
172
|
} catch (r) {
|
|
161
173
|
return console.error("无法解析URL以提取文件名:", t, r), "未知文件名";
|
|
162
174
|
}
|
|
163
175
|
}
|
|
164
|
-
async function
|
|
165
|
-
let r,
|
|
176
|
+
async function d(t) {
|
|
177
|
+
let r, u;
|
|
166
178
|
if (/^https?:\/\//.test(t))
|
|
167
179
|
try {
|
|
168
180
|
const a = await fetch(t);
|
|
169
181
|
if (!a.ok)
|
|
170
182
|
throw new Error(`下载文件失败: ${a.statusText} (URL: ${t})`);
|
|
171
|
-
r = await a.blob(),
|
|
183
|
+
r = await a.blob(), u = i(t);
|
|
172
184
|
} catch (a) {
|
|
173
185
|
throw console.error("使用 fetch 下载文件时出错:", a), a;
|
|
174
186
|
}
|
|
@@ -178,11 +190,11 @@ const X = {
|
|
|
178
190
|
if (a.status !== 200)
|
|
179
191
|
throw new Error(`下载失败: ${a.status}`);
|
|
180
192
|
const C = a.headers["content-disposition"];
|
|
181
|
-
|
|
193
|
+
u = k(C) || "无文件名", r = a.data;
|
|
182
194
|
} catch (a) {
|
|
183
195
|
throw console.error("通过 API 下载文件时出错:", a), a;
|
|
184
196
|
}
|
|
185
|
-
return new File([r],
|
|
197
|
+
return new File([r], u, { type: r.type });
|
|
186
198
|
}
|
|
187
199
|
function k(t) {
|
|
188
200
|
if (!t) return;
|
|
@@ -192,9 +204,9 @@ const X = {
|
|
|
192
204
|
a = a.replace(/^"(.*)"$/, "$1");
|
|
193
205
|
const C = a.split("''");
|
|
194
206
|
if (C.length === 2) {
|
|
195
|
-
const
|
|
207
|
+
const z = C[0].toUpperCase(), V = C[1];
|
|
196
208
|
try {
|
|
197
|
-
if (
|
|
209
|
+
if (z === "UTF-8")
|
|
198
210
|
return decodeURIComponent(V);
|
|
199
211
|
} catch {
|
|
200
212
|
}
|
|
@@ -206,9 +218,9 @@ const X = {
|
|
|
206
218
|
return a;
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
221
|
+
const u = t.match(/filename\s*=\s*("?)([^";]+)\1/i);
|
|
222
|
+
if (u)
|
|
223
|
+
return u[2].trim();
|
|
212
224
|
}
|
|
213
225
|
async function x(t) {
|
|
214
226
|
if (!t || !t.length) {
|
|
@@ -217,7 +229,7 @@ const X = {
|
|
|
217
229
|
}
|
|
218
230
|
s.value = !0;
|
|
219
231
|
try {
|
|
220
|
-
const r = await Promise.all(t.map((
|
|
232
|
+
const r = await Promise.all(t.map((u) => d(u)));
|
|
221
233
|
e.value = r;
|
|
222
234
|
} catch (r) {
|
|
223
235
|
console.error("文件下载时发生错误:", r), e.value = [];
|
|
@@ -234,33 +246,33 @@ const X = {
|
|
|
234
246
|
await x(t ?? []);
|
|
235
247
|
},
|
|
236
248
|
{ immediate: !0, deep: !0 }
|
|
237
|
-
), (t, r) => (
|
|
249
|
+
), (t, r) => (y(), B("div", {
|
|
238
250
|
class: j([n.host === "electron" ? "mv-electron" : "mv-inline", "three-platform"])
|
|
239
251
|
}, [
|
|
240
|
-
v.value === o.ROBOT_SCENE ? (
|
|
252
|
+
v.value === o.ROBOT_SCENE ? (y(), b(P(h), {
|
|
241
253
|
key: 0,
|
|
242
254
|
"file-blobs": e.value,
|
|
243
255
|
"animation-data": t.animationData,
|
|
244
256
|
onGetThreeData: $,
|
|
245
257
|
threeData: n.threeData
|
|
246
|
-
}, null, 8, ["file-blobs", "animation-data", "threeData"])) : v.value === o.LATHE_SCENE ? (
|
|
258
|
+
}, null, 8, ["file-blobs", "animation-data", "threeData"])) : v.value === o.LATHE_SCENE ? (y(), b(P(p), {
|
|
247
259
|
key: 1,
|
|
248
260
|
fileUrls: t.fileUrls,
|
|
249
261
|
threeData: n.threeData,
|
|
250
|
-
trackFileType:
|
|
251
|
-
}, null, 8, ["fileUrls", "threeData", "trackFileType"])) : v.value === o.CPMPIP_SCENE ? (
|
|
262
|
+
trackFileType: U.value
|
|
263
|
+
}, null, 8, ["fileUrls", "threeData", "trackFileType"])) : v.value === o.CPMPIP_SCENE ? (y(), b(P(T), {
|
|
252
264
|
key: 2,
|
|
253
265
|
"file-blobs": e.value,
|
|
254
266
|
threeData: n.threeData
|
|
255
|
-
}, null, 8, ["file-blobs", "threeData"])) : v.value === o.PREVIEW ? (
|
|
267
|
+
}, null, 8, ["file-blobs", "threeData"])) : v.value === o.PREVIEW ? (y(), b(P(g), {
|
|
256
268
|
key: 3,
|
|
257
269
|
"file-blobs": e.value,
|
|
258
270
|
"animation-data": t.animationData
|
|
259
|
-
}, null, 8, ["file-blobs", "animation-data"])) :
|
|
260
|
-
s.value ? (
|
|
271
|
+
}, null, 8, ["file-blobs", "animation-data"])) : L("", !0),
|
|
272
|
+
s.value ? (y(), B("div", X, " 文件下载中,请稍候... ")) : L("", !0)
|
|
261
273
|
], 2));
|
|
262
274
|
}
|
|
263
|
-
}), ee = /* @__PURE__ */ q(Z, [["__scopeId", "data-v-5e37b1fe"]]),
|
|
275
|
+
}), ee = /* @__PURE__ */ q(Z, [["__scopeId", "data-v-5e37b1fe"]]), ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
264
276
|
__proto__: null,
|
|
265
277
|
default: ee
|
|
266
278
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -268,7 +280,8 @@ export {
|
|
|
268
280
|
ee as T,
|
|
269
281
|
Q as a,
|
|
270
282
|
se as b,
|
|
283
|
+
ie as c,
|
|
271
284
|
J as d,
|
|
272
|
-
|
|
285
|
+
ce as t,
|
|
273
286
|
K as u
|
|
274
287
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),m=require("./index-1z9RrjZc.cjs"),A=require("./index.vue_vue_type_style_index_1_lang-sTxwz1W3.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-_G53poH8.cjs");const L=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function O(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFile",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}function B(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/downloadFile",method:"post",data:l,headers:{Authorization:f,Accept:"application/octet-stream"},responseType:"blob"})}function q(l){const f=sessionStorage.getItem("loginToken")??"123456";return m.service({url:"/api/sysFile/uploadFiles",method:"post",data:l,headers:{Authorization:f,"Content-Type":"multipart/form-data"}})}const I=m.defineStore("threeState",{state:()=>({data:{extension:"",url:[],data:{},isThreeScene:!0}}),actions:{setData(l){this.data=l},getData(){return this.data}}});function R(){const l=A.useMenuState(m.pinia),{platform:f}=m.storeToRefs(l),y=I(m.pinia),S=t.computed(()=>{var e;return(e=y==null?void 0:y.data)==null?void 0:e.extension}),d=["uv","cpt","cyd"],v=["urdf"],s=["obj","stl"],o=[...d,...v,...s],P=e=>{if(!E())throw new Error("不是三维系统");y.setData(e)},h=()=>y.getData(),E=()=>f.value==="three",u=e=>{const i=e==null?void 0:e.toLowerCase(),c=i==null?void 0:i.lastIndexOf(".");let T=i;return c>=0&&(T=T==null?void 0:T.slice(c+1)),T},w=e=>{if(!e)return!1;const i=u(e);return o==null?void 0:o.includes(i)};return{getData:h,setData:P,isThreeSystem:E,isUrdf:e=>{if(!e)return!1;const i=u(e);return v==null?void 0:v.includes(i)},isGeneralFile:e=>{if(!e)return!1;const i=u(e);return s==null?void 0:s.includes(i)},isTrackPathFile:e=>{if(!e)return!1;const i=u(e);return d==null?void 0:d.includes(i)},isThreeFile:w,isUseBackdrop:e=>E()&&w(e),initTrackFileType:e=>{if(!e)return{isCpt:!1,isCyd:!1,isUv:!1};const i=u(e),c=d==null?void 0:d.find(b=>b===i);return{isCpt:c==="cpt",isCyd:c==="cyd",isUv:c==="uv"}},getFileExtension:u,extraExtension:S}}const x={key:4,class:"loading"},z=t.defineComponent({__name:"threeViewerHost",props:{fileUrls:{default:()=>[]},host:{default:"inline"},extension:{},animationData:{default:()=>({})},width:{default:"100%"},height:{default:"100%"},threeData:{},componentType:{}},emits:["getThreeData"],setup(l,{emit:f}){const y=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneView-FVcVEW7a.cjs"))),S=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threePreview-C_mY_TBC.cjs"))),d=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeLatheView-CZdorls1.cjs"))),v=t.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./threeSceneViewForCPMPIP-BoeTb3Fi.cjs"))),s={ROBOT_SCENE:"robot",LATHE_SCENE:"latheScene",CPMPIP_SCENE:"cpmpip",PREVIEW:"preview"},o=l,P=A.useMenuState(m.pinia),{platName:h}=m.storeToRefs(P),{isGeneralFile:E,isUrdf:u,isTrackPathFile:w,extraExtension:g}=R(),F=t.computed(()=>(o==null?void 0:o.extension)||g.value),k=t.computed(()=>{var n,r;return(r=(n=o==null?void 0:o.threeData)==null?void 0:n.data)==null?void 0:r.trackFileType}),C=t.computed(()=>{var r;if(o.componentType)switch(o.componentType){case"robot":return s.ROBOT_SCENE;case"latheScene":return s.LATHE_SCENE;case"cpmpip":return s.CPMPIP_SCENE;case"preview":return s.PREVIEW}const n=(r=o==null?void 0:o.fileUrls)==null?void 0:r[0];return E(n)?s.PREVIEW:(h==null?void 0:h.value)==="CPMPIP"&&(u(n)||u(F.value))?s.CPMPIP_SCENE:(h==null?void 0:h.value)==="SFRTubeBend"&&(u(n)||u(F.value))?s.ROBOT_SCENE:w(F.value)&&k.value?s.LATHE_SCENE:s.PREVIEW}),D=f,e=t.ref([]),i=t.ref(!1);function c(n){try{const r=new URL(n).pathname,p=r.substring(r.lastIndexOf("/")+1);return decodeURIComponent(p)}catch(r){return console.error("无法解析URL以提取文件名:",n,r),"未知文件名"}}async function T(n){let r,p;if(/^https?:\/\//.test(n))try{const a=await fetch(n);if(!a.ok)throw new Error(`下载文件失败: ${a.statusText} (URL: ${n})`);r=await a.blob(),p=c(n)}catch(a){throw console.error("使用 fetch 下载文件时出错:",a),a}else try{const a=await B({url:n});if(a.status!==200)throw new Error(`下载失败: ${a.status}`);const _=a.headers["content-disposition"];p=b(_)||"无文件名",r=a.data}catch(a){throw console.error("通过 API 下载文件时出错:",a),a}return new File([r],p,{type:r.type})}function b(n){if(!n)return;const r=n.match(/filename\*\s*=\s*([^;]+)/i);if(r){let a=r[1].trim();a=a.replace(/^"(.*)"$/,"$1");const _=a.split("''");if(_.length===2){const H=_[0].toUpperCase(),U=_[1];try{if(H==="UTF-8")return decodeURIComponent(U)}catch{}return U}try{return decodeURIComponent(a)}catch{return a}}const p=n.match(/filename\s*=\s*("?)([^";]+)\1/i);if(p)return p[2].trim()}async function N(n){if(!n||!n.length){e.value=[];return}i.value=!0;try{const r=await Promise.all(n.map(p=>T(p)));e.value=r}catch(r){console.error("文件下载时发生错误:",r),e.value=[]}finally{i.value=!1}}const M=()=>{D("getThreeData")};return t.watch(()=>o.fileUrls,async n=>{await N(n??[])},{immediate:!0,deep:!0}),(n,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([o.host==="electron"?"mv-electron":"mv-inline","three-platform"])},[C.value===s.ROBOT_SCENE?(t.openBlock(),t.createBlock(t.unref(y),{key:0,"file-blobs":e.value,"animation-data":n.animationData,onGetThreeData:M,threeData:o.threeData},null,8,["file-blobs","animation-data","threeData"])):C.value===s.LATHE_SCENE?(t.openBlock(),t.createBlock(t.unref(d),{key:1,fileUrls:n.fileUrls,threeData:o.threeData,trackFileType:k.value},null,8,["fileUrls","threeData","trackFileType"])):C.value===s.CPMPIP_SCENE?(t.openBlock(),t.createBlock(t.unref(v),{key:2,"file-blobs":e.value,threeData:o.threeData},null,8,["file-blobs","threeData"])):C.value===s.PREVIEW?(t.openBlock(),t.createBlock(t.unref(S),{key:3,"file-blobs":e.value,"animation-data":n.animationData},null,8,["file-blobs","animation-data"])):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createElementBlock("div",x," 文件下载中,请稍候... ")):t.createCommentVNode("",!0)],2))}}),V=L._export_sfc(z,[["__scopeId","data-v-5e37b1fe"]]),W=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));exports.ThreeViewerHost=V;exports.downloadAvatarApi=B;exports.threeViewerHost=W;exports.uploadAmountApi=q;exports.uploadFile=O;exports.useThreeState=I;exports.useThreeSystem=R;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var de = Object.defineProperty;
|
|
2
2
|
var me = (n, s, t) => s in n ? de(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
|
|
3
3
|
var x = (n, s, t) => me(n, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-
|
|
4
|
+
import { U as pe } from "./index.vue_vue_type_style_index_1_lang-BcKOWs1s.js";
|
|
5
5
|
import { S as ve, M as fe, O as be } from "./STLLoader-CiUjaQtA.js";
|
|
6
6
|
import { ay as we, n as E, h as he, e as _e, B as ge, V as z, Q as Me, E as ye, az as Re, J as Se } from "./three-viewport-gizmo-CkQ98n-T.js";
|
|
7
7
|
import { defineComponent as $e, ref as V, computed as D, watch as ue, resolveComponent as J, createElementBlock as j, openBlock as I, createVNode as F, createElementVNode as c, withCtx as L, createTextVNode as U, toDisplayString as C } from "vue";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-DOjFqzi3.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|
|
1
|
+
"use strict";var te=Object.defineProperty;var oe=(r,i,o)=>i in r?te(r,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[i]=o;var D=(r,i,o)=>oe(r,typeof i!="symbol"?i+"":i,o);const se=require("./index.vue_vue_type_style_index_1_lang-CbS7EB3k.cjs"),C=require("./STLLoader-RU7KqloS.cjs"),R=require("./three-viewport-gizmo-BV37JzRa.cjs"),e=require("vue"),ie=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),le={SINGLE:"单机",DOUBLE:"双机"},ne={ROBOT:1,PIPECOMPARSION:2},re="http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";function x(r){if(r==null||!isFinite(r))return"";const i=r/(1024*1024);if(i>=1)return`${i.toFixed(1)} MB`;const o=r/1024;return o>=1?`${o.toFixed(1)} KB`:`${r} B`}function ee(r){try{const i=r.split("?")[0].split("#")[0];return i.substring(i.lastIndexOf("/")+1)||i}catch{return r}}function ae(r){const{manager:i,baseFolderUrl:o,onFileProgress:l}=r,m=new se.URDFLoader(i);return m.packages=n=>`${o.endsWith("/")?o:o+"/"}${n}/`,m.loadMeshCb=(n,N,h)=>{const g=(()=>{const _=n.split("?")[0].split("#")[0],u=_.lastIndexOf(".");return u>=0?_.slice(u+1).toLowerCase():void 0})();switch(g){case"obj":{const _=(()=>{try{return new URL(".",n).toString()}catch{const c=n.lastIndexOf("/");return c>=0?n.slice(0,c+1):n}})(),u=(()=>{var v;return(((v=n.split("/").pop())==null?void 0:v.split("?")[0].split("#")[0])??"").replace(/\.[^/.?#]+$/,"")})(),f=`${_}${u}.mtl`,E=c=>{const v=new C.OBJLoader(N);c&&v.setMaterials(c),v.load(n,b=>h(b),b=>l==null?void 0:l(n,b==null?void 0:b.loaded,b==null?void 0:b.total),b=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${n}`,b),h(new R.Group)})},w=new C.MTLLoader(N);w.setResourcePath(_),w.load(f,c=>{try{c.preload()}catch{}E(c)},c=>l==null?void 0:l(f,c==null?void 0:c.loaded,c==null?void 0:c.total),c=>{console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${f}。将尝试无材质加载。`),E(void 0)});break}case"stl":{new C.STLLoader(N).load(n,u=>{const f=new R.MeshPhongMaterial({color:12303291,shininess:30}),E=new R.Mesh(u,f);E.castShadow=!0,E.receiveShadow=!0,h(E)},u=>l==null?void 0:l(n,u==null?void 0:u.loaded,u==null?void 0:u.total),u=>{console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${n}`,u),h(new R.Group)});break}default:console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${g} (路径: ${n})`),h(new R.Group)}},m}function ce(r,i,o,l){return{loadSceneFromFile:n=>new Promise((N,h)=>{o.value=!0,l.value="正在初始化 URDF 加载器...";let g=0,_=0,u=null;const f=new R.LoadingManager;f.onStart=(w,c,v)=>{g=v||0,_=c||0,l.value=g>0?`开始下载资源: 0 / ${g}`:"开始下载资源...",o.value=!0},f.onProgress=(w,c,v)=>{_=c,g=v;const b=`正在加载 ${c} / ${v} 个文件: ${ee(w)}`;l.value=b,c===v&&(l.value="资源加载完成,正在处理模型...",setTimeout(()=>{if(u){u.updateMatrixWorld(!0);const p=new R.Box3().setFromObject(u);p.isEmpty()&&console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"),u.userData.boundingBox=p,u.traverse(d=>{d.isMesh&&(d.castShadow=!0,d.receiveShadow=!0)}),N(u)}else h(new Error("URDF 文件本身加载失败。"));l.value="模型加载完成",setTimeout(()=>{l.value==="模型加载完成"&&(o.value=!1,l.value="")},500)},100))},f.onError=w=>{console.warn(`LoadingManager 报告一个资源加载失败: ${w}。加载流程将继续。`)};const E=(w,c,v)=>{const b=ee(w);let p;v&&v>0?p=`${b}(${x(c)} / ${x(v)})`:c&&c>0?p=`${b}(已下载 ${x(c)})`:p=`${b}`,l.value=`正在下载第 ${_+1} / ${g} 个文件: ${p}`};try{const w=URL.createObjectURL(n);ae({manager:f,baseFolderUrl:re,onFileProgress:E}).load(w,v=>{u=v},void 0,v=>{console.error(`加载 URDF 文件 (${n.name}) 时发生致命错误:`,v),l.value="URDF 文件解析失败",o.value=!1,h(new Error(`加载 URDF 文件失败: ${n.name}`,{cause:v}))})}catch(w){console.error("初始化 URDF 加载时发生致命错误:",w),l.value="模型加载失败",o.value=!1,h(w)}})}}class ue{constructor(i){D(this,"robot");D(this,"movableJoints");this.robot=i,this.movableJoints=this.getMovableJoints()}getMovableJoints(){return Object.values(this.robot.joints).filter(i=>i.jointType!=="fixed")}getMovableJointNames(){return this.movableJoints.map(i=>i.name)}setJointAngle(i,o){const l=this.robot.joints[i];if(!l||l.jointType==="fixed")return console.warn(`关节 ${i} 不存在或不可动`),!1;if(l.limit){const m=Math.max(l.limit.lower,Math.min(l.limit.upper,o));m!==o&&console.warn(`关节 ${i} 角度被限制在 [${l.limit.lower}, ${l.limit.upper}]`),l.setJointValue(m)}else l.setJointValue(o);return!0}setJointAngles(i){Object.entries(i).forEach(([o,l])=>{typeof l=="number"&&!isNaN(l)&&this.setJointAngle(o,l)})}getCurrentJointStates(){const i={};return this.movableJoints.forEach(o=>{i[o.name]=o.angle||0}),i}resetToZero(){this.movableJoints.forEach(i=>{i.setJointValue(0)})}getJointLimits(i){const o=this.robot.joints[i];return!o||!o.limit?null:{lower:o.limit.lower,upper:o.limit.upper}}async animateToState(i,o=1e3,l){const m=this.getCurrentJointStates(),n=Date.now();return new Promise(N=>{const h=()=>{const g=Date.now()-n,_=Math.min(g/o,1),u=this.easeInOutCubic(_),f={};Object.keys(i).forEach(E=>{const w=m[E]||0,c=i[E];f[E]=w+(c-w)*u}),this.setJointAngles(f),l&&l(_),_<1?requestAnimationFrame(h):N()};h()})}easeInOutCubic(i){return i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2}async playSequence(i,o=1e3,l){for(let m=0;m<i.length;m++)await this.animateToState(i[m],o,n=>{l&&l(m,n)})}}const de=(r,i="YZX")=>{const o=new R.Vector3,l=new R.Quaternion,m=new R.Vector3,n=new R.Euler;r.getWorldPosition(o),r.getWorldQuaternion(l),r.getWorldScale(m),n.setFromQuaternion(l,i);const N={x:r.rotation.x*180/Math.PI,y:r.rotation.y*180/Math.PI,z:r.rotation.z*180/Math.PI},h={x:n.x*180/Math.PI,y:n.y*180/Math.PI,z:n.z*180/Math.PI};return{position:r.position,rotation:N,scale:r.scale,worldPosition:o,worldRotation:h,worldScale:m}},me=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.position[i]=l,r.updateMatrixWorld(!0))},pe=(r,i,o)=>{const l=parseFloat(o);isNaN(l)||(r.rotation[i]=l*Math.PI/180,r.updateMatrixWorld(!0))},ve={class:"panel-content"},fe={class:"obj"},we={key:0,class:"obj-base"},be=["title"],he=["title"],Ve={key:1},_e={class:"obj-position"},Ee={class:"coord-item"},Ne={class:"coord-item"},ge={class:"coord-item"},ye={class:"obj-rotation"},Re={class:"coord-item"},Se={class:"coord-item"},Me={class:"coord-item"},De={class:"world"},Ce={class:"coord-line"},xe={class:"coord-text"},Fe={class:"world-position-item"},$e={class:"world-position-item"},Le={class:"world-position-item"},Oe={class:"coord-line"},Ue={class:"coord-text"},je={class:"world-rotation-item"},Je={class:"world-rotation-item"},ke={class:"world-rotation-item"},Ie=e.defineComponent({__name:"workpieceTreePanel",props:{model:{},maxExpandCount:{default:10},expandStrategy:{default:"breadth"}},emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(r,{emit:i}){const o=r,l=i,m=e.ref([]),n=e.ref({}),N=(t,s=0)=>{const V=[];return Array.isArray(t)&&(t==null?void 0:t.length)>0&&t.forEach(a=>{if(!(a!=null&&a.isMesh)){const y={name:a==null?void 0:a.name,label:(a==null?void 0:a.name)||(a==null?void 0:a.type),show:!0,level:s+1,isPenultimate:!1,type:a==null?void 0:a.type,id:a==null?void 0:a.id,limit:(a==null?void 0:a.limit)??"",children:N(a==null?void 0:a.children,s+1),path:a==null?void 0:a.name};V.push(y)}}),V},h=t=>t?[{name:t==null?void 0:t.name,label:(t==null?void 0:t.name)||(t==null?void 0:t.type),show:!0,level:1,isPenultimate:!1,type:t==null?void 0:t.type,id:t==null?void 0:t.id,limit:(t==null?void 0:t.limit)??"",children:N(t==null?void 0:t.children,1),path:t==null?void 0:t.name}]:[],g=(t,s)=>{const V=[],a=[...t];for(;a.length>0&&V.length<s;){const y=a.shift();y.children&&y.children.length>0&&(V.push(y.id),a.push(...y.children))}return V},_=(t,s)=>{const V=[];return t.forEach(a=>{if(a.children&&a.children.length>0){V.push(a.id);const y=a.children.filter(M=>M.children&&M.children.length>0).slice(0,s).map(M=>M.id);V.push(...y)}}),V.slice(0,s+1)};e.computed(()=>!m.value||m.value.length===0?[]:o.expandStrategy==="firstLevel"?_(m.value,o.maxExpandCount):g(m.value,o.maxExpandCount));const u=t=>t?parseFloat(t.toFixed(3)):0,f=t=>t?parseFloat(t.toFixed(1)):0,E=(t,s)=>{l("updatePosition",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},w=(t,s)=>{l("updateRotation",{obj:o.model,axis:s,value:(t==null?void 0:t.toString())||"0"})},c=t=>{l("visibleChange",t)},v=e.computed(()=>o!=null&&o.model?h(o.model):[]),b=e.computed(()=>{var t,s;return((t=o==null?void 0:o.model)==null?void 0:t.name)||((s=o==null?void 0:o.model)==null?void 0:s.type)}),p=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.type}),d=e.computed(()=>{var t;return(t=o==null?void 0:o.model)==null?void 0:t.visible});return e.watch(()=>o.model,()=>{o.model&&(n.value=de(o.model))},{deep:!0,immediate:!0}),e.watch(v,t=>{m.value=JSON.parse(JSON.stringify(t))},{immediate:!0}),(t,s)=>{var M,F,$,L,O,U,j,J,k,I,T,P,z,B,A,W,q,G,Q,X,Y,Z,K,H;const V=e.resolveComponent("el-divider"),a=e.resolveComponent("el-switch"),y=e.resolveComponent("el-input-number");return e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(V,null,{default:e.withCtx(()=>s[6]||(s[6]=[e.createTextVNode("对象")])),_:1,__:[6]}),e.createElementVNode("div",fe,[o.model?(e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"obj-name",title:b.value},e.toDisplayString(b.value),9,be),e.createElementVNode("div",{class:"obj-type",title:p.value},"["+e.toDisplayString(p.value)+"]",9,he)])):(e.openBlock(),e.createElementBlock("div",Ve,"空")),e.createVNode(a,{"model-value":d.value,onChange:c},null,8,["model-value"])]),e.createVNode(V,null,{default:e.withCtx(()=>s[7]||(s[7]=[e.createTextVNode("相对位置")])),_:1,__:[7]}),e.createElementVNode("div",_e,[e.createElementVNode("div",Ee,[s[8]||(s[8]=e.createElementVNode("span",{class:"axis-label"},"X",-1)),e.createVNode(y,{"model-value":u((F=(M=n.value)==null?void 0:M.position)==null?void 0:F.x),onChange:s[0]||(s[0]=S=>E(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Ne,[s[9]||(s[9]=e.createElementVNode("span",{class:"axis-label"},"Y",-1)),e.createVNode(y,{"model-value":u((L=($=n.value)==null?void 0:$.position)==null?void 0:L.y),onChange:s[1]||(s[1]=S=>E(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",ge,[s[10]||(s[10]=e.createElementVNode("span",{class:"axis-label"},"Z",-1)),e.createVNode(y,{"model-value":u((U=(O=n.value)==null?void 0:O.position)==null?void 0:U.z),onChange:s[2]||(s[2]=S=>E(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[11]||(s[11]=[e.createTextVNode("相对旋转")])),_:1,__:[11]}),e.createElementVNode("div",ye,[e.createElementVNode("div",Re,[s[12]||(s[12]=e.createElementVNode("span",{class:"axis-label"},"X°",-1)),e.createVNode(y,{"model-value":f((J=(j=n.value)==null?void 0:j.rotation)==null?void 0:J.x),onChange:s[3]||(s[3]=S=>w(S,"x")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Se,[s[13]||(s[13]=e.createElementVNode("span",{class:"axis-label"},"Y°",-1)),e.createVNode(y,{"model-value":f((I=(k=n.value)==null?void 0:k.rotation)==null?void 0:I.y),onChange:s[4]||(s[4]=S=>w(S,"y")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])]),e.createElementVNode("div",Me,[s[14]||(s[14]=e.createElementVNode("span",{class:"axis-label"},"Z°",-1)),e.createVNode(y,{"model-value":f((P=(T=n.value)==null?void 0:T.rotation)==null?void 0:P.z),onChange:s[5]||(s[5]=S=>w(S,"z")),size:"small",class:"coord-input-compact",precision:3,step:.1,controls:!0,"controls-position":"right"},null,8,["model-value"])])]),e.createVNode(V,null,{default:e.withCtx(()=>s[15]||(s[15]=[e.createTextVNode("世界信息")])),_:1,__:[15]}),e.createElementVNode("div",De,[e.createElementVNode("div",Ce,[s[16]||(s[16]=e.createElementVNode("span",{class:"coord-label"},"世界位置:",-1)),e.createElementVNode("span",xe,[e.createElementVNode("div",Fe,e.toDisplayString(u((B=(z=n.value)==null?void 0:z.worldPosition)==null?void 0:B.x))+", ",1),e.createElementVNode("div",$e,e.toDisplayString(u((W=(A=n.value)==null?void 0:A.worldPosition)==null?void 0:W.y))+", ",1),e.createElementVNode("div",Le,e.toDisplayString(u((G=(q=n.value)==null?void 0:q.worldPosition)==null?void 0:G.z)),1)])]),e.createElementVNode("div",Oe,[s[17]||(s[17]=e.createElementVNode("span",{class:"coord-label"},"世界旋转:",-1)),e.createElementVNode("span",Ue,[e.createElementVNode("div",je,e.toDisplayString(f((X=(Q=n.value)==null?void 0:Q.worldRotation)==null?void 0:X.x))+"°, ",1),e.createElementVNode("div",Je,e.toDisplayString(f((Z=(Y=n.value)==null?void 0:Y.worldRotation)==null?void 0:Z.y))+"°, ",1),e.createElementVNode("div",ke,e.toDisplayString(f((H=(K=n.value)==null?void 0:K.worldRotation)==null?void 0:H.z))+"° ",1)])])])])}}}),Te=ie._export_sfc(Ie,[["__scopeId","data-v-00d48931"]]);function Pe(r,i,o,l=["URDFVisual"]){let m=null;const n=e.ref(null),N=new R.Raycaster,h=new R.Vector2,g=new Map;function _(){o.value.forEach(p=>{p.traverse(d=>{l!=null&&l.includes(d.type)&&g.set(d.id,{obj:d,axis:d.axis||new R.Vector3(1,0,0),limits:d.limits})})})}function u(p){n.value&&n.value.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(0))}),n.value=p,p.obj.traverse(d=>{var t;d.material&&((t=d.material.emissive)==null||t.set(65280))})}function f(p){const d=r.value.getBoundingClientRect();h.x=(p.clientX-d.left)/d.width*2-1,h.y=-((p.clientY-d.top)/d.height)*2+1,N.setFromCamera(h,m);const t=N.intersectObjects(o.value,!0);if(t.length===0)return;let s=t[0].object,V=null;for(;s;){if(g.has(s.id)){V=g.get(s.id);break}s=s.parent}V&&u(V)}function E(){r.value&&r.value.removeEventListener("click",f,!1)}function w(){const{scene:p,camera:d}=i();m=d,_(),r.value&&r.value.addEventListener("click",f,!1)}function c(p){n.value&&(n.value.obj.visible=p)}function v(p){var s;const{axis:d,value:t}=p;me((s=n.value)==null?void 0:s.obj,d,t)}function b(p){var s;const{axis:d,value:t}=p;pe((s=n.value)==null?void 0:s.obj,d,t)}return{initRaycaster:w,dispose:E,selectedObject3D:n,setSelectedObjVisible:c,updatePosition:v,updateRotation:b}}exports.URDFRobotController=ue;exports.WorkpieceTreePanel=Te;exports.robotMode=le;exports.sceneType=ne;exports.useRaycaster=Pe;exports.useUrdfLoader=ce;
|