any2orca 0.7.0 → 0.7.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.
- package/CHANGELOG.md +25 -0
- package/dist/archive/lookupFilamentColorName.js +15 -4
- package/dist/archive/objectWorldBboxXY.js +80 -58
- package/dist/archive/parseObjectMetadata.js +33 -9
- package/dist/archive/recenterAssembleItems.js +9 -1
- package/dist/archive/recenterBuildItems.js +9 -1
- package/dist/archive/xmlBlocks.d.ts +52 -3
- package/dist/archive/xmlBlocks.js +106 -4
- package/dist/cli/config.js +32 -2
- package/dist/cli/watchState.js +22 -1
- package/dist/engine/buildFilamentConfigs.js +8 -5
- package/dist/inspect.d.ts +8 -1
- package/dist/inspect.js +4 -1
- package/dist/project.js +1 -1
- package/dist/sources/prusa/bundle.js +17 -3
- package/dist/sources/prusa/convertSettings.js +55 -0
- package/dist/sources/prusa/keyMap.js +2 -0
- package/dist/sources/prusa/modelConfig.js +8 -5
- package/dist/sources/prusa/policyB.d.ts +10 -0
- package/dist/sources/prusa/policyB.js +21 -2
- package/dist/sources/prusa/prusa.js +12 -2
- package/dist/sources/prusa/splitParts.d.ts +0 -13
- package/dist/sources/prusa/splitParts.js +107 -42
- package/dist/sources/reader.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker-entry.js +4 -3
- package/dist/worker.d.ts +7 -2
- package/dist/worker.js +22 -8
- package/package.json +3 -3
package/dist/worker.js
CHANGED
|
@@ -45,12 +45,16 @@ export function createConverterWorker(worker, options) {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
pending.delete(message.id);
|
|
48
|
-
if (message.ok)
|
|
48
|
+
if (message.ok === true) {
|
|
49
49
|
entry.resolve(message.result);
|
|
50
|
-
|
|
51
|
-
const slicer = message.error.slicer;
|
|
52
|
-
entry.reject(new Any2orcaError(message.error.code, message.error.message, typeof slicer === "string" ? { slicer } : undefined));
|
|
50
|
+
return;
|
|
53
51
|
}
|
|
52
|
+
// Read defensively: a reply without a usable error would otherwise throw here, after the entry is gone, and the
|
|
53
|
+
// call would never settle.
|
|
54
|
+
const error = message.error;
|
|
55
|
+
const code = typeof error?.code === "string" ? error.code : "invalid_file";
|
|
56
|
+
const text = typeof error?.message === "string" ? error.message : "The converter's worker sent a reply it couldn't read.";
|
|
57
|
+
entry.reject(new Any2orcaError(code, text, typeof error?.slicer === "string" ? { slicer: error.slicer } : undefined));
|
|
54
58
|
});
|
|
55
59
|
function call(body, transfer = [], onProgress) {
|
|
56
60
|
if (terminated)
|
|
@@ -95,9 +99,7 @@ export function createConverterWorker(worker, options) {
|
|
|
95
99
|
}
|
|
96
100
|
return {
|
|
97
101
|
async open(bytes, openOptions = {}) {
|
|
98
|
-
|
|
99
|
-
const ownsWholeBuffer = bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength;
|
|
100
|
-
const payload = openOptions.transfer && ownsWholeBuffer ? bytes : bytes.slice();
|
|
102
|
+
const payload = outgoing(bytes, openOptions.transfer);
|
|
101
103
|
const { handle, inspection } = await call({ op: "open", bytes: payload }, [payload.buffer]);
|
|
102
104
|
return { project: project(handle, inspection), inspection };
|
|
103
105
|
},
|
|
@@ -107,7 +109,10 @@ export function createConverterWorker(worker, options) {
|
|
|
107
109
|
},
|
|
108
110
|
resolvePreset: (preset, release) => call({ op: "resolvePreset", preset, ...releaseField(release) }),
|
|
109
111
|
listProfiles: (filter) => call({ op: "listProfiles", ...(filter ? { filter } : {}) }),
|
|
110
|
-
unwrapBundle
|
|
112
|
+
unwrapBundle(bytes, bundleOptions = {}) {
|
|
113
|
+
const payload = outgoing(bytes, bundleOptions.transfer);
|
|
114
|
+
return call({ op: "unwrapBundle", bytes: payload }, [payload.buffer]);
|
|
115
|
+
},
|
|
111
116
|
terminate() {
|
|
112
117
|
terminated = true;
|
|
113
118
|
worker.terminate();
|
|
@@ -117,6 +122,15 @@ export function createConverterWorker(worker, options) {
|
|
|
117
122
|
},
|
|
118
123
|
};
|
|
119
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* The bytes to post: the caller's own buffer when it may be moved and the
|
|
127
|
+
* view covers all of it, otherwise a fresh copy. Either way only one buffer
|
|
128
|
+
* crosses to the worker.
|
|
129
|
+
*/
|
|
130
|
+
function outgoing(bytes, transfer) {
|
|
131
|
+
const ownsWholeBuffer = bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength;
|
|
132
|
+
return transfer && ownsWholeBuffer ? bytes : bytes.slice();
|
|
133
|
+
}
|
|
120
134
|
/** The release field for a request, left out when no release is named. */
|
|
121
135
|
function releaseField(release) {
|
|
122
136
|
return release?.snapmakerOrcaVersion === undefined ? {} : { release: { snapmakerOrcaVersion: release.snapmakerOrcaVersion } };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "any2orca",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"outputAffecting": "
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"outputAffecting": "PrusaSlicer files: an unchecked Brim box is no brim and supports convert as PrusaSlicer shows them; a placement that isn't a number is kept as written. Bambu-family files are otherwise unchanged",
|
|
5
5
|
"description": "Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer and Flash Studio 3MF projects for the Snapmaker U1 (Snapmaker Orca), entirely on your own machine. Library, CLI and Web Worker in one package.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"3mf",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"docs": "typedoc"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"any2orca-profiles": "0.3.
|
|
68
|
+
"any2orca-profiles": "0.3.1",
|
|
69
69
|
"fflate": "0.8.3",
|
|
70
70
|
"zod": "4.6.7"
|
|
71
71
|
},
|