any2orca 0.10.0 → 0.12.0
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 +31 -0
- package/README.md +2 -2
- package/dist/cli/commands/convert.d.ts +2 -1
- package/dist/cli/commands/convert.js +1 -0
- package/dist/cli/commands/nozzle.d.ts +9 -0
- package/dist/cli/commands/nozzle.js +38 -0
- package/dist/cli/config.d.ts +4 -0
- package/dist/cli/config.js +5 -0
- package/dist/cli/main.js +41 -0
- package/dist/cli/surface.d.ts +11 -0
- package/dist/cli/surface.js +3 -0
- package/dist/diff/diffSettings.js +14 -5
- package/dist/engine/applyFilamentComplianceMode.d.ts +3 -1
- package/dist/engine/applyFilamentComplianceMode.js +5 -1
- package/dist/engine/applyFilamentFlowVariants.d.ts +2 -2
- package/dist/engine/applyFilamentFlowVariants.js +4 -4
- package/dist/engine/applyFilamentPresets.d.ts +50 -5
- package/dist/engine/applyFilamentPresets.js +162 -39
- package/dist/engine/buildProjectSettings.js +4 -2
- package/dist/engine/detectNozzleDiameter.d.ts +28 -0
- package/dist/engine/detectNozzleDiameter.js +44 -0
- package/dist/engine/detectVariantIndex.d.ts +13 -0
- package/dist/engine/detectVariantIndex.js +25 -13
- package/dist/engine/extractFilamentSlots.js +7 -1
- package/dist/engine/filamentVariantLayout.d.ts +31 -3
- package/dist/engine/filamentVariantLayout.js +54 -2
- package/dist/engine/fillFilamentSlots.js +2 -1
- package/dist/engine/padFilamentsToToolheads.d.ts +20 -0
- package/dist/engine/padFilamentsToToolheads.js +82 -0
- package/dist/engine/policy.d.ts +17 -0
- package/dist/engine/policy.js +45 -0
- package/dist/engine/runConvertPipeline.d.ts +15 -0
- package/dist/engine/runConvertPipeline.js +136 -9
- package/dist/engine/setFilamentDiameter.d.ts +13 -0
- package/dist/engine/setFilamentDiameter.js +30 -0
- package/dist/explain/whatChanged.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/inspect.d.ts +8 -2
- package/dist/inspect.js +2 -1
- package/dist/profiles.d.ts +9 -0
- package/dist/profiles.js +10 -0
- package/dist/project.d.ts +42 -8
- package/dist/project.js +71 -19
- package/dist/stamp.d.ts +12 -0
- package/dist/stamp.js +7 -0
- package/dist/version.js +1 -1
- package/dist/workerProtocol.d.ts +2 -0
- package/package.json +3 -3
package/dist/project.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BundleEntry } from "./archive/unwrapBundle.js";
|
|
2
|
+
import { type NozzleChoice } from "./engine/detectNozzleDiameter.js";
|
|
2
3
|
import { type WhatChanged } from "./explain/whatChanged.js";
|
|
3
4
|
import { type Inspection } from "./inspect.js";
|
|
4
5
|
import { ProfileCatalog, type ProfileSource, type ProfileSummary, type RetiredProfile } from "./profiles.js";
|
|
@@ -26,6 +27,14 @@ export interface ConvertOptions {
|
|
|
26
27
|
* hold throws {@link Any2orcaError} `release_not_found`.
|
|
27
28
|
*/
|
|
28
29
|
snapmakerOrcaVersion?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The nozzle size the user's U1 has, which the converted file is for: "0.2", "0.4", "0.6" or "0.8" (one size for
|
|
32
|
+
* all four toolheads, as Snapmaker Orca allows), or "match" for the creator's own size. Default "0.4", the stock
|
|
33
|
+
* nozzle most U1s run. A creator's size that differs gets a note and a What changed item; a project that mixes
|
|
34
|
+
* sizes (Bambu Studio's multi-diameter mode) gets a note naming the filaments on other sizes. Can't contradict
|
|
35
|
+
* `profileId` or a preset, whose profile names its own size.
|
|
36
|
+
*/
|
|
37
|
+
nozzle?: NozzleChoice;
|
|
29
38
|
/** Use this profile instead of matching one. A retired id converts with its successor, with a warning. */
|
|
30
39
|
profileId?: string;
|
|
31
40
|
/**
|
|
@@ -96,6 +105,11 @@ export interface ReportFilament {
|
|
|
96
105
|
export interface ConvertReport {
|
|
97
106
|
/** The profile the file was converted with. */
|
|
98
107
|
profile: ProfileSummary;
|
|
108
|
+
/**
|
|
109
|
+
* The nozzle size the file is for, how it was chosen, and the sizes the creator's project uses. Always set by
|
|
110
|
+
* `convert()`; optional so code that builds a report itself (a test's mock) needn't.
|
|
111
|
+
*/
|
|
112
|
+
nozzle?: NozzleUsed;
|
|
99
113
|
/** How the profile was matched; absent when `profileId` was given. */
|
|
100
114
|
profileMatch?: ProfileMatch;
|
|
101
115
|
/**
|
|
@@ -105,7 +119,7 @@ export interface ConvertReport {
|
|
|
105
119
|
profileNotes: string[];
|
|
106
120
|
/** Set when `profileId` named a retired profile and its successor was used. */
|
|
107
121
|
retiredProfile?: RetiredProfile;
|
|
108
|
-
/** Notes worth showing the user, cleaned up for display. */
|
|
122
|
+
/** Notes worth showing the user, cleaned up for display. Their wording can change in any release: check whether there are any, not what they say. */
|
|
109
123
|
warnings: string[];
|
|
110
124
|
/** Every note the conversion produced, including routine ones, for logs and bug reports. */
|
|
111
125
|
log: string[];
|
|
@@ -130,7 +144,11 @@ export interface ConvertReport {
|
|
|
130
144
|
plates: number;
|
|
131
145
|
objects: number;
|
|
132
146
|
filamentSlots: number;
|
|
133
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Every filament slot of the source, in the file's order, with the name each has in the source and in the output.
|
|
149
|
+
* The copies of the last filament that pad a project to one filament per toolhead aren't listed; What changed says
|
|
150
|
+
* how many were added.
|
|
151
|
+
*/
|
|
134
152
|
filaments: ReportFilament[];
|
|
135
153
|
/** The stamp written into the output, or null if `stamp: false`. */
|
|
136
154
|
stamp: OutputStamp | null;
|
|
@@ -161,9 +179,20 @@ export interface ConvertResult {
|
|
|
161
179
|
output: Uint8Array;
|
|
162
180
|
report: ConvertReport;
|
|
163
181
|
}
|
|
182
|
+
/** The nozzle size a conversion is for, and how it was chosen. */
|
|
183
|
+
export interface NozzleUsed {
|
|
184
|
+
/** What was asked for: a size such as "0.4", or "match" for the creator's. */
|
|
185
|
+
choice: NozzleChoice;
|
|
186
|
+
/** The size the file is converted for, e.g. "0.4". */
|
|
187
|
+
size: string;
|
|
188
|
+
/** The nozzle sizes the creator's project uses, as written, smallest first; empty when the file gives none. */
|
|
189
|
+
sourceSizes: string[];
|
|
190
|
+
}
|
|
164
191
|
export interface ProfileChoice {
|
|
165
192
|
profileId: string;
|
|
166
193
|
profileMatch: ProfileMatch;
|
|
194
|
+
/** The nozzle size the choice is for. Always set by `matchProfile()`; optional so a mock built by hand needn't. */
|
|
195
|
+
nozzle?: NozzleUsed;
|
|
167
196
|
/** Keep the source file's own layer height (auto-matched to a tier that isn't an exact layer height match). */
|
|
168
197
|
carrySourceLayerHeight: boolean;
|
|
169
198
|
/** Why the match may not be what the file asked for (an unusable layer height or a nozzle size with no U1 profile), as sentences. */
|
|
@@ -171,11 +200,14 @@ export interface ProfileChoice {
|
|
|
171
200
|
}
|
|
172
201
|
/**
|
|
173
202
|
* Picks a profile for a file's settings, the same way every UI should (never
|
|
174
|
-
* re-implement this): the
|
|
175
|
-
*
|
|
176
|
-
*
|
|
203
|
+
* re-implement this): among the profiles for the nozzle size the user's U1
|
|
204
|
+
* has (`options.nozzle`, default 0.4; "match" for the creator's own size),
|
|
205
|
+
* the source's own tier name first (from its print_settings_id, e.g. "Extra
|
|
206
|
+
* Fine"), then the nearest layer height, then the catalog default.
|
|
177
207
|
*/
|
|
178
|
-
export declare function matchProfile(projectSettings: Record<string, unknown>, profiles: ProfileSource | ProfileCatalog
|
|
208
|
+
export declare function matchProfile(projectSettings: Record<string, unknown>, profiles: ProfileSource | ProfileCatalog, options?: {
|
|
209
|
+
nozzle?: NozzleChoice;
|
|
210
|
+
}): Promise<ProfileChoice>;
|
|
179
211
|
/**
|
|
180
212
|
* Same cleanup every UI applies before showing warnings: drop routine
|
|
181
213
|
* bookkeeping lines, strip the internal "WARN" prefix and internal file
|
|
@@ -192,8 +224,10 @@ export declare class Project {
|
|
|
192
224
|
/** The project's own settings (Metadata/project_settings.config), as a copy: for a settings diff. */
|
|
193
225
|
settings(): Record<string, unknown>;
|
|
194
226
|
inspect(): Inspection;
|
|
195
|
-
/** The profile auto-matching would pick for this file. */
|
|
196
|
-
matchProfile(profiles: ProfileSource | ProfileCatalog
|
|
227
|
+
/** The profile auto-matching would pick for this file, for the user's nozzle size (`options.nozzle`, default 0.4). */
|
|
228
|
+
matchProfile(profiles: ProfileSource | ProfileCatalog, options?: {
|
|
229
|
+
nozzle?: NozzleChoice;
|
|
230
|
+
}): Promise<ProfileChoice>;
|
|
197
231
|
convert(options: ConvertOptions): Promise<ConvertResult>;
|
|
198
232
|
}
|
|
199
233
|
/** Opens a .3mf; see {@link Project}. */
|
package/dist/project.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { applyPolicyB, policyBFallbackNote } from "./sources/prusa/policyB.js";
|
|
12
12
|
import { applyConvertResponse, prepareConvertRequest } from "./archive/zip.js";
|
|
13
13
|
import { unwrapIfBundle } from "./archive/unwrapBundle.js";
|
|
14
|
-
import { detectNozzleDiameter } from "./engine/detectNozzleDiameter.js";
|
|
14
|
+
import { DEFAULT_NOZZLE, detectNozzleDiameter, NOZZLE_CHOICES, sourceNozzleSizes } from "./engine/detectNozzleDiameter.js";
|
|
15
15
|
import { parseTierName } from "./engine/parseTierName.js";
|
|
16
16
|
import { pickProfile } from "./engine/pickProfile.js";
|
|
17
17
|
import { runConvertPipeline } from "./engine/runConvertPipeline.js";
|
|
@@ -39,40 +39,69 @@ function rawNozzleDiameter(projectSettings) {
|
|
|
39
39
|
const value = typeof first === "string" ? Number(first.trim()) : typeof first === "number" ? first : NaN;
|
|
40
40
|
return Number.isFinite(value) ? value : null;
|
|
41
41
|
}
|
|
42
|
+
/** "0.2 and 0.4 mm" for ["0.2", "0.4"]; "0.4 mm" for one. */
|
|
43
|
+
function sizesText(sizes) {
|
|
44
|
+
return sizes.length <= 1 ? `${sizes[0] ?? "?"} mm` : `${sizes.slice(0, -1).join(", ")} and ${sizes[sizes.length - 1]} mm`;
|
|
45
|
+
}
|
|
42
46
|
/**
|
|
43
47
|
* Picks a profile for a file's settings, the same way every UI should (never
|
|
44
|
-
* re-implement this): the
|
|
45
|
-
*
|
|
46
|
-
*
|
|
48
|
+
* re-implement this): among the profiles for the nozzle size the user's U1
|
|
49
|
+
* has (`options.nozzle`, default 0.4; "match" for the creator's own size),
|
|
50
|
+
* the source's own tier name first (from its print_settings_id, e.g. "Extra
|
|
51
|
+
* Fine"), then the nearest layer height, then the catalog default.
|
|
47
52
|
*/
|
|
48
|
-
export async function matchProfile(projectSettings, profiles) {
|
|
53
|
+
export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
49
54
|
const catalog = await loadCatalog(profiles);
|
|
55
|
+
const choice = options.nozzle ?? DEFAULT_NOZZLE;
|
|
50
56
|
const detectedDiameter = detectNozzleDiameter(projectSettings);
|
|
57
|
+
const source = sourceNozzleSizes(projectSettings);
|
|
58
|
+
const size = choice === "match" ? detectedDiameter : choice;
|
|
59
|
+
if (size !== null && catalog.list({ nozzleDiameter: size }).length === 0) {
|
|
60
|
+
const sizes = [...new Set(catalog.list().map((s) => s.nozzleDiameter))].sort((a, b) => Number(a) - Number(b));
|
|
61
|
+
throw new Any2orcaError("profile_not_found", `There is no U1 profile for a ${size} mm nozzle; the catalog has ${sizesText(sizes)}.`);
|
|
62
|
+
}
|
|
51
63
|
const sourceLayerHeight = numericLayerHeight(projectSettings);
|
|
52
64
|
const printSettingsId = projectSettings.print_settings_id;
|
|
53
|
-
const picked =
|
|
54
|
-
? pickProfile(catalog.list({ nozzleDiameter:
|
|
65
|
+
const picked = size
|
|
66
|
+
? pickProfile(catalog.list({ nozzleDiameter: size }), {
|
|
55
67
|
layerHeight: sourceLayerHeight,
|
|
56
68
|
tierName: typeof printSettingsId === "string" ? parseTierName(printSettingsId) : null,
|
|
57
69
|
})
|
|
58
70
|
: null;
|
|
59
71
|
const profileId = picked?.profileId ?? catalog.index.defaultProfileId;
|
|
72
|
+
const used = catalog.get(profileId)?.nozzleDiameter ?? size ?? "";
|
|
60
73
|
const notes = [];
|
|
61
74
|
const sourceNozzle = rawNozzleDiameter(projectSettings);
|
|
62
|
-
if (
|
|
63
|
-
|
|
75
|
+
if (choice === "match") {
|
|
76
|
+
if (sourceNozzle === null) {
|
|
77
|
+
notes.push("the source file doesn't give a usable nozzle size, so the default profile is used");
|
|
78
|
+
}
|
|
79
|
+
else if (detectedDiameter && Math.abs(sourceNozzle - Number(detectedDiameter)) > 1e-6) {
|
|
80
|
+
notes.push(`the source file is set up for a ${sourceNozzle}mm nozzle, which has no U1 profile; the ${detectedDiameter}mm profile is used`);
|
|
81
|
+
}
|
|
82
|
+
if (source.mixed) {
|
|
83
|
+
notes.push(`the creator's project uses ${sizesText(source.sizes)} nozzles; Snapmaker Orca allows one size for all four toolheads, so the whole file is for ${used} mm`);
|
|
84
|
+
}
|
|
64
85
|
}
|
|
65
|
-
else if (
|
|
66
|
-
|
|
86
|
+
else if (source.mixed) {
|
|
87
|
+
const others = source.filamentSizes.flatMap((s, i) => (s !== null && s !== used ? [`filament ${i + 1} on ${s} mm`] : []));
|
|
88
|
+
notes.push(`the creator's project uses ${sizesText(source.sizes)} nozzles${others.length > 0 ? ` (${others.join(", ")})` : ""}; converted for your ${used} mm nozzles, since Snapmaker Orca allows one size for all four toolheads`);
|
|
89
|
+
}
|
|
90
|
+
else if (sourceNozzle === null) {
|
|
91
|
+
notes.push(`the source file doesn't give a usable nozzle size; converted for your ${used} mm nozzles`);
|
|
92
|
+
}
|
|
93
|
+
else if (Math.abs(sourceNozzle - Number(used)) > 1e-6) {
|
|
94
|
+
notes.push(`the creator's project is set up for a ${sourceNozzle} mm nozzle; converted for your ${used} mm nozzles (choose ${sourceNozzle} mm if your U1 has them)`);
|
|
67
95
|
}
|
|
68
96
|
if (Object.hasOwn(projectSettings, "layer_height") && sourceLayerHeight === null) {
|
|
69
97
|
notes.push(`the source file's layer height (${plainText(String(projectSettings.layer_height)).slice(0, 40)}) isn't a usable number, so it isn't used to choose the profile`);
|
|
70
98
|
}
|
|
71
99
|
return {
|
|
72
100
|
profileId,
|
|
101
|
+
nozzle: { choice, size: used, sourceSizes: source.sizes },
|
|
73
102
|
profileMatch: {
|
|
74
103
|
profileId,
|
|
75
|
-
nozzleDiameter:
|
|
104
|
+
nozzleDiameter: used,
|
|
76
105
|
exact: picked?.exact ?? false,
|
|
77
106
|
matchedByTierName: picked?.matchedByTierName ?? false,
|
|
78
107
|
matchSource: picked ? (picked.matchedByTierName ? "auto-tier-name" : picked.exact ? "auto-exact" : "auto-nearest") : "default-fallback",
|
|
@@ -133,6 +162,9 @@ function checkConvertOptions(options) {
|
|
|
133
162
|
if (o[key] !== undefined && typeof o[key] !== "boolean")
|
|
134
163
|
throw new TypeError(`The \`${key}\` option must be true or false.`);
|
|
135
164
|
}
|
|
165
|
+
if (o.nozzle !== undefined && (typeof o.nozzle !== "string" || !/^(\d{1,2}(\.\d{1,3})?|match)$/.test(o.nozzle))) {
|
|
166
|
+
throw new TypeError(`The \`nozzle\` option must be a nozzle size such as "0.4", or "match" for the creator's size (${NOZZLE_CHOICES.join(", ")}).`);
|
|
167
|
+
}
|
|
136
168
|
if (o.profileId !== undefined && typeof o.profileId !== "string")
|
|
137
169
|
throw new TypeError("The `profileId` option must be a string.");
|
|
138
170
|
if (o.snapmakerOrcaVersion !== undefined && typeof o.snapmakerOrcaVersion !== "string") {
|
|
@@ -195,9 +227,9 @@ export class Project {
|
|
|
195
227
|
inspect() {
|
|
196
228
|
return inspectProject(this.request.projectSettings, this.request.objects, this.parsed.warnings, this.parsed.unpackedBytes, this.parsed.sourcePlateOrigins, this.request.plateCount);
|
|
197
229
|
}
|
|
198
|
-
/** The profile auto-matching would pick for this file. */
|
|
199
|
-
matchProfile(profiles) {
|
|
200
|
-
return matchProfile(this.request.projectSettings, profiles);
|
|
230
|
+
/** The profile auto-matching would pick for this file, for the user's nozzle size (`options.nozzle`, default 0.4). */
|
|
231
|
+
matchProfile(profiles, options = {}) {
|
|
232
|
+
return matchProfile(this.request.projectSettings, profiles, options);
|
|
201
233
|
}
|
|
202
234
|
async convert(options) {
|
|
203
235
|
checkConvertOptions(options);
|
|
@@ -218,6 +250,7 @@ export class Project {
|
|
|
218
250
|
let profileNotes = [];
|
|
219
251
|
let carrySourceLayerHeight = false;
|
|
220
252
|
let retiredProfile;
|
|
253
|
+
let matchedNozzle;
|
|
221
254
|
if (options.preset && options.profileId) {
|
|
222
255
|
throw new Any2orcaError("invalid_preset", "A preset sets its own profile, so it can't be combined with a profile id.");
|
|
223
256
|
}
|
|
@@ -236,17 +269,31 @@ export class Project {
|
|
|
236
269
|
}
|
|
237
270
|
}
|
|
238
271
|
else {
|
|
239
|
-
const choice = await matchProfile(this.request.projectSettings, catalog);
|
|
272
|
+
const choice = await matchProfile(this.request.projectSettings, catalog, { nozzle: options.nozzle });
|
|
240
273
|
profileId = choice.profileId;
|
|
241
274
|
profileMatch = choice.profileMatch;
|
|
242
275
|
profileNotes = [...choice.notes];
|
|
243
276
|
carrySourceLayerHeight = choice.carrySourceLayerHeight;
|
|
277
|
+
matchedNozzle = choice.nozzle;
|
|
244
278
|
routeWarnings.push(...choice.notes.map((note) => ` WARN: ${note}`));
|
|
245
279
|
}
|
|
246
280
|
progress("loading-profile");
|
|
247
281
|
const loaded = await catalogEngine(catalog).load(profileId);
|
|
248
|
-
//
|
|
249
|
-
|
|
282
|
+
// A given profile or preset names its own nozzle size; a `nozzle` that says otherwise is a contradiction, not a choice.
|
|
283
|
+
if (options.nozzle !== undefined && options.nozzle !== "match" && options.nozzle !== loaded.summary.nozzleDiameter) {
|
|
284
|
+
const message = `"${loaded.summary.id}" is a ${loaded.summary.nozzleDiameter} mm nozzle profile, but the nozzle option says ${options.nozzle} mm.`;
|
|
285
|
+
if (preset)
|
|
286
|
+
throw new Any2orcaError("invalid_preset", `This preset was made for ${loaded.summary.nozzleDiameter} mm nozzles: ${message} Convert with that size, or without a nozzle option.`);
|
|
287
|
+
throw new TypeError(`${message} Pass one or the other.`);
|
|
288
|
+
}
|
|
289
|
+
const nozzle = matchedNozzle ?? {
|
|
290
|
+
choice: options.nozzle ?? loaded.summary.nozzleDiameter,
|
|
291
|
+
size: loaded.summary.nozzleDiameter,
|
|
292
|
+
sourceSizes: sourceNozzleSizes(this.request.projectSettings).sizes,
|
|
293
|
+
};
|
|
294
|
+
// The Snapmaker and Generic filament options write the chosen presets' own settings; every option compares each
|
|
295
|
+
// filament with the preset Snapmaker Orca resets it to.
|
|
296
|
+
const filamentPresets = (await catalogEngine(catalog).filamentPresets())?.[loaded.convertProfile.printer.id];
|
|
250
297
|
progress("merging");
|
|
251
298
|
if (preset) {
|
|
252
299
|
const sourceNozzle = detectNozzleDiameter(this.request.projectSettings);
|
|
@@ -265,6 +312,8 @@ export class Project {
|
|
|
265
312
|
const convertProfile = filamentPresets ? { ...loaded.convertProfile, printer: { ...loaded.convertProfile.printer, filamentPresets } } : loaded.convertProfile;
|
|
266
313
|
const pipeline = runConvertPipeline(convertProfile, request, catalog.index.slicer.application, {
|
|
267
314
|
carrySourceLayerHeight,
|
|
315
|
+
targetNozzleDiameter: loaded.summary.nozzleDiameter,
|
|
316
|
+
...(matchedNozzle ? { nozzle: { size: matchedNozzle.size, sourceSizes: matchedNozzle.sourceSizes } } : {}),
|
|
268
317
|
...(preset ? { presetChanges: preset.changes } : {}),
|
|
269
318
|
...(aboveStock.keep.size + aboveStock.stock.size > 0 ? { aboveStock } : {}),
|
|
270
319
|
});
|
|
@@ -291,6 +340,7 @@ export class Project {
|
|
|
291
340
|
profileId,
|
|
292
341
|
source: { format: this.parsed.source, ...(sourceVersion !== null ? { slicerVersion: sourceVersion } : {}) },
|
|
293
342
|
options: {
|
|
343
|
+
nozzle: { choice: nozzle.choice, size: nozzle.size },
|
|
294
344
|
highFlowHotends,
|
|
295
345
|
hardenedNozzles: options.hardenedNozzles === true,
|
|
296
346
|
filamentComplianceMode: options.filamentComplianceMode ?? null,
|
|
@@ -316,10 +366,12 @@ export class Project {
|
|
|
316
366
|
output,
|
|
317
367
|
report: {
|
|
318
368
|
profile: loaded.summary,
|
|
369
|
+
nozzle,
|
|
319
370
|
...(profileMatch ? { profileMatch } : {}),
|
|
320
371
|
profileNotes,
|
|
321
372
|
...(retiredProfile ? { retiredProfile } : {}),
|
|
322
|
-
|
|
373
|
+
// A filament set to a U1 preset because of its diameter comes first: the user has to load other filament.
|
|
374
|
+
warnings: cleanWarnings([...pipeline.leadWarnings, ...this.parsed.warnings, ...(response.warnings ?? []), ...applyWarnings.filter((w) => w.includes("WARN"))]),
|
|
323
375
|
log: [...this.parsed.warnings, ...routeWarnings, ...pipeline.warnings, ...applyWarnings].map((w) => w.trim()).filter(Boolean),
|
|
324
376
|
...(response.filamentComplianceFallback ? { filamentComplianceFallback: response.filamentComplianceFallback } : {}),
|
|
325
377
|
...(response.filamentComplianceUnchanged ? { filamentComplianceUnchanged: response.filamentComplianceUnchanged } : {}),
|
package/dist/stamp.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export declare const OutputStampSchema: z.ZodObject<{
|
|
|
32
32
|
slicerVersion: z.ZodOptional<z.ZodString>;
|
|
33
33
|
}, z.core.$strict>>;
|
|
34
34
|
options: z.ZodObject<{
|
|
35
|
+
nozzle: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
choice: z.ZodString;
|
|
37
|
+
size: z.ZodString;
|
|
38
|
+
}, z.core.$strict>>;
|
|
35
39
|
highFlowHotends: z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodBoolean>]>;
|
|
36
40
|
hardenedNozzles: z.ZodBoolean;
|
|
37
41
|
filamentComplianceMode: z.ZodNullable<z.ZodEnum<{
|
|
@@ -80,6 +84,14 @@ export interface OutputStamp {
|
|
|
80
84
|
slicerVersion?: string;
|
|
81
85
|
};
|
|
82
86
|
options: {
|
|
87
|
+
/**
|
|
88
|
+
* The nozzle size the file is for: `choice` is what was asked ("0.4", or "match" for the creator's size),
|
|
89
|
+
* `size` the size used. Absent in files written before the option; those are for the creator's size.
|
|
90
|
+
*/
|
|
91
|
+
nozzle?: {
|
|
92
|
+
choice: string;
|
|
93
|
+
size: string;
|
|
94
|
+
};
|
|
83
95
|
highFlowHotends: HighFlowHotends;
|
|
84
96
|
hardenedNozzles: boolean;
|
|
85
97
|
filamentComplianceMode: "generic" | "snapmaker" | null;
|
package/dist/stamp.js
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
import "./zodSetup.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import { HighFlowHotendsSchema } from "./schema.js";
|
|
16
|
+
/** The nozzle size the file is for: what was asked (a size, or "match" for the creator's) and the size used. */
|
|
17
|
+
const NozzleStampSchema = z.object({ choice: z.string().max(16), size: z.string().max(16) }).strict();
|
|
16
18
|
import { SOURCE_FORMATS } from "./sources/reader.js";
|
|
17
19
|
export const STAMP_PATH = "Metadata/any2orca.json";
|
|
18
20
|
const AboveStockStampSchema = z
|
|
@@ -54,6 +56,8 @@ export const OutputStampSchema = z
|
|
|
54
56
|
.optional(),
|
|
55
57
|
options: z
|
|
56
58
|
.object({
|
|
59
|
+
/** The nozzle size the file is for; files written before the option have none. */
|
|
60
|
+
nozzle: NozzleStampSchema.optional(),
|
|
57
61
|
highFlowHotends: HighFlowHotendsSchema,
|
|
58
62
|
hardenedNozzles: z.boolean(),
|
|
59
63
|
filamentComplianceMode: z.enum(["generic", "snapmaker"]).nullable(),
|
|
@@ -82,6 +86,8 @@ const StampReadSchema = z.object({
|
|
|
82
86
|
// release with a format this one doesn't know still reads as stamped.
|
|
83
87
|
source: z.object({ format: z.string().regex(/^[a-z0-9-]{1,32}$/), slicerVersion: noteText(64).optional() }).optional(),
|
|
84
88
|
options: z.object({
|
|
89
|
+
// Added with the nozzle option; absent means the file is for the creator's nozzle size.
|
|
90
|
+
nozzle: z.object({ choice: noteText(16), size: noteText(16) }).optional(),
|
|
85
91
|
highFlowHotends: HighFlowHotendsSchema,
|
|
86
92
|
// Added after the first stamps were written; absent means the stock stainless nozzles.
|
|
87
93
|
hardenedNozzles: z.boolean().default(false),
|
|
@@ -111,6 +117,7 @@ export function decodeStamp(bytes) {
|
|
|
111
117
|
profiles: { version: profiles.version, tracks: profiles.tracks },
|
|
112
118
|
profileId,
|
|
113
119
|
options: {
|
|
120
|
+
...(options.nozzle ? { nozzle: { choice: options.nozzle.choice, size: options.nozzle.size } } : {}),
|
|
114
121
|
highFlowHotends: options.highFlowHotends,
|
|
115
122
|
hardenedNozzles: options.hardenedNozzles,
|
|
116
123
|
filamentComplianceMode: options.filamentComplianceMode,
|
package/dist/version.js
CHANGED
package/dist/workerProtocol.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export type WorkerReleaseOption = {
|
|
|
10
10
|
export type WorkerConvertOptions = {
|
|
11
11
|
/** The Snapmaker Orca release to convert for (default: the newest the catalog holds). */
|
|
12
12
|
snapmakerOrcaVersion?: string;
|
|
13
|
+
/** The nozzle size the user's U1 has ("0.2" to "0.8"), or "match" for the creator's; default "0.4". */
|
|
14
|
+
nozzle?: string;
|
|
13
15
|
profileId?: string;
|
|
14
16
|
highFlowHotends?: boolean | readonly boolean[];
|
|
15
17
|
hardenedNozzles?: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "any2orca",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"outputAffecting": "
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"outputAffecting": "Snapmaker Orca no longer opens a converted file with its first filament marked as modified; files are converted for the nozzle size your U1 has, 0.4 mm unless you say otherwise, instead of the size the creator used; and 4 more",
|
|
5
5
|
"description": "Convert Bambu Studio, Creality Print, Anycubic Slicer Next, ElegooSlicer, Flash Studio, QIDI Studio and PrusaSlicer 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",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"homepage": "https://github.com/KuzuriAo/any2orca",
|
|
87
87
|
"engines": {
|
|
88
|
-
"node": ">=
|
|
88
|
+
"node": ">=22"
|
|
89
89
|
},
|
|
90
90
|
"bugs": {
|
|
91
91
|
"url": "https://github.com/KuzuriAo/any2orca/issues"
|