any2orca 0.13.0 → 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/dist/cli/main.js CHANGED
@@ -8,8 +8,9 @@ import { loadCatalog } from "../profiles.js";
8
8
  import { VERSION } from "../version.js";
9
9
  import { MAX_UNPACKED_BYTES_LIMIT } from "../archive/safeUnzip.js";
10
10
  import { runConvert, runWatch } from "./commands/convert.js";
11
- import { CONVERT_OPTIONS, DIFF_OPTIONS, PRESETS_OPTIONS, PROFILES_OPTIONS } from "./surface.js";
11
+ import { CONVERT_OPTIONS, DIFF_OPTIONS, INSPECT_OPTIONS, PRESETS_OPTIONS, PROFILES_OPTIONS } from "./surface.js";
12
12
  import { runDiff } from "./commands/diff.js";
13
+ import { runInspect } from "./commands/inspect.js";
13
14
  import { presetForConvert, presetForDiff, runPresetsAdd, runPresetsExport, runPresetsImport, runPresetsList, runPresetsRemove, runPresetsShow, } from "./commands/presets.js";
14
15
  import { resolveAboveStockChoice } from "../engine/aboveStock.js";
15
16
  import { runProfiles } from "./commands/profiles.js";
@@ -55,6 +56,7 @@ Commands:
55
56
  ${formatOptions([
56
57
  ["convert <files...>", "Convert one or more .3mf files (or bundle .zip files of several)"],
57
58
  ["diff <a.3mf> <b.3mf>", "Compare the settings of two projects, or one with Snapmaker's stock profile"],
59
+ ["inspect <file.3mf>", "Show what a project holds: its printer, filaments, and each plate's objects and filaments"],
58
60
  ["presets add | list | show | ...", "Save your own tuned print settings from a 3MF and convert with them"],
59
61
  ["profiles", "List the profiles convert can use"],
60
62
  ["nozzle [<size> | match | clear]", "Say which nozzle size your U1 has (default 0.4 mm), for every conversion"],
@@ -105,6 +107,28 @@ marked "above the U1's limit (capped)", and one above Snapmaker's stock value
105
107
 
106
108
  Exit codes: 0 no differences, 1 differences, 2 an error.
107
109
  `;
110
+ const INSPECT_HELP = `Usage: any2orca inspect <file.3mf> [options]
111
+
112
+ Shows what a project holds, read the way convert reads it, without converting
113
+ or writing anything: the printer and slicer version it was saved for, its
114
+ process preset, nozzle size and layer height, every filament, and each plate's
115
+ objects and the filaments it uses (by its objects, parts, paint, a filament set
116
+ for a range of heights, supports, or a tool change at a layer), with the heights
117
+ each is used between. The U1 prints with four filaments at a time, so a plate's
118
+ line also says how many it needs at the same height when that is fewer than it
119
+ uses; that number is an estimate from the model, not a slice.
120
+
121
+ It reads source projects and converted ones alike.
122
+
123
+ Options:
124
+ ${formatOptions([
125
+ ["--json", "Print the whole reading as JSON (format any2orca-inspect, version 1), every object with its plate and footprint included"],
126
+ ["--max-unpacked <size>", "The most the project may unpack to, e.g. 4GB or 3000MB (default 2GB, at most 16GB)"],
127
+ ["-h, --help", "Show this help"],
128
+ ])}
129
+
130
+ Exit codes: 0 read, 2 a file that can't be read or a usage error.
131
+ `;
108
132
  const PROFILES_HELP = `Usage: any2orca profiles [options]
109
133
 
110
134
  Lists the profiles "convert --profile <id>" accepts, and the Snapmaker Orca
@@ -215,6 +239,7 @@ ${formatOptions([
215
239
  ["--explain", "After each file, list what the conversion changed, grouped by why: from the creator's file, kept at Snapmaker's stock value, capped for the U1, set for the firmware, layout, and your choices"],
216
240
  ["--explain-json", "Also write that, with every settings difference, to <output>.what-changed.json next to each output (format any2orca-what-changed)"],
217
241
  ["--max-unpacked <size>", "The most a project may unpack to, e.g. 4GB or 3000MB (default 2GB, at most 16GB). For a very large project; it needs about twice that much memory"],
242
+ ["--report", "After each file, print a problem report to copy into a bug report: versions, where it ran, what the project is (slicer, printer, filaments, plates), the options, the result or the error's code, and the notes. Text only, nothing is sent; it holds no file name, object names or paths"],
218
243
  ["--no-stamp", "Leave the small version note (Metadata/any2orca.json) out of the converted file. The note says which any2orca version, profile catalog and options made the file, so it can be traced if a bug turns up; it holds no file names, paths, times or identifiers. The file works the same without it"],
219
244
  ["--out-dir <dir>", "Write outputs here instead of next to each input (created if missing)"],
220
245
  ["--suffix <text>", 'Output filename suffix (default "_U1"; "" removes it, refused if the output would overwrite the input)'],
@@ -322,6 +347,22 @@ async function runCommand(command, rest, io) {
322
347
  return 2;
323
348
  }
324
349
  }
350
+ case "inspect": {
351
+ if (hasHelpFlag(rest)) {
352
+ io.out(INSPECT_HELP);
353
+ return 0;
354
+ }
355
+ try {
356
+ const { values, positionals } = parseArgs({ args: rest, allowPositionals: true, options: INSPECT_OPTIONS });
357
+ if (positionals.length !== 1)
358
+ throw new Error("Usage: any2orca inspect <file.3mf> [--json] (see: any2orca inspect --help)");
359
+ return runInspect({ file: positionals[0], json: Boolean(values.json), ...(values["max-unpacked"] !== undefined ? { maxUnpackedBytes: parseMaxUnpacked(values["max-unpacked"]) } : {}) }, io.out);
360
+ }
361
+ catch (err) {
362
+ io.err(`Error: ${describeFsError(err)}`);
363
+ return 2;
364
+ }
365
+ }
325
366
  case "presets": {
326
367
  const [sub, ...args] = rest;
327
368
  if (!sub || hasHelpFlag(rest)) {
@@ -487,6 +528,7 @@ async function runCommand(command, rest, io) {
487
528
  ...(values["max-unpacked"] !== undefined ? { maxUnpackedBytes: parseMaxUnpacked(values["max-unpacked"]) } : {}),
488
529
  explain: Boolean(values.explain),
489
530
  explainJson: Boolean(values["explain-json"]),
531
+ report: Boolean(values.report),
490
532
  outDir: values["out-dir"],
491
533
  archiveDir: values["archive-dir"],
492
534
  suffix: values.suffix ?? "_U1",
@@ -58,6 +58,15 @@ export declare const PRESETS_OPTIONS: {
58
58
  readonly type: "string";
59
59
  };
60
60
  };
61
+ export declare const INSPECT_OPTIONS: {
62
+ readonly json: {
63
+ readonly type: "boolean";
64
+ readonly default: false;
65
+ };
66
+ readonly "max-unpacked": {
67
+ readonly type: "string";
68
+ };
69
+ };
61
70
  export declare const PROFILES_OPTIONS: {
62
71
  readonly "profiles-dir": {
63
72
  readonly type: "string";
@@ -136,6 +145,10 @@ export declare const CONVERT_OPTIONS: {
136
145
  readonly type: "boolean";
137
146
  readonly default: false;
138
147
  };
148
+ readonly report: {
149
+ readonly type: "boolean";
150
+ readonly default: false;
151
+ };
139
152
  readonly "out-dir": {
140
153
  readonly type: "string";
141
154
  };
@@ -242,6 +255,10 @@ export declare const CLI_SURFACE: {
242
255
  readonly type: "boolean";
243
256
  readonly default: false;
244
257
  };
258
+ readonly report: {
259
+ readonly type: "boolean";
260
+ readonly default: false;
261
+ };
245
262
  readonly "out-dir": {
246
263
  readonly type: "string";
247
264
  };
@@ -309,6 +326,18 @@ export declare const CLI_SURFACE: {
309
326
  };
310
327
  };
311
328
  };
329
+ readonly inspect: {
330
+ readonly positionals: "<file.3mf>";
331
+ readonly options: {
332
+ readonly json: {
333
+ readonly type: "boolean";
334
+ readonly default: false;
335
+ };
336
+ readonly "max-unpacked": {
337
+ readonly type: "string";
338
+ };
339
+ };
340
+ };
312
341
  readonly presets: {
313
342
  readonly subcommands: readonly ["add", "list", "show", "remove", "export", "import"];
314
343
  readonly options: {
@@ -27,6 +27,10 @@ export const PRESETS_OPTIONS = {
27
27
  out: { type: "string" },
28
28
  ...PROFILE_OPTIONS,
29
29
  };
30
+ export const INSPECT_OPTIONS = {
31
+ json: { type: "boolean", default: false },
32
+ "max-unpacked": { type: "string" },
33
+ };
30
34
  export const PROFILES_OPTIONS = {
31
35
  nozzle: { type: "string" },
32
36
  ...PROFILE_OPTIONS,
@@ -47,6 +51,7 @@ export const CONVERT_OPTIONS = {
47
51
  "max-unpacked": { type: "string" },
48
52
  explain: { type: "boolean", default: false },
49
53
  "explain-json": { type: "boolean", default: false },
54
+ report: { type: "boolean", default: false },
50
55
  "out-dir": { type: "string" },
51
56
  suffix: { type: "string", default: "_U1" },
52
57
  "dry-run": { type: "boolean", default: false },
@@ -67,6 +72,7 @@ export const CLI_SURFACE = {
67
72
  convert: { positionals: "<files...>", options: CONVERT_OPTIONS },
68
73
  // --against-stock takes an optional value, so main.ts reads it before parseArgs.
69
74
  diff: { positionals: "<a.3mf> [<b.3mf>]", options: { ...DIFF_OPTIONS, "against-stock": { type: "string", optionalValue: true } } },
75
+ inspect: { positionals: "<file.3mf>", options: INSPECT_OPTIONS },
70
76
  presets: { subcommands: ["add", "list", "show", "remove", "export", "import"], options: PRESETS_OPTIONS },
71
77
  profiles: { options: PROFILES_OPTIONS },
72
78
  // `any2orca nozzle 0.6` saves the size; a size is a value, not a subcommand, so it isn't listed as one.
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * The topics a note can have, in the order the notes come. First what the user has to act on before printing (other
3
- * filament to load), then why the file is for this nozzle size and profile, then the filament naming option, then
4
- * what reading the file and converting its settings and plates had to say.
3
+ * filament to load; a plate whose filaments the U1 can't print as they are, or only with filament changes, or that
4
+ * the Snapmaker Orca release can print wrong), then why the file is for this nozzle size and profile, then the
5
+ * filament naming option, then what reading the file and converting its settings and plates had to say.
5
6
  */
6
- export declare const NOTE_TOPICS: readonly ["filament-diameter", "nozzle", "profile", "filament-presets", "source", "settings", "plates"];
7
+ export declare const NOTE_TOPICS: readonly ["filament-diameter", "plate-filaments", "nozzle", "profile", "filament-presets", "source", "settings", "plates"];
7
8
  /** The topics this release of the library gives its notes. */
8
9
  export type KnownNoteTopic = (typeof NOTE_TOPICS)[number];
9
10
  /** A note's topic: one of `NOTE_TOPICS`, or a value a newer library adds; show an unknown one as it is, after the known ones. */
@@ -7,10 +7,11 @@
7
7
  import { plainText } from "../plainText.js";
8
8
  /**
9
9
  * The topics a note can have, in the order the notes come. First what the user has to act on before printing (other
10
- * filament to load), then why the file is for this nozzle size and profile, then the filament naming option, then
11
- * what reading the file and converting its settings and plates had to say.
10
+ * filament to load; a plate whose filaments the U1 can't print as they are, or only with filament changes, or that
11
+ * the Snapmaker Orca release can print wrong), then why the file is for this nozzle size and profile, then the
12
+ * filament naming option, then what reading the file and converting its settings and plates had to say.
12
13
  */
13
- export const NOTE_TOPICS = ["filament-diameter", "nozzle", "profile", "filament-presets", "source", "settings", "plates"];
14
+ export const NOTE_TOPICS = ["filament-diameter", "plate-filaments", "nozzle", "profile", "filament-presets", "source", "settings", "plates"];
14
15
  /**
15
16
  * Same cleanup every UI applies before showing warnings: drop routine
16
17
  * bookkeeping lines, strip the internal "WARN" and "note" markers and
@@ -0,0 +1,32 @@
1
+ /**
2
+ * What a result says about the filaments each plate uses: a plate that needs more filaments at the same height than
3
+ * the printer has toolheads, a plate that uses more than that but never at once, and, for a project with more
4
+ * filaments than toolheads, which ones each plate uses (what to load for it).
5
+ */
6
+ import type { PlateFilaments } from "../archive/plateFilaments.js";
7
+ /** "filament 4", "filaments 1 and 3", "filaments 1, 3, 5 and 6". */
8
+ export declare function filamentList(slots: readonly number[]): string;
9
+ export interface PlateNote {
10
+ /** The plate's filament slots. */
11
+ slots: number[];
12
+ text: string;
13
+ /** Worth a warning (the plate can't print as it is, or needs filament changes); false for a plain "what it uses" line. */
14
+ warning: boolean;
15
+ }
16
+ /**
17
+ * The notes for a project's plates, the ones that can't print as they are first, then the ones that need filament
18
+ * changes, then the plain lines, each group in plate order.
19
+ *
20
+ * @param filamentCount how many filaments the source project has
21
+ * @param toolheads how many the printer prints with at a time
22
+ */
23
+ export declare function plateFilamentNotes(plates: readonly PlateFilaments[], filamentCount: number, toolheads: number): PlateNote[];
24
+ /**
25
+ * The note for a release that can leave a high-numbered filament out of some layers
26
+ * (`ProfileCatalog.sharedLayerFilamentLimit`): null unless some plate uses a filament above the limit together
27
+ * with the filament that many numbers below it (17 with 1, 18 with 2, for a limit of 16). That pair is what test
28
+ * slices lost layers on; a filament above the limit with other filaments on its plate, or alone, printed whole.
29
+ *
30
+ * @param slicer the release, as shown to the user: "Snapmaker Orca 2.4.1"
31
+ */
32
+ export declare function sharedLayerFilamentNote(plates: readonly PlateFilaments[], limit: number | null, slicer: string): PlateNote | null;
@@ -0,0 +1,89 @@
1
+ /** "filament 4", "filaments 1 and 3", "filaments 1, 3, 5 and 6". */
2
+ export function filamentList(slots) {
3
+ if (slots.length === 1)
4
+ return `filament ${slots[0]}`;
5
+ return `filaments ${slots.slice(0, -1).join(", ")} and ${slots[slots.length - 1]}`;
6
+ }
7
+ /**
8
+ * The notes for a project's plates, the ones that can't print as they are first, then the ones that need filament
9
+ * changes, then the plain lines, each group in plate order.
10
+ *
11
+ * @param filamentCount how many filaments the source project has
12
+ * @param toolheads how many the printer prints with at a time
13
+ */
14
+ export function plateFilamentNotes(plates, filamentCount, toolheads) {
15
+ const tooMany = [];
16
+ const withChanges = [];
17
+ const plain = [];
18
+ for (const { plate, filaments, mostAtOnce } of plates) {
19
+ if (filaments.length === 0)
20
+ continue;
21
+ const slots = filaments.map((f) => f.slot);
22
+ if (mostAtOnce > toolheads) {
23
+ tooMany.push({
24
+ slots,
25
+ warning: true,
26
+ text: `Plate ${plate} needs ${mostAtOnce} filaments at the same height (it uses ${filamentList(slots)}), and the U1 prints with ${toolheads} 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.`,
27
+ });
28
+ }
29
+ else if (slots.length > toolheads) {
30
+ withChanges.push({
31
+ slots,
32
+ warning: true,
33
+ text: `Plate ${plate} uses ${slots.length} filaments (${filamentList(slots)}), no more than ${mostAtOnce} at the same height. The U1 prints with ${toolheads} at a time, so this plate needs filament changes at pauses, which you set up in Snapmaker Orca.`,
34
+ });
35
+ }
36
+ else if (filamentCount > toolheads) {
37
+ plain.push({ slots, warning: false, text: `Plate ${plate} uses ${filamentList(slots)}.` });
38
+ }
39
+ }
40
+ return [...tooMany, ...withChanges, ...plain];
41
+ }
42
+ /** "plate 3", "plates 3 and 4", "plates 1, 3 and 4". */
43
+ function plateList(plates) {
44
+ if (plates.length === 1)
45
+ return `plate ${plates[0]}`;
46
+ return `plates ${plates.slice(0, -1).join(", ")} and ${plates[plates.length - 1]}`;
47
+ }
48
+ /**
49
+ * The note for a release that can leave a high-numbered filament out of some layers
50
+ * (`ProfileCatalog.sharedLayerFilamentLimit`): null unless some plate uses a filament above the limit together
51
+ * with the filament that many numbers below it (17 with 1, 18 with 2, for a limit of 16). That pair is what test
52
+ * slices lost layers on; a filament above the limit with other filaments on its plate, or alone, printed whole.
53
+ *
54
+ * @param slicer the release, as shown to the user: "Snapmaker Orca 2.4.1"
55
+ */
56
+ export function sharedLayerFilamentNote(plates, limit, slicer) {
57
+ if (limit === null)
58
+ return null;
59
+ const affectedPlates = [];
60
+ const affectedSlots = new Set();
61
+ const partnerSlots = new Set();
62
+ for (const { plate, filaments } of plates) {
63
+ // Each filament above the limit whose partner, the filament `limit` numbers below it, is on the plate too.
64
+ const onPlate = new Set(filaments.map((f) => f.slot));
65
+ const above = [...onPlate].filter((slot) => slot > limit && onPlate.has(slot - limit));
66
+ if (above.length === 0)
67
+ continue;
68
+ affectedPlates.push(plate);
69
+ for (const slot of above) {
70
+ affectedSlots.add(slot);
71
+ partnerSlots.add(slot - limit);
72
+ }
73
+ }
74
+ if (affectedPlates.length === 0)
75
+ return null;
76
+ const slots = [...affectedSlots].sort((a, b) => a - b);
77
+ const partners = [...partnerSlots].sort((a, b) => a - b);
78
+ const one = slots.length === 1;
79
+ // What to do first, then what can happen, then how to see it and how to avoid it. A filament from 1 to the limit
80
+ // is never the one left out, so moving the higher-numbered filament there is safe whatever else the plate uses.
81
+ return {
82
+ slots,
83
+ warning: true,
84
+ text: `Check ${plateList(affectedPlates)} before printing. ${slicer} can skip ${filamentList(slots)} on some layers when ` +
85
+ `${filamentList(partners)} ${partners.length === 1 ? "is" : "are"} on the same plate, and it gives no warning. ` +
86
+ `Look through the sliced preview for missing color. To avoid the problem, print ${one ? "the two" : "each pair"} on separate plates, ` +
87
+ `or give ${filamentList(slots)} ${one ? "a number" : "numbers"} from 1 to ${limit} in Snapmaker Orca.`,
88
+ };
89
+ }
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";
@@ -49,5 +51,7 @@ export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsen
49
51
  export type { KnownStatsMatchSource, StatsConsent, StatsConsentState, StatsEvent, StatsEventInput, StatsMatchSource } from "./telemetry.js";
50
52
  export { MATCH_SOURCES } from "./schema.js";
51
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";
52
56
  export { plainText } from "./plainText.js";
53
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";
@@ -29,5 +30,6 @@ export { extractPreset } from "./presets/extractPreset.js";
29
30
  export { parsePresetFile, serializePresets, resolvePreset, withoutChanges, MAX_PRESET_NAME_LENGTH, MAX_PRESETS_PER_FILE, MAX_PRESETS_FILE_BYTES } from "./presets/preset.js";
30
31
  export { buildStatsEvent, parseStatsEvent, receiveStatsEvent, resolveStatsConsent, STATS_MATCH_SOURCES } from "./telemetry.js";
31
32
  export { MATCH_SOURCES } from "./schema.js";
33
+ export { describeEnvironment, describeUserAgent, PLAIN_NOTES, problemReport } from "./problemReport.js";
32
34
  export { plainText } from "./plainText.js";
33
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;