any2orca 0.10.0 → 0.11.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 +12 -0
- package/README.md +1 -1
- package/dist/engine/applyFilamentPresets.d.ts +40 -5
- package/dist/engine/applyFilamentPresets.js +136 -40
- package/dist/engine/buildProjectSettings.js +4 -2
- package/dist/engine/policy.d.ts +8 -0
- package/dist/engine/policy.js +8 -0
- package/dist/engine/runConvertPipeline.js +6 -4
- package/dist/explain/whatChanged.js +2 -1
- package/dist/inspect.d.ts +1 -1
- package/dist/project.d.ts +1 -1
- package/dist/project.js +3 -2
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# any2orca
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Output-affecting
|
|
6
|
+
|
|
7
|
+
- **Snapmaker Orca no longer warns about modified G-code when it opens a converted file, and a filament named like another printer's preset stays usable with the U1.** Since 0.10.0 each filament's list of changed settings named every filament setting, its start and end G-code included, and Snapmaker Orca warns about every G-code setting such a list names. Now the list names only the settings that differ from the preset Snapmaker Orca resets the filament to, so the app keeps every value that differs and fills in the rest with the same values. Under Original, a filament whose name isn't one of Snapmaker Orca's U1 presets (a Bambu preset, say) gets the preset the Snapmaker option would choose as its parent (Snapmaker PLA Matte for a matte PLA, Generic where Snapmaker has none): its name and the creator's values stay, and Snapmaker Orca no longer resets it to another printer's preset of the same name, which listed only that maker's printers. A filament whose base is a U1 preset takes that preset's own filament G-code. A filament no U1 preset fits names what the creator changed, what the conversion changed and the printers it can be used with. In the test projects, the Snapmaker and Generic options change only the lists; Original also gains the parents, and its filament G-code changes only where the parent's differs from Snapmaker's stock comment (a comment too).
|
|
8
|
+
- **Snapmaker Orca keeps the nozzle type a converted file records.** The file records the U1's stock stainless steel 0.4 nozzle and the hardened steel 0.6, or hardened steel when you choose hardened nozzles, so Snapmaker Orca can warn when a filament is too abrasive for the nozzle. Snapmaker's own printer presets have the 0.4 and 0.6 swapped, and Snapmaker Orca's app reset the file's nozzle type to the installed preset's when it opened the file, so the warning followed the swapped value there; only the command line used the file's. Now the printer's entry in the list of changed settings names the nozzle type, so the app keeps it. Where the file and the installed preset agree, nothing changes; where they differ, the app shows the printer preset as modified.
|
|
9
|
+
|
|
10
|
+
### Other
|
|
11
|
+
|
|
12
|
+
- **any2orca needs Node 22 or newer.** Node 20 reached its end of life in April 2026 and no longer gets security fixes, so CI tests Node 22 and 24. Nothing in the library's API or the CLI changes.
|
|
13
|
+
- **The docs say that warning and error messages can be reworded in any release.** Branch on an error's `code`, or on whether `report.warnings` or `inspection.warnings` has any entries, never on the text. The library README, the two fields' doc comments and the publishing ideas say so.
|
|
14
|
+
|
|
3
15
|
## 0.10.0
|
|
4
16
|
|
|
5
17
|
### Output-affecting
|
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ A call that fails throws `Any2orcaError`. Its `code` is stable, so a UI can bran
|
|
|
136
136
|
| `invalid_preset` | A preset or presets file that is malformed, over a limit, or can't be used with the options given |
|
|
137
137
|
| `preset_base_unknown` | A preset can't be made from this file: it isn't set up for a profile in the catalog |
|
|
138
138
|
|
|
139
|
-
The error's message, and every entry in `report.warnings`, is written for the person converting and doesn't name the library. Any app can show it as it is.
|
|
139
|
+
The error's message, and every entry in `report.warnings`, is written for the person converting and doesn't name the library. Any app can show it as it is. The wording can change in any release, so branch on the error's `code`, or on whether there are any warnings at all, never on the text.
|
|
140
140
|
|
|
141
141
|
## Strict content security policies
|
|
142
142
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrinterFilamentPresets } from "../profiles.js";
|
|
2
|
+
import { type FilamentNameTable } from "./filamentComplianceNames.js";
|
|
2
3
|
import type { JsonRecord } from "./types.js";
|
|
3
4
|
/** A slot that takes a preset's settings: its 0-based index, the preset, and the creator's values it replaces. */
|
|
4
5
|
export interface AppliedFilamentPreset {
|
|
@@ -21,9 +22,43 @@ export declare function presetChanges(values: Record<string, string[]>, creator:
|
|
|
21
22
|
*/
|
|
22
23
|
export declare function writeFilamentPresets(settings: JsonRecord, files: Record<string, JsonRecord>, applied: readonly AppliedFilamentPreset[], presets: PrinterFilamentPresets | undefined, slotCount: number): void;
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* What Snapmaker Orca's app resets a filament's unnamed settings to when it opens the file: the parent the file
|
|
26
|
+
* names for it, or else the installed preset of the same name (Preset.cpp, load_external_preset).
|
|
27
|
+
* - `preset`: a U1 preset whose settings the catalog holds: the slot's own, or the `parent` written for it.
|
|
28
|
+
* - `named`: a preset the Snapmaker or Generic option named whose settings the catalog lacks; the app uses its own.
|
|
29
|
+
* - `source`: no U1 preset fits, so the app resets to whatever preset of that name is installed, if any.
|
|
28
30
|
*/
|
|
29
|
-
export
|
|
31
|
+
export type FilamentBase = {
|
|
32
|
+
kind: "preset";
|
|
33
|
+
values: Record<string, string[]>;
|
|
34
|
+
parent?: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "named";
|
|
37
|
+
} | {
|
|
38
|
+
kind: "source";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Each slot's base. Under Original, a filament whose name isn't a U1 preset gets a U1 parent, the preset the
|
|
42
|
+
* Snapmaker option would choose (Snapmaker's own for the product line, or Generic where Snapmaker has none): the
|
|
43
|
+
* creator's name and values stay, and what the file doesn't name resets to a preset made for the U1 rather than
|
|
44
|
+
* to another printer's preset of the same name.
|
|
45
|
+
*/
|
|
46
|
+
export declare function filamentBases(settings: JsonRecord, slotCount: number, presets: PrinterFilamentPresets | undefined, table: FilamentNameTable | undefined, printerId: string,
|
|
47
|
+
/** The Snapmaker or Generic option was chosen. */
|
|
48
|
+
option: boolean): FilamentBase[];
|
|
49
|
+
/**
|
|
50
|
+
* A slot whose base is a U1 preset, its own or its parent, takes that preset's G-code, the U1's own, so the app
|
|
51
|
+
* (which resets unnamed settings to the base's) and the command line (which uses the file's) run the same
|
|
52
|
+
* G-code, and neither calls it modified.
|
|
53
|
+
*/
|
|
54
|
+
export declare function writeBaseGcode(settings: JsonRecord, files: Record<string, JsonRecord>, bases: readonly FilamentBase[], slotCount: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Each filament's entry in `different_settings_to_system` names the settings that differ from its base, and
|
|
57
|
+
* a parent goes in `inherits_group`. The app resets every setting an entry doesn't name to the base's value,
|
|
58
|
+
* which is the file's anyway, and warns about every G-code setting one names (PresetBundle.cpp,
|
|
59
|
+
* validate_presets), so an entry naming more than differs warns about G-code nobody changed. A filament no
|
|
60
|
+
* U1 preset fits names what the source file says the creator changed, what the conversion changed (its
|
|
61
|
+
* G-code, the U1's own, among them) and the printers it suits; every filament setting when the source's list
|
|
62
|
+
* can't be read.
|
|
63
|
+
*/
|
|
64
|
+
export declare function listFilamentSettings(settings: JsonRecord, bases: readonly FilamentBase[], source: JsonRecord, slotCount: number): void;
|
|
@@ -3,12 +3,21 @@
|
|
|
3
3
|
* The Snapmaker and Generic filament options: a slot renamed to a preset Snapmaker Orca ships takes that
|
|
4
4
|
* preset's own settings, standard and high-flow values and its G-code included, so the file, Snapmaker Orca's
|
|
5
5
|
* app (which resets a filament whose name matches a shipped preset) and its command line (which uses the file's
|
|
6
|
-
* values) all agree. And
|
|
7
|
-
* so
|
|
6
|
+
* values) all agree. And each filament's entry in `different_settings_to_system` names the settings that differ
|
|
7
|
+
* from the preset the app resets that filament to, so the app keeps what the file says, the creator's values
|
|
8
|
+
* under Original included, and warns about G-code only where it really differs.
|
|
8
9
|
*/
|
|
9
10
|
import { SETTINGS_CATALOG } from "../diff/settingsCatalog.js";
|
|
10
11
|
import { FILAMENT_FLOW_VARIANT_KEYS } from "./applyFilamentFlowVariants.js";
|
|
12
|
+
import { resolveFilamentName } from "./filamentComplianceNames.js";
|
|
11
13
|
const VARIANT_KEYS = new Set(FILAMENT_FLOW_VARIANT_KEYS);
|
|
14
|
+
/** Filament settings that are project state rather than a preset's (Snapmaker Orca's presets hold no color), so never named. */
|
|
15
|
+
const PROJECT_STATE_KEYS = new Set(["filament_colour"]);
|
|
16
|
+
/**
|
|
17
|
+
* Named for a filament no U1 preset fits: the app resets it to an installed preset of the same name, and one made for
|
|
18
|
+
* another printer (Bambu's, say) lists only that maker's printers, so the filament couldn't be used with the U1.
|
|
19
|
+
*/
|
|
20
|
+
const COMPATIBILITY_KEYS = ["compatible_printers"];
|
|
12
21
|
/** One preset's settings: the values the printer's presets share, with its own over them. Undefined when there are none. */
|
|
13
22
|
export function presetSettingsFor(presets, name) {
|
|
14
23
|
if (!presets || !Object.hasOwn(presets.presets, name))
|
|
@@ -27,6 +36,34 @@ export function presetChanges(values, creator) {
|
|
|
27
36
|
}
|
|
28
37
|
return out;
|
|
29
38
|
}
|
|
39
|
+
/** Writes `values` into one slot: the project's per-filament lists, and the embedded preset file named `name`. */
|
|
40
|
+
function writeSlot(settings, files, slot, name, values, slotCount) {
|
|
41
|
+
for (const [key, value] of Object.entries(values)) {
|
|
42
|
+
const list = settings[key];
|
|
43
|
+
if (!Array.isArray(list))
|
|
44
|
+
continue;
|
|
45
|
+
const next = [...list];
|
|
46
|
+
if (VARIANT_KEYS.has(key) && next.length === slotCount * 2) {
|
|
47
|
+
next[slot * 2] = value[0];
|
|
48
|
+
next[slot * 2 + 1] = value[1] ?? value[0];
|
|
49
|
+
}
|
|
50
|
+
else if (next.length === slotCount) {
|
|
51
|
+
next[slot] = value[0];
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
continue;
|
|
55
|
+
settings[key] = next;
|
|
56
|
+
}
|
|
57
|
+
for (const cfg of Object.values(files)) {
|
|
58
|
+
if (cfg.name !== name)
|
|
59
|
+
continue;
|
|
60
|
+
for (const [key, value] of Object.entries(values)) {
|
|
61
|
+
const own = cfg[key];
|
|
62
|
+
// The embedded preset keeps its layout: one value where it holds one, the preset's own list otherwise.
|
|
63
|
+
cfg[key] = Array.isArray(own) && own.length === 1 ? [value[0]] : [...value];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
30
67
|
/**
|
|
31
68
|
* Writes each applied preset's settings into its slot: the project's per-filament lists (both values of a
|
|
32
69
|
* per-variant setting where the nozzle has a high-flow option) and the slot's embedded preset file. Runs after
|
|
@@ -35,50 +72,109 @@ export function presetChanges(values, creator) {
|
|
|
35
72
|
export function writeFilamentPresets(settings, files, applied, presets, slotCount) {
|
|
36
73
|
for (const { slot, preset } of applied) {
|
|
37
74
|
const values = presetSettingsFor(presets, preset);
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
for (const [key, value] of Object.entries(values)) {
|
|
41
|
-
const list = settings[key];
|
|
42
|
-
if (!Array.isArray(list))
|
|
43
|
-
continue;
|
|
44
|
-
const next = [...list];
|
|
45
|
-
if (VARIANT_KEYS.has(key) && next.length === slotCount * 2) {
|
|
46
|
-
next[slot * 2] = value[0];
|
|
47
|
-
next[slot * 2 + 1] = value[1] ?? value[0];
|
|
48
|
-
}
|
|
49
|
-
else if (next.length === slotCount) {
|
|
50
|
-
next[slot] = value[0];
|
|
51
|
-
}
|
|
52
|
-
else
|
|
53
|
-
continue;
|
|
54
|
-
settings[key] = next;
|
|
55
|
-
}
|
|
56
|
-
for (const cfg of Object.values(files)) {
|
|
57
|
-
if (cfg.name !== preset)
|
|
58
|
-
continue;
|
|
59
|
-
for (const [key, value] of Object.entries(values)) {
|
|
60
|
-
const own = cfg[key];
|
|
61
|
-
// The embedded preset keeps its layout: one value where it holds one, the preset's own list otherwise.
|
|
62
|
-
cfg[key] = Array.isArray(own) && own.length === 1 ? [value[0]] : [...value];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
75
|
+
if (values)
|
|
76
|
+
writeSlot(settings, files, slot, preset, values, slotCount);
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
68
|
-
*
|
|
69
|
-
* Snapmaker
|
|
70
|
-
*
|
|
71
|
-
*
|
|
80
|
+
* Each slot's base. Under Original, a filament whose name isn't a U1 preset gets a U1 parent, the preset the
|
|
81
|
+
* Snapmaker option would choose (Snapmaker's own for the product line, or Generic where Snapmaker has none): the
|
|
82
|
+
* creator's name and values stay, and what the file doesn't name resets to a preset made for the U1 rather than
|
|
83
|
+
* to another printer's preset of the same name.
|
|
84
|
+
*/
|
|
85
|
+
export function filamentBases(settings, slotCount, presets, table, printerId,
|
|
86
|
+
/** The Snapmaker or Generic option was chosen. */
|
|
87
|
+
option) {
|
|
88
|
+
const names = Array.isArray(settings.filament_settings_id) ? settings.filament_settings_id : [];
|
|
89
|
+
const types = Array.isArray(settings.filament_type) ? settings.filament_type : [];
|
|
90
|
+
const offered = table && Object.hasOwn(table.printers, printerId) ? table.printers[printerId].presets : {};
|
|
91
|
+
return Array.from({ length: slotCount }, (_, i) => {
|
|
92
|
+
const name = typeof names[i] === "string" ? names[i] : "";
|
|
93
|
+
const own = presetSettingsFor(presets, name);
|
|
94
|
+
if (own)
|
|
95
|
+
return { kind: "preset", values: own };
|
|
96
|
+
if (Object.hasOwn(offered, name))
|
|
97
|
+
return option ? { kind: "named" } : { kind: "source" };
|
|
98
|
+
if (!table)
|
|
99
|
+
return { kind: "source" };
|
|
100
|
+
const parent = resolveFilamentName(table, printerId, typeof types[i] === "string" ? types[i] : "", name, "snapmaker").preset?.name;
|
|
101
|
+
const values = parent === undefined ? undefined : presetSettingsFor(presets, parent);
|
|
102
|
+
return values ? { kind: "preset", values, parent } : { kind: "source" };
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A slot whose base is a U1 preset, its own or its parent, takes that preset's G-code, the U1's own, so the app
|
|
107
|
+
* (which resets unnamed settings to the base's) and the command line (which uses the file's) run the same
|
|
108
|
+
* G-code, and neither calls it modified.
|
|
109
|
+
*/
|
|
110
|
+
export function writeBaseGcode(settings, files, bases, slotCount) {
|
|
111
|
+
const names = Array.isArray(settings.filament_settings_id) ? settings.filament_settings_id : [];
|
|
112
|
+
bases.forEach((base, slot) => {
|
|
113
|
+
const name = names[slot];
|
|
114
|
+
if (base.kind !== "preset" || typeof name !== "string")
|
|
115
|
+
return;
|
|
116
|
+
const gcode = Object.fromEntries(Object.entries(base.values).filter(([key]) => key.endsWith("_gcode")));
|
|
117
|
+
writeSlot(settings, files, slot, name, gcode, slotCount);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const text = (v) => (typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : undefined);
|
|
121
|
+
/** One slot's values of a filament setting: one per slot, or two (standard, high flow); undefined for any other layout. */
|
|
122
|
+
function slotValues(value, slot, slotCount) {
|
|
123
|
+
const values = !Array.isArray(value) ? [value] : value.length === slotCount * 2 ? value.slice(slot * 2, slot * 2 + 2) : value.length === slotCount ? [value[slot]] : undefined;
|
|
124
|
+
const out = values?.map(text);
|
|
125
|
+
return out?.every((v) => v !== undefined) ? out : undefined;
|
|
126
|
+
}
|
|
127
|
+
/** Whether two value lists mean the same, one value standing for both variants as Snapmaker Orca reads it. */
|
|
128
|
+
function sameValues(a, b) {
|
|
129
|
+
if (!a || !b)
|
|
130
|
+
return false;
|
|
131
|
+
if (a.length === b.length)
|
|
132
|
+
return a.every((v, i) => v === b[i]);
|
|
133
|
+
if (a.length === 1)
|
|
134
|
+
return b.every((v) => v === a[0]);
|
|
135
|
+
return b.length === 1 && a.every((v) => v === b[0]);
|
|
136
|
+
}
|
|
137
|
+
/** The settings the source file says the creator changed in one filament; null when its list can't be read for that slot. */
|
|
138
|
+
function sourceEntry(source, slot, slotCount) {
|
|
139
|
+
const list = source.different_settings_to_system;
|
|
140
|
+
if (!Array.isArray(list) || list.length !== slotCount + 2)
|
|
141
|
+
return null;
|
|
142
|
+
const entry = list[slot + 1];
|
|
143
|
+
return typeof entry === "string" ? entry.split(";") : null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Each filament's entry in `different_settings_to_system` names the settings that differ from its base, and
|
|
147
|
+
* a parent goes in `inherits_group`. The app resets every setting an entry doesn't name to the base's value,
|
|
148
|
+
* which is the file's anyway, and warns about every G-code setting one names (PresetBundle.cpp,
|
|
149
|
+
* validate_presets), so an entry naming more than differs warns about G-code nobody changed. A filament no
|
|
150
|
+
* U1 preset fits names what the source file says the creator changed, what the conversion changed (its
|
|
151
|
+
* G-code, the U1's own, among them) and the printers it suits; every filament setting when the source's list
|
|
152
|
+
* can't be read.
|
|
72
153
|
*/
|
|
73
|
-
export function listFilamentSettings(settings,
|
|
74
|
-
if (
|
|
154
|
+
export function listFilamentSettings(settings, bases, source, slotCount) {
|
|
155
|
+
if (slotCount < 1)
|
|
75
156
|
return;
|
|
76
157
|
const keys = Object.keys(settings)
|
|
77
|
-
.filter((k) => Object.hasOwn(SETTINGS_CATALOG, k) && SETTINGS_CATALOG[k].group === "filament")
|
|
78
|
-
.sort()
|
|
79
|
-
|
|
158
|
+
.filter((k) => Object.hasOwn(SETTINGS_CATALOG, k) && SETTINGS_CATALOG[k].group === "filament" && !PROJECT_STATE_KEYS.has(k))
|
|
159
|
+
.sort();
|
|
160
|
+
const known = new Set(keys);
|
|
161
|
+
const entries = Array.from({ length: slotCount }, (_, slot) => {
|
|
162
|
+
const base = bases[slot] ?? { kind: "source" };
|
|
163
|
+
if (base.kind === "named")
|
|
164
|
+
return "";
|
|
165
|
+
const values = (key) => slotValues(settings[key], slot, slotCount);
|
|
166
|
+
if (base.kind === "preset")
|
|
167
|
+
return keys.filter((k) => !sameValues(values(k), Object.hasOwn(base.values, k) ? base.values[k] : undefined)).join(";");
|
|
168
|
+
const creator = sourceEntry(source, slot, slotCount);
|
|
169
|
+
const named = creator === null ? keys : [...creator.filter((k) => known.has(k)), ...keys.filter((k) => !sameValues(slotValues(source[k], slot, slotCount), values(k)))];
|
|
170
|
+
return [...new Set([...named, ...COMPATIBILITY_KEYS])].sort().join(";");
|
|
171
|
+
});
|
|
80
172
|
const current = Array.isArray(settings.different_settings_to_system) ? settings.different_settings_to_system : [];
|
|
81
173
|
const print = typeof current[0] === "string" ? current[0] : "";
|
|
82
|
-
const
|
|
83
|
-
|
|
174
|
+
const last = current.length >= 2 ? current[current.length - 1] : undefined;
|
|
175
|
+
const printer = typeof last === "string" ? last : "";
|
|
176
|
+
settings.different_settings_to_system = [print, ...entries, printer];
|
|
177
|
+
const parents = bases.map((base) => (base.kind === "preset" && base.parent !== undefined ? base.parent : ""));
|
|
178
|
+
if (parents.some((parent) => parent !== ""))
|
|
179
|
+
settings.inherits_group = ["", ...parents, ""];
|
|
84
180
|
}
|
|
@@ -6,6 +6,7 @@ import { coerceValue } from "./coerceValue.js";
|
|
|
6
6
|
import { collapseNozzleVariants } from "./collapseNozzleVariants.js";
|
|
7
7
|
import { detectVariantIndex } from "./detectVariantIndex.js";
|
|
8
8
|
import { jsonEqual } from "./internal/jsonEqual.js";
|
|
9
|
+
import { PRINTER_KEYS_KEPT } from "./policy.js";
|
|
9
10
|
import { resolveMinIfLower } from "./resolveMinIfLower.js";
|
|
10
11
|
import { stripBambuOnlyNozzleVariantKeys } from "./stripBambuOnlyNozzleVariantKeys.js";
|
|
11
12
|
/** Bambu/Orca both store this as an array whose first element is a `;`-joined key list (remaining elements are unused padding). */
|
|
@@ -153,7 +154,8 @@ release) {
|
|
|
153
154
|
//
|
|
154
155
|
// A stock baseline has no list of its own (Snapmaker Orca writes none
|
|
155
156
|
// for an unmodified project), so one is created with Orca's layout: the
|
|
156
|
-
// print entry, one entry per filament, then the printer entry
|
|
157
|
+
// print entry, one entry per filament, then the printer entry, which
|
|
158
|
+
// names the printer settings the file keeps (PRINTER_KEYS_KEPT).
|
|
157
159
|
const allKeys = Object.keys(newSettings)
|
|
158
160
|
.filter((k) => k !== "different_settings_to_system")
|
|
159
161
|
.sort();
|
|
@@ -161,7 +163,7 @@ release) {
|
|
|
161
163
|
const filamentCount = Array.isArray(newSettings.filament_colour) ? newSettings.filament_colour.length : 1;
|
|
162
164
|
newSettings.different_settings_to_system = Array.isArray(diffs)
|
|
163
165
|
? [allKeys.join(";"), ...diffs.slice(1)]
|
|
164
|
-
: [allKeys.join(";"), ...Array.from({ length: filamentCount }, () => ""), ""];
|
|
166
|
+
: [allKeys.join(";"), ...Array.from({ length: filamentCount }, () => ""), PRINTER_KEYS_KEPT.join(";")];
|
|
165
167
|
return {
|
|
166
168
|
newSettings,
|
|
167
169
|
changedKeys,
|
package/dist/engine/policy.d.ts
CHANGED
|
@@ -20,3 +20,11 @@ export declare const MACHINE_SETTINGS_KEYS: readonly string[];
|
|
|
20
20
|
export declare function isGcodeKey(key: string): boolean;
|
|
21
21
|
/** Filament keys that always keep the U1 profile's value, besides every G-code key (see {@link isGcodeKey}). */
|
|
22
22
|
export declare const FILAMENT_KEY_BLOCKLIST: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Printer settings named in the printer's entry of `different_settings_to_system`, so Snapmaker Orca's app keeps
|
|
25
|
+
* the file's value: it resets every printer setting the entry doesn't name to the installed printer preset's, and
|
|
26
|
+
* that preset can change without a release (Snapmaker updates its profiles through the app). `nozzle_type`: the
|
|
27
|
+
* file records the U1's stock stainless 0.4 and the hardened 0.6, or hardened nozzles when the user says so, where
|
|
28
|
+
* Snapmaker's presets have the 0.4 and 0.6 swapped. A named value equal to the preset's changes nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare const PRINTER_KEYS_KEPT: readonly string[];
|
package/dist/engine/policy.js
CHANGED
|
@@ -273,3 +273,11 @@ export const FILAMENT_KEY_BLOCKLIST = [
|
|
|
273
273
|
"compatible_prints",
|
|
274
274
|
"compatible_prints_condition",
|
|
275
275
|
];
|
|
276
|
+
/**
|
|
277
|
+
* Printer settings named in the printer's entry of `different_settings_to_system`, so Snapmaker Orca's app keeps
|
|
278
|
+
* the file's value: it resets every printer setting the entry doesn't name to the installed printer preset's, and
|
|
279
|
+
* that preset can change without a release (Snapmaker updates its profiles through the app). `nozzle_type`: the
|
|
280
|
+
* file records the U1's stock stainless 0.4 and the hardened 0.6, or hardened nozzles when the user says so, where
|
|
281
|
+
* Snapmaker's presets have the 0.4 and 0.6 swapped. A named value equal to the preset's changes nothing.
|
|
282
|
+
*/
|
|
283
|
+
export const PRINTER_KEYS_KEPT = ["nozzle_type"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { applyFilamentComplianceMode } from "./applyFilamentComplianceMode.js";
|
|
2
2
|
import { labelOf } from "../diff/diffSettings.js";
|
|
3
|
-
import { listFilamentSettings, writeFilamentPresets } from "./applyFilamentPresets.js";
|
|
3
|
+
import { filamentBases, listFilamentSettings, writeBaseGcode, writeFilamentPresets } from "./applyFilamentPresets.js";
|
|
4
4
|
import { EXTRA_PROJECT_LEVEL_FILAMENT_KEYS } from "./constants.js";
|
|
5
5
|
import { buildFilamentConfigs } from "./buildFilamentConfigs.js";
|
|
6
6
|
import { clampColorPenetration } from "./clampColorPenetration.js";
|
|
@@ -226,10 +226,12 @@ export function runConvertPipeline(profile, request, application, options = {})
|
|
|
226
226
|
const { shifts, plateOrigins, warnings: shiftWarnings } = computeShifts(request.objects, printer.printableArea, Number.isFinite(bambuClearanceRadius) ? bambuClearanceRadius : null, printer.extruderClearanceRadius, request.plateCount);
|
|
227
227
|
warnings.push(...shiftWarnings);
|
|
228
228
|
addShiftItems(tracker, request.objects, shifts);
|
|
229
|
-
// Last of the filament steps: the chosen presets' settings,
|
|
230
|
-
// Orca keeps what the file says.
|
|
229
|
+
// Last of the filament steps: the chosen presets' settings, each U1 base preset's G-code, then each filament's
|
|
230
|
+
// changed settings named against the preset Snapmaker Orca resets it to, so it keeps what the file says.
|
|
231
231
|
writeFilamentPresets(newSettings, filamentFiles, appliedPresets, printer.filamentPresets, slotCount);
|
|
232
|
-
|
|
232
|
+
const bases = filamentBases(newSettings, slotCount, printer.filamentPresets, printer.filamentNames, printer.id, Boolean(request.filamentComplianceMode));
|
|
233
|
+
writeBaseGcode(newSettings, filamentFiles, bases, slotCount);
|
|
234
|
+
listFilamentSettings(newSettings, bases, request.projectSettings, slotCount);
|
|
233
235
|
const configFiles = { ...filamentFiles };
|
|
234
236
|
// `warnings` mixes routine per-conversion bookkeeping (e.g. computeShifts'
|
|
235
237
|
// "true geometric center -> target" line, which fires on every plate
|
|
@@ -119,7 +119,8 @@ export class ChangeTracker {
|
|
|
119
119
|
const gcode = key.endsWith("_gcode");
|
|
120
120
|
if (!info || (info.group === "filament" && !gcode) || !Object.hasOwn(stock, key) || !Object.hasOwn(output, key))
|
|
121
121
|
continue;
|
|
122
|
-
|
|
122
|
+
// All G-code in the file is the U1's own: Snapmaker's stock, or that of the U1 preset a filament takes it from.
|
|
123
|
+
if (gcode ? sameSetting(source[key], output[key]) : sameSetting(source[key], stock[key]) || !sameSetting(output[key], stock[key]))
|
|
123
124
|
continue;
|
|
124
125
|
if (info.group === "machine" || gcode) {
|
|
125
126
|
printerSettings++;
|
package/dist/inspect.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface Inspection {
|
|
|
62
62
|
* 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.
|
|
63
63
|
*/
|
|
64
64
|
sourcePlateOrigins?: Record<number, [number, number]>;
|
|
65
|
-
/** Non-fatal notes from reading the file. */
|
|
65
|
+
/** Non-fatal notes from reading the file. Their wording can change in any release: check whether there are any, not what they say. */
|
|
66
66
|
warnings: string[];
|
|
67
67
|
/**
|
|
68
68
|
* The project's unpacked size in bytes. Above 1 GB, converting takes a minute or two and a few GB of
|
package/dist/project.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ export interface ConvertReport {
|
|
|
105
105
|
profileNotes: string[];
|
|
106
106
|
/** Set when `profileId` named a retired profile and its successor was used. */
|
|
107
107
|
retiredProfile?: RetiredProfile;
|
|
108
|
-
/** Notes worth showing the user, cleaned up for display. */
|
|
108
|
+
/** 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
109
|
warnings: string[];
|
|
110
110
|
/** Every note the conversion produced, including routine ones, for logs and bug reports. */
|
|
111
111
|
log: string[];
|
package/dist/project.js
CHANGED
|
@@ -245,8 +245,9 @@ export class Project {
|
|
|
245
245
|
}
|
|
246
246
|
progress("loading-profile");
|
|
247
247
|
const loaded = await catalogEngine(catalog).load(profileId);
|
|
248
|
-
// The Snapmaker and Generic filament options write the chosen presets' own settings
|
|
249
|
-
|
|
248
|
+
// The Snapmaker and Generic filament options write the chosen presets' own settings; every option compares each
|
|
249
|
+
// filament with the preset Snapmaker Orca resets it to.
|
|
250
|
+
const filamentPresets = (await catalogEngine(catalog).filamentPresets())?.[loaded.convertProfile.printer.id];
|
|
250
251
|
progress("merging");
|
|
251
252
|
if (preset) {
|
|
252
253
|
const sourceNozzle = detectNozzleDiameter(this.request.projectSettings);
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "any2orca",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"outputAffecting": "
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"outputAffecting": "Snapmaker Orca no longer warns about modified G-code when it opens a converted file, and a filament named like another printer's preset stays usable with the U1; Snapmaker Orca keeps the nozzle type a converted file records",
|
|
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"
|