three-slicer-viewer 0.3.2 → 0.3.4
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/TOOLPATH_SPEC.md +8 -1
- package/VIEWER.md +24 -0
- package/data/config-schema-lean.json +1 -1
- package/dist/components.js +47 -43
- package/dist/gcode_parse.js +154 -111
- package/dist/index.js +4409 -4069
- package/dist/{model_loaders-DxlFNFOu.js → model_loaders-Dk9rqXFb.js} +27 -27
- package/dist/model_loaders.js +2 -2
- package/dist/parse_3mf-CpbA-6Iq.js +666 -0
- package/dist/parse_3mf.worker.js +67 -5
- package/dist/sl1_encode.worker.js +1 -1
- package/dist/sl1_write-B6nWmCUu.js +313 -0
- package/dist/sla_slice.worker.js +1 -1
- package/dist/toolpath.js +303 -177
- package/package.json +6 -1
- package/src/core/paint_tools.js +8 -0
- package/src/settings/bed_frame.js +28 -0
- package/src/settings/index.js +1 -0
- package/src/settings/kernel_setting_keys.js +79 -0
- package/src/settings/settings_core.js +194 -8
- package/types/gcode.d.ts +13 -0
- package/types/paint.d.ts +7 -0
- package/types/settings.d.ts +14 -1
- package/types/toolpath.d.ts +6 -0
- package/types/viewer.d.ts +1 -1
- package/dist/parse_3mf-BZISF3eW.js +0 -327
- package/dist/sl1_write-BovHbg3k.js +0 -303
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { OBJLoader as
|
|
1
|
+
import * as k from "three";
|
|
2
|
+
import { OBJLoader as P } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
3
3
|
import { PLYLoader as x } from "three/examples/jsm/loaders/PLYLoader.js";
|
|
4
4
|
import { AMFLoader as S } from "three/examples/jsm/loaders/AMFLoader.js";
|
|
5
|
-
import { p as M } from "./parse_3mf-
|
|
5
|
+
import { p as M } from "./parse_3mf-CpbA-6Iq.js";
|
|
6
6
|
import { makeParse3mfWorker as v } from "./make_worker.js";
|
|
7
|
-
const
|
|
8
|
-
let
|
|
7
|
+
const b = 80, y = 84, _ = 50, B = (t) => y + t * _;
|
|
8
|
+
let p = null, h = !1, D = 0;
|
|
9
9
|
const w = /* @__PURE__ */ new Map();
|
|
10
|
-
function
|
|
10
|
+
function W() {
|
|
11
11
|
if (h || typeof Worker > "u") return null;
|
|
12
|
-
if (
|
|
12
|
+
if (p) return p;
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
p = v(), p.onmessage = (t) => {
|
|
15
15
|
const { id: e, objects: s, project: r, error: n } = t.data || {}, c = w.get(e);
|
|
16
16
|
c && (w.delete(e), n ? c.reject(new Error(n)) : c.resolve({ objects: s, project: r }));
|
|
17
|
-
},
|
|
17
|
+
}, p.onerror = () => {
|
|
18
18
|
h = !0;
|
|
19
19
|
for (const [, t] of w) t.reject(new Error("3MF parse worker failed"));
|
|
20
|
-
w.clear(),
|
|
20
|
+
w.clear(), p = null;
|
|
21
21
|
};
|
|
22
22
|
} catch {
|
|
23
|
-
h = !0,
|
|
23
|
+
h = !0, p = null;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return p;
|
|
26
26
|
}
|
|
27
|
-
async function
|
|
28
|
-
const s =
|
|
27
|
+
async function $(t, e) {
|
|
28
|
+
const s = W();
|
|
29
29
|
if (!s) return M(t, e);
|
|
30
30
|
try {
|
|
31
|
-
const r = ++
|
|
31
|
+
const r = ++D, n = new Promise((c, i) => w.set(r, { resolve: c, reject: i }));
|
|
32
32
|
return s.postMessage({ id: r, buffer: t, baseName: e }), await n;
|
|
33
33
|
} catch {
|
|
34
34
|
return M(t, e);
|
|
@@ -46,8 +46,8 @@ function C(t) {
|
|
|
46
46
|
function O(t) {
|
|
47
47
|
const e = new DataView(t);
|
|
48
48
|
if (t.byteLength >= y) {
|
|
49
|
-
const i = e.getUint32(
|
|
50
|
-
if (t.byteLength ===
|
|
49
|
+
const i = e.getUint32(b, !0);
|
|
50
|
+
if (t.byteLength === B(i)) {
|
|
51
51
|
const l = new Float32Array(i * 9);
|
|
52
52
|
let f = y, u = 0;
|
|
53
53
|
for (let o = 0; o < i; o++) {
|
|
@@ -67,7 +67,7 @@ function O(t) {
|
|
|
67
67
|
function j(t, e) {
|
|
68
68
|
const s = t?.attributes?.position;
|
|
69
69
|
if (!s || s.count < 3) return null;
|
|
70
|
-
const r = t.index, n = new
|
|
70
|
+
const r = t.index, n = new k.Vector3(), c = Math.floor((r ? r.count : s.count) / 3), i = new Float32Array(c * 9);
|
|
71
71
|
let l = 0;
|
|
72
72
|
const f = (u) => {
|
|
73
73
|
n.fromBufferAttribute(s, u), e && n.applyMatrix4(e), i[l++] = n.x, i[l++] = n.y, i[l++] = n.z;
|
|
@@ -108,7 +108,7 @@ async function V(t, e) {
|
|
|
108
108
|
return [{ name: t, modelPos: r }];
|
|
109
109
|
}
|
|
110
110
|
case "obj": {
|
|
111
|
-
const r = new
|
|
111
|
+
const r = new P().parse(new TextDecoder().decode(e));
|
|
112
112
|
return L(t, F(r), !1);
|
|
113
113
|
}
|
|
114
114
|
case "ply": {
|
|
@@ -117,7 +117,7 @@ async function V(t, e) {
|
|
|
117
117
|
return [{ name: t, modelPos: n }];
|
|
118
118
|
}
|
|
119
119
|
case "3mf": {
|
|
120
|
-
const { objects: r, project: n } = await
|
|
120
|
+
const { objects: r, project: n } = await $(e, t), c = r.map((i) => ({ name: i.name, modelPos: i.tris, baked: i.baked, objectid: i.objectid, paint: i.paint, bbox: i.bbox, project: n }));
|
|
121
121
|
if (!c.length && n.gcodePlates) return [{ name: t, gcodePlates: n.gcodePlates, project: n }];
|
|
122
122
|
if (!c.length) throw new Error("No mesh in 3MF");
|
|
123
123
|
return c;
|
|
@@ -154,7 +154,7 @@ function R(t) {
|
|
|
154
154
|
const s = 1e4, r = /* @__PURE__ */ new Map(), n = new Int32Array(e * 3);
|
|
155
155
|
for (let o = 0; o < e; o++)
|
|
156
156
|
for (let a = 0; a < 3; a++) {
|
|
157
|
-
const
|
|
157
|
+
const d = o * 9 + a * 3, m = `${Math.round(t[d] * s)},${Math.round(t[d + 1] * s)},${Math.round(t[d + 2] * s)}`;
|
|
158
158
|
let g = r.get(m);
|
|
159
159
|
g === void 0 && (g = r.size, r.set(m, g)), n[o * 3 + a] = g;
|
|
160
160
|
}
|
|
@@ -169,22 +169,22 @@ function R(t) {
|
|
|
169
169
|
}, f = /* @__PURE__ */ new Map();
|
|
170
170
|
for (let o = 0; o < e; o++)
|
|
171
171
|
for (let a = 0; a < 3; a++) {
|
|
172
|
-
const
|
|
172
|
+
const d = n[o * 3 + a], m = n[o * 3 + (a + 1) % 3], g = d < m ? d * 4294967296 + m : m * 4294967296 + d, E = f.get(g);
|
|
173
173
|
E === void 0 ? f.set(g, o) : l(o, E);
|
|
174
174
|
}
|
|
175
175
|
const u = /* @__PURE__ */ new Map();
|
|
176
176
|
for (let o = 0; o < e; o++) {
|
|
177
177
|
const a = i(o);
|
|
178
|
-
let
|
|
179
|
-
|
|
178
|
+
let d = u.get(a);
|
|
179
|
+
d || (d = [], u.set(a, d)), d.push(o);
|
|
180
180
|
}
|
|
181
181
|
return u.size < 2 ? null : [...u.values()].sort((o, a) => a.length - o.length);
|
|
182
182
|
}
|
|
183
183
|
export {
|
|
184
184
|
X as G,
|
|
185
|
-
|
|
185
|
+
b as S,
|
|
186
186
|
y as a,
|
|
187
|
-
|
|
187
|
+
_ as b,
|
|
188
188
|
T as c,
|
|
189
189
|
R as d,
|
|
190
190
|
I as e,
|
|
@@ -192,5 +192,5 @@ export {
|
|
|
192
192
|
q as g,
|
|
193
193
|
V as l,
|
|
194
194
|
H as r,
|
|
195
|
-
|
|
195
|
+
B as s
|
|
196
196
|
};
|
package/dist/model_loaders.js
CHANGED
|
@@ -2,9 +2,9 @@ import "three";
|
|
|
2
2
|
import "three/examples/jsm/loaders/OBJLoader.js";
|
|
3
3
|
import "three/examples/jsm/loaders/PLYLoader.js";
|
|
4
4
|
import "three/examples/jsm/loaders/AMFLoader.js";
|
|
5
|
-
import "./parse_3mf-
|
|
5
|
+
import "./parse_3mf-CpbA-6Iq.js";
|
|
6
6
|
import "./make_worker.js";
|
|
7
|
-
import { G as m, c as n, e as l, f as d, l as E, r as c, d as f, g as C } from "./model_loaders-
|
|
7
|
+
import { G as m, c as n, e as l, f as d, l as E, r as c, d as f, g as C } from "./model_loaders-Dk9rqXFb.js";
|
|
8
8
|
export {
|
|
9
9
|
m as GCODE_EXTS,
|
|
10
10
|
n as SUPPORTED_EXT,
|