three-slicer 0.2.5 → 0.3.1

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 (44) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +13 -8
  3. package/THIRD-PARTY-NOTICES.md +7 -2
  4. package/components/dist/SettingsPanel.js +12 -198
  5. package/data/config-schema-lean.json +1 -0
  6. package/data/processes.js +1 -1
  7. package/data/ui-tree-keys.json +1 -0
  8. package/engine/src/client.js +9 -0
  9. package/engine/src/data.js +6 -0
  10. package/engine/src/settings.js +12 -627
  11. package/engine/src/sla_core.js +14 -8
  12. package/engine/src/toggle_eval.js +9 -77
  13. package/package.json +24 -17
  14. package/types/client.d.ts +3 -0
  15. package/types/components.d.ts +3 -29
  16. package/types/settings.d.ts +15 -0
  17. package/types/toggle.d.ts +2 -22
  18. package/types/viewer-gcode.d.ts +2 -29
  19. package/types/viewer-loaders.d.ts +1 -33
  20. package/types/viewer-toolpath.d.ts +3 -113
  21. package/types/viewer.d.ts +6 -213
  22. package/viewer/dist/Viewport.js +9 -6571
  23. package/viewer/dist/gcode_reexport.js +1 -0
  24. package/viewer/dist/loaders_reexport.js +1 -0
  25. package/viewer/dist/toolpath_reexport.js +1 -0
  26. package/components/README.md +0 -44
  27. package/components/styles.css +0 -88
  28. package/engine/src/kernel_setting_keys.js +0 -132
  29. package/engine/src/preset_file.js +0 -99
  30. package/types/.omc/state/sessions/02e5ddf5-4378-46e1-8fca-e90412c30804/pre-tool-advisory-throttle.json +0 -10
  31. package/viewer/README.md +0 -423
  32. package/viewer/dist/gcode_parse.js +0 -190
  33. package/viewer/dist/make_worker.js +0 -31
  34. package/viewer/dist/model_loaders.js +0 -184
  35. package/viewer/dist/parse_3mf-C2X_W442.js +0 -300
  36. package/viewer/dist/parse_3mf.worker.js +0 -10
  37. package/viewer/dist/sl1_encode.worker.js +0 -10
  38. package/viewer/dist/sl1_write-CtX8cVL7.js +0 -302
  39. package/viewer/dist/sla_reconstruct-CXkYhux2.js +0 -176
  40. package/viewer/dist/sla_reconstruct.worker.js +0 -24
  41. package/viewer/dist/sla_slice.worker.js +0 -74
  42. package/viewer/dist/toolpath_gpu-4foc4FaU.js +0 -482
  43. package/viewer/dist/toolpath_gpu.js +0 -13
  44. package/viewer/styles.css +0 -394
@@ -1,184 +0,0 @@
1
- import * as L from "three";
2
- import { OBJLoader as T } from "three/examples/jsm/loaders/OBJLoader.js";
3
- import { PLYLoader as v } from "three/examples/jsm/loaders/PLYLoader.js";
4
- import { AMFLoader as P } from "three/examples/jsm/loaders/AMFLoader.js";
5
- import { p as E } from "./parse_3mf-C2X_W442.js";
6
- import { makeParse3mfWorker as W } from "./make_worker.js";
7
- let h = null, M = !1, $ = 0;
8
- const y = /* @__PURE__ */ new Map();
9
- function B() {
10
- if (M || typeof Worker > "u") return null;
11
- if (h) return h;
12
- try {
13
- h = W(), h.onmessage = (t) => {
14
- const { id: r, objects: s, project: o, error: n } = t.data || {}, i = y.get(r);
15
- i && (y.delete(r), n ? i.reject(new Error(n)) : i.resolve({ objects: s, project: o }));
16
- }, h.onerror = () => {
17
- M = !0;
18
- for (const [, t] of y) t.reject(new Error("3MF parse worker failed"));
19
- y.clear(), h = null;
20
- };
21
- } catch {
22
- M = !0, h = null;
23
- }
24
- return h;
25
- }
26
- async function C(t, r) {
27
- const s = B();
28
- if (!s) return E(t, r);
29
- try {
30
- const o = ++$, n = new Promise((i, c) => y.set(o, { resolve: i, reject: c }));
31
- return s.postMessage({ id: o, buffer: t, baseName: r }), await n;
32
- } catch {
33
- return E(t, r);
34
- }
35
- }
36
- const F = ["stl", "obj", "3mf", "amf", "ply"], x = /* @__PURE__ */ new Map();
37
- function R(t, r) {
38
- for (const s of (Array.isArray(t) ? t : String(t).split(",")).map((o) => o.trim().toLowerCase()))
39
- x.set(s, r), F.includes(s) || F.push(s);
40
- }
41
- function D(t) {
42
- const r = t.lastIndexOf(".");
43
- return r < 0 ? "" : t.slice(r + 1).toLowerCase();
44
- }
45
- function I(t) {
46
- const r = new DataView(t);
47
- if (t.byteLength >= 84) {
48
- const c = r.getUint32(80, !0);
49
- if (t.byteLength === 84 + c * 50) {
50
- const a = new Float32Array(c * 9);
51
- let u = 84, d = 0;
52
- for (let p = 0; p < c; p++) {
53
- u += 12;
54
- for (let e = 0; e < 3; e++)
55
- a[d++] = r.getFloat32(u, !0), a[d++] = r.getFloat32(u + 4, !0), a[d++] = r.getFloat32(u + 8, !0), u += 12;
56
- u += 2;
57
- }
58
- return a;
59
- }
60
- }
61
- const s = new TextDecoder().decode(t), o = /vertex\s+([-\d.eE+]+)\s+([-\d.eE+]+)\s+([-\d.eE+]+)/g, n = [];
62
- let i;
63
- for (; i = o.exec(s); ) n.push(+i[1], +i[2], +i[3]);
64
- return n.length < 9 ? null : new Float32Array(n);
65
- }
66
- function A(t, r) {
67
- var d;
68
- const s = (d = t == null ? void 0 : t.attributes) == null ? void 0 : d.position;
69
- if (!s || s.count < 3) return null;
70
- const o = t.index, n = new L.Vector3(), i = Math.floor((o ? o.count : s.count) / 3), c = new Float32Array(i * 9);
71
- let a = 0;
72
- const u = (p) => {
73
- n.fromBufferAttribute(s, p), r && n.applyMatrix4(r), c[a++] = n.x, c[a++] = n.y, c[a++] = n.z;
74
- };
75
- if (o)
76
- for (let p = 0; p < i * 3; p++) u(o.getX(p));
77
- else
78
- for (let p = 0; p < i * 3; p++) u(p);
79
- return c;
80
- }
81
- function j(t) {
82
- t.updateMatrixWorld(!0);
83
- const r = [];
84
- return t.traverse((s) => {
85
- s.isMesh && s.geometry && r.push({ geometry: s.geometry, matrix: s.matrixWorld });
86
- }), r;
87
- }
88
- function k(t, r, s) {
89
- const o = r.map((a) => A(a.geometry, a.matrix)).filter(Boolean);
90
- if (!o.length) return [];
91
- if (s && o.length > 1)
92
- return o.map((a, u) => ({ name: `${t}#${u + 1}`, modelPos: a }));
93
- if (o.length === 1) return [{ name: t, modelPos: o[0] }];
94
- let n = 0;
95
- for (const a of o) n += a.length;
96
- const i = new Float32Array(n);
97
- let c = 0;
98
- for (const a of o)
99
- i.set(a, c), c += a.length;
100
- return [{ name: t, modelPos: i }];
101
- }
102
- async function U(t, r) {
103
- const s = D(t);
104
- switch (s) {
105
- case "stl": {
106
- const o = I(r);
107
- if (!o) throw new Error("Failed to parse STL");
108
- return [{ name: t, modelPos: o }];
109
- }
110
- case "obj": {
111
- const o = new T().parse(new TextDecoder().decode(r));
112
- return k(t, j(o), !1);
113
- }
114
- case "ply": {
115
- const o = new v().parse(r), n = A(o, null);
116
- if (!n) throw new Error("No PLY geometry");
117
- return [{ name: t, modelPos: n }];
118
- }
119
- case "3mf": {
120
- const { objects: o, project: n } = await C(r, t), i = o.map((c) => ({ name: c.name, modelPos: c.tris, objectid: c.objectid, paint: c.paint, bbox: c.bbox, project: n }));
121
- if (!i.length) throw new Error("No mesh in 3MF");
122
- return i;
123
- }
124
- case "amf": {
125
- const o = new P().parse(r), n = k(t, j(o), !0);
126
- if (!n.length) throw new Error("No mesh in AMF");
127
- return n;
128
- }
129
- default: {
130
- const o = x.get(s);
131
- if (!o) throw new Error(`Unsupported format: .${s}`);
132
- const n = await o(r, t);
133
- if (!(n != null && n.length)) throw new Error(`No mesh in .${s}`);
134
- return n;
135
- }
136
- }
137
- }
138
- function V(t) {
139
- const r = Math.floor(t.length / 9);
140
- if (r < 2) return null;
141
- const s = 1e4, o = /* @__PURE__ */ new Map(), n = new Int32Array(r * 3);
142
- for (let e = 0; e < r; e++)
143
- for (let l = 0; l < 3; l++) {
144
- const f = e * 9 + l * 3, m = `${Math.round(t[f] * s)},${Math.round(t[f + 1] * s)},${Math.round(t[f + 2] * s)}`;
145
- let w = o.get(m);
146
- w === void 0 && (w = o.size, o.set(m, w)), n[e * 3 + l] = w;
147
- }
148
- const i = new Int32Array(r);
149
- for (let e = 0; e < r; e++) i[e] = e;
150
- const c = (e) => {
151
- for (; i[e] !== e; )
152
- i[e] = i[i[e]], e = i[e];
153
- return e;
154
- }, a = (e, l) => {
155
- e = c(e), l = c(l), e !== l && (i[l] = e);
156
- }, u = /* @__PURE__ */ new Map();
157
- for (let e = 0; e < r; e++)
158
- for (let l = 0; l < 3; l++) {
159
- const f = n[e * 3 + l], m = n[e * 3 + (l + 1) % 3], w = f < m ? f * 4294967296 + m : m * 4294967296 + f, g = u.get(w);
160
- g === void 0 ? u.set(w, e) : a(e, g);
161
- }
162
- const d = /* @__PURE__ */ new Map();
163
- for (let e = 0; e < r; e++) {
164
- const l = c(e);
165
- let f = d.get(l);
166
- f || (f = [], d.set(l, f)), f.push(e);
167
- }
168
- return d.size < 2 ? null : [...d.values()].sort((e, l) => l.length - e.length).map((e) => {
169
- const l = new Float32Array(e.length * 9);
170
- let f = 0;
171
- for (const m of e) {
172
- const w = m * 9;
173
- for (let g = 0; g < 9; g++) l[f++] = t[w + g];
174
- }
175
- return l;
176
- });
177
- }
178
- export {
179
- F as SUPPORTED_EXT,
180
- D as fileExt,
181
- U as loadModel,
182
- R as registerLoader,
183
- V as splitConnectedComponents
184
- };
@@ -1,300 +0,0 @@
1
- import { unzip as W, unzipSync as B } from "three/examples/jsm/libs/fflate.module.js";
2
- function q(t) {
3
- return new Promise((n) => {
4
- let o = !1;
5
- const e = (s) => {
6
- o || (o = !0, n(s));
7
- };
8
- try {
9
- W(t, (s, i) => e(s ? B(t) : i));
10
- } catch {
11
- e(B(t));
12
- }
13
- });
14
- }
15
- const F = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0];
16
- function K(t, n) {
17
- const o = new Array(12);
18
- for (let e = 0; e < 4; e++)
19
- for (let s = 0; s < 3; s++)
20
- o[e * 3 + s] = t[e * 3] * n[s] + t[e * 3 + 1] * n[3 + s] + t[e * 3 + 2] * n[6 + s] + (e === 3 ? n[9 + s] : 0);
21
- return o;
22
- }
23
- function C(t) {
24
- if (!t) return F;
25
- const n = t.trim().split(/\s+/).map(Number);
26
- return n.length === 12 && n.every(Number.isFinite) ? n : F;
27
- }
28
- const U = {};
29
- function d(t, n) {
30
- const e = (U[n] || (U[n] = new RegExp(`\\b${n}\\s*=\\s*"([^"]*)"`))).exec(t);
31
- return e ? e[1] : null;
32
- }
33
- const D = /<vertex\s+x="([^"]*)"\s+y="([^"]*)"\s+z="([^"]*)"/g, V = /<triangle\s+v1="([^"]*)"\s+v2="([^"]*)"\s+v3="([^"]*)"([^>]*)/g, $ = [
34
- ["paint_color", "color"],
35
- // multi-material: state 1..16 == Extruder1..16
36
- ["paint_supports", "supports"],
37
- // support enforcer/blocker: states 1 and 2
38
- ["paint_seam", "seam"],
39
- // unsupported by the kernel — collected for the warning only
40
- ["paint_fuzzy_skin", "fuzzy"]
41
- // ditto
42
- ];
43
- function Y() {
44
- return { color: /* @__PURE__ */ new Map(), supports: /* @__PURE__ */ new Map(), seam: /* @__PURE__ */ new Map(), fuzzy: /* @__PURE__ */ new Map() };
45
- }
46
- function Q(t) {
47
- return !t || $.every(([, n]) => t[n].size === 0);
48
- }
49
- function J(t, n, o) {
50
- for (const [e, s] of $) {
51
- if (!t.includes(e)) continue;
52
- const i = d(t, e);
53
- i && o[s].set(n, i);
54
- }
55
- }
56
- function Z(t) {
57
- const n = [];
58
- D.lastIndex = 0;
59
- let o;
60
- for (; o = D.exec(t); ) n.push(+o[1], +o[2], +o[3]);
61
- if (!n.length)
62
- for (const i of t.match(/<vertex\b[^>]*>/g) || []) n.push(+d(i, "x"), +d(i, "y"), +d(i, "z"));
63
- if (n.length < 9) return null;
64
- const e = [], s = Y();
65
- for (V.lastIndex = 0; o = V.exec(t); ) {
66
- const i = e.length / 3;
67
- e.push(+o[1], +o[2], +o[3]), o[4].length > 2 && J(o[4], i, s);
68
- }
69
- if (!e.length)
70
- for (const i of t.match(/<triangle\b[^>]*>/g) || []) {
71
- const p = e.length / 3;
72
- e.push(+d(i, "v1"), +d(i, "v2"), +d(i, "v3")), J(i, p, s);
73
- }
74
- return e.length ? { verts: n, tris: e, paint: s } : null;
75
- }
76
- function x(t) {
77
- const n = /* @__PURE__ */ new Map(), o = /<object\b([^>]*)>([\s\S]*?)<\/object>/g;
78
- let e;
79
- for (; e = o.exec(t); ) {
80
- const p = d(e[1], "id");
81
- if (!p) continue;
82
- const u = e[2], r = [];
83
- for (const a of u.match(/<component\b[^>]*>/g) || []) {
84
- const l = d(a, "objectid");
85
- l && r.push({ objectid: l, path: d(a, "p:path") || d(a, "path"), transform: C(d(a, "transform")) });
86
- }
87
- n.set(p, r.length ? { components: r } : { mesh: Z(u) });
88
- }
89
- const s = [], i = /<build\b[^>]*>([\s\S]*?)<\/build>/.exec(t);
90
- if (i)
91
- for (const p of i[1].match(/<item\b[^>]*>/g) || []) {
92
- const u = d(p, "objectid");
93
- u && s.push({ objectid: u, path: d(p, "p:path") || d(p, "path"), transform: C(d(p, "transform")) });
94
- }
95
- return { objects: n, items: s };
96
- }
97
- function O(t) {
98
- const n = String(t).replace(/^\/+/, "");
99
- return n.includes("%") ? decodeURIComponent(n) : n;
100
- }
101
- function k(t) {
102
- const n = {};
103
- for (const o of t.match(/<metadata\b[^>]*>/g) || []) {
104
- const e = d(o, "key");
105
- e && (n[e] = d(o, "value") ?? "");
106
- }
107
- return n;
108
- }
109
- function tt(t) {
110
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), e = /<object\b([^>]*)>([\s\S]*?)<\/object>/g;
111
- let s;
112
- for (; s = e.exec(t); ) {
113
- const u = d(s[1], "id");
114
- if (u) {
115
- const r = s[2];
116
- n.set(u, k(r.replace(/<(?:part|volume)\b[\s\S]*?<\/(?:part|volume)>/g, "")));
117
- const a = [];
118
- for (const l of r.match(/<volume\b[\s\S]*?<\/volume>/g) || []) {
119
- const b = k(l).volume_type, _ = b === "SupportBlocker" ? "blocker" : b === "SupportEnforcer" ? "enforcer" : null, j = Number(d(l, "firstid")), S = Number(d(l, "lastid"));
120
- _ && Number.isInteger(j) && Number.isInteger(S) && j >= 0 && S >= j && a.push({ firstTriangle: j, lastTriangle: S, kind: _ });
121
- }
122
- a.length && o.set(u, a);
123
- }
124
- }
125
- const i = [], p = /<plate\b[^>]*>([\s\S]*?)<\/plate>/g;
126
- for (; s = p.exec(t); ) {
127
- const u = s[1], r = k(u.replace(/<model_instance\b[\s\S]*?<\/model_instance>/g, "")), a = [];
128
- for (const l of u.match(/<model_instance\b[\s\S]*?<\/model_instance>/g) || []) {
129
- const b = k(l).object_id;
130
- b && a.push(b);
131
- }
132
- i.push({ index: Math.max(0, (Number(r.plater_id) || i.length + 1) - 1), objectIds: a });
133
- }
134
- return { objects: n, plates: i, volumes: o };
135
- }
136
- const et = Object.freeze({
137
- manualSupportPoints: "prepared-roundtrip",
138
- drainHoles: "preserved-unsupported",
139
- modifierVolumes: "prepared-mask-filtering",
140
- uiEditing: "unavailable"
141
- });
142
- function X(t, n, o, e, s) {
143
- const i = /* @__PURE__ */ new Map();
144
- if (!(t != null && t.trim())) return i;
145
- const p = t.trim().split(/\r?\n/), u = new RegExp(`^${n}_format_version=(\\d+)$`).exec(p[0]), r = u ? Number(u[1]) : 0;
146
- for (const a of p.slice(u ? 1 : 0)) {
147
- const l = /^object_id=(\d+)\|(.*)$/.exec(a);
148
- if (!l || i.has(Number(l == null ? void 0 : l[1]))) continue;
149
- const b = Number(l[1]), _ = l[2].trim() ? l[2].trim().split(/\s+/).map(Number) : [], j = o(r);
150
- if (!j || _.length % j !== 0 || _.some((c) => !Number.isFinite(c))) {
151
- e.push({ code: n === "support_points" ? "SLA_SUPPORT_POINT_COUNT" : "SLA_DRAIN_HOLE_COUNT", object: b }), i.set(b, []);
152
- continue;
153
- }
154
- const S = [];
155
- for (let c = 0; c < _.length; c += j) S.push(s(_.slice(c, c + j), r));
156
- i.set(b, S);
157
- }
158
- return i;
159
- }
160
- function G(t, n) {
161
- const [o, e, s] = n;
162
- return [o * t[0] + e * t[3] + s * t[6] + t[9], o * t[1] + e * t[4] + s * t[7] + t[10], o * t[2] + e * t[5] + s * t[8] + t[11]];
163
- }
164
- function nt(t, n) {
165
- const [o, e, s] = n, i = [o * t[0] + e * t[3] + s * t[6], o * t[1] + e * t[4] + s * t[7], o * t[2] + e * t[5] + s * t[8]], p = Math.hypot(...i);
166
- return p ? i.map((u) => u / p) : i;
167
- }
168
- function ot(t, n) {
169
- var p, u;
170
- const o = (r) => {
171
- const a = t.get(r);
172
- return a ? n.decode(a) : null;
173
- }, e = {
174
- settings: null,
175
- // Metadata/project_settings.config — the flattened preset (raw upstream strings)
176
- objectMeta: /* @__PURE__ */ new Map(),
177
- // 3mf object id -> per-object metadata (name, extruder, per-object overrides)
178
- plates: [],
179
- // [{index, objectIds}]
180
- hasLayerHeightProfile: !1,
181
- hasCustomGcodePerLayer: !1,
182
- volumeMeta: /* @__PURE__ */ new Map(),
183
- sla: { capabilities: { ...et }, issues: [], supportPoints: /* @__PURE__ */ new Map(), drainHoles: /* @__PURE__ */ new Map() }
184
- }, s = o("Metadata/project_settings.config");
185
- if (s)
186
- try {
187
- e.settings = JSON.parse(s);
188
- } catch {
189
- e.settings = null;
190
- }
191
- const i = o("Metadata/model_settings.config");
192
- if (i) {
193
- const r = tt(i);
194
- e.objectMeta = r.objects, e.plates = r.plates, e.volumeMeta = r.volumes;
195
- }
196
- return e.sla.supportPoints = X(
197
- o("Metadata/Slic3r_PE_sla_support_points.txt"),
198
- "support_points",
199
- (r) => r === 0 ? 3 : r === 1 ? 5 : 0,
200
- e.sla.issues,
201
- (r, a) => ({
202
- position: r.slice(0, 3),
203
- radius: a === 0 ? 0.4 : r[3],
204
- type: a === 0 || r[4] === 2 ? "manual" : r[4] === 1 ? "island" : "slope"
205
- })
206
- ), e.sla.drainHoles = X(
207
- o("Metadata/Slic3r_PE_sla_drain_holes.txt"),
208
- "drain_holes",
209
- (r) => r === 1 ? 8 : 0,
210
- e.sla.issues,
211
- (r) => {
212
- const a = Math.hypot(r[3], r[4], r[5]), l = a ? r.slice(3, 6).map((b) => b / a) : r.slice(3, 6);
213
- return { position: r.slice(0, 3).map((b, _) => b + l[_]), normal: l, radius: r[6], height: r[7] - 1 };
214
- }
215
- ), e.hasLayerHeightProfile = !!((p = o("Metadata/layer_heights_profile.txt")) != null && p.trim()), e.hasCustomGcodePerLayer = !!((u = o("Metadata/custom_gcode_per_layer.xml")) != null && u.trim()), e;
216
- }
217
- async function rt(t, n = "model") {
218
- const o = ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t), e = await q(o), s = /* @__PURE__ */ new Map();
219
- for (const c of Object.keys(e)) s.set(O(c), e[c]);
220
- const i = new TextDecoder(), p = /* @__PURE__ */ new Map(), u = (c) => {
221
- const w = O(c);
222
- if (p.has(w)) return p.get(w);
223
- const m = s.get(w), M = m ? x(i.decode(m)) : null;
224
- return p.set(w, M), M;
225
- };
226
- let r = "3D/3dmodel.model";
227
- const a = s.get("_rels/.rels");
228
- if (a) {
229
- for (const c of i.decode(a).match(/<Relationship\b[^>]*>/g) || [])
230
- if ((d(c, "Type") || "").endsWith("/3dmodel")) {
231
- r = O(d(c, "Target"));
232
- break;
233
- }
234
- }
235
- const l = u(r);
236
- if (!l) throw new Error(`3MF root model not found: ${r}`);
237
- const b = [], _ = ot(s, i), j = (c, w, m, M, P, z) => {
238
- if (z > 16) return;
239
- const T = u(w), I = T == null ? void 0 : T.objects.get(c);
240
- if (!I) return;
241
- if (I.components) {
242
- for (const y of I.components) j(y.objectid, y.path || w, K(y.transform, m), M, P, z + 1);
243
- return;
244
- }
245
- if (!I.mesh) return;
246
- const { verts: E, tris: v, paint: A } = I.mesh, R = M.length / 9;
247
- for (let y = 0; y < v.length; y++) {
248
- const f = v[y] * 3, g = E[f], h = E[f + 1], N = E[f + 2];
249
- M.push(
250
- g * m[0] + h * m[3] + N * m[6] + m[9],
251
- g * m[1] + h * m[4] + N * m[7] + m[10],
252
- g * m[2] + h * m[5] + N * m[8] + m[11]
253
- );
254
- }
255
- if (A) for (const [, y] of $)
256
- for (const [f, g] of A[y]) P[y].set(R + f, g);
257
- }, S = l.items.length ? l.items : [...l.objects.keys()].filter((c) => l.objects.get(c).mesh).map((c) => ({ objectid: c, path: r, transform: F }));
258
- return S.forEach((c, w) => {
259
- const m = [], M = Y();
260
- if (j(c.objectid, c.path || r, c.transform, m, M, 0), m.length < 9) return;
261
- let P = new Float32Array(m);
262
- const z = [], T = _.volumeMeta.get(c.objectid) || [];
263
- if (T.length) {
264
- const f = /* @__PURE__ */ new Set();
265
- for (let g = 0; g < T.length; g++) {
266
- const h = T[g], N = h.firstTriangle * 9, H = Math.min(m.length, (h.lastTriangle + 1) * 9);
267
- if (!(N >= H)) {
268
- for (let L = h.firstTriangle; L <= h.lastTriangle; L++) f.add(L);
269
- z.push({ id: `${c.objectid}:modifier:${g}`, kind: h.kind, tris: new Float32Array(m.slice(N, H)) });
270
- }
271
- }
272
- if (f.size) {
273
- const g = [];
274
- for (let h = 0; h < m.length / 9; h++) f.has(h) || g.push(...m.slice(h * 9, h * 9 + 9));
275
- P = new Float32Array(g);
276
- }
277
- }
278
- const I = (_.sla.supportPoints.get(w + 1) || []).map((f) => ({ ...f, position: G(c.transform, f.position) })), E = (_.sla.drainHoles.get(w + 1) || []).map((f) => ({
279
- ...f,
280
- position: G(c.transform, f.position),
281
- normal: nt(c.transform, f.normal)
282
- }));
283
- let v = 1 / 0, A = 1 / 0, R = -1 / 0, y = -1 / 0;
284
- for (let f = 0; f < P.length; f += 3) {
285
- const g = P[f], h = P[f + 1];
286
- g < v && (v = g), g > R && (R = g), h < A && (A = h), h > y && (y = h);
287
- }
288
- b.push({
289
- name: S.length > 1 ? `${n}#${w + 1}` : n,
290
- tris: P,
291
- objectid: c.objectid,
292
- paint: Q(M) ? null : M,
293
- sla: { supportPoints: I, drainHoles: E, modifierVolumes: z },
294
- bbox: { minX: v, minY: A, maxX: R, maxY: y }
295
- });
296
- }), { objects: b, project: _ };
297
- }
298
- export {
299
- rt as p
300
- };
@@ -1,10 +0,0 @@
1
- import { p as f } from "./parse_3mf-C2X_W442.js";
2
- self.onmessage = async (a) => {
3
- const { id: s, buffer: r, baseName: t } = a.data || {};
4
- try {
5
- const { objects: e, project: o } = await f(r, t);
6
- self.postMessage({ id: s, objects: e, project: o }, e.map((c) => c.tris.buffer));
7
- } catch (e) {
8
- self.postMessage({ id: s, error: e && e.message || String(e) });
9
- }
10
- };
@@ -1,10 +0,0 @@
1
- import { zlibSync as p } from "three/examples/jsm/libs/fflate.module.js";
2
- import { s as m, r as l, e as g } from "./sl1_write-CtX8cVL7.js";
3
- self.onmessage = async ({ data: { indices: r, paths: o, params: t, aa: f } }) => {
4
- const a = m(t), e = [];
5
- for (let s = 0; s < r.length; s++) {
6
- const n = l(o[s], a, f || 1);
7
- e.push(await g(n, a.px, a.py, { deflate: p })), (s & 7) === 7 && self.postMessage({ progress: s + 1 });
8
- }
9
- self.postMessage({ indices: r, pngs: e }, e.map((s) => s.buffer));
10
- };