any2orca 0.12.1 → 0.14.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 +20 -0
- package/README.md +7 -2
- package/dist/archive/meshPaint.d.ts +25 -0
- package/dist/archive/meshPaint.js +136 -0
- package/dist/archive/objectWorldBboxXY.d.ts +19 -1
- package/dist/archive/objectWorldBboxXY.js +32 -8
- package/dist/archive/paintColor.d.ts +21 -0
- package/dist/archive/paintColor.js +88 -0
- package/dist/archive/plateFilaments.d.ts +65 -0
- package/dist/archive/plateFilaments.js +363 -0
- package/dist/cli/commands/convert.d.ts +10 -0
- package/dist/cli/commands/convert.js +83 -19
- package/dist/cli/commands/inspect.d.ts +17 -0
- package/dist/cli/commands/inspect.js +75 -0
- package/dist/cli/main.js +43 -1
- package/dist/cli/surface.d.ts +29 -0
- package/dist/cli/surface.js +6 -0
- package/dist/engine/carrySourceLayerHeight.js +2 -2
- package/dist/engine/runConvertPipeline.d.ts +9 -2
- package/dist/engine/runConvertPipeline.js +24 -6
- package/dist/explain/filamentNotes.d.ts +17 -1
- package/dist/explain/filamentNotes.js +28 -12
- package/dist/explain/notes.d.ts +40 -0
- package/dist/explain/notes.js +74 -0
- package/dist/explain/plateNotes.d.ts +32 -0
- package/dist/explain/plateNotes.js +89 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +4 -1
- package/dist/inspect.d.ts +9 -1
- package/dist/inspect.js +2 -1
- package/dist/problemReport.d.ts +68 -0
- package/dist/problemReport.js +312 -0
- package/dist/profiles.d.ts +12 -0
- package/dist/profiles.js +18 -1
- package/dist/project.d.ts +31 -8
- package/dist/project.js +91 -48
- package/dist/sources/bambuFamily.js +6 -1
- package/dist/sources/prusa/prusa.js +6 -1
- package/dist/sources/reader.d.ts +6 -0
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
export { convert, inspect, openProject, matchProfile, unwrapBundle, Project, CONVERT_STAGES } from "./project.js";
|
|
13
13
|
export type { ConvertOptions, ConvertReport, ConvertResult, ConvertStage, KnownConvertStage, NozzleUsed, OpenOptions, ProfileChoice, ReportFilament, ReportFilamentPreset } from "./project.js";
|
|
14
14
|
export { DEFAULT_MAX_UNPACKED_BYTES, LARGE_PROJECT_BYTES, MAX_UNPACKED_BYTES_LIMIT } from "./archive/safeUnzip.js";
|
|
15
|
+
export { FILAMENT_USES } from "./archive/plateFilaments.js";
|
|
16
|
+
export type { FilamentUse, KnownFilamentUse, PlateFilaments, PlateFilamentUse } from "./archive/plateFilaments.js";
|
|
15
17
|
export { SOURCE_VENDORS } from "./inspect.js";
|
|
16
18
|
export type { FilamentSlotInfo, Inspection, KnownSourceVendor, SourceVendor } from "./inspect.js";
|
|
17
19
|
export { SOURCE_FORMATS } from "./sources/reader.js";
|
|
@@ -35,7 +37,10 @@ export type { DiffAttention, DiffGroup, DiffGroupName, DiffOptions, DiffRow, Dif
|
|
|
35
37
|
export { diffReference, presetDiffSide, stockDiffSide } from "./diff/reference.js";
|
|
36
38
|
export type { SettingGroup, SettingInfo } from "./diff/settingsCatalog.js";
|
|
37
39
|
export { formatWhatChanged, CHANGE_REASONS } from "./explain/whatChanged.js";
|
|
38
|
-
export { filamentNotes } from "./explain/filamentNotes.js";
|
|
40
|
+
export { filamentNotes, filamentPresetNotes } from "./explain/filamentNotes.js";
|
|
41
|
+
export type { FilamentPresetNote, NotesReport } from "./explain/filamentNotes.js";
|
|
42
|
+
export { NOTE_TOPICS } from "./explain/notes.js";
|
|
43
|
+
export type { ConvertNote, KnownNoteTopic, NoteTopic } from "./explain/notes.js";
|
|
39
44
|
export type { ChangeGroup, ChangeItem, ChangeReason, KnownChangeReason, WhatChanged } from "./explain/whatChanged.js";
|
|
40
45
|
export { extractPreset } from "./presets/extractPreset.js";
|
|
41
46
|
export { parsePresetFile, serializePresets, resolvePreset, withoutChanges, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES } from "./presets/preset.js";
|
|
@@ -46,5 +51,7 @@ export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsen
|
|
|
46
51
|
export type { KnownStatsMatchSource, StatsConsent, StatsConsentState, StatsEvent, StatsEventInput, StatsMatchSource } from "./telemetry.js";
|
|
47
52
|
export { MATCH_SOURCES } from "./schema.js";
|
|
48
53
|
export type { ConvertObject, HighFlowHotends, KnownMatchSource, MatchSource, ProfileMatch, Shifts } from "./schema.js";
|
|
54
|
+
export { describeEnvironment, describeUserAgent, PLAIN_NOTES, problemReport } from "./problemReport.js";
|
|
55
|
+
export type { ProblemReportInput, ProblemReportOptions } from "./problemReport.js";
|
|
49
56
|
export { plainText } from "./plainText.js";
|
|
50
57
|
export { VERSION } from "./version.js";
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { convert, inspect, openProject, matchProfile, unwrapBundle, Project, CONVERT_STAGES } from "./project.js";
|
|
14
14
|
export { DEFAULT_MAX_UNPACKED_BYTES, LARGE_PROJECT_BYTES, MAX_UNPACKED_BYTES_LIMIT } from "./archive/safeUnzip.js";
|
|
15
|
+
export { FILAMENT_USES } from "./archive/plateFilaments.js";
|
|
15
16
|
export { SOURCE_VENDORS } from "./inspect.js";
|
|
16
17
|
export { SOURCE_FORMATS } from "./sources/reader.js";
|
|
17
18
|
export { DEFAULT_NOZZLE, NOZZLE_CHOICES, SUPPORTED_NOZZLE_DIAMETERS } from "./engine/detectNozzleDiameter.js";
|
|
@@ -23,10 +24,12 @@ export { diffSettings, DIFF_ATTENTIONS, DIFF_STATUSES } from "./diff/diffSetting
|
|
|
23
24
|
export { valueLayoutNotes, VALUE_LAYOUTS } from "./diff/valueLayout.js";
|
|
24
25
|
export { diffReference, presetDiffSide, stockDiffSide } from "./diff/reference.js";
|
|
25
26
|
export { formatWhatChanged, CHANGE_REASONS } from "./explain/whatChanged.js";
|
|
26
|
-
export { filamentNotes } from "./explain/filamentNotes.js";
|
|
27
|
+
export { filamentNotes, filamentPresetNotes } from "./explain/filamentNotes.js";
|
|
28
|
+
export { NOTE_TOPICS } from "./explain/notes.js";
|
|
27
29
|
export { extractPreset } from "./presets/extractPreset.js";
|
|
28
30
|
export { parsePresetFile, serializePresets, resolvePreset, withoutChanges, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES } from "./presets/preset.js";
|
|
29
31
|
export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsent, STATS_MATCH_SOURCES } from "./telemetry.js";
|
|
30
32
|
export { MATCH_SOURCES } from "./schema.js";
|
|
33
|
+
export { describeEnvironment, describeUserAgent, PLAIN_NOTES, problemReport } from "./problemReport.js";
|
|
31
34
|
export { plainText } from "./plainText.js";
|
|
32
35
|
export { VERSION } from "./version.js";
|
package/dist/inspect.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type FilamentColorMatch } from "./archive/lookupFilamentColorName.js";
|
|
9
9
|
import { type SupportedNozzleDiameter } from "./engine/detectNozzleDiameter.js";
|
|
10
|
+
import type { PlateFilaments } from "./archive/plateFilaments.js";
|
|
10
11
|
import type { ConvertObject } from "./schema.js";
|
|
11
12
|
/** The printer makers any2orca recognizes, from a project's printer and preset names; "other" for any it doesn't. */
|
|
12
13
|
export declare const SOURCE_VENDORS: readonly ["bambu", "creality", "anycubic", "snapmaker", "elegoo", "prusa", "flashforge", "qidi", "other"];
|
|
@@ -68,6 +69,13 @@ export interface Inspection {
|
|
|
68
69
|
* PrusaSlicer 2.9 places its beds in rings with a gap of at most 100 mm, later rows at positive Y. Absent: use that grid.
|
|
69
70
|
*/
|
|
70
71
|
sourcePlateOrigins?: Record<number, [number, number]>;
|
|
72
|
+
/**
|
|
73
|
+
* The filaments each plate uses, one entry per plate in order, empty plates included: by its objects and their
|
|
74
|
+
* parts, by paint, by a filament set for a range of heights, by supports and by tool changes at a layer; each with
|
|
75
|
+
* the heights it is used between, and the most the plate needs at the same height (an estimate from the model, not
|
|
76
|
+
* a slice). Always set by `inspect()`; optional so code that builds an Inspection itself (a test's mock) needn't.
|
|
77
|
+
*/
|
|
78
|
+
plateFilaments?: PlateFilaments[];
|
|
71
79
|
/** Non-fatal notes from reading the file. Their wording can change in any release: check whether there are any, not what they say. */
|
|
72
80
|
warnings: string[];
|
|
73
81
|
/**
|
|
@@ -78,4 +86,4 @@ export interface Inspection {
|
|
|
78
86
|
}
|
|
79
87
|
export declare function detectSourceVendor(printerModel: string | null, sourcePresetName?: string | null, printerNotes?: string | null, printerPresetName?: string | null, filamentPresetName?: string | null): SourceVendor;
|
|
80
88
|
/** Builds an {@link Inspection} from a parsed project's settings and objects. */
|
|
81
|
-
export declare function inspectProject(projectSettings: Record<string, unknown>, objects: ConvertObject[], warnings: readonly string[], unpackedBytes: number, sourcePlateOrigins?: Readonly<Record<number, readonly [number, number]>>, plateCount?: number): Inspection;
|
|
89
|
+
export declare function inspectProject(projectSettings: Record<string, unknown>, objects: ConvertObject[], warnings: readonly string[], unpackedBytes: number, sourcePlateOrigins?: Readonly<Record<number, readonly [number, number]>>, plateCount?: number, plateFilaments?: readonly PlateFilaments[]): Inspection;
|
package/dist/inspect.js
CHANGED
|
@@ -69,7 +69,7 @@ export function detectSourceVendor(printerModel, sourcePresetName = null, printe
|
|
|
69
69
|
return "other";
|
|
70
70
|
}
|
|
71
71
|
/** Builds an {@link Inspection} from a parsed project's settings and objects. */
|
|
72
|
-
export function inspectProject(projectSettings, objects, warnings, unpackedBytes, sourcePlateOrigins, plateCount) {
|
|
72
|
+
export function inspectProject(projectSettings, objects, warnings, unpackedBytes, sourcePlateOrigins, plateCount, plateFilaments) {
|
|
73
73
|
const colors = toStringArray(projectSettings.filament_colour);
|
|
74
74
|
const types = toStringArray(projectSettings.filament_type);
|
|
75
75
|
const names = toStringArray(projectSettings.filament_settings_id);
|
|
@@ -111,6 +111,7 @@ export function inspectProject(projectSettings, objects, warnings, unpackedBytes
|
|
|
111
111
|
sourcePrintableArea: Array.isArray(printableArea) && printableArea.length <= 64 && printableArea.every((p) => typeof p === "string")
|
|
112
112
|
? printableArea.slice()
|
|
113
113
|
: null,
|
|
114
|
+
...(plateFilaments ? { plateFilaments: plateFilaments.map((p) => ({ plate: p.plate, filaments: p.filaments.map((f) => ({ ...f, uses: [...f.uses] })), mostAtOnce: p.mostAtOnce })) } : {}),
|
|
114
115
|
warnings: [...warnings],
|
|
115
116
|
unpackedBytes,
|
|
116
117
|
...(sourcePlateOrigins
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Inspection } from "./inspect.js";
|
|
2
|
+
import type { ProfileCatalog } from "./profiles.js";
|
|
3
|
+
import type { ConvertReport } from "./project.js";
|
|
4
|
+
/** The options a conversion was asked for, as the report shows them: every field optional, none holding a file's text. */
|
|
5
|
+
export interface ProblemReportOptions {
|
|
6
|
+
/** The nozzle size asked for: "0.4", or "match". */
|
|
7
|
+
nozzle?: string;
|
|
8
|
+
/** The Snapmaker Orca release asked for, e.g. "2.4.1"; leave out for the newest. */
|
|
9
|
+
snapmakerOrcaVersion?: string;
|
|
10
|
+
/** A profile chosen by hand; leave out when the profile was matched. */
|
|
11
|
+
profileId?: string;
|
|
12
|
+
/** The filament naming option, when one was on. */
|
|
13
|
+
filamentComplianceMode?: "generic" | "snapmaker";
|
|
14
|
+
/** Which toolheads have the high-flow hotend: `true` for all, or one entry per toolhead. */
|
|
15
|
+
highFlowHotends?: boolean | readonly boolean[];
|
|
16
|
+
/** Whether the nozzles are hardened steel. */
|
|
17
|
+
hardenedNozzles?: boolean;
|
|
18
|
+
/** Whether the version note was written; `false` only when it was turned off. */
|
|
19
|
+
stamp?: boolean;
|
|
20
|
+
/** Whether a preset of the user's own was used. Its name isn't taken: it is the user's own text. */
|
|
21
|
+
preset?: boolean;
|
|
22
|
+
/** Settings kept above stock, and settings set to stock, by their Snapmaker Orca names. */
|
|
23
|
+
aboveStock?: {
|
|
24
|
+
keep?: readonly string[];
|
|
25
|
+
stock?: readonly string[];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** What {@link problemReport} builds its text from: give it what you have, and leave the rest out. */
|
|
29
|
+
export interface ProblemReportInput {
|
|
30
|
+
/** What ran it, in a few words of your own: "any2orca.com", "any2orca command line", "my publishing script". */
|
|
31
|
+
app?: string;
|
|
32
|
+
/** Where it ran. Default: {@link describeEnvironment}. */
|
|
33
|
+
environment?: string;
|
|
34
|
+
/** What `inspect()` said about the file, when it could be opened. */
|
|
35
|
+
inspection?: Inspection;
|
|
36
|
+
/** The conversion's report, when it finished. */
|
|
37
|
+
report?: ConvertReport;
|
|
38
|
+
/** What was thrown, when it didn't. Only its code (or, for an unexpected error, its kind) goes in the report. */
|
|
39
|
+
error?: unknown;
|
|
40
|
+
/** The step it had reached: "opening", or the last stage `onProgress` gave. */
|
|
41
|
+
stage?: string;
|
|
42
|
+
/** The options the conversion was asked for. */
|
|
43
|
+
options?: ProblemReportOptions;
|
|
44
|
+
/** The profile catalog used, for its version and its Snapmaker Orca release. */
|
|
45
|
+
catalog?: ProfileCatalog;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The wordings whose text goes into a report, as the notes read (a capital at the start, a period at the end).
|
|
49
|
+
* `{n}` is a number, `{list}` numbers ("1, 2 and 3"), `{key}` and `{keys}` Snapmaker Orca setting names (checked
|
|
50
|
+
* against its settings), `{preset}` one of this conversion's own preset names, `{a|b}` one of the words given.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PLAIN_NOTES: readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* A browser and system from a user agent string: the browser's name and major version, and the system's name.
|
|
55
|
+
* Nothing else of the string is kept; one that names no browser this knows gives "a browser".
|
|
56
|
+
*/
|
|
57
|
+
export declare function describeUserAgent(userAgent: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Where this code is running, in a few words: "Node 22.12.0 on macOS (arm64)" or "Chrome 131 on Windows". Reads only
|
|
60
|
+
* the runtime's own version and system name; makes no request.
|
|
61
|
+
*/
|
|
62
|
+
export declare function describeEnvironment(): string;
|
|
63
|
+
/**
|
|
64
|
+
* The problem report as text, one fact per line, ready to copy. Give it what you have: the inspection when the
|
|
65
|
+
* file opened, the report when the conversion finished, the error when it didn't. See the module comment for what
|
|
66
|
+
* never goes in.
|
|
67
|
+
*/
|
|
68
|
+
export declare function problemReport(input: ProblemReportInput): string;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* A problem report someone can copy into a bug report: what was converted, with what, for what, and what came of
|
|
4
|
+
* it, as plain text. Nothing is sent anywhere; the function only builds the text.
|
|
5
|
+
*
|
|
6
|
+
* It holds nothing that identifies the file or its owner: no file name, no object or plate names, no paths, no
|
|
7
|
+
* error message or stack. What a file can carry in a name or a value never goes in as it is:
|
|
8
|
+
*
|
|
9
|
+
* - Preset names (filaments, the process preset) are short, plain, and cut at a "(...3mf)" suffix, which is where
|
|
10
|
+
* Bambu Studio puts the project file's name on an edited preset; a name that still holds a file name is left out.
|
|
11
|
+
* - A note's text is included only when it matches one of the wordings in {@link PLAIN_NOTES}, whose variable parts
|
|
12
|
+
* are numbers, plate, object and filament numbers, Snapmaker Orca's own setting names and this conversion's
|
|
13
|
+
* preset names. Any other note is listed by its topic alone. A wording changed in a later release stops matching
|
|
14
|
+
* and falls back to its topic: the safe side.
|
|
15
|
+
*/
|
|
16
|
+
import { SETTINGS_CATALOG } from "./diff/settingsCatalog.js";
|
|
17
|
+
import { Any2orcaError } from "./errors.js";
|
|
18
|
+
import { plainText } from "./plainText.js";
|
|
19
|
+
import { VERSION } from "./version.js";
|
|
20
|
+
const MAX_NAME = 80;
|
|
21
|
+
/** A preset name as the report may show it, or null when it can't be shown. */
|
|
22
|
+
function presetName(name) {
|
|
23
|
+
if (typeof name !== "string")
|
|
24
|
+
return null;
|
|
25
|
+
// Bambu Studio names an edited preset after the project file: "Bambu PLA Basic @BBL X1C(my-model.3mf)".
|
|
26
|
+
const cut = plainText(name).replace(/\s*\([^()]*\.3mf\)\s*$/i, "").trim().slice(0, MAX_NAME);
|
|
27
|
+
if (cut === "" || /\.(3mf|stl|step|stp|obj|zip|gcode)\b/i.test(cut) || /[\\/]/.test(cut.replace(/ \/ /g, " ")))
|
|
28
|
+
return null;
|
|
29
|
+
return cut;
|
|
30
|
+
}
|
|
31
|
+
/** A short plain value the file gives about itself (a version, a printer model): letters, digits and a little punctuation only. */
|
|
32
|
+
function plainFact(value, max = 60) {
|
|
33
|
+
if (typeof value !== "string")
|
|
34
|
+
return null;
|
|
35
|
+
const text = plainText(value).trim().slice(0, max);
|
|
36
|
+
return /^[A-Za-z0-9][A-Za-z0-9 .+_()-]*$/.test(text) && !/\.(3mf|stl|step|stp|obj|zip|gcode)\b/i.test(text) ? text : null;
|
|
37
|
+
}
|
|
38
|
+
/** A material as written, when it reads like one ("PLA", "PETG-CF", "PA6-GF"); otherwise "other". */
|
|
39
|
+
function material(type) {
|
|
40
|
+
return /^[A-Za-z0-9][A-Za-z0-9+ -]{0,15}$/.test(type) ? type : "other";
|
|
41
|
+
}
|
|
42
|
+
// --- Notes whose text can't quote the file ------------------------------------------------------------------------
|
|
43
|
+
const N = String.raw `\d+(?:\.\d+)?`;
|
|
44
|
+
const PRESET = String.raw `\u0001\d+\u0002`;
|
|
45
|
+
const PIECES = {
|
|
46
|
+
n: N,
|
|
47
|
+
list: String.raw `\d+(?:, \d+)*(?: and \d+)?`,
|
|
48
|
+
key: String.raw `[a-z][a-z0-9_]{1,80}`,
|
|
49
|
+
keys: String.raw `[a-z][a-z0-9_]{1,80}(?:, [a-z][a-z0-9_]{1,80})*(?: and \d+ more)?`,
|
|
50
|
+
preset: PRESET,
|
|
51
|
+
presets: String.raw `${PRESET}(?:, ${PRESET})*`,
|
|
52
|
+
version: String.raw `\d+(?:\.\d+){1,3}`,
|
|
53
|
+
sizes: String.raw `${N}(?:, ${N})*(?: and ${N})? mm`,
|
|
54
|
+
onsizes: String.raw `filament \d+ on ${N} mm(?:, filament \d+ on ${N} mm)*`,
|
|
55
|
+
size: String.raw `\d+(?:\.\d+)? [MG]B`,
|
|
56
|
+
unit: String.raw `mm/s²?|mm³/s|mm`,
|
|
57
|
+
// A filament preset's changed settings, as filamentNotes words them: a setting it names, and two numbers with its unit.
|
|
58
|
+
changes: (() => {
|
|
59
|
+
const item = String.raw `(?:nozzle temperature|first-layer nozzle temperature|flow ratio|max volumetric speed|pressure advance|retraction length|bed temperature \((?:smooth|textured) PEI\)|max fan speed) -?[\d.]{1,12}(?: °C| mm³/s| mm|%)? → -?[\d.]{1,12}(?: °C| mm³/s| mm|%)?`;
|
|
60
|
+
return String.raw `(?:${item}(?:, ${item})*(?: and ${item})?(?:, and \d+ other settings?)?|\d+ other settings?)`;
|
|
61
|
+
})(),
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The wordings whose text goes into a report, as the notes read (a capital at the start, a period at the end).
|
|
65
|
+
* `{n}` is a number, `{list}` numbers ("1, 2 and 3"), `{key}` and `{keys}` Snapmaker Orca setting names (checked
|
|
66
|
+
* against its settings), `{preset}` one of this conversion's own preset names, `{a|b}` one of the words given.
|
|
67
|
+
*/
|
|
68
|
+
export const PLAIN_NOTES = [
|
|
69
|
+
// Which filaments each plate uses.
|
|
70
|
+
"Plate {n} needs {n} filaments at the same height (it uses {filament|filaments} {list}), and the U1 prints with {n} at a time, so it can't print as it is. In Snapmaker Orca, move some of its objects to another plate or use fewer filaments on it.",
|
|
71
|
+
"Plate {n} uses {n} filaments ({filament|filaments} {list}), no more than {n} at the same height. The U1 prints with {n} at a time, so this plate needs filament changes at pauses, which you set up in Snapmaker Orca.",
|
|
72
|
+
"Plate {n} uses {filament|filaments} {list}.",
|
|
73
|
+
"Check {plate|plates} {list} before printing. Snapmaker Orca {version} can skip {filament|filaments} {list} on some layers when {filament|filaments} {list} {is|are} on the same plate, and it gives no warning. Look through the sliced preview for missing color. To avoid the problem, print {the two|each pair} on separate plates, or give {filament|filaments} {list} {a number|numbers} from 1 to {n} in Snapmaker Orca.",
|
|
74
|
+
// Plates and placement.
|
|
75
|
+
"Plate {n} has no objects in the project; it stays empty, so the other plates keep their numbers.",
|
|
76
|
+
"Plate {n}'s spacing was clamped to {n}x (ideally {n}x) to keep every object on the bed, so objects on this plate may be closer together than the Snapmaker U1's clearance radius calls for. Review spacing on this plate manually before printing.",
|
|
77
|
+
"Plate {n}'s objects were pulled together to fit the target bed, and object {n} and object {n} are touching or overlapping as a result (tolerance {n}mm). Review spacing on this plate before printing.",
|
|
78
|
+
"Plate {n}'s objects were pulled together to fit the target bed, and object {n} and object {n} are only {n}mm apart as a result (tolerance {n}mm). Review spacing on this plate before printing.",
|
|
79
|
+
"Plate {n}'s combined footprint ({n} x {n} mm) is larger than the usable printable area ({n} x {n} mm, keeping a {n}mm margin from the {n} x {n} mm bed's edge) by {n}mm in {X|Y} -- some objects will be positioned outside the printable area even when centered. Split this plate or rearrange/scale down the objects before converting.",
|
|
80
|
+
"Plate {n}'s combined footprint ({n} x {n} mm) is larger than the usable printable area ({n} x {n} mm, keeping a {n}mm margin from the {n} x {n} mm bed's edge) by {n}mm in X and by {n}mm in Y -- some objects will be positioned outside the printable area even when centered. Split this plate or rearrange/scale down the objects before converting.",
|
|
81
|
+
"The project's {n} beds become {n} plates.",
|
|
82
|
+
// The nozzle size and the profile.
|
|
83
|
+
"The creator's project is set up for a {n} mm nozzle; converted for your {n} mm nozzles (choose {n} mm if your U1 has them).",
|
|
84
|
+
"The creator's project uses {sizes} nozzles; Snapmaker Orca allows one size for all four toolheads, so the whole file is for {n} mm.",
|
|
85
|
+
"The creator's project uses {sizes} nozzles; converted for your {n} mm nozzles, since Snapmaker Orca allows one size for all four toolheads.",
|
|
86
|
+
"The creator's project uses {sizes} nozzles ({onsizes}); converted for your {n} mm nozzles, since Snapmaker Orca allows one size for all four toolheads.",
|
|
87
|
+
"The source file doesn't give a usable nozzle size; converted for your {n} mm nozzles.",
|
|
88
|
+
"The source file doesn't give a usable nozzle size, so the default profile is used.",
|
|
89
|
+
"The source file is set up for a {n} mm nozzle, which has no U1 profile; the {n} mm profile is used.",
|
|
90
|
+
"The U1 has no {n} mm profile for this nozzle size, so your file's {n} mm layer height was kept, on the closest profile ({n} mm).",
|
|
91
|
+
"Your file's {n} mm layer height is outside what the U1 supports for this nozzle size, so it was set to {n} mm, on the closest profile ({n} mm).",
|
|
92
|
+
"High-flow hotends were requested, but Snapmaker has no high-flow option for this nozzle size (only 0.4 mm), so the project is set up for standard hotends.",
|
|
93
|
+
"This profile has no separate high-flow speeds in Snapmaker's presets, so it uses its normal speeds; the selected toolheads are still set to the Liber High Flow Hotend.",
|
|
94
|
+
// Settings.
|
|
95
|
+
"No changed print settings were marked in this file. If the printer profile was switched in the slicer without re-applying the settings afterward, they may not have carried over.",
|
|
96
|
+
"Filament max volumetric speed lowered to at most {n} mm³/s, Snapmaker's value for its fastest U1 filament. Raise it in Snapmaker Orca if your filament can melt faster.",
|
|
97
|
+
"Filament max volumetric speed lowered to at most {n} mm³/s ({n} mm³/s on a high-flow toolhead), Snapmaker's value for its fastest U1 filament. Raise it in Snapmaker Orca if your filament can melt faster.",
|
|
98
|
+
"{key} lowered to {n} {unit}, the U1's machine limit.",
|
|
99
|
+
"{key} has {n} values for {n} filaments in the source file, so Snapmaker's stock value is used for it.",
|
|
100
|
+
"{n} filament settings have {n} values for {n} filaments in the source file, so Snapmaker's stock values are used for them: {keys}.",
|
|
101
|
+
"{key} has {n} values for {n} filaments in the source file; the first {n} are used.",
|
|
102
|
+
"{n} filament settings have {n} values for {n} filaments in the source file; the first {n} of each are used: {keys}.",
|
|
103
|
+
"The source file has no filament_colour list, so its filament settings aren't carried over.",
|
|
104
|
+
// Reading the file.
|
|
105
|
+
"This is a large project ({size} unpacked). Converting it takes a minute or two and a few GB of memory; close other apps or tabs if your computer has little memory.",
|
|
106
|
+
"{n} filament color(s) taken from the printer's extruder colors, which are what PrusaSlicer shows for this project.",
|
|
107
|
+
"{n} color change(s) at set heights become pauses at the same heights: the U1 pauses there (M600) for the filament swap, as PrusaSlicer's color change means. The new colors aren't shown in the preview.",
|
|
108
|
+
"This project's layer-range settings (settings for a range of heights of an object) aren't carried yet.",
|
|
109
|
+
// Filament presets.
|
|
110
|
+
"{Filament|Filaments} {list} {uses|use} {preset}'s own settings, which match the creator's.",
|
|
111
|
+
"{Filament|Filaments} {list} {uses|use} {preset}'s own settings instead of the creator's: {changes}.",
|
|
112
|
+
"{Filament|Filaments} {list} {was|were} tuned for a {n} mm nozzle on the creator's printer; converted {for your|with the U1's} {n} mm {nozzles|profile}, {it takes|they take} the U1's calibration for {its material|their materials} from {presets} (flow, max volumetric speed, pressure advance, retraction, cooling) and {keeps|keep} the creator's temperatures and other filament facts. The colors are unchanged, so a preset of your own can be chosen in Snapmaker Orca.",
|
|
113
|
+
];
|
|
114
|
+
function escapeRegExp(text) {
|
|
115
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
116
|
+
}
|
|
117
|
+
/** A wording as a pattern that matches the whole note. */
|
|
118
|
+
function wordingPattern(wording) {
|
|
119
|
+
let source = "";
|
|
120
|
+
let at = 0;
|
|
121
|
+
for (const m of wording.matchAll(/\{([^{}]*)\}/g)) {
|
|
122
|
+
source += escapeRegExp(wording.slice(at, m.index));
|
|
123
|
+
const inner = m[1];
|
|
124
|
+
source += Object.hasOwn(PIECES, inner) ? `(?:${PIECES[inner]})` : `(?:${inner.split("|").map(escapeRegExp).join("|")})`;
|
|
125
|
+
at = m.index + m[0].length;
|
|
126
|
+
}
|
|
127
|
+
return new RegExp(`^${source}${escapeRegExp(wording.slice(at))}$`);
|
|
128
|
+
}
|
|
129
|
+
const PLAIN_PATTERNS = PLAIN_NOTES.map(wordingPattern);
|
|
130
|
+
/** Setting-like words in a note (they have an underscore) must be Snapmaker Orca's own: a file can name a setting anything. */
|
|
131
|
+
function onlyKnownSettings(text) {
|
|
132
|
+
return (text.match(/\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\b/g) ?? []).every((word) => Object.hasOwn(SETTINGS_CATALOG, word) || word === "filament_colour");
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A note's text as the report may show it, or null when it could quote the file. `presets` are this conversion's
|
|
136
|
+
* preset names as the file has them; in the text each is replaced by its form for the report.
|
|
137
|
+
*/
|
|
138
|
+
function plainNoteText(note, presets) {
|
|
139
|
+
// The conversion's own preset names become markers, longest first, so a name inside a longer one doesn't split it.
|
|
140
|
+
const names = [...new Set(presets.filter((name) => name.length >= 3))].sort((a, b) => b.length - a.length);
|
|
141
|
+
let marked = note.text;
|
|
142
|
+
if (/[\u0001\u0002]/.test(marked))
|
|
143
|
+
return null;
|
|
144
|
+
names.forEach((name, i) => {
|
|
145
|
+
marked = marked.split(name).join(`\u0001${i}\u0002`);
|
|
146
|
+
});
|
|
147
|
+
if (!PLAIN_PATTERNS.some((pattern) => pattern.test(marked)) || !onlyKnownSettings(marked))
|
|
148
|
+
return null;
|
|
149
|
+
let shown = true;
|
|
150
|
+
const text = marked.replace(/\u0001(\d+)\u0002/g, (_, i) => {
|
|
151
|
+
const name = presetName(names[Number(i)]);
|
|
152
|
+
if (name === null)
|
|
153
|
+
shown = false;
|
|
154
|
+
return name ?? "";
|
|
155
|
+
});
|
|
156
|
+
return shown ? text : null;
|
|
157
|
+
}
|
|
158
|
+
// --- Where it ran ---------------------------------------------------------------------------------------------------
|
|
159
|
+
const SYSTEMS = [
|
|
160
|
+
[/Windows/i, "Windows"],
|
|
161
|
+
[/Android/i, "Android"],
|
|
162
|
+
[/iPhone|iPad|iPod/i, "iOS"],
|
|
163
|
+
[/Mac OS X|Macintosh|macOS/i, "macOS"],
|
|
164
|
+
[/CrOS/i, "ChromeOS"],
|
|
165
|
+
[/Linux/i, "Linux"],
|
|
166
|
+
];
|
|
167
|
+
const BROWSERS = [
|
|
168
|
+
[/\bEdg(?:e|A|iOS)?\/(\d{1,4})/, "Edge"],
|
|
169
|
+
[/\bOPR\/(\d{1,4})/, "Opera"],
|
|
170
|
+
[/\bFirefox\/(\d{1,4})/, "Firefox"],
|
|
171
|
+
[/\bChrome\/(\d{1,4})/, "Chrome"],
|
|
172
|
+
[/\bVersion\/(\d{1,4})[\d.]* (?:Mobile\/\S+ )?Safari\//, "Safari"],
|
|
173
|
+
];
|
|
174
|
+
/**
|
|
175
|
+
* A browser and system from a user agent string: the browser's name and major version, and the system's name.
|
|
176
|
+
* Nothing else of the string is kept; one that names no browser this knows gives "a browser".
|
|
177
|
+
*/
|
|
178
|
+
export function describeUserAgent(userAgent) {
|
|
179
|
+
const ua = String(userAgent).slice(0, 1000);
|
|
180
|
+
const system = SYSTEMS.find(([pattern]) => pattern.test(ua))?.[1];
|
|
181
|
+
for (const [pattern, name] of BROWSERS) {
|
|
182
|
+
const version = pattern.exec(ua)?.[1];
|
|
183
|
+
if (version)
|
|
184
|
+
return `${name} ${version}${system ? ` on ${system}` : ""}`;
|
|
185
|
+
}
|
|
186
|
+
return `a browser${system ? ` on ${system}` : ""}`;
|
|
187
|
+
}
|
|
188
|
+
const NODE_SYSTEMS = { darwin: "macOS", win32: "Windows", linux: "Linux" };
|
|
189
|
+
/**
|
|
190
|
+
* Where this code is running, in a few words: "Node 22.12.0 on macOS (arm64)" or "Chrome 131 on Windows". Reads only
|
|
191
|
+
* the runtime's own version and system name; makes no request.
|
|
192
|
+
*/
|
|
193
|
+
export function describeEnvironment() {
|
|
194
|
+
const node = globalThis.process;
|
|
195
|
+
if (node?.versions?.node) {
|
|
196
|
+
const system = NODE_SYSTEMS[node.platform ?? ""] ?? plainFact(node.platform, 20) ?? "an unknown system";
|
|
197
|
+
const arch = plainFact(node.arch, 20);
|
|
198
|
+
return `Node ${plainFact(node.versions.node, 20) ?? "?"} on ${system}${arch ? ` (${arch})` : ""}`;
|
|
199
|
+
}
|
|
200
|
+
const userAgent = globalThis.navigator?.userAgent;
|
|
201
|
+
return typeof userAgent === "string" ? describeUserAgent(userAgent) : "an unknown runtime";
|
|
202
|
+
}
|
|
203
|
+
// --- The report -----------------------------------------------------------------------------------------------------
|
|
204
|
+
/** "1, 2 and 3". */
|
|
205
|
+
const list = (items) => (items.length <= 1 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`);
|
|
206
|
+
function optionsLine(options) {
|
|
207
|
+
const highFlow = options.highFlowHotends;
|
|
208
|
+
const toolheads = Array.isArray(highFlow) ? highFlow.flatMap((on, i) => (on === true ? [i + 1] : [])).slice(0, 16) : [];
|
|
209
|
+
const keys = (names) => (names ?? []).filter((k) => typeof k === "string" && Object.hasOwn(SETTINGS_CATALOG, k)).slice(0, 40);
|
|
210
|
+
const keep = keys(options.aboveStock?.keep);
|
|
211
|
+
const stock = keys(options.aboveStock?.stock);
|
|
212
|
+
return [
|
|
213
|
+
`nozzle ${options.nozzle !== undefined && /^(\d{1,2}(\.\d{1,3})?|match)$/.test(options.nozzle) ? options.nozzle : "default"}`,
|
|
214
|
+
`Snapmaker Orca ${options.snapmakerOrcaVersion !== undefined && /^\d+(\.\d+){1,3}$/.test(options.snapmakerOrcaVersion) ? options.snapmakerOrcaVersion : "newest"}`,
|
|
215
|
+
`profile ${options.profileId !== undefined && /^[a-z0-9][a-z0-9.-]{0,80}$/.test(options.profileId) ? `${options.profileId} (chosen)` : "matched"}`,
|
|
216
|
+
`filament names ${options.filamentComplianceMode === "generic" || options.filamentComplianceMode === "snapmaker" ? options.filamentComplianceMode : "original"}`,
|
|
217
|
+
`high flow ${highFlow === true ? "all toolheads" : toolheads.length > 0 ? `toolheads ${list(toolheads)}` : "none"}`,
|
|
218
|
+
`hardened nozzles ${options.hardenedNozzles === true ? "yes" : "no"}`,
|
|
219
|
+
`version note ${options.stamp === false ? "off" : "on"}`,
|
|
220
|
+
`own preset ${options.preset === true ? "yes" : "no"}`,
|
|
221
|
+
...(keep.length > 0 ? [`kept above stock: ${keep.join(", ")}`] : []),
|
|
222
|
+
...(stock.length > 0 ? [`set to stock: ${stock.join(", ")}`] : []),
|
|
223
|
+
].join("; ");
|
|
224
|
+
}
|
|
225
|
+
/** What went wrong, without the message: an Any2orcaError's code, or an unexpected error's kind. */
|
|
226
|
+
function errorFact(error) {
|
|
227
|
+
if (error instanceof Any2orcaError || (typeof error === "object" && error !== null && error.name === "Any2orcaError")) {
|
|
228
|
+
const code = error.code;
|
|
229
|
+
return typeof code === "string" && /^[a-z][a-z0-9_]{0,40}$/.test(code) ? code : "unknown code";
|
|
230
|
+
}
|
|
231
|
+
const name = typeof error === "object" && error !== null ? error.name : undefined;
|
|
232
|
+
return `unexpected (${typeof name === "string" && /^[A-Za-z][A-Za-z0-9]{0,40}$/.test(name) ? name : "not an Error"})`;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The problem report as text, one fact per line, ready to copy. Give it what you have: the inspection when the
|
|
236
|
+
* file opened, the report when the conversion finished, the error when it didn't. See the module comment for what
|
|
237
|
+
* never goes in.
|
|
238
|
+
*/
|
|
239
|
+
export function problemReport(input) {
|
|
240
|
+
const { inspection, report, catalog } = input;
|
|
241
|
+
const lines = ["any2orca problem report", "(Text only. It holds no file name, object names or paths.)", ""];
|
|
242
|
+
const add = (label, value) => {
|
|
243
|
+
if (value)
|
|
244
|
+
lines.push(`${label}: ${value}`);
|
|
245
|
+
};
|
|
246
|
+
add("any2orca", VERSION);
|
|
247
|
+
const tracks = catalog ? `${catalog.index.slicer.name} ${catalog.index.slicer.version}` : report?.stamp?.profiles.tracks;
|
|
248
|
+
const dataVersion = catalog?.index.dataVersion ?? report?.stamp?.profiles.version;
|
|
249
|
+
add("Profile data", dataVersion ? `${plainFact(dataVersion, 20) ?? "?"}${tracks ? `, for ${plainFact(tracks, 40) ?? "?"}` : ""}` : null);
|
|
250
|
+
add("App", input.app !== undefined ? (plainFact(input.app, 80) ?? "(not shown: not plain text)") : null);
|
|
251
|
+
add("Ran on", plainText(input.environment ?? describeEnvironment()).slice(0, 80));
|
|
252
|
+
if (inspection) {
|
|
253
|
+
const stampFormat = report?.stamp?.source?.format;
|
|
254
|
+
add("Source", [
|
|
255
|
+
stampFormat ? `${plainFact(stampFormat, 30) ?? "?"} project` : null,
|
|
256
|
+
inspection.slicerVersion ? `slicer version ${plainFact(inspection.slicerVersion, 30) ?? "(not shown)"}` : null,
|
|
257
|
+
inspection.printerModel ? `printer ${presetName(inspection.printerModel) ?? "(not shown)"} (${plainFact(inspection.sourceVendor, 20) ?? "other"})` : `printer maker ${plainFact(inspection.sourceVendor, 20) ?? "other"}`,
|
|
258
|
+
inspection.sourcePresetName ? `process preset ${presetName(inspection.sourcePresetName) ?? "(not shown)"}` : null,
|
|
259
|
+
]
|
|
260
|
+
.filter(Boolean)
|
|
261
|
+
.join("; "));
|
|
262
|
+
const plateCount = inspection.plateCount ?? inspection.plates.length;
|
|
263
|
+
const sizes = inspection.nozzleDiameters ?? [];
|
|
264
|
+
add("Project", [
|
|
265
|
+
`${plateCount} plate${plateCount === 1 ? "" : "s"}${inspection.plates.length < plateCount ? ` (${inspection.plates.length} with objects)` : ""}`,
|
|
266
|
+
`${inspection.objects.length} object${inspection.objects.length === 1 ? "" : "s"}`,
|
|
267
|
+
`${inspection.filaments.length} filament${inspection.filaments.length === 1 ? "" : "s"}`,
|
|
268
|
+
`${inspection.unpackedBytes >= 1024 ** 2 ? `${(inspection.unpackedBytes / 1024 ** 2).toFixed(1)} MB` : `${Math.max(1, Math.round(inspection.unpackedBytes / 1024))} KB`} unpacked`,
|
|
269
|
+
sizes.length > 0 ? `nozzle ${sizes.map((s) => plainFact(s, 8) ?? "?").join(", ")} mm` : null,
|
|
270
|
+
inspection.layerHeight !== null ? `layer height ${inspection.layerHeight} mm` : null,
|
|
271
|
+
]
|
|
272
|
+
.filter(Boolean)
|
|
273
|
+
.join("; "));
|
|
274
|
+
for (const filament of inspection.filaments.slice(0, 64)) {
|
|
275
|
+
const output = report?.filaments?.find((f) => f.slot === filament.slot)?.outputName;
|
|
276
|
+
const source = presetName(filament.presetName) ?? (filament.presetName ? "(name not shown)" : "(no preset name)");
|
|
277
|
+
const renamed = output !== undefined && output !== filament.presetName ? ` -> ${presetName(output) ?? "(name not shown)"}` : "";
|
|
278
|
+
lines.push(`Filament ${filament.slot}: ${material(filament.type)}, ${/^#[0-9A-Fa-f]{3,8}$/.test(filament.color) ? filament.color : "(color not shown)"}, ${source}${renamed}`);
|
|
279
|
+
}
|
|
280
|
+
if (inspection.filaments.length > 64)
|
|
281
|
+
lines.push(`(and ${inspection.filaments.length - 64} more filaments)`);
|
|
282
|
+
for (const plate of (report?.plateFilaments ?? inspection.plateFilaments ?? []).filter((p) => p.filaments.length > 0).slice(0, 100)) {
|
|
283
|
+
const objects = inspection.objects.filter((o) => (o.plate ?? 1) === plate.plate).length;
|
|
284
|
+
const uses = plate.filaments.map((f) => `${f.slot} (${f.uses.filter((u) => /^[a-z-]{1,20}$/.test(u)).join(", ")})`).join(", ");
|
|
285
|
+
lines.push(`Plate ${plate.plate}: ${objects} object${objects === 1 ? "" : "s"}; filaments ${uses}; most at the same height ${plate.mostAtOnce}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (input.options)
|
|
289
|
+
add("Options", optionsLine(input.options));
|
|
290
|
+
// A report built by hand (a test's stand-in) may hold only some of its fields.
|
|
291
|
+
if (report?.profile) {
|
|
292
|
+
const match = report.profileMatch ? `matched, ${plainFact(report.profileMatch.matchSource, 30) ?? "?"}` : report.preset ? "from the preset" : "chosen";
|
|
293
|
+
add("Result", `converted with ${plainFact(report.profile.id, 80) ?? "?"} (${match}), for ${plainFact(report.nozzle?.size, 8) ?? "?"} mm nozzles${report.retiredProfile ? "; the profile asked for is retired" : ""}`);
|
|
294
|
+
add("What changed", (report.whatChanged?.groups ?? []).map((g) => `${plainFact(String(g.reason), 20) ?? "?"} ${g.items.length}`).join(", "));
|
|
295
|
+
}
|
|
296
|
+
else if (input.error !== undefined) {
|
|
297
|
+
add("Result", `error ${errorFact(input.error)}${input.stage !== undefined ? ` at ${plainFact(input.stage, 30) ?? "an unnamed step"}` : ""}`);
|
|
298
|
+
}
|
|
299
|
+
const notes = report?.notes ?? [];
|
|
300
|
+
if (notes.length > 0) {
|
|
301
|
+
const presets = [...(inspection?.filaments.map((f) => f.presetName) ?? []), ...(report?.filaments?.map((f) => f.outputName) ?? []), ...(report?.filamentPresets?.map((p) => p.preset) ?? [])];
|
|
302
|
+
lines.push(`Notes: ${notes.length}`);
|
|
303
|
+
for (const note of notes.slice(0, 200)) {
|
|
304
|
+
const topic = /^[a-z][a-z-]{0,30}$/.test(note.topic) ? note.topic : "other";
|
|
305
|
+
lines.push(` [${topic}] ${plainNoteText(note, presets) ?? "(text not included: it can quote a name or value from the file)"}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else if (report) {
|
|
309
|
+
lines.push("Notes: none");
|
|
310
|
+
}
|
|
311
|
+
return lines.join("\n");
|
|
312
|
+
}
|
package/dist/profiles.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare const ProfileIndexSchema: z.ZodObject<{
|
|
|
73
73
|
name: z.ZodString;
|
|
74
74
|
version: z.ZodString;
|
|
75
75
|
application: z.ZodString;
|
|
76
|
+
sharedLayerFilamentLimit: z.ZodOptional<z.ZodNumber>;
|
|
76
77
|
}, z.core.$strip>;
|
|
77
78
|
source: z.ZodOptional<z.ZodObject<{
|
|
78
79
|
repository: z.ZodString;
|
|
@@ -195,6 +196,8 @@ export interface ProfileIndex {
|
|
|
195
196
|
name: string;
|
|
196
197
|
version: string;
|
|
197
198
|
application: string;
|
|
199
|
+
/** The release can leave a filament numbered above this out of some layers when the filament that many numbers below it prints on the same plate; see `ProfileCatalog.sharedLayerFilamentLimit`. Absent when it has no such limit. */
|
|
200
|
+
sharedLayerFilamentLimit?: number;
|
|
198
201
|
};
|
|
199
202
|
/** Where the profiles come from: the target slicer's repository and the release tag and commit they were generated at. */
|
|
200
203
|
source?: {
|
|
@@ -311,6 +314,15 @@ export declare class ProfileCatalog {
|
|
|
311
314
|
* release that allows mixed sizes says so in its catalog entry, which is where per-toolhead sizes would start.
|
|
312
315
|
*/
|
|
313
316
|
get mixedNozzleSizes(): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* The highest filament number this catalog's Snapmaker Orca release prints in every layer whatever else is on
|
|
319
|
+
* the plate, or null when the release has no such limit. Snapmaker Orca 2.4.0 and 2.4.1 can leave filament 17
|
|
320
|
+
* and up out of some layers, with no message, when the filament 16 numbers below it prints on the same plate
|
|
321
|
+
* (the key its tool order cache uses, read from each release's own source code when its profile data is
|
|
322
|
+
* generated), so for them this is 16; a release whose source no longer has that key gives null. `convert()`
|
|
323
|
+
* notes a plate that uses a filament above the limit together with the filament that many numbers below it.
|
|
324
|
+
*/
|
|
325
|
+
get sharedLayerFilamentLimit(): number | null;
|
|
314
326
|
list(filter?: {
|
|
315
327
|
nozzleDiameter?: string;
|
|
316
328
|
}): ProfileSummary[];
|
package/dist/profiles.js
CHANGED
|
@@ -78,7 +78,13 @@ export const ProfileIndexSchema = z.object({
|
|
|
78
78
|
schema: z.literal(1),
|
|
79
79
|
dataVersion: VERSION,
|
|
80
80
|
slicer: z
|
|
81
|
-
.object({
|
|
81
|
+
.object({
|
|
82
|
+
name: NAME,
|
|
83
|
+
version: VERSION,
|
|
84
|
+
application: z.string().regex(APPLICATION_VALUE),
|
|
85
|
+
/** See {@link ProfileCatalog.sharedLayerFilamentLimit}. Absent when the release has no such limit. */
|
|
86
|
+
sharedLayerFilamentLimit: z.number().int().min(1).max(1024).optional(),
|
|
87
|
+
})
|
|
82
88
|
// The Application value names the pinned release, so it can't disagree with it.
|
|
83
89
|
.refine((s) => s.application.endsWith(`-${s.version}`), "slicer.application must end with the slicer version"),
|
|
84
90
|
/** Where the profiles come from: the target slicer's repository and the release tag and commit they were generated at. */
|
|
@@ -258,6 +264,17 @@ export class ProfileCatalog {
|
|
|
258
264
|
get mixedNozzleSizes() {
|
|
259
265
|
return this.index.releases?.find((r) => r.path === ".")?.mixedNozzleSizes === true;
|
|
260
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* The highest filament number this catalog's Snapmaker Orca release prints in every layer whatever else is on
|
|
269
|
+
* the plate, or null when the release has no such limit. Snapmaker Orca 2.4.0 and 2.4.1 can leave filament 17
|
|
270
|
+
* and up out of some layers, with no message, when the filament 16 numbers below it prints on the same plate
|
|
271
|
+
* (the key its tool order cache uses, read from each release's own source code when its profile data is
|
|
272
|
+
* generated), so for them this is 16; a release whose source no longer has that key gives null. `convert()`
|
|
273
|
+
* notes a plate that uses a filament above the limit together with the filament that many numbers below it.
|
|
274
|
+
*/
|
|
275
|
+
get sharedLayerFilamentLimit() {
|
|
276
|
+
return this.index.slicer.sharedLayerFilamentLimit ?? null;
|
|
277
|
+
}
|
|
261
278
|
list(filter = {}) {
|
|
262
279
|
const { nozzleDiameter } = filter;
|
|
263
280
|
return this.summaries.filter((s) => nozzleDiameter === undefined || s.nozzleDiameter === nozzleDiameter).map((s) => ({ ...s }));
|
package/dist/project.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type BundleEntry } from "./archive/unwrapBundle.js";
|
|
2
2
|
import { type NozzleChoice } from "./engine/detectNozzleDiameter.js";
|
|
3
3
|
import { type WhatChanged } from "./explain/whatChanged.js";
|
|
4
|
+
import { cleanWarnings, type ConvertNote } from "./explain/notes.js";
|
|
5
|
+
export { cleanWarnings };
|
|
4
6
|
import { type Inspection } from "./inspect.js";
|
|
7
|
+
import { type PlateFilaments } from "./archive/plateFilaments.js";
|
|
5
8
|
import { ProfileCatalog, type ProfileSource, type ProfileSummary, type RetiredProfile } from "./profiles.js";
|
|
6
9
|
import { type ProfileMatch, type Shifts } from "./schema.js";
|
|
7
10
|
import { type AboveStockChoice } from "./engine/aboveStock.js";
|
|
@@ -114,13 +117,25 @@ export interface ConvertReport {
|
|
|
114
117
|
profileMatch?: ProfileMatch;
|
|
115
118
|
/**
|
|
116
119
|
* Why the profile was chosen, in sentences for the user, when it was auto-matched and the match wasn't plain
|
|
117
|
-
* (the source nozzle has no U1 profile, say). Empty for an exact match, a `profileId` or a preset.
|
|
120
|
+
* (the source nozzle has no U1 profile, say). Empty for an exact match, a `profileId` or a preset. Each is also
|
|
121
|
+
* in `warnings` and in `notes`: show one of the three lists, not two.
|
|
118
122
|
*/
|
|
119
123
|
profileNotes: string[];
|
|
120
124
|
/** Set when `profileId` named a retired profile and its successor was used. */
|
|
121
125
|
retiredProfile?: RetiredProfile;
|
|
122
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Notes worth showing the user, cleaned up for display, in the conversion's order; `notes` has the same sentences
|
|
128
|
+
* sorted by topic, with the filaments each names. Their wording can change in any release: check whether there
|
|
129
|
+
* are any, not what they say.
|
|
130
|
+
*/
|
|
123
131
|
warnings: string[];
|
|
132
|
+
/**
|
|
133
|
+
* Every note for the user, once, in one list sorted by topic (the order of `NOTE_TOPICS`) with each topic's
|
|
134
|
+
* headline first: the sentences of `warnings`, `profileNotes` and {@link filamentNotes}, in one style (a capital
|
|
135
|
+
* at the start, a period at the end, "0.4 mm"), each with the filament slots it names. A UI that shows this list
|
|
136
|
+
* in its order, grouped by topic if it likes, needs none of the other three.
|
|
137
|
+
*/
|
|
138
|
+
notes: ConvertNote[];
|
|
124
139
|
/** Every note the conversion produced, including routine ones, for logs and bug reports. */
|
|
125
140
|
log: string[];
|
|
126
141
|
/** Product lines that use Generic under `filamentComplianceMode: "snapmaker"`, because Snapmaker makes no preset for them at this nozzle size. */
|
|
@@ -142,6 +157,13 @@ export interface ConvertReport {
|
|
|
142
157
|
plateOrigins?: Record<number, [number, number]>;
|
|
143
158
|
/** The plates in the converted file, empty ones included. */
|
|
144
159
|
plates: number;
|
|
160
|
+
/**
|
|
161
|
+
* The filaments each plate of the converted file uses, one entry per plate in order, empty plates included: what
|
|
162
|
+
* to load for it, and whether it needs more at the same height than the U1 has toolheads (`mostAtOnce`; `notes`
|
|
163
|
+
* says so in words). As `inspection.plateFilaments`, read by the converted project's settings. Always set by
|
|
164
|
+
* `convert()`; optional so code that builds a report itself (a test's mock) needn't.
|
|
165
|
+
*/
|
|
166
|
+
plateFilaments?: PlateFilaments[];
|
|
145
167
|
objects: number;
|
|
146
168
|
filamentSlots: number;
|
|
147
169
|
/**
|
|
@@ -208,22 +230,23 @@ export interface ProfileChoice {
|
|
|
208
230
|
export declare function matchProfile(projectSettings: Record<string, unknown>, profiles: ProfileSource | ProfileCatalog, options?: {
|
|
209
231
|
nozzle?: NozzleChoice;
|
|
210
232
|
}): Promise<ProfileChoice>;
|
|
211
|
-
/**
|
|
212
|
-
* Same cleanup every UI applies before showing warnings: drop routine
|
|
213
|
-
* bookkeeping lines, strip the internal "WARN" prefix and internal file
|
|
214
|
-
* names.
|
|
215
|
-
*/
|
|
216
|
-
export declare function cleanWarnings(warnings: readonly string[]): string[];
|
|
217
233
|
/** An opened source file. Reading it again is the expensive part, so keep one per file. */
|
|
218
234
|
export declare class Project {
|
|
219
235
|
private readonly parsed;
|
|
220
236
|
private readonly request;
|
|
237
|
+
private partPaint?;
|
|
238
|
+
private sourcePlateFilaments?;
|
|
221
239
|
private constructor();
|
|
222
240
|
/** Reads a .3mf. Throws {@link Any2orcaError} (`invalid_file`, `too_large` or `invalid_project`) if it can't be used. */
|
|
223
241
|
static open(bytes: Uint8Array, options?: OpenOptions): Project;
|
|
224
242
|
/** The project's own settings (Metadata/project_settings.config), as a copy: for a settings diff. */
|
|
225
243
|
settings(): Record<string, unknown>;
|
|
226
244
|
inspect(): Inspection;
|
|
245
|
+
/**
|
|
246
|
+
* The filaments each plate uses, read by `projectSettings`: the source's for what the creator's file says, a
|
|
247
|
+
* converted project's for what the U1 prints. The meshes' paint is scanned once, on first use.
|
|
248
|
+
*/
|
|
249
|
+
private plateFilaments;
|
|
227
250
|
/** The profile auto-matching would pick for this file, for the user's nozzle size (`options.nozzle`, default 0.4). */
|
|
228
251
|
matchProfile(profiles: ProfileSource | ProfileCatalog, options?: {
|
|
229
252
|
nozzle?: NozzleChoice;
|