bambu-printer-mcp 1.1.93 → 1.1.94

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.
@@ -72,7 +72,7 @@ export async function listModelPlates(filePath, options = {}) {
72
72
  const instanceId = Number(/<metadata\s+key="instance_id"\s+value="(\d+)"/.exec(instance[1])?.[1] ?? 0);
73
73
  return objectId ? [{ objectId, instanceId }] : [];
74
74
  }) });
75
- plates.set(number, { index: number - 1, name: words(name?.[1] ?? "") || `Plate ${number}`, sliced: false, instances, filaments: [], filaments_complete: true,
75
+ plates.set(number, { index: number - 1, name: words(name?.[1] ?? "") || `Plate ${number}`, sliced: false, instances, filaments: [], filaments_complete: true, build_items: [], parts: [],
76
76
  objects: [...match[1].matchAll(/<metadata\s+key="object_id"\s+value="(\d+)"/g)].flatMap(item => objects.get(item[1]) ? [objects.get(item[1])] : []) });
77
77
  }
78
78
  for (const name of Object.keys(zip.files)) {
@@ -82,7 +82,7 @@ export async function listModelPlates(filePath, options = {}) {
82
82
  const number = Number(match[1]);
83
83
  if (!valid(number))
84
84
  continue;
85
- const plate = plates.get(number) ?? { index: number - 1, name: `Plate ${number}`, objects: [], instances: [], sliced: false, filaments: [], filaments_complete: true };
85
+ const plate = plates.get(number) ?? { index: number - 1, name: `Plate ${number}`, objects: [], instances: [], sliced: false, filaments: [], filaments_complete: true, build_items: [], parts: [] };
86
86
  const layout = layouts.get(number) ?? { number, objectIds: [] };
87
87
  layouts.set(number, layout);
88
88
  if (match[2] === "gcode")
@@ -104,9 +104,9 @@ export async function listModelPlates(filePath, options = {}) {
104
104
  result.plates = [...plates.values()].sort((a, b) => a.index - b.index);
105
105
  // A standard single-build 3MF has no Bambu plate metadata: it is one plate.
106
106
  if (!result.plates.length) {
107
- result.plates.push({ index: 0, name: "Plate 1", objects: [], instances: [], sliced: false, filaments: [], filaments_complete: true });
107
+ result.plates.push({ index: 0, name: "Plate 1", objects: [], instances: [], sliced: false, filaments: [], filaments_complete: true, build_items: [], parts: [] });
108
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]) });
109
+ layouts.set(1, { number: 1, allItems: true, objectIds: [...settings.matchAll(/<object\b[^>]*\bid="(\d+)"/g)].map(match => match[1]) });
110
110
  }
111
111
  const geometry = has("item") && (has("mesh") || has("component"));
112
112
  if (!geometry) {
@@ -123,6 +123,11 @@ export async function listModelPlates(filePath, options = {}) {
123
123
  for (const plate of result.plates) {
124
124
  plate.filaments = filaments.plates.get(plate.index + 1) ?? [];
125
125
  plate.filaments_complete = !filaments.incomplete.has(plate.index + 1);
126
+ // A sliced-only file has no model to draw from.
127
+ if (geometry) {
128
+ plate.build_items = filaments.buildItems.get(plate.index + 1) ?? [];
129
+ plate.parts = filaments.parts.get(plate.index + 1) ?? [];
130
+ }
126
131
  }
127
132
  result.project_filaments = filaments.project;
128
133
  if (options.thumbnails)
@@ -34,6 +34,21 @@ export interface PlateFilament {
34
34
  /** The first part (else object) on this plate that prints with it; absent for support, painting or tool changes only. */
35
35
  name?: string;
36
36
  }
37
+ /**
38
+ * One part on a plate, as the open 3MF standard places it, so a client draws it in its filament's colour without
39
+ * reading slicer files: the mesh object `object_id`, in the model part `path` when that is not the root
40
+ * 3D/3dmodel.model (production extension p:path, as the file names it), and the 1-based project filament it prints
41
+ * with. `painted` is true when the slicer's painting (paint_color) recolours some of its facets.
42
+ */
43
+ export interface PlatePart {
44
+ object_id: number;
45
+ /** The root object (a build item's objectid) this part belongs to: copies of one mesh may print in other filaments. */
46
+ build_object_id: number;
47
+ path?: string;
48
+ name: string;
49
+ filament: number;
50
+ painted?: true;
51
+ }
37
52
  type Settings = Map<string, string>;
38
53
  interface Part {
39
54
  id: string;
@@ -74,6 +89,8 @@ export interface PlateLayout {
74
89
  }[];
75
90
  /** Metadata/plate_N.json filament_ids (0-based) when the file holds this plate's slice. */
76
91
  slicedFilamentIds?: number[];
92
+ /** The file has no plate metadata: this one plate holds every build item. */
93
+ allItems?: boolean;
77
94
  }
78
95
  /**
79
96
  * The filaments each plate prints with, keyed by plate number. `settings` is model_settings.config, `model` the root
@@ -83,5 +100,7 @@ export declare function plateFilaments(zip: JSZip, settings: string, model: stri
83
100
  plates: Map<number, PlateFilament[]>;
84
101
  incomplete: Set<number>;
85
102
  project: PlateFilament[];
103
+ buildItems: Map<number, number[]>;
104
+ parts: Map<number, PlatePart[]>;
86
105
  }>;
87
106
  export {};
@@ -9,11 +9,12 @@ const metadataOf = (block) => new Map([...block.matchAll(/<metadata\s+key="([^"]
9
9
  /** model_settings.config objects with their own settings and parts (parts never nest). */
10
10
  export function readModelObjects(settings) {
11
11
  return [...settings.matchAll(/<object\b[^>]*\bid="(\d+)"[^>]*>([\s\S]*?)<\/object>/g)].map(match => {
12
- const parts = [...match[2].matchAll(/<part\b([^>]*)>([\s\S]*?)<\/part>/g)].map(part => {
13
- const own = metadataOf(part[2]);
12
+ // A part may be self-closing (<part id="1" subtype="normal_part"/>): it has no settings of its own.
13
+ const parts = [...match[2].matchAll(/<part\b([^>]*?)(?:\/>|>([\s\S]*?)<\/part>)/g)].map(part => {
14
+ const own = metadataOf(part[2] ?? "");
14
15
  return { id: /\bid="(\d+)"/.exec(part[1])?.[1] ?? "", subtype: /\bsubtype="([^"]+)"/.exec(part[1])?.[1] ?? "normal_part", name: words(own.get("name") ?? ""), settings: own };
15
16
  });
16
- const own = metadataOf(match[2].replace(/<part\b[^>]*>[\s\S]*?<\/part>/g, ""));
17
+ const own = metadataOf(match[2].replace(/<part\b[^>]*?(?:\/>|>[\s\S]*?<\/part>)/g, ""));
17
18
  return { id: match[1], name: words(own.get("name") ?? ""), settings: own, parts };
18
19
  });
19
20
  }
@@ -165,7 +166,11 @@ export async function plateFilaments(zip, settings, model, plates, limits = PAIN
165
166
  const objects = new Map(readModelObjects(settings).map(object => [object.id, object]));
166
167
  // Root objects' components: which sub-object mesh in which file each part is (part id = component objectid).
167
168
  const components = new Map();
169
+ // Root objects that are meshes themselves (a plain 3MF): their own id is the part.
170
+ const rootMeshes = new Set();
168
171
  for (const object of model.matchAll(/<(?:\w+:)?object\b[^>]*\bid="(\d+)"[^>]*>([\s\S]*?)<\/(?:\w+:)?object>/g)) {
172
+ if (/<(?:\w+:)?mesh[\s>]/.test(object[2]))
173
+ rootMeshes.add(object[1]);
169
174
  const parts = new Map();
170
175
  for (const component of object[2].matchAll(/<(?:\w+:)?component\b([^>]*)\/?>/g)) {
171
176
  const path = /\b(?:\w+:)?path="\/?([^"]+)"/.exec(component[1])?.[1];
@@ -216,20 +221,70 @@ export async function plateFilaments(zip, settings, model, plates, limits = PAIN
216
221
  .filter(layer => /\btype="2"/.test(layer[1]))
217
222
  .map(layer => Number(/\bextruder="(\d+)"/.exec(layer[1])?.[1])));
218
223
  }
219
- // Painting only matters for parts on a plate that is not sliced yet.
224
+ // Painting decides an unsliced plate's filaments, and marks painted parts on every plate. Unsliced plates' meshes
225
+ // come first, so the read budget goes to the filament lists before the painted marks.
220
226
  const paintPaths = new Set();
221
- for (const plate of plates)
222
- if (!plate.slicedFilamentIds)
223
- for (const objectId of plate.objectIds)
224
- for (const path of components.get(objectId)?.values() ?? [])
225
- paintPaths.add(path);
227
+ for (const sliced of [false, true])
228
+ for (const plate of plates)
229
+ if (!!plate.slicedFilamentIds === sliced)
230
+ for (const objectId of plate.objectIds)
231
+ for (const path of components.get(objectId)?.values() ?? [])
232
+ paintPaths.add(path);
233
+ // A build item whose object is itself the mesh (a plain 3MF) keeps its painting in the root model.
234
+ const ROOT_MODEL = "3D/3dmodel.model";
235
+ if (buildItems.some(item => rootMeshes.has(/\bobjectid="(\d+)"/.exec(item)?.[1] ?? "")))
236
+ paintPaths.add(ROOT_MODEL);
226
237
  const { painting, unread } = await readPainting(zip, paintPaths, limits);
227
238
  // Plates with a part whose painting couldn't be read: they list every declared filament and say they're incomplete.
228
239
  const incomplete = new Set();
229
240
  const global = (key) => intOf(config[key]) ?? 0;
230
241
  const FEATURES = ["wall_filament", "sparse_infill_filament", "solid_infill_filament"];
231
242
  const result = new Map();
243
+ const plateItems = new Map();
244
+ const plateParts = new Map();
245
+ const itemObject = buildItems.map(item => /\bobjectid="(\d+)"/.exec(item)?.[1]);
246
+ // The plate's copies as root build items (0-based, in build order): a copy is its object's instance_id-th item.
247
+ const plateItemsOf = (plate) => {
248
+ const items = new Set();
249
+ if (plate.instances?.length)
250
+ for (const copy of plate.instances) {
251
+ let seen = -1;
252
+ const index = itemObject.findIndex(objectId => objectId === copy.objectId && ++seen === copy.instanceId);
253
+ if (index >= 0)
254
+ items.add(index);
255
+ }
256
+ else
257
+ itemObject.forEach((objectId, index) => { if (objectId && (plate.allItems || plate.objectIds.includes(objectId)))
258
+ items.add(index); });
259
+ return items;
260
+ };
232
261
  for (const plate of plates) {
262
+ const items = plateItemsOf(plate);
263
+ plateItems.set(plate.number, [...items].sort((a, b) => a - b));
264
+ // Each model part of the plate's objects once, in its own filament: what a client colours when it draws the plate.
265
+ const drawn = [];
266
+ for (const objectId of [...new Set([...items].map(index => itemObject[index]))]) {
267
+ const object = objects.get(objectId);
268
+ const meshes = components.get(objectId);
269
+ const objectFilament = intOf(object?.settings.get("extruder")) || (global("wall_filament") > 0 ? global("wall_filament") : 1);
270
+ const entry = (id, name, filament) => {
271
+ const path = meshes?.get(id) ?? (id === objectId && rootMeshes.has(objectId) ? ROOT_MODEL : undefined);
272
+ const paint = path ? painting.get(`${path}#${id}`) : undefined;
273
+ drawn.push({ object_id: Number(id), build_object_id: Number(objectId), ...(path && path !== "3D/3dmodel.model" ? { path: `/${path}` } : {}), name,
274
+ filament: valid(filament) ? filament : 1, ...(paint?.states.size ? { painted: true } : {}) });
275
+ };
276
+ if (object?.parts.length) {
277
+ for (const part of object.parts)
278
+ if (part.subtype === "normal_part" && /^\d+$/.test(part.id))
279
+ entry(part.id, part.name || object.name, intOf(part.settings.get("extruder")) || objectFilament);
280
+ }
281
+ else if (meshes)
282
+ for (const id of meshes.keys())
283
+ entry(id, object?.name ?? "", objectFilament);
284
+ else if (rootMeshes.has(objectId))
285
+ entry(objectId, object?.name ?? "", objectFilament);
286
+ }
287
+ plateParts.set(plate.number, drawn.slice(0, 1000));
233
288
  const used = new Map();
234
289
  const add = (index, name) => {
235
290
  if (!valid(index))
@@ -313,6 +368,13 @@ export async function plateFilaments(zip, settings, model, plates, limits = PAIN
313
368
  if (!used.size && (plate.objectIds.some(id => !objects.has(id)) || (!objects.size && buildItems.length)))
314
369
  for (const key of FEATURES)
315
370
  add(global(key) > 0 ? global(key) : 1);
371
+ // Painting on such an object's own mesh prints its painted filaments.
372
+ for (const index of items) {
373
+ const objectId = itemObject[index];
374
+ if (objectId && !objects.get(objectId)?.parts.length && rootMeshes.has(objectId))
375
+ for (const state of painting.get(`${ROOT_MODEL}#${objectId}`)?.states ?? [])
376
+ add(state, objects.get(objectId)?.name || undefined);
377
+ }
316
378
  // A mixed filament slot prints as its component filaments (PartPlate.cpp:1437-1449, expand_mixed_filaments in
317
379
  // FilamentMixer.cpp:460-478; components are 1-based, comma-separated, FilamentMixer.cpp:165-180).
318
380
  const mixed = Array.isArray(config.filament_is_mixed) ? config.filament_is_mixed.map(value => boolOf(value) === true) : [];
@@ -338,5 +400,5 @@ export async function plateFilaments(zip, settings, model, plates, limits = PAIN
338
400
  result.set(plate.number, [...used.entries()].sort((a, b) => a[0] - b[0]).map(([index, name]) => describe(index, project, name)));
339
401
  }
340
402
  // Every filament the project declares, used on a plate or not: slice_stl takes one profile per declared filament.
341
- return { plates: result, incomplete, project: Array.from({ length: declared }, (_, i) => describe(i + 1, project)) };
403
+ return { plates: result, incomplete, project: Array.from({ length: declared }, (_, i) => describe(i + 1, project)), buildItems: plateItems, parts: plateParts };
342
404
  }
@@ -258,7 +258,7 @@ export declare const PRINT_PROGRESS_OUTPUT_SCHEMA: {
258
258
  };
259
259
  state: {
260
260
  type: string;
261
- enum: ("failed" | "cancelled" | "idle" | "offline" | "preparing" | "printing" | "paused" | "finished" | "busy")[];
261
+ enum: ("failed" | "cancelled" | "idle" | "preparing" | "printing" | "paused" | "finished" | "offline" | "busy")[];
262
262
  };
263
263
  job: {
264
264
  type: string;
@@ -353,7 +353,7 @@ export declare const PRINT_PROGRESS_OUTPUT_SCHEMA: {
353
353
  };
354
354
  severity: {
355
355
  type: string;
356
- enum: ("error" | "info" | "fatal" | "warning")[];
356
+ enum: ("fatal" | "error" | "info" | "warning")[];
357
357
  };
358
358
  message: {
359
359
  type: string;
package/dist/index.js CHANGED
@@ -2094,7 +2094,7 @@ class BambuPrinterMCPServer {
2094
2094
  },
2095
2095
  {
2096
2096
  name: "list_3mf_plates",
2097
- description: "List a Bambu Studio or OrcaSlicer 3MF's plates as its designer laid them out, before slicing: plate_count, and for each plate its index (from 0; slice_stl's slice_plate is index + 1, inspect_print_file's plate_index is index), name, the objects on it, each object copy's identify_id (instances: the ids slice_stl's skip_objects takes) whether the file already holds its G-code (sliced), and filaments: the project filaments that plate prints with and only those (index from 1 = slice_stl's load_filaments/filament_colours position and print_3mf's ams_mapping position + 1; colour, material, filament_id, and the first part using it), from the slice when there is one, otherwise worked out as Bambu Studio does from the plate's parts, painting, support, layer ranges and tool changes. filaments_complete is false when a part's mesh was too large to read its painting: that plate then lists every declared filament, so offer them all rather than miss one that prints. project_filaments lists every filament the project declares, used or not (slice_stl takes one load_filaments profile per declared filament). A plain 3MF without plate metadata is one plate. include_thumbnails adds each plate's own preview from the file (thumbnail_png_base64). Read-only.",
2097
+ description: "List a Bambu Studio or OrcaSlicer 3MF's plates as its designer laid them out, before slicing: plate_count, and for each plate its index (from 0; slice_stl's slice_plate is index + 1, inspect_print_file's plate_index is index), name, the objects on it, each object copy's identify_id (instances: the ids slice_stl's skip_objects takes) whether the file already holds its G-code (sliced), and filaments: the project filaments that plate prints with and only those (index from 1 = slice_stl's load_filaments/filament_colours position and print_3mf's ams_mapping position + 1; colour, material, filament_id, and the first part using it), from the slice when there is one, otherwise worked out as Bambu Studio does from the plate's parts, painting, support, layer ranges and tool changes. filaments_complete is false when a part's mesh was too large to read its painting: that plate then lists every declared filament, so offer them all rather than miss one that prints. project_filaments lists every filament the project declares, used or not (slice_stl takes one load_filaments profile per declared filament). build_items: the root 3D/3dmodel.model build items on the plate (0-based, build order); parts: each model part of the plate's objects once, with object_id (the mesh object), path when that mesh is in another model part (p:path), build_object_id (the root object a build item places), name, filament (1-based) and painted: true when slicer painting recolours some facets; draw a plate from these with the 3MF's own meshes. A plain 3MF without plate metadata is one plate. include_thumbnails adds each plate's own preview from the file (thumbnail_png_base64). Read-only.",
2098
2098
  inputSchema: {
2099
2099
  type: "object",
2100
2100
  properties: {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "bambu-printer-mcp",
3
- "version": "1.1.93",
3
+ "version": "1.1.94",
4
4
  "description": "MCP server for Bambu Lab 3D printers with STL manipulation, slicing, and print management",
5
5
  "counterpart": {
6
6
  "contract": "counterpart/1",
7
- "notes": "Adds installation self-checks and printer names with their makers, and clears stale progress until the new job reports its own.",
7
+ "notes": "Writes and edits multi-part, multi-colour 3MF projects and reports each plate’s parts and colours.",
8
8
  "autoUpdate": true
9
9
  },
10
10
  "main": "dist/index.js",
package/src/3mf_parser.ts CHANGED
@@ -5,6 +5,7 @@ import * as fs from 'fs/promises';
5
5
  import { AsyncLocalStorage } from 'node:async_hooks';
6
6
  import { createHash, randomUUID } from 'node:crypto';
7
7
  import * as path from 'node:path';
8
+ import { readSafe3mfArchive } from './safety/archive.js';
8
9
 
9
10
  // Parses Bambu Studio's JSON config data
10
11
  function parseBambuJSONConfig(jsonData: any): Partial<BambuSlicerConfig> {
@@ -511,8 +512,8 @@ export async function analyze3MFPlateObjects(
511
512
  filePath: string,
512
513
  plateIndex: number = 0
513
514
  ): Promise<ThreeMFPlateObjects> {
514
- const data = await fs.readFile(filePath);
515
- const zip = await JSZip.loadAsync(data);
515
+ // Bounded, with colliding or inconsistent entry names refused, as the other 3MF reads here.
516
+ const { zip } = await readSafe3mfArchive(filePath);
516
517
  const plateNumber = plateIndex + 1;
517
518
  const sliceInfo = zip.file('Metadata/slice_info.config');
518
519
  if (!sliceInfo) {
@@ -231,6 +231,15 @@ export const CAD_TOOLS = [
231
231
  description:
232
232
  "The script's own print() output from this run, capped at 4000 characters (build.log keeps the rest). The script's words, not a measurement by the engine.",
233
233
  },
234
+ three_mf: {
235
+ type: "string",
236
+ description: "When build() returned project_3mf(): the written 3MF project, ready for slice_stl.",
237
+ },
238
+ three_mf_project: {
239
+ type: "object",
240
+ description:
241
+ "When build() returned project_3mf(): base (the edited input alias, or null for a new project), changes, and the written file read back as list_3mf_plates reads it (plates with build_items, parts and filaments; project_filaments).",
242
+ },
234
243
  seconds: { type: "number" },
235
244
  },
236
245
  [
@@ -385,6 +394,7 @@ Captured mesh preparation: load_scan(name, source_units="m" or "mm", up_axis="x"
385
394
  Fit reference workflow: return load_scan("scan", source_units="m", up_axis="y") from build() in mode: "mesh" to export an unchanged, prepared reference STL for cad_check_fit. Declare every linked OBJ/MTL/texture asset. If you crop, simplify, fill, or otherwise alter this reference, report exactly what you excluded/changed and that the fit check proves only that reduced reference in the stated pose. A fit check against a scan is information; it must never resize or override an interface specified by measured dimensions. Keep those measured interfaces and report the discrepancy.
386
395
  Result selection and edits: set final: true only on the result you select. cad-result.json in each immediate run folder is protected from script writes and retains final, completed_at, lineage_id (source hash), full checks and artifact paths; clients can discover the latest completed final record after restart without rebuilding. Final is a selection marker, not a replacement for valid/checks. Queued calls may expire with cad-queue-timeout before dispatch; do not automatically replay. Unchanged declared files reuse a read-only content-addressed bundle under output_dir/.cad-inputs, preserving filenames and restricting reads to that bundle. Keep this shared cache with the saved runs.
387
396
  Mesh cleanup workflow: return a trimesh.Trimesh in mode: "mesh". Load the prepared mesh, fit needed geometry with NumPy/SciPy, rebuild regular sections/features with build123d or manifold3d CrossSection/extrusion/revolve, and combine meshes with manifold3d booleans. scikit-image supplies marching cubes for voxel/SDF work; Shapely supplies planar operations; Pillow supplies image/texture reads. Keep numeric choices in P and regenerate from declared inputs. Validate closure, winding, manifold status, dimensions and all six views using cad_run. What to regularise, infer, preserve or label comes from the caller's cleanup rules, not this engine prompt.
397
+ Multi-colour 3MF projects: build() may return project_3mf() instead of a shape. A new project: p = project_3mf(); p.add_part(shape, name="Lid", filament=2, object="Box", plate=1) for each part (parts that share object= are one object, printed as one piece; plates from 1), in solid mode with build123d shapes (the checks fuse each object's parts) or mode: "mesh" with trimesh parts. Editing a designer's 3MF: declare it as an input and p = project_3mf("kit") in mode: "mesh"; p.objects lists its objects (name, id, plate; p.object(id or unique name)) and their parts (name, id, filament, painted, mesh: a trimesh in the object's frame); p.add_part(shape, name=..., filament=..., object="Body") adds a part in that object's frame, p.replace_part(part, mesh) swaps a part's mesh (its painting goes with the old mesh) and p.set_part(part, name=..., filament=...) renames or recolours one; everything else in the file (print settings, painting, plates, other parts) is kept. cad_run writes <name>.3mf beside the STL and returns three_mf and three_mf_project (each plate's parts and filaments, read back from the file); slice it with slice_stl, never by rebuilding it from the STL.
388
398
  Captured scan touch-up: t = scan_touchup(load_scan("scan", source_units="m", up_axis="y", ground=False), colour="colour", normal="normal", edge_mm=0.4) takes a textured capture (declare its OBJ, MTL and colour and normal map PNGs as inputs; pass the map aliases). It removes loose pieces and spikes, closes holes and refines to edge_mm without shrinking the body. t.regions() prints the colour regions (id, colour, area, size, flatness; 0 is the body) to build.log and saves regions.png in the run folder: read both, then name regions by id in the same scan and edge_mm. t.flatten(ids, shape="plane" or "curved"), t.bead(id, diameter_mm, proud_mm), t.cord(id, diameter_mm, proud_mm) (a cord follows its region's own curve) and t.seat(height_mm) record steps; return t.mesh(relief_gain=1.0), which adds the normal map's measured relief, applies the steps with manifold3d and prints its changes. Keep relief_gain at 1: a larger gain amplifies the map's noise, not stitches. When the caller's rules call for a textile's relief the scan missed (fabric, knit, crochet the photos show raised), t.texture_relief(height_mm, regions=None) raises its stitch pattern from the colour texture on the textile only (never flattened, beaded or corded regions); about 0.6 to 1.0 mm peak to peak prints visibly. It is off unless called: never for hard objects, printed graphics or labels.
389
399
  The result includes paths, millimetre bounds/size, mesh and STEP volumes, solid count, watertight/manifold/winding/STEP checks, bodies (closest approach between solids, contact with the print plate at Z = 0, labelled bodies that are not one solid), problems, checked and not_checked, six orthographic renders (front, back, left, right, top, bottom), a perspective view from the front right and above, and a contact sheet with the perspective view large beside the six. Fix every entry in problems before selecting a result; an empty problems list proves nothing listed in not_checked. After every cad_run, Read its perspective view (renders.perspective, as the result's next says) before the next cad_run or any other change: a run you have not looked at tells you nothing about the form. Judge the form from the perspective view first: would a person recognise the product and want it? Then inspect all six; revise visible defects. Before the final run, list what the views show is wrong against the bought product you named (for a scan, the object in its photos), and fix each one or report it. To get a number out of a design (a spring force, a strain, a clearance you derived), print() it in the script: the result returns it as printed, with no need to make a run fail. A valid mesh or nominal parameter does not prove the requested dimension: measure the actual exported interfaces. Use cad_check_fit on a model and reference STL with an explicit rigid transform; report raw-scan interference and minimum gap. Calipers are authoritative but disagreement with a scan is unresolved measurement evidence, not permission to silently rescale it. Check assembly/insertion paths and actual articulated poses, not sums of local joint limits or reference points alone. Printing, clearance under load, supports and motion need separate evidence.
390
400
  Fit, flexure and thread parameters: put each interface's nominal size, its source (measured, published, or assumed), the print correction, and the design fit in P as separate named values, so a fit report revises one number without resending the script. Model every dimension you claim: a parameter the geometry never uses (a wallet or case width that no cut or wall reads) is a defect; use it or remove it. Shape flexures so their bending lies in the layer plane of the exported print orientation, with the stroke, preload, and hard-stop gap as P values; build the stopped pose as well as the rest pose when checking. Model printed threads as explicit coarse geometry with the same pitch on both sides and clearance as a radial P offset; never scale a screw to clear its hole.