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/project.js
CHANGED
|
@@ -18,7 +18,12 @@ import { runConvertPipeline } from "./engine/runConvertPipeline.js";
|
|
|
18
18
|
import { diffSettings } from "./diff/diffSettings.js";
|
|
19
19
|
import { Any2orcaError } from "./errors.js";
|
|
20
20
|
import { toWhatChanged } from "./explain/whatChanged.js";
|
|
21
|
+
import { cleanWarnings, noteFrom, sortNotes } from "./explain/notes.js";
|
|
22
|
+
export { cleanWarnings };
|
|
23
|
+
import { filamentPresetNotes } from "./explain/filamentNotes.js";
|
|
21
24
|
import { inspectProject } from "./inspect.js";
|
|
25
|
+
import { filamentCountOf, readPartPaint, readPlateFilaments } from "./archive/plateFilaments.js";
|
|
26
|
+
import { plateFilamentNotes, sharedLayerFilamentNote } from "./explain/plateNotes.js";
|
|
22
27
|
import { catalogEngine, loadCatalog, ProfileCatalog } from "./profiles.js";
|
|
23
28
|
import { ConvertRequestSchema, ConvertResponseSchema, HighFlowHotendsSchema, } from "./schema.js";
|
|
24
29
|
import { resolveAboveStockChoice } from "./engine/aboveStock.js";
|
|
@@ -43,14 +48,8 @@ function rawNozzleDiameter(projectSettings) {
|
|
|
43
48
|
function sizesText(sizes) {
|
|
44
49
|
return sizes.length <= 1 ? `${sizes[0] ?? "?"} mm` : `${sizes.slice(0, -1).join(", ")} and ${sizes[sizes.length - 1]} mm`;
|
|
45
50
|
}
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
* re-implement this): among the profiles for the nozzle size the user's U1
|
|
49
|
-
* has (`options.nozzle`, default 0.4; "match" for the creator's own size),
|
|
50
|
-
* the source's own tier name first (from its print_settings_id, e.g. "Extra
|
|
51
|
-
* Fine"), then the nearest layer height, then the catalog default.
|
|
52
|
-
*/
|
|
53
|
-
export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
51
|
+
/** {@link matchProfile}, with each note's topic for `convert()`'s `report.notes`. */
|
|
52
|
+
async function matchProfileDetailed(projectSettings, profiles, options = {}) {
|
|
54
53
|
const catalog = await loadCatalog(profiles);
|
|
55
54
|
const choice = options.nozzle ?? DEFAULT_NOZZLE;
|
|
56
55
|
const detectedDiameter = detectNozzleDiameter(projectSettings);
|
|
@@ -70,14 +69,15 @@ export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
|
70
69
|
: null;
|
|
71
70
|
const profileId = picked?.profileId ?? catalog.index.defaultProfileId;
|
|
72
71
|
const used = catalog.get(profileId)?.nozzleDiameter ?? size ?? "";
|
|
73
|
-
const
|
|
72
|
+
const topics = [];
|
|
73
|
+
const notes = { push: (text, topic = "nozzle") => topics.push({ topic, text }) };
|
|
74
74
|
const sourceNozzle = rawNozzleDiameter(projectSettings);
|
|
75
75
|
if (choice === "match") {
|
|
76
76
|
if (sourceNozzle === null) {
|
|
77
77
|
notes.push("the source file doesn't give a usable nozzle size, so the default profile is used");
|
|
78
78
|
}
|
|
79
79
|
else if (detectedDiameter && Math.abs(sourceNozzle - Number(detectedDiameter)) > 1e-6) {
|
|
80
|
-
notes.push(`the source file is set up for a ${sourceNozzle}mm nozzle, which has no U1 profile; the ${detectedDiameter}mm profile is used`);
|
|
80
|
+
notes.push(`the source file is set up for a ${sourceNozzle} mm nozzle, which has no U1 profile; the ${detectedDiameter} mm profile is used`);
|
|
81
81
|
}
|
|
82
82
|
if (source.mixed) {
|
|
83
83
|
notes.push(`the creator's project uses ${sizesText(source.sizes)} nozzles; Snapmaker Orca allows one size for all four toolheads, so the whole file is for ${used} mm`);
|
|
@@ -94,7 +94,7 @@ export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
|
94
94
|
notes.push(`the creator's project is set up for a ${sourceNozzle} mm nozzle; converted for your ${used} mm nozzles (choose ${sourceNozzle} mm if your U1 has them)`);
|
|
95
95
|
}
|
|
96
96
|
if (Object.hasOwn(projectSettings, "layer_height") && sourceLayerHeight === null) {
|
|
97
|
-
notes.push(`the source file's layer height (${plainText(String(projectSettings.layer_height)).slice(0, 40)}) isn't a usable number, so it isn't used to choose the profile
|
|
97
|
+
notes.push(`the source file's layer height (${plainText(String(projectSettings.layer_height)).slice(0, 40)}) isn't a usable number, so it isn't used to choose the profile`, "profile");
|
|
98
98
|
}
|
|
99
99
|
return {
|
|
100
100
|
profileId,
|
|
@@ -107,37 +107,20 @@ export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
|
107
107
|
matchSource: picked ? (picked.matchedByTierName ? "auto-tier-name" : picked.exact ? "auto-exact" : "auto-nearest") : "default-fallback",
|
|
108
108
|
},
|
|
109
109
|
carrySourceLayerHeight: Boolean(picked && !picked.exact && sourceLayerHeight !== null),
|
|
110
|
-
notes,
|
|
110
|
+
notes: topics.map((note) => note.text),
|
|
111
|
+
topics,
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
115
|
+
* Picks a profile for a file's settings, the same way every UI should (never
|
|
116
|
+
* re-implement this): among the profiles for the nozzle size the user's U1
|
|
117
|
+
* has (`options.nozzle`, default 0.4; "match" for the creator's own size),
|
|
118
|
+
* the source's own tier name first (from its print_settings_id, e.g. "Extra
|
|
119
|
+
* Fine"), then the nearest layer height, then the catalog default.
|
|
117
120
|
*/
|
|
118
|
-
export function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
.filter((w) => {
|
|
122
|
-
if (!w)
|
|
123
|
-
return false;
|
|
124
|
-
if (w.includes("SKIP filament_colour: list length mismatch"))
|
|
125
|
-
return false;
|
|
126
|
-
if (w.includes("left unchanged"))
|
|
127
|
-
return false;
|
|
128
|
-
if (w.includes("ignored") && w.includes("trailing non-JSON"))
|
|
129
|
-
return false;
|
|
130
|
-
return true;
|
|
131
|
-
})
|
|
132
|
-
.map((w) => w
|
|
133
|
-
.replace(/^WARN:\s*/i, "")
|
|
134
|
-
.replace(/^WARN\s+/i, "")
|
|
135
|
-
.replace(/\s+in\s+model_settings\.config\.?/i, "")
|
|
136
|
-
.replace(/\s+in\s+3D\/3dmodel\.model\.?/i, "")
|
|
137
|
-
.replace(/\s+in\s+[A-Za-z0-9_./-]+\.(config|model|xml)\.?/i, "")
|
|
138
|
-
.replace(/\.$/, ""))
|
|
139
|
-
// Warnings can quote names from the file; they're prose for people, so they never carry control characters.
|
|
140
|
-
.map(plainText);
|
|
121
|
+
export async function matchProfile(projectSettings, profiles, options = {}) {
|
|
122
|
+
const { topics: _topics, ...choice } = await matchProfileDetailed(projectSettings, profiles, options);
|
|
123
|
+
return choice;
|
|
141
124
|
}
|
|
142
125
|
/** JSON round trip, as the request and response took over HTTP. */
|
|
143
126
|
function viaJson(value) {
|
|
@@ -193,6 +176,8 @@ function describeIssues(issues) {
|
|
|
193
176
|
export class Project {
|
|
194
177
|
parsed;
|
|
195
178
|
request;
|
|
179
|
+
partPaint;
|
|
180
|
+
sourcePlateFilaments;
|
|
196
181
|
constructor(parsed, request) {
|
|
197
182
|
this.parsed = parsed;
|
|
198
183
|
this.request = request;
|
|
@@ -225,7 +210,23 @@ export class Project {
|
|
|
225
210
|
return structuredClone(this.request.projectSettings);
|
|
226
211
|
}
|
|
227
212
|
inspect() {
|
|
228
|
-
|
|
213
|
+
this.sourcePlateFilaments ??= this.plateFilaments(this.request.projectSettings);
|
|
214
|
+
return inspectProject(this.request.projectSettings, this.request.objects, this.parsed.warnings, this.parsed.unpackedBytes, this.parsed.sourcePlateOrigins, this.request.plateCount, this.sourcePlateFilaments);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The filaments each plate uses, read by `projectSettings`: the source's for what the creator's file says, a
|
|
218
|
+
* converted project's for what the U1 prints. The meshes' paint is scanned once, on first use.
|
|
219
|
+
*/
|
|
220
|
+
plateFilaments(projectSettings) {
|
|
221
|
+
this.partPaint ??= readPartPaint(this.parsed.zipEntries, this.request.objects, this.parsed.partPlacements, filamentCountOf(this.request.projectSettings));
|
|
222
|
+
return readPlateFilaments({
|
|
223
|
+
zipEntries: this.parsed.zipEntries,
|
|
224
|
+
projectSettings,
|
|
225
|
+
objects: this.request.objects,
|
|
226
|
+
partPlacements: this.parsed.partPlacements,
|
|
227
|
+
plateCount: Math.max(1, this.request.plateCount ?? 0),
|
|
228
|
+
paint: this.partPaint,
|
|
229
|
+
});
|
|
229
230
|
}
|
|
230
231
|
/** The profile auto-matching would pick for this file, for the user's nozzle size (`options.nozzle`, default 0.4). */
|
|
231
232
|
matchProfile(profiles, options = {}) {
|
|
@@ -238,12 +239,20 @@ export class Project {
|
|
|
238
239
|
const top = await loadCatalog(options.profiles);
|
|
239
240
|
const catalog = options.snapmakerOrcaVersion === undefined ? top : await top.forRelease(options.snapmakerOrcaVersion);
|
|
240
241
|
const routeWarnings = [];
|
|
242
|
+
const routeNotes = [];
|
|
243
|
+
const route = (topic, text) => {
|
|
244
|
+
routeWarnings.push(text);
|
|
245
|
+
const note = noteFrom(topic, text);
|
|
246
|
+
if (note)
|
|
247
|
+
routeNotes.push(note);
|
|
248
|
+
};
|
|
241
249
|
// A PrusaSlicer project records no list of what its creator changed; with the vendor's presets at hand, the
|
|
242
250
|
// list is the diff against the project's print preset (policy B), as a Bambu Studio family project's own list is.
|
|
243
251
|
let policyB = null;
|
|
244
252
|
if (this.parsed.prusa) {
|
|
245
253
|
policyB = await applyPolicyB(this.parsed.prusa, top, this.request.projectSettings);
|
|
246
|
-
|
|
254
|
+
for (const note of policyB ? policyB.notes : [policyBFallbackNote(this.parsed.prusa, top)])
|
|
255
|
+
route("source", note);
|
|
247
256
|
}
|
|
248
257
|
let profileId;
|
|
249
258
|
let profileMatch;
|
|
@@ -258,24 +267,26 @@ export class Project {
|
|
|
258
267
|
const aboveStock = resolveAboveStockChoice(options.aboveStock);
|
|
259
268
|
if (preset) {
|
|
260
269
|
profileId = preset.profileId;
|
|
261
|
-
|
|
270
|
+
for (const note of preset.notes)
|
|
271
|
+
route("profile", ` WARN: ${note}`);
|
|
262
272
|
}
|
|
263
273
|
else if (options.profileId) {
|
|
264
274
|
profileId = options.profileId;
|
|
265
275
|
retiredProfile = catalog.retiredSuccessor(profileId);
|
|
266
276
|
if (retiredProfile) {
|
|
267
|
-
|
|
277
|
+
route("profile", ` WARN: profile "${profileId}" (${retiredProfile.displayName}) has been retired; converted with "${retiredProfile.successorId}" instead.`);
|
|
268
278
|
profileId = retiredProfile.successorId;
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
else {
|
|
272
|
-
const choice = await
|
|
282
|
+
const choice = await matchProfileDetailed(this.request.projectSettings, catalog, { nozzle: options.nozzle });
|
|
273
283
|
profileId = choice.profileId;
|
|
274
284
|
profileMatch = choice.profileMatch;
|
|
275
285
|
profileNotes = [...choice.notes];
|
|
276
286
|
carrySourceLayerHeight = choice.carrySourceLayerHeight;
|
|
277
287
|
matchedNozzle = choice.nozzle;
|
|
278
|
-
|
|
288
|
+
for (const note of choice.topics)
|
|
289
|
+
route(note.topic, ` WARN: ${note.text}`);
|
|
279
290
|
}
|
|
280
291
|
progress("loading-profile");
|
|
281
292
|
const loaded = await catalogEngine(catalog).load(profileId);
|
|
@@ -298,7 +309,7 @@ export class Project {
|
|
|
298
309
|
if (preset) {
|
|
299
310
|
const sourceNozzle = detectNozzleDiameter(this.request.projectSettings);
|
|
300
311
|
if (sourceNozzle && sourceNozzle !== loaded.summary.nozzleDiameter) {
|
|
301
|
-
|
|
312
|
+
route("nozzle", ` WARN: converted with your ${loaded.summary.nozzleDiameter} mm nozzle preset; the original project was set up for a ${sourceNozzle} mm nozzle.`);
|
|
302
313
|
}
|
|
303
314
|
}
|
|
304
315
|
const highFlowHotends = normalizeHighFlowOption(options.highFlowHotends);
|
|
@@ -313,7 +324,7 @@ export class Project {
|
|
|
313
324
|
const pipeline = runConvertPipeline(convertProfile, request, catalog.index.slicer.application, {
|
|
314
325
|
carrySourceLayerHeight,
|
|
315
326
|
targetNozzleDiameter: loaded.summary.nozzleDiameter,
|
|
316
|
-
...(matchedNozzle ? { nozzle: { size: matchedNozzle.size, sourceSizes: matchedNozzle.sourceSizes } } : {}),
|
|
327
|
+
...(matchedNozzle ? { nozzle: { choice: matchedNozzle.choice, size: matchedNozzle.size, sourceSizes: matchedNozzle.sourceSizes } } : {}),
|
|
317
328
|
...(preset ? { presetChanges: preset.changes } : {}),
|
|
318
329
|
...(aboveStock.keep.size + aboveStock.stock.size > 0 ? { aboveStock } : {}),
|
|
319
330
|
});
|
|
@@ -353,6 +364,35 @@ export class Project {
|
|
|
353
364
|
progress("writing");
|
|
354
365
|
const applyWarnings = [];
|
|
355
366
|
const output = applyConvertResponse({ ...this.parsed, warnings: applyWarnings }, response, stamp ? { [STAMP_PATH]: encodeStamp(stamp) } : {});
|
|
367
|
+
// One list of every note, by topic, each topic's headline first (explain/notes.ts): the profile's own note, then
|
|
368
|
+
// the pipeline's lead note, then each filament's preset detail, which goes with whatever explains why it has one.
|
|
369
|
+
const leadSlots = (topic) => new Set(pipeline.leadNotes.filter((n) => n.topic === topic).flatMap((n) => n.slots ?? []));
|
|
370
|
+
const diameterSlots = leadSlots("filament-diameter");
|
|
371
|
+
const nozzleSlots = leadSlots("nozzle");
|
|
372
|
+
const presetTopic = (slot) => (diameterSlots.has(slot) ? "filament-diameter" : nozzleSlots.has(slot) ? "nozzle" : "filament-presets");
|
|
373
|
+
const presetNotes = filamentPresetNotes(response, presetTopic).map((n) => ({ topic: n.slots.length > 0 ? presetTopic(n.slots[0]) : "filament-presets", ...(n.slots.length > 0 ? { slots: n.slots } : {}), text: n.text }));
|
|
374
|
+
const from = (topic, lines) => lines.flatMap((line) => noteFrom(topic, line) ?? []);
|
|
375
|
+
// Which filaments each plate uses, read by the converted project's settings: what the U1 prints. The printer's
|
|
376
|
+
// nozzle list has one entry per toolhead.
|
|
377
|
+
const plateFilaments = this.plateFilaments(response.projectSettings);
|
|
378
|
+
const nozzles = response.projectSettings.nozzle_diameter;
|
|
379
|
+
const toolheads = Array.isArray(nozzles) && nozzles.length > 0 ? nozzles.length : 4;
|
|
380
|
+
// First the release's own limit, where a plate runs into it: a filament can go missing from the print with no message.
|
|
381
|
+
const sharedLayerNote = sharedLayerFilamentNote(plateFilaments, catalog.sharedLayerFilamentLimit, `${catalog.index.slicer.name} ${catalog.index.slicer.version}`);
|
|
382
|
+
const plateNotes = [...(sharedLayerNote ? [sharedLayerNote] : []), ...plateFilamentNotes(plateFilaments, filamentCountOf(this.request.projectSettings), toolheads)];
|
|
383
|
+
const plateFilamentWarnings = plateNotes.filter((n) => n.warning).map((n) => ` WARN: ${n.text}`);
|
|
384
|
+
const plateWarnings = new Set(pipeline.plateWarnings);
|
|
385
|
+
const notes = sortNotes([
|
|
386
|
+
...routeNotes,
|
|
387
|
+
...pipeline.leadNotes,
|
|
388
|
+
...presetNotes,
|
|
389
|
+
...from("source", this.parsed.warnings),
|
|
390
|
+
...from("settings", (pipeline.response.warnings ?? []).filter((w) => !plateWarnings.has(w))),
|
|
391
|
+
// What a plate's filaments mean for printing it is something to act on, so it has its own topic near the top;
|
|
392
|
+
// the plain lines of what each plate uses stay with the plates.
|
|
393
|
+
...plateNotes.flatMap((n) => noteFrom(n.warning ? "plate-filaments" : "plates", n.text, n.slots) ?? []),
|
|
394
|
+
...from("plates", [...pipeline.plateWarnings, ...applyWarnings.filter((w) => w.includes("WARN"))]),
|
|
395
|
+
]);
|
|
356
396
|
const inspection = this.inspect();
|
|
357
397
|
const outputNames = Array.isArray(response.projectSettings.filament_settings_id) ? response.projectSettings.filament_settings_id : [];
|
|
358
398
|
const filaments = inspection.filaments.map((f) => ({
|
|
@@ -371,14 +411,17 @@ export class Project {
|
|
|
371
411
|
profileNotes,
|
|
372
412
|
...(retiredProfile ? { retiredProfile } : {}),
|
|
373
413
|
// A filament set to a U1 preset because of its diameter comes first: the user has to load other filament.
|
|
374
|
-
|
|
375
|
-
|
|
414
|
+
// Then what a plate's filaments mean for printing it, ahead of the notes about settings.
|
|
415
|
+
warnings: cleanWarnings([...pipeline.leadWarnings, ...plateFilamentWarnings, ...this.parsed.warnings, ...(response.warnings ?? []), ...applyWarnings.filter((w) => w.includes("WARN"))]),
|
|
416
|
+
notes,
|
|
417
|
+
log: [...this.parsed.warnings, ...routeWarnings, ...pipeline.warnings, ...plateFilamentWarnings, ...applyWarnings].map((w) => w.trim()).filter(Boolean),
|
|
376
418
|
...(response.filamentComplianceFallback ? { filamentComplianceFallback: response.filamentComplianceFallback } : {}),
|
|
377
419
|
...(response.filamentComplianceUnchanged ? { filamentComplianceUnchanged: response.filamentComplianceUnchanged } : {}),
|
|
378
420
|
...(response.filamentPresets ? { filamentPresets: response.filamentPresets } : {}),
|
|
379
421
|
shifts: response.shifts,
|
|
380
422
|
...(response.plateOrigins ? { plateOrigins: Object.fromEntries(Object.entries(response.plateOrigins).map(([plate, origin]) => [Number(plate), origin])) } : {}),
|
|
381
423
|
plates: Math.max(1, this.request.plateCount ?? 0, ...inspection.plates),
|
|
424
|
+
plateFilaments,
|
|
382
425
|
objects: inspection.objects.length,
|
|
383
426
|
filamentSlots: inspection.filaments.length,
|
|
384
427
|
filaments,
|
|
@@ -59,8 +59,12 @@ export const bambuFamilyReader = {
|
|
|
59
59
|
const plateCount = modelSettingsText ? Math.min(countPlates(modelSettingsText), MAX_OBJECTS) : 0;
|
|
60
60
|
const objectMetadata = parseObjectMetadata(topModelText, modelSettingsText);
|
|
61
61
|
const partFileCache = new Map();
|
|
62
|
+
const partPlacements = new Map();
|
|
62
63
|
const objects = Object.entries(itemPositions).map(([id, fallbackXy]) => {
|
|
63
|
-
const
|
|
64
|
+
const parts = [];
|
|
65
|
+
const bbox = objectWorldBboxXY(id, topModelText, partFileCache, zipEntries, parts);
|
|
66
|
+
if (parts.length > 0)
|
|
67
|
+
partPlacements.set(id, parts);
|
|
64
68
|
const plate = plateAssignments[id];
|
|
65
69
|
const meta = objectMetadata[id];
|
|
66
70
|
return {
|
|
@@ -78,6 +82,7 @@ export const bambuFamilyReader = {
|
|
|
78
82
|
request: { projectSettings: projectSettings, objects, ...(plateCount > 0 ? { plateCount } : {}) },
|
|
79
83
|
warnings,
|
|
80
84
|
unpackedBytes,
|
|
85
|
+
partPlacements,
|
|
81
86
|
};
|
|
82
87
|
},
|
|
83
88
|
};
|
|
@@ -323,6 +323,7 @@ export const prusaReader = {
|
|
|
323
323
|
// A wrapper object (an older PrusaSlicer's extra instance) has no config entry of its own: the mesh object's serves.
|
|
324
324
|
const configFor = (id) => byId.get(id) ?? components.get(id)?.map((c) => byId.get(c)).find((o) => o !== undefined);
|
|
325
325
|
const partFileCache = new Map();
|
|
326
|
+
const partPlacements = new Map();
|
|
326
327
|
// PrusaSlicer 2.9 can place objects on several beds, virtual copies of the printer's bed on a grid; each becomes a
|
|
327
328
|
// plate. An older project has one bed. An object on no bed (off every one) stays on plate 1, with a warning.
|
|
328
329
|
const version = ini.version ? (/^\d+\.\d+\.\d+/.exec(ini.version)?.[0] ?? null) : null;
|
|
@@ -330,7 +331,10 @@ export const prusaReader = {
|
|
|
330
331
|
const bed = severalBeds ? parseBedShape(ini.settings.get("bed_shape")) : null;
|
|
331
332
|
const plateOf = new Map();
|
|
332
333
|
const objects = Object.entries(itemPositions).map(([id, fallbackXy]) => {
|
|
333
|
-
const
|
|
334
|
+
const parts = [];
|
|
335
|
+
const bbox = objectWorldBboxXY(id, modelText, partFileCache, zipEntries, parts);
|
|
336
|
+
if (parts.length > 0)
|
|
337
|
+
partPlacements.set(id, parts);
|
|
334
338
|
const name = configFor(Number(id))?.name;
|
|
335
339
|
let plate = 1;
|
|
336
340
|
if (bed) {
|
|
@@ -403,6 +407,7 @@ export const prusaReader = {
|
|
|
403
407
|
warnings,
|
|
404
408
|
unpackedBytes,
|
|
405
409
|
...(sourcePlateOrigins ? { sourcePlateOrigins } : {}),
|
|
410
|
+
partPlacements,
|
|
406
411
|
};
|
|
407
412
|
},
|
|
408
413
|
};
|
package/dist/sources/reader.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Readers are tried in order; the first whose `detect` says yes reads the file.
|
|
11
11
|
*/
|
|
12
|
+
import type { PartPlacement } from "../archive/objectWorldBboxXY.js";
|
|
12
13
|
import type { ConvertRequest } from "../schema.js";
|
|
13
14
|
/** The file formats any2orca reads: Bambu Studio's and the slicers built on it, and PrusaSlicer's. */
|
|
14
15
|
export declare const SOURCE_FORMATS: readonly ["bambu-family", "prusaslicer"];
|
|
@@ -52,6 +53,11 @@ export interface ParsedProject {
|
|
|
52
53
|
* plates out on Bambu Studio's grid (PrusaSlicer 2.9's beds). Absent for the Bambu Studio family.
|
|
53
54
|
*/
|
|
54
55
|
sourcePlateOrigins?: Record<number, [number, number]>;
|
|
56
|
+
/**
|
|
57
|
+
* Each object's parts as the model places them, by object id, from the pass that measured the objects: what the
|
|
58
|
+
* per-plate filament reading takes each part's mesh, transform and height from.
|
|
59
|
+
*/
|
|
60
|
+
partPlacements?: Map<string, PartPlacement[]>;
|
|
55
61
|
}
|
|
56
62
|
export interface ReadContext {
|
|
57
63
|
/** The project's unpacked size, every entry together (already checked against the cap). */
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "any2orca",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3mf",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"api": "node scripts/api-report.mjs"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"any2orca-profiles": "0.
|
|
69
|
+
"any2orca-profiles": "0.5.0",
|
|
70
70
|
"fflate": "0.8.3",
|
|
71
71
|
"zod": "4.6.7"
|
|
72
72
|
},
|