ss-component-new 1.1.821 → 1.1.823

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.
Files changed (141) hide show
  1. package/dist/{OrbitControls-D6pgin7s.js → OrbitControls-Cm4Xs_Bq.js} +1 -1
  2. package/dist/{OrbitControls-Ff5ikkUQ.cjs → OrbitControls-D-XDZGf-.cjs} +1 -1
  3. package/dist/{STLLoader-BNh7D2zV.cjs → STLLoader-BxpEhvEg.cjs} +161 -161
  4. package/dist/{STLLoader-LGKv5i3H.js → STLLoader-DofhZbOw.js} +522 -593
  5. package/dist/{array-D1hKYLwI.cjs → array-Bfmx0w6P.cjs} +2 -2
  6. package/dist/{array-C60T9pDZ.js → array-DbAuNWGt.js} +1 -1
  7. package/dist/{iconfont-v9CcCMwF.js → iconfont-DQodgJo8.js} +73 -75
  8. package/dist/iconfont-Di4uXnX1.cjs +1 -0
  9. package/dist/icons/svg/editTable.svg +1 -1
  10. package/dist/icons/svg/export.svg +1 -0
  11. package/dist/icons/svg/model.svg +1 -0
  12. package/dist/icons/svg/three.svg +1 -0
  13. package/dist/index-1i-XlS2m.js +101 -0
  14. package/dist/{index-BdsJiFeW.cjs → index-6jSC3unU.cjs} +1 -1
  15. package/dist/{index-2kzGjuzu.js → index-6zbHinQ6.js} +10 -9
  16. package/dist/index-B-oe2x1V.cjs +109 -0
  17. package/dist/index-B-qent3l.cjs +1 -0
  18. package/dist/{index-CukZ8eDZ.js → index-BBo52W9F.js} +4 -4
  19. package/dist/index-BOev8isw.cjs +21 -0
  20. package/dist/index-BQgnYD51.js +6492 -0
  21. package/dist/{index-owcnOlVq.js → index-BYW-ix_Q.js} +5 -5
  22. package/dist/{index-4_M1SpeV.js → index-Bi1gr72d.js} +14 -14
  23. package/dist/{index-DnVaHi8q.js → index-BmHmnXS9.js} +7 -7
  24. package/dist/index-BoS30LXH.cjs +1 -0
  25. package/dist/index-BuBMi9JA.cjs +1 -0
  26. package/dist/{index-Zi9xLtwj.js → index-BvE05H-i.js} +2 -2
  27. package/dist/index-BwpOMKef.cjs +1 -0
  28. package/dist/index-C18ZPRC7.cjs +1 -0
  29. package/dist/{index-HVJSfh2g.js → index-CJx2DcDb.js} +21 -19
  30. package/dist/{index-B3cUSGXB.js → index-CL59qQ_W.js} +9 -8
  31. package/dist/{index-DDsJpzfR.js → index-CLdN0W98.js} +47 -47
  32. package/dist/index-CPP7L10q.cjs +1 -0
  33. package/dist/index-CSWIBSmo.cjs +1 -0
  34. package/dist/{index-DEobyz7r.js → index-CTgZZ96L.js} +6 -5
  35. package/dist/{index-WXpPDsev.js → index-CZ1ui4mT.js} +1 -1
  36. package/dist/index-CfQvGqaX.cjs +1 -0
  37. package/dist/index-CgJYAzeA.cjs +1 -0
  38. package/dist/{index-Cuj-fGNO.cjs → index-ChZHGw_N.cjs} +1 -1
  39. package/dist/index-ChtmIuBu.js +29771 -0
  40. package/dist/index-CjFcaJcL.cjs +1 -0
  41. package/dist/index-CjTmkzBO.js +24 -0
  42. package/dist/{index-Dtw4WkUo.cjs → index-CngO0AUc.cjs} +1 -1
  43. package/dist/index-CqCPdyGu.js +1248 -0
  44. package/dist/index-Cr6pWv0l.cjs +1 -0
  45. package/dist/{index-Cw95lvvp.js → index-D8Msszln.js} +223 -223
  46. package/dist/index-DDvUG6fk.js +22 -0
  47. package/dist/{index-CdMrhxHS.js → index-DMlIMlyC.js} +10 -10
  48. package/dist/{index-3Cdyqd1B.cjs → index-DOBeGYzT.cjs} +1 -1
  49. package/dist/index-DP0k43fj.cjs +1 -0
  50. package/dist/index-DTxccgVM.cjs +1 -0
  51. package/dist/{index-JAJeIBYE.cjs → index-DVAGljX0.cjs} +1 -1
  52. package/dist/{index-B5Vi6RBj.cjs → index-DVCrYVKw.cjs} +1 -1
  53. package/dist/{index-CY2iphpd.cjs → index-DbniLh9G.cjs} +1 -1
  54. package/dist/index-Dj_ofPeK.cjs +1 -0
  55. package/dist/{index-DtogzZej.js → index-DocnYz5P.js} +1 -1
  56. package/dist/index-DrL7vroa.js +319 -0
  57. package/dist/index-Dt2McMki.js +13668 -0
  58. package/dist/{index-Cphx1eY1.js → index-Gba1Qfcc.js} +7 -8
  59. package/dist/{index-DMb9Vu-7.js → index-IUkCD4R_.js} +1 -1
  60. package/dist/{index-DAyzDsjs.js → index-K6BRW_Bw.js} +1 -1
  61. package/dist/{index-DzM8zZqe.js → index-OH9t-y2p.js} +4 -4
  62. package/dist/index-PNDdZKYG.cjs +1 -0
  63. package/dist/{index-Dn04IPFM.js → index-QETLKFyV.js} +10 -10
  64. package/dist/{index-BWHtpT9o.cjs → index-RgTvyK54.cjs} +1 -1
  65. package/dist/{index-CF_0RdqV.cjs → index-dukFqRog.cjs} +1 -1
  66. package/dist/{index-C9Boo2Cw.cjs → index-dyoOdMKX.cjs} +1 -1
  67. package/dist/index-f9bwREQl.cjs +1 -0
  68. package/dist/{index-Dxoxm0Cc.js → index-mmWAqzR5.js} +25 -25
  69. package/dist/index-rPc9VS0S.cjs +1 -0
  70. package/dist/index-tPamnhR2.js +236 -0
  71. package/dist/{index-H3kf9EQv.js → index-tX2Hs05F.js} +11 -10
  72. package/dist/{index-DEU-pXeW.js → index-uvns6W6E.js} +1838 -1812
  73. package/dist/index-weauvEnW.cjs +4 -0
  74. package/dist/{index-B8xEed7C.cjs → index-wlnPb2aB.cjs} +1 -1
  75. package/dist/{index.vue_vue_type_script_setup_true_lang-iyZtrhDf.js → index.vue_vue_type_script_setup_true_lang-C4G6mB7R.js} +28 -28
  76. package/dist/{index.vue_vue_type_script_setup_true_lang-CaYQQb8M.cjs → index.vue_vue_type_script_setup_true_lang-CWi4UVPF.cjs} +1 -1
  77. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-qefZ9E5G.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CtN9Ij0Y.js} +53 -23
  78. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-CTcahF4Z.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-mQIxU0SD.cjs} +90 -90
  79. package/dist/{index.vue_vue_type_style_index_0_scoped_6bfd62db_lang-Cxjh1E1z.js → index.vue_vue_type_style_index_0_scoped_1966237d_lang-D3xcEtDT.js} +6488 -6474
  80. package/dist/{index.vue_vue_type_style_index_0_scoped_6bfd62db_lang-0eNHRdYw.cjs → index.vue_vue_type_style_index_0_scoped_1966237d_lang-DwIFJsxs.cjs} +14 -14
  81. package/dist/{index.vue_vue_type_style_index_0_scoped_86d2b6b8_lang-kymzIBO8.js → index.vue_vue_type_style_index_0_scoped_86d2b6b8_lang-D5CTJUDi.js} +17 -17
  82. package/dist/{index.vue_vue_type_style_index_0_scoped_86d2b6b8_lang-GlR2V0TC.cjs → index.vue_vue_type_style_index_0_scoped_86d2b6b8_lang-VPQBXOPW.cjs} +1 -1
  83. package/dist/index.vue_vue_type_style_index_1_lang-DraQDAAw.cjs +32 -0
  84. package/dist/index.vue_vue_type_style_index_1_lang-hffXwR3x.js +7028 -0
  85. package/dist/isUndefined-4Qg9wncf.js +84 -0
  86. package/dist/isUndefined-BEt4O79g.cjs +1 -0
  87. package/dist/{main-C6I42yaU.js → main-CBCk94h5.js} +30 -29
  88. package/dist/main-DO_PN7jt.cjs +1 -0
  89. package/dist/ss-component.cjs +1 -1
  90. package/dist/ss-component.css +2 -2
  91. package/dist/ss-component.js +11 -11
  92. package/dist/ss-component2.cjs +1 -1
  93. package/dist/ss-component2.js +12 -12
  94. package/dist/threeModel-GKSAzHfe.cjs +1 -0
  95. package/dist/{threeModel-BEt5OVCP.js → threeModel-RJwJMtfW.js} +91 -92
  96. package/dist/{threePreview-BUZRvBRx.js → threePreview-BSqdALPK.js} +3 -3
  97. package/dist/{threePreview-Dyzqu5s7.cjs → threePreview-CKvbwCiX.cjs} +1 -1
  98. package/dist/threeSceneView-BVbVe_Et.js +1277 -0
  99. package/dist/threeSceneView-KvCERteS.cjs +5 -0
  100. package/dist/{threeViewerHost-IhSFkCeD.js → threeViewerHost-AuhfL2Cn.js} +55 -57
  101. package/dist/threeViewerHost-D0pu5wk5.cjs +1 -0
  102. package/package.json +1 -1
  103. package/public/icons/svg/editTable.svg +1 -1
  104. package/public/icons/svg/export.svg +1 -0
  105. package/public/icons/svg/model.svg +1 -0
  106. package/public/icons/svg/three.svg +1 -0
  107. package/dist/animationData-B2T3Oamw.js +0 -108
  108. package/dist/animationData-Db_9HBoM.cjs +0 -1
  109. package/dist/iconfont-CZj6ltAs.cjs +0 -1
  110. package/dist/index-2KKrCkl8.cjs +0 -1
  111. package/dist/index-2OWkrGDh.js +0 -24
  112. package/dist/index-B1iXzkUF.cjs +0 -1
  113. package/dist/index-BBB4VObc.cjs +0 -11
  114. package/dist/index-BIVWMqJQ.cjs +0 -1
  115. package/dist/index-BWpZSzL1.cjs +0 -1
  116. package/dist/index-BllULnvx.cjs +0 -1
  117. package/dist/index-BvO1uTn0.js +0 -21
  118. package/dist/index-C2bI4adc.js +0 -8628
  119. package/dist/index-C9pN8_un.js +0 -548
  120. package/dist/index-CPdKWCSo.cjs +0 -1
  121. package/dist/index-CQfFbeTJ.cjs +0 -1
  122. package/dist/index-CZJOPfp5.js +0 -1152
  123. package/dist/index-Cb0q1Y5b.cjs +0 -1
  124. package/dist/index-Cfomm0G1.cjs +0 -109
  125. package/dist/index-CvvFU_QA.cjs +0 -1
  126. package/dist/index-DYMLmifU.cjs +0 -1
  127. package/dist/index-DfPyuGyq.js +0 -101
  128. package/dist/index-Dm2qfeUm.cjs +0 -1
  129. package/dist/index-DtX1F0sz.cjs +0 -4
  130. package/dist/index-Du3VUDcF.cjs +0 -1
  131. package/dist/index-VWNqRYy9.js +0 -36270
  132. package/dist/index-kmj8K3JX.cjs +0 -1
  133. package/dist/index-ndZw4AQJ.cjs +0 -1
  134. package/dist/index-y5FEcncv.cjs +0 -1
  135. package/dist/index.vue_vue_type_style_index_1_lang-Bmwy3cgo.cjs +0 -42
  136. package/dist/index.vue_vue_type_style_index_1_lang-Rs1M3B8e.js +0 -11984
  137. package/dist/main-2gDZp_zL.cjs +0 -1
  138. package/dist/threeModel-DgOcIXVI.cjs +0 -1
  139. package/dist/threeSceneView-BZx98QgN.js +0 -1450
  140. package/dist/threeSceneView-DSkGJN5d.cjs +0 -5
  141. package/dist/threeViewerHost-T_51aUg5.cjs +0 -1
@@ -1,1450 +0,0 @@
1
- var Ne = Object.defineProperty;
2
- var We = (w, s, o) => s in w ? Ne(w, s, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[s] = o;
3
- var ke = (w, s, o) => We(w, typeof s != "symbol" ? s + "" : s, o);
4
- import { defineComponent as Pe, ref as P, watch as ne, shallowRef as fe, computed as ge, onUnmounted as Te, resolveComponent as le, createElementBlock as Z, openBlock as U, createElementVNode as m, createCommentVNode as ae, createBlock as ve, createVNode as b, withCtx as H, unref as J, Fragment as Ve, renderList as Ae, toDisplayString as N, onMounted as Ee, nextTick as Se, onBeforeUnmount as qe, withDirectives as te, isRef as he, vModelRadio as be, vShow as ye } from "vue";
5
- import { u as Ke, a as He, b as Qe, S as T } from "./iconfont-v9CcCMwF.js";
6
- import { U as et, B as tt } from "./index-VWNqRYy9.js";
7
- import { L as lt, n as Re, o as nt, h as at, e as _e, p as ot, O as st, B as it, m as ze, T as Je, V as X, k as oe, l as rt } from "./STLLoader-LGKv5i3H.js";
8
- import { a as K } from "./index-DEU-pXeW.js";
9
- import { c as Me } from "./index.vue_vue_type_style_index_1_lang-Rs1M3B8e.js";
10
- import { E as Y, H as xe } from "./index-C2bI4adc.js";
11
- import { f as ut, a as ct } from "./animationData-B2T3Oamw.js";
12
- import { o as dt, p as pt } from "./index-Cw95lvvp.js";
13
- import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- const mt = "http://222.92.178.198:60000/chfs/shared/Insofrobot/urdf";
15
- function De(w) {
16
- if (w == null || !isFinite(w)) return "";
17
- const s = w / (1024 * 1024);
18
- if (s >= 1) return `${s.toFixed(1)} MB`;
19
- const o = w / 1024;
20
- return o >= 1 ? `${o.toFixed(1)} KB` : `${w} B`;
21
- }
22
- function Le(w) {
23
- try {
24
- const s = w.split("?")[0].split("#")[0];
25
- return s.substring(s.lastIndexOf("/") + 1) || s;
26
- } catch {
27
- return w;
28
- }
29
- }
30
- function vt(w) {
31
- const { manager: s, baseFolderUrl: o, onFileProgress: r } = w, g = new et(s);
32
- return g.packages = (f) => `${o.endsWith("/") ? o : o + "/"}${f}/`, g.loadMeshCb = (f, y, C) => {
33
- const p = (() => {
34
- const k = f.split("?")[0].split("#")[0], c = k.lastIndexOf(".");
35
- return c >= 0 ? k.slice(c + 1).toLowerCase() : void 0;
36
- })();
37
- switch (p) {
38
- // OBJ+MTL
39
- case "obj": {
40
- const k = (() => {
41
- try {
42
- return new URL(".", f).toString();
43
- } catch {
44
- const e = f.lastIndexOf("/");
45
- return e >= 0 ? f.slice(0, e + 1) : f;
46
- }
47
- })(), c = (() => {
48
- var i;
49
- return (((i = f.split("/").pop()) == null ? void 0 : i.split("?")[0].split("#")[0]) ?? "").replace(/\.[^/.?#]+$/, "");
50
- })(), _ = `${k}${c}.mtl`, n = (e) => {
51
- const i = new st(y);
52
- e && i.setMaterials(e), i.load(
53
- f,
54
- (l) => C(l),
55
- (l) => r == null ? void 0 : r(f, l == null ? void 0 : l.loaded, l == null ? void 0 : l.total),
56
- (l) => {
57
- console.error(`[URDF 资源加载失败,已跳过] 无法加载 OBJ 模型: ${f}`, l), C(new Re());
58
- }
59
- );
60
- }, t = new ot(y);
61
- t.setResourcePath(k), t.load(
62
- _,
63
- (e) => {
64
- try {
65
- e.preload();
66
- } catch {
67
- }
68
- n(e);
69
- },
70
- (e) => r == null ? void 0 : r(_, e == null ? void 0 : e.loaded, e == null ? void 0 : e.total),
71
- (e) => {
72
- console.warn(`[URDF 资源警告] 未找到或加载材质失败: ${_}。将尝试无材质加载。`), n(void 0);
73
- }
74
- );
75
- break;
76
- }
77
- case "stl": {
78
- new nt(y).load(
79
- f,
80
- (c) => {
81
- const _ = new at({ color: 12303291, shininess: 30 }), n = new _e(c, _);
82
- n.castShadow = !0, n.receiveShadow = !0, C(n);
83
- },
84
- (c) => r == null ? void 0 : r(f, c == null ? void 0 : c.loaded, c == null ? void 0 : c.total),
85
- (c) => {
86
- console.error(`[URDF 资源加载失败,已跳过] 无法加载 STL 模型: ${f}`, c), C(new Re());
87
- }
88
- );
89
- break;
90
- }
91
- default:
92
- console.error(`[URDF 资源加载失败,已跳过] 不支持的网格格式: .${p} (路径: ${f})`), C(new Re());
93
- }
94
- }, g;
95
- }
96
- function ft(w, s, o, r) {
97
- return { loadSceneFromFile: (f) => new Promise((y, C) => {
98
- o.value = !0, r.value = "正在初始化 URDF 加载器...";
99
- let p = 0, k = 0, c = null;
100
- const _ = new lt();
101
- _.onStart = (t, e, i) => {
102
- p = i || 0, k = e || 0, r.value = p > 0 ? `开始下载资源: 0 / ${p}` : "开始下载资源...", o.value = !0;
103
- }, _.onProgress = (t, e, i) => {
104
- k = e, p = i;
105
- const l = `正在加载 ${e} / ${i} 个文件: ${Le(t)}`;
106
- r.value = l, e === i && (r.value = "资源加载完成,正在处理模型...", setTimeout(() => {
107
- if (c) {
108
- c.updateMatrixWorld(!0);
109
- const d = new it().setFromObject(c);
110
- d.isEmpty() && console.warn("模型加载完成,但所有可视化网格均加载失败,模型将不可见。"), c.userData.boundingBox = d, c.traverse((R) => {
111
- R.isMesh && (R.castShadow = !0, R.receiveShadow = !0);
112
- }), y(c);
113
- } else
114
- C(new Error("URDF 文件本身加载失败。"));
115
- r.value = "模型加载完成", setTimeout(() => {
116
- r.value === "模型加载完成" && (o.value = !1, r.value = "");
117
- }, 500);
118
- }, 100));
119
- }, _.onError = (t) => {
120
- console.warn(`LoadingManager 报告一个资源加载失败: ${t}。加载流程将继续。`);
121
- };
122
- const n = (t, e, i) => {
123
- const l = Le(t);
124
- let d;
125
- i && i > 0 ? d = `${l}(${De(e)} / ${De(i)})` : e && e > 0 ? d = `${l}(已下载 ${De(e)})` : d = `${l}`, r.value = `正在下载第 ${k + 1} / ${p} 个文件: ${d}`;
126
- };
127
- try {
128
- const t = URL.createObjectURL(f);
129
- vt({
130
- manager: _,
131
- baseFolderUrl: mt,
132
- onFileProgress: n
133
- }).load(
134
- t,
135
- (i) => {
136
- c = i;
137
- },
138
- void 0,
139
- (i) => {
140
- console.error(`加载 URDF 文件 (${f.name}) 时发生致命错误:`, i), r.value = "URDF 文件解析失败", o.value = !1, C(new Error(`加载 URDF 文件失败: ${f.name}`, { cause: i }));
141
- }
142
- );
143
- } catch (t) {
144
- console.error("初始化 URDF 加载时发生致命错误:", t), r.value = "模型加载失败", o.value = !1, C(t);
145
- }
146
- }) };
147
- }
148
- class gt {
149
- constructor(s) {
150
- ke(this, "robot");
151
- ke(this, "movableJoints");
152
- this.robot = s, this.movableJoints = this.getMovableJoints();
153
- }
154
- /**
155
- * 获取所有可动关节
156
- */
157
- getMovableJoints() {
158
- return Object.values(this.robot.joints).filter((s) => s.jointType !== "fixed");
159
- }
160
- /**
161
- * 获取可动关节名称列表
162
- */
163
- getMovableJointNames() {
164
- return this.movableJoints.map((s) => s.name);
165
- }
166
- /**
167
- * 设置单个关节角度
168
- */
169
- setJointAngle(s, o) {
170
- const r = this.robot.joints[s];
171
- if (!r || r.jointType === "fixed")
172
- return console.warn(`关节 ${s} 不存在或不可动`), !1;
173
- if (r.limit) {
174
- const g = Math.max(r.limit.lower, Math.min(r.limit.upper, o));
175
- g !== o && console.warn(`关节 ${s} 角度被限制在 [${r.limit.lower}, ${r.limit.upper}]`), r.setJointValue(g);
176
- } else
177
- r.setJointValue(o);
178
- return !0;
179
- }
180
- /**
181
- * 批量设置关节角度
182
- */
183
- setJointAngles(s) {
184
- Object.entries(s).forEach(([o, r]) => {
185
- typeof r == "number" && !isNaN(r) && this.setJointAngle(o, r);
186
- });
187
- }
188
- /**
189
- * 获取当前所有关节状态
190
- */
191
- getCurrentJointStates() {
192
- const s = {};
193
- return this.movableJoints.forEach((o) => {
194
- s[o.name] = o.angle || 0;
195
- }), s;
196
- }
197
- /**
198
- * 重置所有关节到零位
199
- */
200
- resetToZero() {
201
- this.movableJoints.forEach((s) => {
202
- s.setJointValue(0);
203
- });
204
- }
205
- /**
206
- * 获取关节限制信息
207
- */
208
- getJointLimits(s) {
209
- const o = this.robot.joints[s];
210
- return !o || !o.limit ? null : {
211
- lower: o.limit.lower,
212
- upper: o.limit.upper
213
- };
214
- }
215
- /**
216
- * 线性插值动画到目标状态
217
- */
218
- async animateToState(s, o = 1e3, r) {
219
- const g = this.getCurrentJointStates(), f = Date.now();
220
- return new Promise((y) => {
221
- const C = () => {
222
- const p = Date.now() - f, k = Math.min(p / o, 1), c = this.easeInOutCubic(k), _ = {};
223
- Object.keys(s).forEach((n) => {
224
- const t = g[n] || 0, e = s[n];
225
- _[n] = t + (e - t) * c;
226
- }), this.setJointAngles(_), r && r(k), k < 1 ? requestAnimationFrame(C) : y();
227
- };
228
- C();
229
- });
230
- }
231
- /**
232
- * 缓动函数
233
- */
234
- easeInOutCubic(s) {
235
- return s < 0.5 ? 4 * s * s * s : 1 - Math.pow(-2 * s + 2, 3) / 2;
236
- }
237
- /**
238
- * 播放关键帧动画序列
239
- */
240
- async playSequence(s, o = 1e3, r) {
241
- for (let g = 0; g < s.length; g++)
242
- await this.animateToState(s[g], o, (f) => {
243
- r && r(g, f);
244
- });
245
- }
246
- }
247
- const ue = 1e-3, se = rt.degToRad, Ue = (w) => w.reduce((s, o) => {
248
- let r = 0;
249
- const g = o.Y ?? 0, f = o.C ?? 0, y = o.R ?? 0;
250
- return g > 0 && (r += g), f > 0 && y > 0 && (r += y * se(f)), s + r;
251
- }, 0), Oe = (w) => {
252
- const s = [], o = w.Y ?? 0, r = w.B ?? 0, g = w.C ?? 0, f = w.R ?? 0, y = {
253
- pos: new X(0, 0, 0),
254
- localY: new X(0, 1, 0),
255
- localX: new X(1, 0, 0),
256
- localZ: new X(0, 0, 1)
257
- };
258
- if (!o && !g) return s;
259
- if (s.push(y.pos.clone()), r !== 0) {
260
- const C = new oe().makeRotationAxis(y.localY, se(r));
261
- y.localX.applyMatrix4(C), y.localZ.applyMatrix4(C);
262
- }
263
- if (o > 0 && (y.pos.add(y.localY.clone().multiplyScalar(o * ue)), s.push(y.pos.clone())), g > 0 && f > 0) {
264
- const C = se(g), p = f * ue, k = y.pos.clone().add(y.localX.clone().multiplyScalar(-p)), c = Math.max(16, Math.ceil(g / 5));
265
- for (let _ = 1; _ <= c; _++) {
266
- const n = C * _ / c, t = new oe().makeRotationAxis(y.localZ, n), i = y.localX.clone().multiplyScalar(p).applyMatrix4(t), l = k.clone().add(i);
267
- s.push(l);
268
- }
269
- }
270
- return s;
271
- };
272
- function we(w, s, o, r, g, f = 0) {
273
- let y = s.slice(0, g + 1);
274
- const C = s[g + 1];
275
- if (C && f > 0) {
276
- const e = {
277
- ...C,
278
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
279
- B: (C.B ?? 0) * f,
280
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
281
- C: (C.C ?? 0) * f
282
- };
283
- y.push(e);
284
- }
285
- const p = Ue(y), k = Math.max(0, o - p), c = [];
286
- c.push(new X(0, 0, 0));
287
- const _ = new X(0, k * ue, 0);
288
- k > 0 && c.push(_);
289
- let n = {
290
- pos: _.clone(),
291
- localY: new X(0, 1, 0),
292
- localX: new X(1, 0, 0),
293
- localZ: new X(0, 0, 1)
294
- };
295
- const t = [];
296
- for (let e = y.length - 1; e >= 0; e--) {
297
- const i = y[e], l = Oe(i);
298
- if (l.length > 0) {
299
- const d = l.map((S) => {
300
- const O = S.clone(), q = new oe();
301
- return q.makeBasis(n.localX, n.localY, n.localZ), O.applyMatrix4(q), O.add(n.pos);
302
- });
303
- t.push(d);
304
- const R = d[d.length - 1];
305
- n.pos = R.clone();
306
- const j = i.B ?? 0, L = i.C ?? 0;
307
- if (j !== 0) {
308
- const S = new oe().makeRotationAxis(n.localY, se(j));
309
- n.localX.applyMatrix4(S), n.localZ.applyMatrix4(S);
310
- }
311
- if (L > 0) {
312
- const S = se(L), O = new oe().makeRotationAxis(n.localZ, S);
313
- n.localY.applyMatrix4(O), n.localX.applyMatrix4(O);
314
- }
315
- }
316
- }
317
- for (const e of t)
318
- e.length > 1 && c.push(...e.slice(1));
319
- c.length < 2 && c.push(new X(0, 1e-3, 0));
320
- try {
321
- const e = new ze(c, !1, "catmullrom", 0.01), i = new Je(e, Math.max(2, c.length * 4), r * ue, 18, !1);
322
- w.geometry.dispose(), w.geometry = i;
323
- } catch (e) {
324
- console.error("管件更新失败", e);
325
- }
326
- }
327
- function Fe(w, s, o, r = 0) {
328
- let g = w.slice(0, o + 1);
329
- const f = w[o + 1];
330
- if (f && r > 0) {
331
- const n = {
332
- ...f,
333
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
334
- B: (f.B ?? 0) * r,
335
- // 根据插值因子计算当前的弯曲角度C,实现从0到目标角度的平滑过渡
336
- C: (f.C ?? 0) * r
337
- };
338
- g.push(n);
339
- }
340
- const y = Ue(g), C = Math.max(0, s - y), p = [];
341
- p.push(new X(0, 0, 0));
342
- const k = new X(0, C * ue, 0);
343
- C > 0 && p.push(k);
344
- let c = {
345
- pos: k.clone(),
346
- localY: new X(0, 1, 0),
347
- localX: new X(1, 0, 0),
348
- localZ: new X(0, 0, 1)
349
- };
350
- const _ = [];
351
- for (let n = g.length - 1; n >= 0; n--) {
352
- const t = g[n], e = Oe(t);
353
- if (e.length > 0) {
354
- const i = e.map((j) => {
355
- const L = j.clone(), S = new oe();
356
- return S.makeBasis(c.localX, c.localY, c.localZ), L.applyMatrix4(S), L.add(c.pos);
357
- });
358
- _.push(i);
359
- const l = i[i.length - 1];
360
- c.pos = l.clone();
361
- const d = t.B ?? 0, R = t.C ?? 0;
362
- if (d !== 0) {
363
- const j = new oe().makeRotationAxis(c.localY, se(d));
364
- c.localX.applyMatrix4(j), c.localZ.applyMatrix4(j);
365
- }
366
- if (R > 0) {
367
- const j = se(R), L = new oe().makeRotationAxis(c.localZ, j);
368
- c.localY.applyMatrix4(L), c.localX.applyMatrix4(L);
369
- }
370
- }
371
- }
372
- for (const n of _)
373
- n.length > 1 && p.push(...n.slice(1));
374
- return p.length < 2 && p.push(new X(0, 1e-3, 0)), p;
375
- }
376
- function me(w, s, o, r, g, f, y, C = 0, p = 0) {
377
- const k = g - p, c = Fe(o, k, y, C);
378
- let n = Fe(r, p, y, C);
379
- n.forEach((e) => e.y = -e.y), n.reverse();
380
- const t = [...n, ...c];
381
- try {
382
- const e = new ze(t, !1, "catmullrom", 0.01), i = new Je(e, Math.max(2, t.length * 4), f * ue, 18, !1);
383
- s.geometry.dispose(), w.geometry.dispose(), s.parent && s.parent.remove(s), w.geometry = i;
384
- } catch (e) {
385
- console.error("管件更新失败", e);
386
- }
387
- }
388
- const re = {
389
- SINGLE: "单机器人弯管",
390
- DOUBLE: "双机器人弯管"
391
- }, ht = { class: "panel-content" }, bt = { class: "action-bar" }, yt = {
392
- key: 0,
393
- class: "animation-controls"
394
- }, wt = { class: "control-row" }, _t = { class: "control-row" }, Ct = { class: "control-row" }, $t = { class: "frame-info" }, kt = { class: "control-row" }, Rt = { class: "progress-bar" }, Mt = {
395
- key: 1,
396
- class: "table-footer"
397
- }, Dt = { class: "dialog-footer" }, Pt = /* @__PURE__ */ Pe({
398
- __name: "animationPanel",
399
- props: {
400
- model: {},
401
- threeData: {},
402
- isSelfWindow: { type: Boolean }
403
- },
404
- emits: ["getThreeData"],
405
- setup(w, { emit: s }) {
406
- const o = w, r = s, g = P(), f = P(), y = P("单机器人弯管");
407
- ne(() => o.threeData, () => {
408
- const u = Me(o.threeData), a = u == null ? void 0 : u.data;
409
- if (y.value = a == null ? void 0 : a.任务类型, !o.isSelfWindow && o.threeData) {
410
- let h = {};
411
- y.value === re.SINGLE && (h = u == null ? void 0 : u.singleRobotData), y.value === re.DOUBLE && (h = u == null ? void 0 : u.doubleRobotData);
412
- const {
413
- initialPipeLength: M = 0,
414
- pipeRadius: $ = 0,
415
- clampLength: x = 0,
416
- animationData: F
417
- } = h;
418
- L.value = M, S.value = $, O.value = x, g.value = F;
419
- const V = Me(g.value);
420
- p.value = (V == null ? void 0 : V["输出(动画数据)"]) || [];
421
- let G = (V == null ? void 0 : V["输出(动画数据)Content"]) ?? [];
422
- G && (f.value = G);
423
- }
424
- }, {
425
- immediate: !0
426
- });
427
- const C = async () => {
428
- if (!sessionStorage.getItem("systemKey")) {
429
- r("getThreeData");
430
- return;
431
- }
432
- let a = {};
433
- y.value === re.SINGLE && (a = await ut()), y.value === re.DOUBLE && (a = await ct());
434
- const {
435
- initialPipeLength: h = 0,
436
- pipeRadius: M = 0,
437
- clampLength: $ = 0,
438
- animationData: x
439
- } = a;
440
- L.value = h, S.value = M, O.value = $, g.value = x;
441
- const F = Me(g.value);
442
- p.value = (F == null ? void 0 : F["输出(动画数据)"]) || [];
443
- let V = (F == null ? void 0 : F["输出(动画数据)Content"]) ?? [];
444
- V && (f.value = V);
445
- }, p = P([]), k = P(!1), c = P(""), _ = P(!1), n = P(0), t = P(0), e = P(1e3), i = P(null);
446
- let l = !1;
447
- const d = fe(null), R = fe(null), j = fe(null), L = P(1302), S = P(12.5), O = P(30), q = P([]), Q = P(null), B = ge(() => o.model ? Object.values(o.model.joints).filter((u) => u.jointType !== "fixed").map((u) => u.name) : []), $e = P(["Y", "B", "C", "R"]), z = ge(() => [...B.value, ...$e.value]), ie = ge(() => z.value.length > 0 ? `请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
448
- ${z.value.join(" ")}
449
- 0 0 0 ...
450
- 1 2 3 ...` : "请先加载模型。"), ce = (u, a) => {
451
- if (!a)
452
- return null;
453
- const h = u.links[a];
454
- if (!h)
455
- return console.warn(`在模型中未找到名为 '${a}' 的 link`), console.log("可用的链接:", Object.keys(u.links)), null;
456
- let M = null;
457
- return h.traverse(($) => {
458
- $ instanceof _e && !M && (M = $);
459
- }), M || console.warn(`在 link '${a}' 中未找到可用的 Mesh 对象`), M;
460
- }, de = () => {
461
- j.value && (j.value.visible = !0), d.value && d.value.parent && d.value.parent.remove(d.value), j.value = null, d.value = null, R.value = null;
462
- };
463
- ne(z, (u, a) => {
464
- if (JSON.stringify(u) !== JSON.stringify(a))
465
- if (u.length > 0) {
466
- const h = u.reduce((M, $) => (M[$] = "0", M), {});
467
- p.value = [h];
468
- } else
469
- p.value = [];
470
- }, { immediate: !0 }), ne(() => o.model, (u) => {
471
- de(), u ? (i.value = new gt(u), q.value = Object.keys(u.links), q.value.includes("Pipe_Link") ? Q.value = "Pipe_Link" : Q.value = null) : (i.value = null, q.value = [], Q.value = null);
472
- }, { immediate: !0 }), ne([Q, O], ([u, a]) => {
473
- if (de(), o.model && u) {
474
- const h = ce(o.model, u);
475
- if (console.log(h, "meshToReplace"), h && h.parent) {
476
- j.value = h;
477
- const M = new _e(
478
- h.geometry.clone(),
479
- h.material
480
- );
481
- if (M.name = "managed_pipe_clone", h.parent.add(M), M.position.copy(h.position), M.rotation.copy(h.rotation), M.scale.copy(h.scale), h.visible = !1, y.value === re.SINGLE && (M.position.y -= a * 1e-3), d.value = M, y.value === re.DOUBLE) {
482
- const $ = new _e(
483
- h.geometry.clone(),
484
- h.material
485
- );
486
- $.name = "managed_oppsite_pipe_clone", $.position.copy(h.position), $.rotation.copy(h.rotation), $.scale.copy(h.scale), h.parent.add($), R.value = $;
487
- }
488
- d.value && R.value && me(
489
- d.value,
490
- R.value,
491
- [],
492
- [],
493
- L.value,
494
- S.value,
495
- 0,
496
- 0,
497
- O.value
498
- ), Y.success(`已将 Link: "${u}" 设置为当前管件`);
499
- } else
500
- u && console.warn(`在 link '${u}' 中未找到可替换的网格或其没有父级。`);
501
- }
502
- });
503
- const pe = () => p.value.map((u) => ({
504
- Y: parseFloat(u.Y) || 0,
505
- B: parseFloat(u.B) || 0,
506
- C: parseFloat(u.C) || 0,
507
- R: parseFloat(u.R) || 0
508
- })), E = () => {
509
- const u = [], a = [];
510
- return p.value.forEach((h) => {
511
- const { Y1: M, B1: $, C1: x, R1: F, Y2: V, B2: G, C2: W, R2: I } = h;
512
- u.push({
513
- Y: parseFloat(M) || 0,
514
- B: parseFloat($) || 0,
515
- C: parseFloat(x) || 0,
516
- R: parseFloat(F) || 0
517
- }), a.push({
518
- Y: parseFloat(V) || 0,
519
- B: parseFloat(G) || 0,
520
- C: parseFloat(W) || 0,
521
- R: parseFloat(I) || 0
522
- });
523
- }), {
524
- posPipeYbcr: u,
525
- negPipeYbcr: a
526
- };
527
- }, v = (u) => {
528
- if (u < 0 || u >= p.value.length) {
529
- console.error(`帧索引 ${u} 超出范围`);
530
- return;
531
- }
532
- const a = p.value[u];
533
- if (console.log(`应用第 ${u} 帧数据 ${a.value}`), i.value) {
534
- const h = {};
535
- B.value.forEach((M) => {
536
- const $ = parseFloat(a[M]);
537
- isNaN($) || (h[M] = $);
538
- }), i.value.setJointAngles(h);
539
- }
540
- if (d.value && R.value) {
541
- const h = E();
542
- console.log("ybcr数据:", h), me(
543
- d.value,
544
- R.value,
545
- h.posPipeYbcr,
546
- h.negPipeYbcr,
547
- L.value,
548
- S.value,
549
- u,
550
- 0,
551
- O.value
552
- );
553
- return;
554
- }
555
- if (d.value) {
556
- const h = pe();
557
- console.log("ybcr数据:", h), we(
558
- d.value,
559
- h,
560
- L.value,
561
- S.value,
562
- u,
563
- 0
564
- );
565
- return;
566
- }
567
- n.value = u;
568
- }, ee = async () => {
569
- if (p.value.length === 0) {
570
- Y.error("无法播放动画:无数据");
571
- return;
572
- }
573
- _.value = !0, l = !1, n.value = 0;
574
- const u = d.value ? pe() : [];
575
- try {
576
- for (let a = 0; a < p.value.length && !l; a++) {
577
- n.value = a;
578
- const h = p.value[a], M = {};
579
- i.value && B.value.forEach(($) => {
580
- const x = parseFloat(h[$]);
581
- isNaN(x) || (M[$] = x);
582
- }), i.value ? await i.value.animateToState(
583
- M,
584
- e.value,
585
- ($) => {
586
- if (t.value = (a + $) / p.value.length * 100, d.value && R.value) {
587
- const x = E();
588
- console.log("ybcr数据:", u), me(
589
- d.value,
590
- R.value,
591
- x.posPipeYbcr,
592
- x.negPipeYbcr,
593
- L.value,
594
- S.value,
595
- a - 1,
596
- $,
597
- O.value
598
- );
599
- } else d.value && we(d.value, u, L.value, S.value, a - 1, $);
600
- }
601
- ) : d.value && R.value ? await new Promise(($) => {
602
- const x = performance.now();
603
- let F;
604
- const V = (G) => {
605
- if (l) {
606
- cancelAnimationFrame(F), $();
607
- return;
608
- }
609
- const W = G - x, I = Math.min(W / e.value, 1);
610
- t.value = (a + I) / p.value.length * 100;
611
- const A = E();
612
- me(
613
- d.value,
614
- R.value,
615
- A.posPipeYbcr,
616
- A.negPipeYbcr,
617
- L.value,
618
- S.value,
619
- a - 1,
620
- I,
621
- O.value
622
- ), I < 1 ? F = requestAnimationFrame(V) : $();
623
- };
624
- F = requestAnimationFrame(V);
625
- }) : d.value ? await new Promise(($) => {
626
- const x = performance.now();
627
- let F;
628
- const V = (G) => {
629
- if (l) {
630
- cancelAnimationFrame(F), $();
631
- return;
632
- }
633
- const W = G - x, I = Math.min(W / e.value, 1);
634
- t.value = (a + I) / p.value.length * 100, we(d.value, u, L.value, S.value, a - 1, I), I < 1 ? F = requestAnimationFrame(V) : $();
635
- };
636
- F = requestAnimationFrame(V);
637
- }) : (await new Promise(($) => setTimeout($, e.value)), t.value = (a + 1) / p.value.length * 100);
638
- }
639
- l || Y.success("动画播放完成");
640
- } catch (a) {
641
- console.error("动画播放出错:", a), Y.error("动画播放出错");
642
- } finally {
643
- _.value = !1, t.value = 0;
644
- }
645
- }, D = () => {
646
- l = !0, _.value = !1, t.value = 0, Y.info("动画已停止");
647
- }, je = () => {
648
- if (i.value && i.value.resetToZero(), console.log("pipeMesh.value", d.value), d.value && R.value) {
649
- const u = E();
650
- me(
651
- d.value,
652
- R.value,
653
- u.posPipeYbcr,
654
- u.negPipeYbcr,
655
- L.value,
656
- S.value,
657
- -1,
658
- 0,
659
- O.value
660
- );
661
- } else if (d.value) {
662
- const u = pe();
663
- we(
664
- d.value,
665
- u,
666
- L.value,
667
- S.value,
668
- -1,
669
- 0
670
- );
671
- }
672
- n.value = 0, Y.success("机器人和管件已重置");
673
- }, Ye = () => {
674
- console.log("当前管件Mesh:", d.value);
675
- }, Be = (u) => {
676
- _.value && D(), v(u);
677
- }, Ie = async () => {
678
- if (z.value.length === 0) {
679
- Y.warning("没有可导出的表头");
680
- return;
681
- }
682
- const u = z.value.join(" ");
683
- try {
684
- await navigator.clipboard.writeText(u), Y.success("表头已成功复制到剪贴板!");
685
- } catch (a) {
686
- console.error("复制失败:", a), Y.error("复制失败,请检查浏览器权限或手动复制。");
687
- }
688
- }, Xe = () => {
689
- if (!c.value.trim()) {
690
- Y.warning("导入内容不能为空");
691
- return;
692
- }
693
- const u = c.value.trim().split(`
694
- `).filter((x) => x.trim() !== "");
695
- if (u.length < 2) {
696
- Y.error("导入数据至少需要包含表头行和一行数据");
697
- return;
698
- }
699
- const a = u[0].split(" ").map((x) => x.trim()), h = {};
700
- if (a.forEach((x, F) => {
701
- z.value.includes(x) && (h[F] = x);
702
- }), Object.keys(h).length === 0) {
703
- Y.error("没有找到匹配的表头,请检查表头名称是否正确");
704
- return;
705
- }
706
- const $ = u.slice(1).map((x) => {
707
- const F = x.split(" "), V = {};
708
- return z.value.forEach((G) => {
709
- V[G] = "0";
710
- }), Object.entries(h).forEach(([G, W]) => {
711
- const I = F[parseInt(G)];
712
- I !== void 0 && I.trim() !== "" && (V[W] = I.trim());
713
- }), V;
714
- });
715
- $.length > 0 ? (p.value = $, Y.success(`成功导入 ${$.length} 行数据!`), k.value = !1, c.value = "") : Y.error("未能解析到有效数据,请检查格式。");
716
- }, Ge = () => {
717
- const u = z.value.reduce((a, h) => (a[h] = "0", a), {});
718
- p.value.push(u);
719
- }, Ze = (u) => `第 ${u + 1} 帧`;
720
- return Te(() => {
721
- de(), l = !0;
722
- }), (u, a) => {
723
- var G, W, I;
724
- const h = le("el-icon"), M = le("el-input-number"), $ = le("el-slider"), x = le("el-progress"), F = le("el-input"), V = le("el-dialog");
725
- return U(), Z("div", ht, [
726
- m("div", bt, [
727
- b(K, {
728
- onClick: C,
729
- modelValue: "获取数据"
730
- }),
731
- b(K, {
732
- onClick: Ie,
733
- disabled: z.value.length === 0,
734
- modelValue: "导出表头"
735
- }, null, 8, ["disabled"]),
736
- b(K, {
737
- modelValue: "播放",
738
- onClick: ee,
739
- disabled: p.value.length === 0 || _.value,
740
- buttonType: "primary"
741
- }, {
742
- default: H(() => [
743
- _.value ? (U(), ve(h, {
744
- key: 0,
745
- class: "is-loading"
746
- }, {
747
- default: H(() => [
748
- b(J(xe))
749
- ]),
750
- _: 1
751
- })) : ae("", !0)
752
- ]),
753
- _: 1
754
- }, 8, ["disabled"]),
755
- b(K, {
756
- onClick: D,
757
- modelValue: "停止",
758
- buttonType: "danger"
759
- }),
760
- b(K, {
761
- onClick: je,
762
- modelValue: "重置",
763
- buttonType: "primary"
764
- }),
765
- b(K, {
766
- onClick: Ye,
767
- modelValue: "测试功能",
768
- buttonType: "primary"
769
- })
770
- ]),
771
- p.value.length > 0 ? (U(), Z("div", yt, [
772
- m("div", wt, [
773
- a[9] || (a[9] = m("label", null, "帧间隔 (ms):", -1)),
774
- b(M, {
775
- modelValue: e.value,
776
- "onUpdate:modelValue": a[0] || (a[0] = (A) => e.value = A),
777
- min: 100,
778
- max: 5e3,
779
- step: 100,
780
- size: "small",
781
- style: { width: "120px" }
782
- }, null, 8, ["modelValue"]),
783
- a[10] || (a[10] = m("label", null, "管件总长 (mm):", -1)),
784
- b(M, {
785
- modelValue: L.value,
786
- "onUpdate:modelValue": a[1] || (a[1] = (A) => L.value = A),
787
- min: 0,
788
- size: "small",
789
- style: { width: "120px" }
790
- }, null, 8, ["modelValue"]),
791
- a[11] || (a[11] = m("label", null, "管件半径 (mm):", -1)),
792
- b(M, {
793
- modelValue: S.value,
794
- "onUpdate:modelValue": a[2] || (a[2] = (A) => S.value = A),
795
- min: 0,
796
- size: "small",
797
- style: { width: "120px" }
798
- }, null, 8, ["modelValue"]),
799
- a[12] || (a[12] = m("label", null, "夹持长度 (mm):", -1)),
800
- b(M, {
801
- modelValue: O.value,
802
- "onUpdate:modelValue": a[3] || (a[3] = (A) => O.value = A),
803
- min: 0,
804
- size: "small",
805
- style: { width: "120px" }
806
- }, null, 8, ["modelValue"])
807
- ]),
808
- m("div", _t, [
809
- a[13] || (a[13] = m("label", null, "管件 Mesh:", -1)),
810
- b(J(dt), {
811
- modelValue: Q.value,
812
- "onUpdate:modelValue": a[4] || (a[4] = (A) => Q.value = A),
813
- placeholder: "选择管件Link",
814
- size: "small",
815
- disabled: "",
816
- style: { width: "180px" }
817
- }, {
818
- default: H(() => [
819
- (U(!0), Z(Ve, null, Ae(q.value, (A) => (U(), ve(J(pt), {
820
- key: A,
821
- label: A,
822
- value: A
823
- }, null, 8, ["label", "value"]))), 128))
824
- ]),
825
- _: 1
826
- }, 8, ["modelValue", "disabled"])
827
- ]),
828
- m("div", Ct, [
829
- a[14] || (a[14] = m("label", null, "当前帧:", -1)),
830
- m("span", $t, N(n.value + 1) + " / " + N(p.value.length), 1)
831
- ]),
832
- m("div", kt, [
833
- a[15] || (a[15] = m("label", null, "动画进度:", -1)),
834
- b($, {
835
- modelValue: n.value,
836
- "onUpdate:modelValue": a[5] || (a[5] = (A) => n.value = A),
837
- min: 0,
838
- max: p.value.length > 0 ? p.value.length - 1 : 0,
839
- step: 1,
840
- "format-tooltip": Ze,
841
- onInput: Be,
842
- disabled: p.value.length === 0,
843
- style: { "flex-grow": "1", margin: "0 10px" }
844
- }, null, 8, ["modelValue", "max", "disabled"])
845
- ]),
846
- m("div", Rt, [
847
- b(x, {
848
- percentage: t.value,
849
- "show-text": !1,
850
- "stroke-width": 6
851
- }, null, 8, ["percentage"])
852
- ])
853
- ])) : ae("", !0),
854
- (U(), ve(tt, {
855
- itemData: (G = f.value) == null ? void 0 : G.compData,
856
- key: (W = f.value) == null ? void 0 : W.id,
857
- index: (I = f.value) == null ? void 0 : I.id,
858
- showHeader: !1
859
- }, null, 8, ["itemData", "index"])),
860
- z.value.length > 0 ? (U(), Z("div", Mt, [
861
- b(K, {
862
- modelValue: "添加新行",
863
- onClick: Ge,
864
- buttonType: "primary"
865
- }, {
866
- default: H(() => [
867
- _.value ? (U(), ve(h, {
868
- key: 0,
869
- class: "is-loading"
870
- }, {
871
- default: H(() => [
872
- b(J(xe))
873
- ]),
874
- _: 1
875
- })) : ae("", !0)
876
- ]),
877
- _: 1
878
- })
879
- ])) : ae("", !0),
880
- b(V, {
881
- modelValue: k.value,
882
- "onUpdate:modelValue": a[8] || (a[8] = (A) => k.value = A),
883
- title: "导入数据",
884
- width: "500px"
885
- }, {
886
- footer: H(() => [
887
- m("span", Dt, [
888
- b(K, {
889
- modelValue: "取消",
890
- onClick: a[7] || (a[7] = (A) => k.value = !1)
891
- }),
892
- b(K, {
893
- modelValue: "确认导入",
894
- onClick: Xe,
895
- type: "primary"
896
- })
897
- ])
898
- ]),
899
- default: H(() => [
900
- a[16] || (a[16] = m("p", { class: "import-instructions" }, " 请从Excel或csv中复制数据 (首行为表头, Tab分隔) ", -1)),
901
- b(F, {
902
- modelValue: c.value,
903
- "onUpdate:modelValue": a[6] || (a[6] = (A) => c.value = A),
904
- type: "textarea",
905
- rows: 10,
906
- placeholder: ie.value
907
- }, null, 8, ["modelValue", "placeholder"])
908
- ]),
909
- _: 1,
910
- __: [16]
911
- }, 8, ["modelValue"])
912
- ]);
913
- };
914
- }
915
- }), St = /* @__PURE__ */ Ce(Pt, [["__scopeId", "data-v-3736fa93"]]), xt = { class: "panel-content" }, Lt = {
916
- key: 0,
917
- class: "joints-list"
918
- }, Ft = { class: "joint-info-row" }, Tt = { class: "joint-left" }, Vt = { class: "joint-name" }, At = { class: "joint-range" }, Et = { class: "joint-type" }, zt = {
919
- key: 0,
920
- class: "joint-control-row"
921
- }, Jt = { class: "slider-container" }, Ut = ["min", "max", "value", "onInput"], Ot = { class: "value-display" }, jt = { class: "joint-value" }, Yt = { class: "unit" }, Bt = {
922
- key: 1,
923
- class: "empty-state"
924
- }, It = /* @__PURE__ */ Pe({
925
- __name: "urdfJointPanel",
926
- props: {
927
- model: {}
928
- },
929
- setup(w, { expose: s }) {
930
- const o = w, r = P([]), g = P(null), f = (n, t = !1) => n === "revolute" ? t ? Math.PI : -Math.PI : n === "prismatic" ? t ? 1 : -1 : 0, y = (n) => {
931
- if (!n || !n.joints)
932
- return console.warn("URDF模型无效或不包含关节信息"), [];
933
- const t = [];
934
- return Object.keys(n.joints).forEach((e) => {
935
- var d, R;
936
- const i = n.joints[e];
937
- if (i.jointType === "fixed")
938
- return;
939
- const l = {
940
- lower: ((d = i.limit) == null ? void 0 : d.lower) ?? f(i.jointType, !1),
941
- upper: ((R = i.limit) == null ? void 0 : R.upper) ?? f(i.jointType, !0)
942
- };
943
- t.push({
944
- name: e,
945
- type: i.jointType || "unknown",
946
- limit: l,
947
- currentValue: i.angle || 0,
948
- urdfJoint: i
949
- });
950
- }), t.sort((e, i) => e.name.localeCompare(i.name));
951
- }, C = (n, t) => {
952
- var d;
953
- const e = r.value.find((R) => R.name === n);
954
- if (!e) return;
955
- const i = parseFloat(t), l = Math.max(e.limit.lower, Math.min(e.limit.upper, i));
956
- e.currentValue = l, (d = o.model) != null && d.setJointValue ? o.model.setJointValue(n, l) : e.urdfJoint.setJointValue(l);
957
- }, p = () => {
958
- r.value.forEach((n) => {
959
- (n.type === "revolute" || n.type === "prismatic") && C(n.name, 0);
960
- });
961
- }, k = () => {
962
- o.model && r.value.forEach((n) => {
963
- n.urdfJoint.angle !== void 0 && n.currentValue !== n.urdfJoint.angle && (n.currentValue = n.urdfJoint.angle);
964
- });
965
- }, c = () => {
966
- const n = () => {
967
- k(), g.value = requestAnimationFrame(n);
968
- };
969
- n();
970
- }, _ = () => {
971
- g.value && (cancelAnimationFrame(g.value), g.value = null);
972
- };
973
- return ne(
974
- () => o.model,
975
- (n) => {
976
- n ? r.value = y(n) : r.value = [];
977
- },
978
- { immediate: !0 }
979
- ), Ee(() => {
980
- c();
981
- }), Te(() => {
982
- _();
983
- }), s({
984
- resetAllJoints: p
985
- }), (n, t) => (U(), Z("div", xt, [
986
- r.value.length > 0 ? (U(), Z("div", Lt, [
987
- (U(!0), Z(Ve, null, Ae(r.value, (e) => (U(), Z("div", {
988
- key: e.name,
989
- class: "joint-item"
990
- }, [
991
- m("div", Ft, [
992
- m("div", Tt, [
993
- m("span", Vt, N(e.name), 1),
994
- m("span", At, " [" + N(e.limit.lower.toFixed(2)) + ", " + N(e.limit.upper.toFixed(2)) + "] ", 1)
995
- ]),
996
- m("span", Et, N(e.type), 1)
997
- ]),
998
- e.type === "revolute" || e.type === "prismatic" ? (U(), Z("div", zt, [
999
- m("div", Jt, [
1000
- m("input", {
1001
- type: "range",
1002
- min: e.limit.lower,
1003
- max: e.limit.upper,
1004
- step: "0.01",
1005
- value: e.currentValue,
1006
- onInput: (i) => C(e.name, i.target.value),
1007
- class: "joint-slider"
1008
- }, null, 40, Ut)
1009
- ]),
1010
- m("div", Ot, [
1011
- m("span", jt, N(e.currentValue ? Number(e.currentValue).toFixed(3) : "0.000"), 1),
1012
- m("span", Yt, N(e.type === "revolute" ? "rad" : "m"), 1)
1013
- ])
1014
- ])) : ae("", !0)
1015
- ]))), 128))
1016
- ])) : (U(), Z("div", Bt, t[0] || (t[0] = [
1017
- m("p", null, "未检测到可控制的关节", -1)
1018
- ])))
1019
- ]));
1020
- }
1021
- }), Xt = /* @__PURE__ */ Ce(It, [["__scopeId", "data-v-9adcbc67"]]), Gt = { class: "panel-content" }, Zt = "id", Nt = {
1022
- __name: "urdfTree",
1023
- props: {
1024
- model: Object,
1025
- maxExpandCount: {
1026
- type: Number,
1027
- default: 10
1028
- },
1029
- expandStrategy: {
1030
- type: String,
1031
- default: "breadth",
1032
- validator: (w) => ["breadth", "firstLevel"].includes(w)
1033
- }
1034
- },
1035
- emits: ["nodeClick"],
1036
- setup(w, { emit: s }) {
1037
- const o = w, r = s, g = P([]), f = {
1038
- children: "children",
1039
- label: "label"
1040
- }, y = (t) => {
1041
- r("nodeClick", t);
1042
- }, C = (t, e = 0) => {
1043
- const i = [];
1044
- return Array.isArray(t) && (t == null ? void 0 : t.length) > 0 && t.forEach((l) => {
1045
- if (!(l != null && l.isMesh) && ((l == null ? void 0 : l.type) === "URDFJoint" || (l == null ? void 0 : l.type) === "URDFLink")) {
1046
- const d = {
1047
- name: l == null ? void 0 : l.name,
1048
- label: l == null ? void 0 : l.name,
1049
- show: !0,
1050
- level: e + 1,
1051
- isPenultimate: !1,
1052
- type: l == null ? void 0 : l.type,
1053
- id: l == null ? void 0 : l.id,
1054
- limit: (l == null ? void 0 : l.limit) ?? "",
1055
- children: C(l == null ? void 0 : l.children, e + 1),
1056
- path: l == null ? void 0 : l.name
1057
- };
1058
- i.push(d);
1059
- }
1060
- }), i;
1061
- }, p = (t) => t ? [{
1062
- name: t == null ? void 0 : t.name,
1063
- label: t == null ? void 0 : t.name,
1064
- show: !0,
1065
- level: 1,
1066
- isPenultimate: !1,
1067
- type: t == null ? void 0 : t.type,
1068
- id: t == null ? void 0 : t.id,
1069
- limit: (t == null ? void 0 : t.limit) ?? "",
1070
- children: C(t == null ? void 0 : t.children, 1),
1071
- path: t == null ? void 0 : t.name
1072
- }] : [], k = (t, e) => {
1073
- const i = [], l = [...t];
1074
- for (; l.length > 0 && i.length < e; ) {
1075
- const d = l.shift();
1076
- d.children && d.children.length > 0 && (i.push(d.id), l.push(...d.children));
1077
- }
1078
- return i;
1079
- }, c = (t, e) => {
1080
- const i = [];
1081
- return t.forEach((l) => {
1082
- if (l.children && l.children.length > 0) {
1083
- i.push(l.id);
1084
- const d = l.children.filter((R) => R.children && R.children.length > 0).slice(0, e).map((R) => R.id);
1085
- i.push(...d);
1086
- }
1087
- }), i.slice(0, e + 1);
1088
- }, _ = ge(() => !g.value || g.value.length === 0 ? [] : o.expandStrategy === "firstLevel" ? c(g.value, o.maxExpandCount) : k(g.value, o.maxExpandCount)), n = ge(() => o != null && o.model ? p(o.model) : []);
1089
- return ne(
1090
- n,
1091
- (t) => {
1092
- g.value = JSON.parse(JSON.stringify(t));
1093
- },
1094
- { immediate: !0 }
1095
- ), (t, e) => {
1096
- const i = le("el-tree");
1097
- return U(), Z("div", Gt, [
1098
- b(i, {
1099
- data: g.value,
1100
- props: f,
1101
- "default-expanded-keys": _.value,
1102
- "node-key": Zt,
1103
- onNodeClick: y
1104
- }, null, 8, ["data", "default-expanded-keys"])
1105
- ]);
1106
- };
1107
- }
1108
- }, Wt = /* @__PURE__ */ Ce(Nt, [["__scopeId", "data-v-0dda287c"]]), qt = { class: "obj-viewer-container" }, Kt = { class: "buttonGroup-top" }, Ht = { class: "buttonGroup-topLeft" }, Qt = { class: "buttonGroup-left" }, el = { class: "buttonGroup-right" }, tl = { class: "buttonGroup-bottom" }, ll = { class: "left-panel" }, nl = { class: "panel-header" }, al = { class: "panel-body" }, ol = {
1109
- key: 1,
1110
- class: "clipping-content"
1111
- }, sl = { class: "radio-group" }, il = { class: "radio-label" }, rl = { class: "radio-label" }, ul = { class: "radio-label" }, cl = { class: "radio-label" }, dl = { class: "right-panel" }, pl = { class: "panel-header" }, ml = { class: "panel-body" }, vl = {
1112
- key: 0,
1113
- class: "loading-overlay"
1114
- }, fl = /* @__PURE__ */ Pe({
1115
- __name: "threeSceneView",
1116
- props: {
1117
- fileBlobs: { default: () => [] },
1118
- animationData: { default: () => ({}) },
1119
- threeData: {},
1120
- isSelfWindow: { type: Boolean }
1121
- },
1122
- emits: ["getAnimationData", "getThreeData"],
1123
- setup(w, { emit: s }) {
1124
- const o = s, r = w, g = P(null), f = P(!1), y = P(""), C = P(!1), p = P(""), k = P(!1), c = P(""), _ = fe(null), n = fe(null), {
1125
- currentModels: t,
1126
- resetView: e,
1127
- initThreeJS: i,
1128
- handleResize: l,
1129
- getThreeJSObjects: d,
1130
- cleanup: R,
1131
- setModels: j
1132
- } = Ke(g), { loadSceneFromFile: L } = ft(
1133
- d,
1134
- t,
1135
- f,
1136
- y
1137
- ), { isAnimating: S, toggleAnimation: O, stopAnimation: q } = He(d, t), { isClipping: Q, activeClippingAxis: B, toggleClipping: $e, updateClippingPlanes: z } = Qe(d, t), ie = (E) => {
1138
- C.value = !0, p.value = E, E === "剖面视图" && !Q.value && $e();
1139
- }, ce = (E) => {
1140
- k.value = !0, c.value = E, E === "动画仿真" && o("getAnimationData");
1141
- }, de = () => {
1142
- o("getThreeData");
1143
- }, pe = () => {
1144
- Se(() => {
1145
- });
1146
- };
1147
- return ne(() => r.fileBlobs, (E) => {
1148
- if (E && E.length > 0) {
1149
- const v = E[0];
1150
- if (!v.name.toLowerCase().endsWith(".urdf")) {
1151
- Y.warning("提供的文件不是有效的 urdf 文件。");
1152
- return;
1153
- }
1154
- L(v).then((ee) => {
1155
- _.value = ee;
1156
- }).catch((ee) => {
1157
- console.error("加载URDF文件时发生错误:", ee), Y.error("加载urdf模型失败"), _.value = null;
1158
- });
1159
- } else
1160
- _.value = null;
1161
- }, {
1162
- immediate: !0,
1163
- deep: !0
1164
- }), ne(_, (E) => {
1165
- j(E ? [E] : []);
1166
- }), Ee(async () => {
1167
- await Se();
1168
- try {
1169
- i(), window.addEventListener("resize", l);
1170
- const E = d();
1171
- n.value = E.scene;
1172
- } catch (E) {
1173
- console.error("Three.js 初始化失败:", E), Y.error("渲染引擎初始化失败!");
1174
- }
1175
- }), qe(() => {
1176
- p.value = "", c.value = "", window.removeEventListener("resize", l), S.value && q(), R();
1177
- }), (E, v) => {
1178
- const ee = le("el-scrollbar");
1179
- return U(), Z("div", qt, [
1180
- m("div", {
1181
- ref_key: "threejsContainer",
1182
- ref: g,
1183
- class: "threejs-container"
1184
- }, null, 512),
1185
- m("div", Kt, [
1186
- b(T, {
1187
- name: "guanjianjiexi",
1188
- size: "34"
1189
- }),
1190
- b(T, {
1191
- name: "guanjiekongzhi",
1192
- size: "34"
1193
- }),
1194
- b(T, {
1195
- name: "gongyishengcheng",
1196
- size: "34"
1197
- }),
1198
- b(T, {
1199
- name: "buchangshezhi",
1200
- size: "34"
1201
- }),
1202
- b(T, {
1203
- name: "shuchujiagongchengxu",
1204
- size: "34"
1205
- })
1206
- ]),
1207
- m("div", Ht, [
1208
- b(T, {
1209
- name: "viewReset",
1210
- size: "24",
1211
- onClick: J(e),
1212
- title: "重置"
1213
- }, null, 8, ["onClick"]),
1214
- b(T, {
1215
- name: "fangda",
1216
- size: "24",
1217
- title: "放大"
1218
- }),
1219
- b(T, {
1220
- name: "suoxiao",
1221
- size: "24",
1222
- title: "缩小"
1223
- }),
1224
- b(T, {
1225
- name: "lookAround",
1226
- size: "24",
1227
- onClick: J(O),
1228
- title: J(S) ? "停止动画" : "动画视图"
1229
- }, null, 8, ["onClick", "title"])
1230
- ]),
1231
- m("div", Qt, [
1232
- b(T, {
1233
- name: "jiegoushu",
1234
- size: "24",
1235
- onClick: v[0] || (v[0] = (D) => ie("场景树")),
1236
- active: C.value && p.value === "场景树",
1237
- title: "场景树"
1238
- }, null, 8, ["active"]),
1239
- b(T, {
1240
- name: "clipping",
1241
- size: "24",
1242
- onClick: v[1] || (v[1] = (D) => ie("剖面视图")),
1243
- active: C.value && p.value === "剖面视图",
1244
- title: "剖面视图"
1245
- }, null, 8, ["active"]),
1246
- b(T, {
1247
- name: "donghuafangzhen",
1248
- size: "24",
1249
- onClick: v[2] || (v[2] = (D) => ie("场景树3"))
1250
- }),
1251
- b(T, {
1252
- name: "donghuafangzhen",
1253
- size: "24",
1254
- onClick: v[3] || (v[3] = (D) => ie("场景4"))
1255
- })
1256
- ]),
1257
- m("div", el, [
1258
- b(T, {
1259
- name: "donghuafangzhen",
1260
- size: "24"
1261
- }),
1262
- b(T, {
1263
- name: "donghuafangzhen",
1264
- size: "24"
1265
- }),
1266
- b(T, {
1267
- name: "guanjiekongzhi",
1268
- size: "24",
1269
- onClick: v[4] || (v[4] = (D) => ce("关节控制")),
1270
- active: k.value && c.value === "关节控制",
1271
- title: "关节控制"
1272
- }, null, 8, ["active"]),
1273
- b(T, {
1274
- name: "donghuafangzhen",
1275
- size: "24",
1276
- title: "动画仿真",
1277
- onClick: v[5] || (v[5] = (D) => ce("动画仿真")),
1278
- active: k.value && c.value === "动画仿真"
1279
- }, null, 8, ["active"]),
1280
- b(T, {
1281
- name: "donghuafangzhen",
1282
- size: "24",
1283
- title: "urdf动画",
1284
- onClick: v[6] || (v[6] = (D) => ce("urdf动画")),
1285
- active: k.value && c.value === "urdf动画"
1286
- }, null, 8, ["active"]),
1287
- b(T, {
1288
- name: "donghuafangzhen",
1289
- size: "24"
1290
- })
1291
- ]),
1292
- m("div", tl, [
1293
- b(T, {
1294
- name: "kuaitui",
1295
- size: "24",
1296
- backgroundColor: "#ffffff",
1297
- title: "快退",
1298
- onClick: v[7] || (v[7] = () => {
1299
- })
1300
- }),
1301
- b(T, {
1302
- name: "bofang",
1303
- size: "24",
1304
- backgroundColor: "#ffffff",
1305
- title: "播放",
1306
- onClick: pe
1307
- }),
1308
- b(T, {
1309
- name: "kuaijin",
1310
- size: "24",
1311
- backgroundColor: "#ffffff",
1312
- title: "快进",
1313
- onClick: v[8] || (v[8] = () => {
1314
- })
1315
- }),
1316
- b(T, {
1317
- name: "zanting",
1318
- size: "24",
1319
- backgroundColor: "#ffffff",
1320
- title: "暂停",
1321
- onClick: v[9] || (v[9] = () => {
1322
- })
1323
- }),
1324
- b(T, {
1325
- name: "zhongzhi",
1326
- size: "24",
1327
- backgroundColor: "#ffffff",
1328
- title: "停止",
1329
- onClick: v[10] || (v[10] = () => {
1330
- })
1331
- })
1332
- ]),
1333
- te(m("div", ll, [
1334
- m("div", nl, [
1335
- m("span", null, N(p.value), 1),
1336
- m("span", {
1337
- class: "close",
1338
- onClick: v[11] || (v[11] = (D) => C.value = !1)
1339
- }, " X ")
1340
- ]),
1341
- m("div", al, [
1342
- b(ee, { height: "100%" }, {
1343
- default: H(() => [
1344
- p.value === "场景树" ? (U(), ve(Wt, {
1345
- key: 0,
1346
- model: _.value
1347
- }, null, 8, ["model"])) : ae("", !0),
1348
- p.value === "剖面视图" ? (U(), Z("div", ol, [
1349
- m("div", sl, [
1350
- m("label", il, [
1351
- te(m("input", {
1352
- type: "radio",
1353
- name: "clipping-axis",
1354
- value: "none",
1355
- "onUpdate:modelValue": v[12] || (v[12] = (D) => he(B) ? B.value = D : null),
1356
- onChange: v[13] || (v[13] = //@ts-ignore
1357
- (...D) => J(z) && J(z)(...D))
1358
- }, null, 544), [
1359
- [be, J(B)]
1360
- ]),
1361
- v[21] || (v[21] = m("span", { class: "radio-text" }, "无切割", -1))
1362
- ]),
1363
- m("label", rl, [
1364
- te(m("input", {
1365
- type: "radio",
1366
- name: "clipping-axis",
1367
- value: "x",
1368
- "onUpdate:modelValue": v[14] || (v[14] = (D) => he(B) ? B.value = D : null),
1369
- onChange: v[15] || (v[15] = //@ts-ignore
1370
- (...D) => J(z) && J(z)(...D))
1371
- }, null, 544), [
1372
- [be, J(B)]
1373
- ]),
1374
- v[22] || (v[22] = m("span", { class: "radio-text" }, "X轴切割", -1))
1375
- ]),
1376
- m("label", ul, [
1377
- te(m("input", {
1378
- type: "radio",
1379
- name: "clipping-axis",
1380
- value: "y",
1381
- "onUpdate:modelValue": v[16] || (v[16] = (D) => he(B) ? B.value = D : null),
1382
- onChange: v[17] || (v[17] = //@ts-ignore
1383
- (...D) => J(z) && J(z)(...D))
1384
- }, null, 544), [
1385
- [be, J(B)]
1386
- ]),
1387
- v[23] || (v[23] = m("span", { class: "radio-text" }, "Y轴切割", -1))
1388
- ]),
1389
- m("label", cl, [
1390
- te(m("input", {
1391
- type: "radio",
1392
- name: "clipping-axis",
1393
- value: "z",
1394
- "onUpdate:modelValue": v[18] || (v[18] = (D) => he(B) ? B.value = D : null),
1395
- onChange: v[19] || (v[19] = //@ts-ignore
1396
- (...D) => J(z) && J(z)(...D))
1397
- }, null, 544), [
1398
- [be, J(B)]
1399
- ]),
1400
- v[24] || (v[24] = m("span", { class: "radio-text" }, "Z轴切割", -1))
1401
- ])
1402
- ])
1403
- ])) : ae("", !0)
1404
- ]),
1405
- _: 1
1406
- })
1407
- ])
1408
- ], 512), [
1409
- [ye, C.value]
1410
- ]),
1411
- te(m("div", dl, [
1412
- m("div", pl, [
1413
- m("span", null, N(c.value), 1),
1414
- m("span", {
1415
- class: "close",
1416
- onClick: v[20] || (v[20] = (D) => k.value = !1)
1417
- }, " X ")
1418
- ]),
1419
- m("div", ml, [
1420
- b(ee, { height: "100%" }, {
1421
- default: H(() => [
1422
- te(b(Xt, { model: _.value }, null, 8, ["model"]), [
1423
- [ye, c.value === "关节控制"]
1424
- ]),
1425
- te(b(St, {
1426
- model: _.value,
1427
- onGetThreeData: de,
1428
- threeData: r.threeData,
1429
- isSelfWindow: r.isSelfWindow
1430
- }, null, 8, ["model", "threeData", "isSelfWindow"]), [
1431
- [ye, c.value === "动画仿真"]
1432
- ])
1433
- ]),
1434
- _: 1
1435
- })
1436
- ])
1437
- ], 512), [
1438
- [ye, k.value]
1439
- ]),
1440
- f.value ? (U(), Z("div", vl, [
1441
- v[25] || (v[25] = m("div", { class: "loading-spinner" }, null, -1)),
1442
- m("p", null, N(y.value), 1)
1443
- ])) : ae("", !0)
1444
- ]);
1445
- };
1446
- }
1447
- }), Dl = /* @__PURE__ */ Ce(fl, [["__scopeId", "data-v-c64ef635"]]);
1448
- export {
1449
- Dl as default
1450
- };