bambu-printer-mcp 1.1.71 → 1.1.73

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/README.md CHANGED
@@ -1035,7 +1035,7 @@ List a designer's 3MF plates as Bambu Studio shows them when the file is opened,
1035
1035
 
1036
1036
  #### list_3mf_plate_objects
1037
1037
 
1038
- List object IDs from a sliced 3MF plate. Use this before `skip_objects` so you pass real Bambu object IDs instead of display-order guesses.
1038
+ List the objects of a sliced 3MF plate that the printer can skip, one per copy, with each copy's `identify_id` from `Metadata/slice_info.config`, as Bambu Studio's skip dialog lists them. Use this before `skip_objects` so you pass real Bambu object IDs instead of display-order guesses.
1039
1039
 
1040
1040
  ```json
1041
1041
  {
@@ -1202,7 +1202,7 @@ When `slicer_type` is `bambustudio` (the default), these additional parameters a
1202
1202
  | `arrange` | boolean | Auto-arrange objects on the build plate |
1203
1203
  | `ensure_on_bed` | boolean | Lift floating models onto the bed |
1204
1204
  | `clone_objects` | string | Clone counts per object, comma-separated (e.g. `"1,3,1,10"`) |
1205
- | `skip_objects` | string | Object indices to skip, comma-separated (e.g. `"3,5,10"`) |
1205
+ | `skip_objects` | string | `identify_id`s of the object copies to skip, comma-separated (e.g. `"78,92"`); `list_3mf_plates` gives them per plate as `instances` |
1206
1206
  | `load_filaments` | string | Filament profile paths, semicolon-separated |
1207
1207
  | `load_filament_ids` | string | Filament-to-object mapping, comma-separated. STL input only: Bambu Studio's CLI refuses it for a 3MF, where each object or part names its own filament (see `counterpart_make_3mf`) |
1208
1208
  | `nozzle_volume_type` | string | Installed nozzle flow type: `standard` or `high_flow` (default: `BAMBU_NOZZLE_VOLUME_TYPE`, else the preset's Standard default). `high_flow` uses the presets' High Flow values, such as the filament's High Flow max volumetric speed, and is refused if the machine preset declares no High Flow variant. Also on `slice_with_template`. |
@@ -27,4 +27,12 @@ export declare function getCollarCharmRolePolicy(): {
27
27
  };
28
28
  };
29
29
  export declare function analyze3MFAmsRequirements(filePath: string, plateIndex?: number): Promise<ThreeMFAmsRequirements>;
30
+ /**
31
+ * The objects of one sliced plate that the printer can skip, as Bambu Studio lists them in its skip dialog
32
+ * (02.08.02.61 slic3r/GUI/PartSkipDialog.cpp:734-741, SkipPartCanvas.cpp:690-730): one entry per instance
33
+ * from Metadata/slice_info.config's plate whose `index` matches (written per instance at bbs_3mf.cpp:8718-8750),
34
+ * with its identify_id. plate_N.json's bbox_objects are not paired by position: their `id` is an internal
35
+ * object id the printer doesn't know (BambuStudio.cpp:7374-7382), and copies share a name. The wipe tower
36
+ * is never a slice_info object.
37
+ */
30
38
  export declare function analyze3MFPlateObjects(filePath: string, plateIndex?: number): Promise<ThreeMFPlateObjects>;
@@ -453,68 +453,66 @@ export async function analyze3MFAmsRequirements(filePath, plateIndex = 0) {
453
453
  }),
454
454
  };
455
455
  }
456
+ /**
457
+ * The objects of one sliced plate that the printer can skip, as Bambu Studio lists them in its skip dialog
458
+ * (02.08.02.61 slic3r/GUI/PartSkipDialog.cpp:734-741, SkipPartCanvas.cpp:690-730): one entry per instance
459
+ * from Metadata/slice_info.config's plate whose `index` matches (written per instance at bbs_3mf.cpp:8718-8750),
460
+ * with its identify_id. plate_N.json's bbox_objects are not paired by position: their `id` is an internal
461
+ * object id the printer doesn't know (BambuStudio.cpp:7374-7382), and copies share a name. The wipe tower
462
+ * is never a slice_info object.
463
+ */
456
464
  export async function analyze3MFPlateObjects(filePath, plateIndex = 0) {
457
465
  const data = await fs.readFile(filePath);
458
466
  const zip = await JSZip.loadAsync(data);
459
- const plateName = `Metadata/plate_${plateIndex + 1}.json`;
460
- const plateFile = zip.file(plateName);
461
- if (!plateFile) {
462
- throw new Error(`3MF is missing ${plateName}; cannot list plate objects.`);
463
- }
464
- const plateJson = JSON.parse(await plateFile.async('string'));
465
- const bboxObjects = Array.isArray(plateJson?.bbox_objects) ? plateJson.bbox_objects : [];
466
- const sliceInfoObjects = [];
467
+ const plateNumber = plateIndex + 1;
467
468
  const sliceInfo = zip.file('Metadata/slice_info.config');
468
- if (sliceInfo) {
469
+ if (!sliceInfo) {
470
+ throw new Error('This 3MF has no Metadata/slice_info.config, so it was not sliced by Bambu Studio or OrcaSlicer and has no skip-object ids. Slice it first.');
471
+ }
472
+ const parsed = await parseStringPromise(await sliceInfo.async('string'), { explicitArray: true });
473
+ const plates = parsed?.config?.plate ?? [];
474
+ const selected = plates.find(plate => (plate?.metadata ?? [])
475
+ .some((item) => item?.$?.key === 'index' && Number(item?.$?.value) === plateNumber));
476
+ if (!selected) {
477
+ throw new Error(`Plate ${plateNumber} was not sliced in this 3MF, so it has no skip-object ids.`);
478
+ }
479
+ const labelObjectEnabled = (selected.metadata ?? [])
480
+ .some((item) => item?.$?.key === 'label_object_enabled' && item?.$?.value === 'true');
481
+ const instances = (selected.object ?? []).flatMap((object) => {
482
+ const id = Number(object?.$?.identify_id);
483
+ if (!Number.isSafeInteger(id) || id <= 0)
484
+ return [];
485
+ return [{ id, name: typeof object.$.name === 'string' ? object.$.name : `object_${id}`, skipped: object.$.skipped === 'true' }];
486
+ });
487
+ // First-layer area and box, attached by name only where one instance and one box carry it.
488
+ const boxes = new Map();
489
+ const plateFile = zip.file(`Metadata/plate_${plateNumber}.json`);
490
+ if (plateFile) {
469
491
  try {
470
- const parsed = await parseStringPromise(await sliceInfo.async('string'), {
471
- explicitArray: false,
472
- mergeAttrs: true,
473
- });
474
- const plateNodes = parsed?.config?.plate
475
- ? Array.isArray(parsed.config.plate) ? parsed.config.plate : [parsed.config.plate]
476
- : [];
477
- const plateNumber = plateIndex + 1;
478
- const selectedPlate = plateNodes.find((plate) => {
479
- const metadata = Array.isArray(plate?.metadata)
480
- ? plate.metadata
481
- : plate?.metadata
482
- ? [plate.metadata]
483
- : [];
484
- return metadata.some((item) => item?.key === 'index' && Number(item?.value) === plateNumber);
485
- }) || plateNodes[plateIndex] || plateNodes[0];
486
- const objectNodes = selectedPlate?.object
487
- ? Array.isArray(selectedPlate.object) ? selectedPlate.object : [selectedPlate.object]
488
- : [];
489
- for (const object of objectNodes) {
490
- const id = Number.parseInt(String(object?.identify_id ?? ''), 10);
491
- if (!Number.isInteger(id))
492
+ const plateJson = JSON.parse(await plateFile.async('string'));
493
+ for (const box of Array.isArray(plateJson?.bbox_objects) ? plateJson.bbox_objects : []) {
494
+ if (typeof box?.name !== 'string' || box.name === 'wipe_tower')
492
495
  continue;
493
- sliceInfoObjects.push({
494
- id,
495
- name: typeof object?.name === 'string' ? object.name : null,
496
- });
496
+ boxes.set(box.name, [...(boxes.get(box.name) ?? []), box]);
497
497
  }
498
498
  }
499
499
  catch {
500
- // Fall back to bbox IDs for older or malformed 3MFs.
500
+ // The ids above still stand without the boxes.
501
501
  }
502
502
  }
503
+ const nameCount = new Map();
504
+ for (const instance of instances)
505
+ nameCount.set(instance.name, (nameCount.get(instance.name) ?? 0) + 1);
503
506
  return {
504
507
  plateIndex,
505
- objects: bboxObjects
506
- .map((object, index) => {
507
- const sliceObject = sliceInfoObjects[index];
508
- const id = sliceObject?.id ?? Number(object?.id);
509
- if (!Number.isInteger(id))
510
- return null;
508
+ labelObjectEnabled,
509
+ objects: instances.map((instance) => {
510
+ const box = nameCount.get(instance.name) === 1 && boxes.get(instance.name)?.length === 1 ? boxes.get(instance.name)[0] : undefined;
511
511
  return {
512
- id,
513
- name: sliceObject?.name || (typeof object?.name === 'string' ? object.name : `object_${id}`),
514
- area: Number.isFinite(Number(object?.area)) ? Number(object.area) : null,
515
- bbox: object?.bbox ?? null,
512
+ ...instance,
513
+ area: box && Number.isFinite(Number(box.area)) ? Number(box.area) : null,
514
+ bbox: box?.bbox ?? null,
516
515
  };
517
- })
518
- .filter((object) => object !== null),
516
+ }),
519
517
  };
520
518
  }
@@ -36,3 +36,9 @@ export declare function trayColour(rawStatus: any, tray: number): string | undef
36
36
  * Filament-map nozzle 1 (left) is cloud nozzle 1 and 2 (right) is 0 (CloudTaskNozzleId).
37
37
  */
38
38
  export declare function studioAmsMappingInfo(filaments: ProjectFilament[], mapping: number[], colourOfTray: (tray: number) => string | undefined): Array<Record<string, unknown>>;
39
+ /**
40
+ * A project-level ams_mapping as Bambu Studio sends it: the caller's tray for each filament the selected plate prints,
41
+ * -1 for every project filament it doesn't (SelectMachineDialog::get_ams_mapping_result, SelectMachine.cpp:1463-1500,
42
+ * maps only the plate's own filaments). A tray for an unused filament is never sent to the printer.
43
+ */
44
+ export declare function studioAmsMapping(mapping: number[], usedPositions: number[]): number[];
@@ -70,8 +70,10 @@ export function bridgeAmsMapping2Entry(value, dualNozzle = false) {
70
70
  return dualNozzle ? { ams_id: 255, slot_id: 0 } : { ams_id: 255, slot_id: 255 };
71
71
  if (value === 254)
72
72
  return { ams_id: 254, slot_id: dualNozzle ? 0 : 254 };
73
+ // An AMS-HT has one slot; its absolute tray index is its own unit id (Bambu Studio 02.08.02.61
74
+ // DevFilaSystem.cpp:367-368), sent as that unit's ams_id with slot 0 (SelectMachine.cpp:1489-1497).
73
75
  if (value >= 128)
74
- return { ams_id: 128, slot_id: value - 128 };
76
+ return { ams_id: value, slot_id: 0 };
75
77
  return { ams_id: Math.floor(value / 4), slot_id: value % 4 };
76
78
  }
77
79
  /** Read every project filament (not just the plate's used ones) from project_settings.config. */
@@ -123,3 +125,12 @@ export function studioAmsMappingInfo(filaments, mapping, colourOfTray) {
123
125
  };
124
126
  });
125
127
  }
128
+ /**
129
+ * A project-level ams_mapping as Bambu Studio sends it: the caller's tray for each filament the selected plate prints,
130
+ * -1 for every project filament it doesn't (SelectMachineDialog::get_ams_mapping_result, SelectMachine.cpp:1463-1500,
131
+ * maps only the plate's own filaments). A tray for an unused filament is never sent to the printer.
132
+ */
133
+ export function studioAmsMapping(mapping, usedPositions) {
134
+ const used = new Set(usedPositions);
135
+ return mapping.map((tray, position) => used.has(position) ? tray : -1);
136
+ }
@@ -1,10 +1,26 @@
1
+ import { type PlateFilament } from "./plate-filaments.js";
1
2
  export interface ModelPlate {
2
3
  /** Zero-based, as inspect_print_file's plate_index; slice_stl's slice_plate is index + 1. */
3
4
  index: number;
4
5
  name: string;
5
6
  objects: string[];
7
+ /**
8
+ * Each object copy on the plate with its identify_id, from model_settings.config's <model_instance> entries
9
+ * (Bambu Studio 02.08.02.61 bbs_3mf.cpp:8448-8482). These are the ids slice_stl's skip_objects takes: the
10
+ * CLI matches them against each instance's loaded id (BambuStudio.cpp:1785-1789, 6530-6545).
11
+ */
12
+ instances: {
13
+ identify_id: number;
14
+ name: string;
15
+ }[];
6
16
  /** The file already holds this plate's G-code. */
7
17
  sliced: boolean;
18
+ /**
19
+ * The project filaments this plate prints with, and only those (counterpart/1): what a client asks the person to
20
+ * choose spools for. From the slice when the file holds one (plate_N.json filament_ids), otherwise worked out as
21
+ * Bambu Studio does for the objects on this plate (see plate-filaments.ts). Filaments of other plates never appear.
22
+ */
23
+ filaments: PlateFilament[];
8
24
  /** The plate's own preview from the file (Metadata/plate_N.png), when asked for and present. */
9
25
  thumbnail_png_base64?: string;
10
26
  }
@@ -14,6 +30,11 @@ export interface ModelPlates {
14
30
  title?: string;
15
31
  designer?: string;
16
32
  licence?: string;
33
+ /**
34
+ * Every filament the project declares (project_settings.config), used on a plate or not, from 1: slice_stl takes one
35
+ * load_filaments profile per declared filament. Empty for a 3MF that declares none.
36
+ */
37
+ project_filaments: PlateFilament[];
17
38
  }
18
39
  export declare function listModelPlates(filePath: string, options?: {
19
40
  thumbnails?: boolean;
@@ -8,10 +8,12 @@
8
8
  * is one plate. Only bounded metadata is read; nothing is extracted or run.
9
9
  */
10
10
  import { readSafe3mfArchive } from "../safety/archive.js";
11
+ import { plateFilaments } from "./plate-filaments.js";
11
12
  /** For the settings and plate files; the model file can be large and is only scanned. */
12
13
  const MAX_METADATA_BYTES = 8 * 1024 * 1024;
13
14
  const MAX_THUMBNAIL_BYTES = 2 * 1024 * 1024;
14
15
  const MAX_PLATES = 1000;
16
+ const MAX_INSTANCES_PER_PLATE = 1000;
15
17
  const words = (value) => value
16
18
  .replace(/&(?:amp|lt|gt|quot|apos);/g, entity => ({ "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": "\"", "&apos;": "'" }[entity]))
17
19
  .replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, 256);
@@ -33,7 +35,7 @@ export async function listModelPlates(filePath, options = {}) {
33
35
  throw new Error("That file is not a 3MF model.");
34
36
  // An element named `tag`, plain or with a namespace prefix (<item …>, <p:item …>).
35
37
  const has = (tag) => !!modelBytes && [" ", ">", "/", "\n", "\r", "\t"].some(end => modelBytes.includes(`<${tag}${end}`) || modelBytes.includes(`:${tag}${end}`));
36
- const result = { plate_count: 0, plates: [] };
38
+ const result = { plate_count: 0, plates: [], project_filaments: [] };
37
39
  const metadata = new Map([...head.matchAll(/<metadata\s+name="([^"]+)"[^>]*>([^<]*)<\/metadata>/g)].map(match => [match[1], words(match[2])]));
38
40
  if (metadata.get("Title"))
39
41
  result.title = metadata.get("Title");
@@ -47,6 +49,7 @@ export async function listModelPlates(filePath, options = {}) {
47
49
  return [match[1], words(name?.[1] ?? "")];
48
50
  }));
49
51
  const plates = new Map();
52
+ const layouts = new Map();
50
53
  // A plate number out of range is skipped, as a slicer would not show it.
51
54
  const valid = (number) => Number.isSafeInteger(number) && number >= 1 && number <= MAX_PLATES;
52
55
  for (const match of settings.matchAll(/<plate\b[^>]*>([\s\S]*?)<\/plate>/g)) {
@@ -57,7 +60,19 @@ export async function listModelPlates(filePath, options = {}) {
57
60
  if (!valid(number))
58
61
  continue;
59
62
  const name = /<metadata\s+key="plater_name"\s+value="([^"]*)"/.exec(match[1]);
60
- plates.set(number, { index: number - 1, name: words(name?.[1] ?? "") || `Plate ${number}`, sliced: false,
63
+ const instances = [...match[1].matchAll(/<model_instance>([\s\S]*?)<\/model_instance>/g)].flatMap(instance => {
64
+ const object = /<metadata\s+key="object_id"\s+value="(\d+)"/.exec(instance[1])?.[1];
65
+ const identify = Number(/<metadata\s+key="identify_id"\s+value="(\d+)"/.exec(instance[1])?.[1]);
66
+ return object !== undefined && Number.isSafeInteger(identify) && identify > 0
67
+ ? [{ identify_id: identify, name: objects.get(object) ?? "" }] : [];
68
+ }).slice(0, MAX_INSTANCES_PER_PLATE);
69
+ layouts.set(number, { number, objectIds: [...match[1].matchAll(/<metadata\s+key="object_id"\s+value="(\d+)"/g)].map(item => item[1]),
70
+ instances: [...match[1].matchAll(/<model_instance>([\s\S]*?)<\/model_instance>/g)].flatMap(instance => {
71
+ const objectId = /<metadata\s+key="object_id"\s+value="(\d+)"/.exec(instance[1])?.[1];
72
+ const instanceId = Number(/<metadata\s+key="instance_id"\s+value="(\d+)"/.exec(instance[1])?.[1] ?? 0);
73
+ return objectId ? [{ objectId, instanceId }] : [];
74
+ }) });
75
+ plates.set(number, { index: number - 1, name: words(name?.[1] ?? "") || `Plate ${number}`, sliced: false, instances, filaments: [],
61
76
  objects: [...match[1].matchAll(/<metadata\s+key="object_id"\s+value="(\d+)"/g)].flatMap(item => objects.get(item[1]) ? [objects.get(item[1])] : []) });
62
77
  }
63
78
  for (const name of Object.keys(zip.files)) {
@@ -67,12 +82,17 @@ export async function listModelPlates(filePath, options = {}) {
67
82
  const number = Number(match[1]);
68
83
  if (!valid(number))
69
84
  continue;
70
- const plate = plates.get(number) ?? { index: number - 1, name: `Plate ${number}`, objects: [], sliced: false };
85
+ const plate = plates.get(number) ?? { index: number - 1, name: `Plate ${number}`, objects: [], instances: [], sliced: false, filaments: [] };
86
+ const layout = layouts.get(number) ?? { number, objectIds: [] };
87
+ layouts.set(number, layout);
71
88
  if (match[2] === "gcode")
72
89
  plate.sliced = true;
73
90
  else {
74
91
  try {
75
92
  const value = JSON.parse(await text(name));
93
+ // Studio's record of the filaments this plate's slice uses (0-based project positions).
94
+ if (Array.isArray(value.filament_ids))
95
+ layout.slicedFilamentIds = value.filament_ids.filter((id) => Number.isInteger(id) && id >= 0 && id < 64);
76
96
  if (Array.isArray(value.bbox_objects))
77
97
  plate.objects = value.bbox_objects
78
98
  .flatMap(object => typeof object.name === "string" && object.name !== "wipe_tower" ? [words(object.name)] : []).slice(0, 200);
@@ -83,8 +103,11 @@ export async function listModelPlates(filePath, options = {}) {
83
103
  }
84
104
  result.plates = [...plates.values()].sort((a, b) => a.index - b.index);
85
105
  // A standard single-build 3MF has no Bambu plate metadata: it is one plate.
86
- if (!result.plates.length)
87
- result.plates.push({ index: 0, name: "Plate 1", objects: [], sliced: false });
106
+ if (!result.plates.length) {
107
+ result.plates.push({ index: 0, name: "Plate 1", objects: [], instances: [], sliced: false, filaments: [] });
108
+ // Without plates every object is on the one plate.
109
+ layouts.set(1, { number: 1, objectIds: [...settings.matchAll(/<object\b[^>]*\bid="(\d+)"/g)].map(match => match[1]) });
110
+ }
88
111
  const geometry = has("item") && (has("mesh") || has("component"));
89
112
  if (!geometry) {
90
113
  // A sliced-only file (previews and G-code, no model): only its sliced plates can print.
@@ -92,6 +115,14 @@ export async function listModelPlates(filePath, options = {}) {
92
115
  if (!result.plates.length)
93
116
  throw new Error("This 3MF has previews and settings but no model or printable plate.");
94
117
  }
118
+ // A slice's G-code without its plate_N.json gives no filament list: the derivation stands.
119
+ // A model file too large to read whole: its resources come first and its build items last (a plain 3MF).
120
+ const modelText = !modelBytes ? "" : modelBytes.length <= 64 * 1024 * 1024 ? modelBytes.toString("utf8")
121
+ : `${head}${modelBytes.subarray(-1024 * 1024).toString("utf8")}`;
122
+ const filaments = await plateFilaments(zip, settings, modelText, result.plates.map(plate => layouts.get(plate.index + 1) ?? { number: plate.index + 1, objectIds: [] }));
123
+ for (const plate of result.plates)
124
+ plate.filaments = filaments.plates.get(plate.index + 1) ?? [];
125
+ result.project_filaments = filaments.project;
95
126
  if (options.thumbnails)
96
127
  for (const plate of result.plates) {
97
128
  const file = zip.file(`Metadata/plate_${plate.index + 1}.png`);
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The project filaments each plate of a Bambu Studio / OrcaSlicer 3MF prints with, worked out the way Bambu Studio
3
+ * does it (v02.08.02.61), so a client asks the person to choose spools only for the filaments that plate uses.
4
+ *
5
+ * - A sliced plate: Studio's own record, Metadata/plate_N.json `filament_ids` (0-based), written from the slice.
6
+ * - An unsliced plate: PartPlate::get_extruders_under_cli (src/slic3r/GUI/PartPlate.cpp:1298-1420) over the objects
7
+ * with an instance on the plate (model_settings.config <model_instance>; an instance with printable="0" in the
8
+ * 3dmodel.model build is skipped, PartPlate.cpp:1321):
9
+ * - each volume's ModelVolume::get_extruders (src/libslic3r/Model.cpp:3357-3412): negative parts, support blockers
10
+ * and enforcers print nothing; the volume's painted states (mmu_segmentation, `paint_color`); the volume's own
11
+ * extruder (ModelVolume::extruder_id, Model.cpp:3295-3306: the part's, else the object's, else 1) unless paint
12
+ * covers every facet of a model part; and the volume's wall/solid/sparse infill filaments, else the object's;
13
+ * - the object's layer-range extruders (Metadata/layer_config_ranges.xml, by 1-based model object index);
14
+ * - the object's feature filaments when separate_filaments_for_features is on;
15
+ * - the support and support-interface filaments when the object (or the project) prints support or a raft;
16
+ * - the plate's tool changes (Metadata/custom_gcode_per_layer.xml, CustomGCode::ToolChange = 2,
17
+ * PartPlate.cpp:1263-1274).
18
+ * Painting is decoded as FacetsAnnotation::set_triangle_from_string (Model.cpp:4631-4650) and
19
+ * TriangleSelector::deserialize (src/libslic3r/TriangleSelector.cpp:2111-2139) read it; this is a reimplementation
20
+ * from that documented behaviour, not Studio's code.
21
+ *
22
+ * Only bounded metadata and mesh text are read; nothing is extracted or run.
23
+ */
24
+ import type JSZip from "jszip";
25
+ export interface PlateFilament {
26
+ /** 1-based project filament number: slice_stl's load_filaments/filament_colours position, print_3mf's ams_mapping index + 1. */
27
+ index: number;
28
+ /** As the project declares it (project_settings.config filament_colour), #RRGGBB. */
29
+ colour?: string;
30
+ /** project_settings.config filament_type. */
31
+ material?: string;
32
+ /** project_settings.config filament_ids (Bambu's filament id, e.g. GFA00). */
33
+ filament_id?: string;
34
+ /** The first part (else object) on this plate that prints with it; absent for support, painting or tool changes only. */
35
+ name?: string;
36
+ }
37
+ type Settings = Map<string, string>;
38
+ interface Part {
39
+ id: string;
40
+ subtype: string;
41
+ name: string;
42
+ settings: Settings;
43
+ }
44
+ interface ObjectEntry {
45
+ id: string;
46
+ name: string;
47
+ settings: Settings;
48
+ parts: Part[];
49
+ }
50
+ /** model_settings.config objects with their own settings and parts (parts never nest). */
51
+ export declare function readModelObjects(settings: string): ObjectEntry[];
52
+ /**
53
+ * The filament states a painted facet string holds (0 is "the volume's own filament"). Studio's string is hex,
54
+ * read last character first, each digit four bits low bit first, so the nibbles are the digits in reverse order.
55
+ * Each node is one nibble: two low bits are the split-side count (children = sides + 1); a leaf's state is the high
56
+ * two bits, or, when both are set, 3 + the next nibble + 15 for every preceding 0b1111 nibble.
57
+ */
58
+ export declare function paintedStates(paint: string): number[];
59
+ export interface PlateLayout {
60
+ /** 1-based plate number. */
61
+ number: number;
62
+ /** model_settings.config object ids with an instance on this plate, in plate order. */
63
+ objectIds: string[];
64
+ /** Each copy on the plate: its object and that object's instance_id (model_settings.config <model_instance>). */
65
+ instances?: {
66
+ objectId: string;
67
+ instanceId: number;
68
+ }[];
69
+ /** Metadata/plate_N.json filament_ids (0-based) when the file holds this plate's slice. */
70
+ slicedFilamentIds?: number[];
71
+ }
72
+ /**
73
+ * The filaments each plate prints with, keyed by plate number. `settings` is model_settings.config, `model` the root
74
+ * 3D/3dmodel.model text.
75
+ */
76
+ export declare function plateFilaments(zip: JSZip, settings: string, model: string, plates: PlateLayout[]): Promise<{
77
+ plates: Map<number, PlateFilament[]>;
78
+ project: PlateFilament[];
79
+ }>;
80
+ export {};