bambu-printer-mcp 1.1.87 → 1.1.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cad/contracts.js +15 -3
- package/dist/cad-engine.js +1 -0
- package/dist/design-guidance.d.ts +2 -2
- package/dist/design-guidance.js +5 -3
- package/package.json +1 -1
- package/src/cad/contracts.ts +17 -3
- package/src/cad/geometry.py +204 -0
- package/src/cad/scan_touchup.py +630 -0
- package/src/cad/worker.py +3 -1
- package/src/cad-engine.ts +1 -0
- package/src/design-guidance.ts +5 -3
package/dist/cad/contracts.js
CHANGED
|
@@ -100,7 +100,7 @@ export const CAD_TOOLS = [
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
name: "cad_run",
|
|
103
|
-
description: "Build parametric CAD headlessly in OS confinement. Read cad_design first: declare literal P = {...} and build() returning a build123d Shape. Supply script OR script_path; parameters overrides saved named values in one call before derived dimensions. Calls wait for the environment’s exclusive execution slot up to their own deadline and report queue_wait_ms. Each call creates a private immutable subfolder under allowed output_dir, never overwriting previous artifacts. The saved .py and .parameters.json are the recovery checkpoint even after cancellation. Returns independently measured geometry, STL/STEP, six renders and a contact sheet; valid geometry is
|
|
103
|
+
description: "Build parametric CAD headlessly in OS confinement. Read cad_design first: declare literal P = {...} and build() returning a build123d Shape. Supply script OR script_path; parameters overrides saved named values in one call before derived dimensions. Calls wait for the environment’s exclusive execution slot up to their own deadline and report queue_wait_ms. Each call creates a private immutable subfolder under allowed output_dir, never overwriting previous artifacts. The saved .py and .parameters.json are the recovery checkpoint even after cancellation. Returns independently measured geometry, STL/STEP, six renders and a contact sheet, the closest approach between every pair of solids (bodies), problems, and what was checked and not checked; valid means only that the exported geometry is sound, never that the part fits, holds, moves or prints.",
|
|
104
104
|
inputSchema: {
|
|
105
105
|
type: "object",
|
|
106
106
|
properties: {
|
|
@@ -189,6 +189,17 @@ export const CAD_TOOLS = [
|
|
|
189
189
|
type: "object",
|
|
190
190
|
additionalProperties: { type: ["boolean", "null"] },
|
|
191
191
|
},
|
|
192
|
+
bodies: {
|
|
193
|
+
type: "object",
|
|
194
|
+
description: "Solid mode: near pairs of solids screened on tessellations and measured exactly on the STEP where the screen cannot clear them, against a print-in-place clearance from P.print_in_place_clearance_mm or 0.3 mm (touching or overlap only when P.print_in_place is false); touching or overlapping pairs, pairs under the clearance, pairs only screened, solids below the print plate (Z = 0) or above it with no solid under them that reaches it, and labelled bodies that are not exactly one solid.",
|
|
195
|
+
},
|
|
196
|
+
problems: {
|
|
197
|
+
type: "array",
|
|
198
|
+
items: { type: "string" },
|
|
199
|
+
description: "Defects found by the checks that valid does not cover (fused or too-close bodies, a severed body, a solid below the plate or starting in mid-air, pairs not measured). Each kind lists up to eight, then a count of the rest. Empty when none were found, which is not a pass on anything listed in not_checked.",
|
|
200
|
+
},
|
|
201
|
+
checked: { type: "array", items: { type: "string" } },
|
|
202
|
+
not_checked: { type: "array", items: { type: "string" } },
|
|
192
203
|
renders: { type: "object", additionalProperties: { type: "string" } },
|
|
193
204
|
seconds: { type: "number" },
|
|
194
205
|
}, [
|
|
@@ -278,13 +289,14 @@ export const CAD_DESIGN_PROMPT = {
|
|
|
278
289
|
title: "Parametric code-CAD design",
|
|
279
290
|
description: "MCP-owned rules for headless build123d designs and one-call parameter revisions.",
|
|
280
291
|
text: `Use code-CAD for dimensioned functional designs and parameter edits. Build in millimetres with build123d 0.13.0; the MCP owns the Python environment, execution, export, validation and rendering. Check cad_status and use cad_setup with install: true when needed. No Blender, Fusion, network or printer access is available to your script.
|
|
281
|
-
Declare exactly one top-level P = {...} dictionary of JSON-compatible literal named parameters. Put every functional dimension in P; derive geometry from P. Define build() to return a build123d Shape or Compound of disjoint solid parts. Do not put construction or exports in a __main__ block: cad_run calls build() and exports the result. Imports, functions and derived P entries are fine. Parameters are applied to the literal defaults before derived expressions execute. For solid designs without inputs, the script and parameters file alone reconstruct it. For input-dependent designs, declare inputs as an array of {name, path} files: cad_run snapshots only those allowed files, exposes INPUTS[alias] to your script, and saves an inputs manifest. Retain the snapshots too for recovery; subsequent script_path edits reuse them unless inputs is explicitly supplied. No other personal files are readable. For a mesh-only experiment use mode: "mesh" and return a trimesh.Trimesh from build(); it exports and checks STL plus six renders, with step: null and an explicit reason. It does not manufacture a fake parametric STEP or promise scan-cleanup capability.
|
|
292
|
+
Declare exactly one top-level P = {...} dictionary of JSON-compatible literal named parameters. Put every functional dimension in P; derive geometry from P. Define build() to return a build123d Shape or Compound of disjoint solid parts. When a design has separate bodies (print-in-place parts, a captive wheel, links of a fabric), return Compound(children=[...]) with a label on each body: cad_run then checks that each labelled body is exactly one solid, so a piece cut off one body cannot hide behind two bodies fused into one. Near pairs of solids are screened and, where the screen cannot clear them, measured exactly against P["print_in_place_clearance_mm"] when you declare it, else 0.3 mm. If the bodies are shown assembled rather than printed in place (a shaft in its hole at a fit clearance), set P["print_in_place"] = False: only touching or overlap is then a problem. Export in print orientation with the plate at Z = 0: a solid below it, or above it with nothing under it that reaches it, is a problem. Do not put construction or exports in a __main__ block: cad_run calls build() and exports the result. Imports, functions and derived P entries are fine. Parameters are applied to the literal defaults before derived expressions execute. For solid designs without inputs, the script and parameters file alone reconstruct it. For input-dependent designs, declare inputs as an array of {name, path} files: cad_run snapshots only those allowed files, exposes INPUTS[alias] to your script, and saves an inputs manifest. Retain the snapshots too for recovery; subsequent script_path edits reuse them unless inputs is explicitly supplied. No other personal files are readable. For a mesh-only experiment use mode: "mesh" and return a trimesh.Trimesh from build(); it exports and checks STL plus six renders, with step: null and an explicit reason. It does not manufacture a fake parametric STEP or promise scan-cleanup capability.
|
|
282
293
|
Call cad_run with script, output_dir and a plain name. It saves <name>.py and <name>.parameters.json before running, then exports <name>.stl and <name>.step in a fresh subfolder. For an edit, one cad_run with script_path pointing to the earlier .py, parameters containing just the changed dimension, output_dir and name regenerates it without resending the script. Existing parameter values are retained; unknown names and type changes are refused. A killed run can be retried from its checkpoint in a new workspace; mutations are never replayed automatically.
|
|
283
294
|
Captured mesh preparation: load_scan(name, source_units="m" or "mm", up_axis="x"|"-x"|"y"|"-y"|"z"|"-z", ground=True) is provided to build(). Name must be a declared input. Declare source units and the object's usage-up axis explicitly: the helper converts metres to millimetres, applies a rigid up-axis rotation and translates the lowest Z to zero; it never guesses scale or fits to calipers. Geometry/texture references must be declared inputs too; snapshots preserve distinct original filenames. Exports must be millimetres, Z up, in the orientation the object is used.
|
|
284
295
|
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.
|
|
285
296
|
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.
|
|
286
297
|
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.
|
|
287
|
-
|
|
298
|
+
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.
|
|
299
|
+
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) and contact sheet. Fix every entry in problems before selecting a result; an empty problems list proves nothing listed in not_checked. Inspect all six; revise visible defects. 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.
|
|
288
300
|
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.
|
|
289
301
|
Check insertion and articulated poses with cad_check_fit against each object state that matters (the bare product, the product in its case, and the case with its attachment as its own reference envelope), including the widest section on the way in. Report interference and minimum gap per state. In your summary, attach each "fits", "holds", and "prints without supports" claim to the check or slice number that shows it; a valid flag alone shows none of them. Apply fdm_design and fdm_slicing too, with fdm_fit and fdm_flexures when they apply; never invoke a printer as part of constructing CAD.`,
|
|
290
302
|
};
|
package/dist/cad-engine.js
CHANGED
|
@@ -10,11 +10,11 @@ export interface DesignPrompt {
|
|
|
10
10
|
description: string;
|
|
11
11
|
text: string;
|
|
12
12
|
}
|
|
13
|
-
export declare const FDM_CORE = "Design the finished object the user wants, with the manufacturing plan as part of the design. Preserve its function, fit, and visual identity. Use your design ability freely to make that outcome practical through geometry, orientation, materials, color placement, supports, and assembly.\n\nUse the actual printer and material context: nozzle arrangement and filament routing, build volume, nozzle and line widths, layer profile, cooling, available filaments, and relevant successful prints or calibration. Missing information is unknown, not a capability the printer automatically has. Use reasonable, labeled assumptions for reversible choices; ask only when an unknown materially changes the result.\n\nBefore committing to detailed geometry, choose a plausible way to manufacture and assemble it. For a consequential tradeoff, compare the strongest one-piece approach with a meaningfully different orientation or split. Simple parts do not need a design tournament. Judge total effort to obtain a good finished object: printing, consumed filament, likely rework, support cleanup, assembly, and extra hardware. Respect the user's priorities instead of applying fixed numerical weights.\n\nKeep assembled orientation and print orientation distinct. Preserve critical dimensions and mating surfaces. Account for measurement uncertainty and fit clearance separately; a scan or printed measuring tool does not establish its own accuracy. Use the smallest useful fit sample when uncertainty could otherwise waste a substantial print. A size the person confirmed without changing a prefilled number is not a measurement. If a case, cover, or attachment is mentioned, the bare product's size is not the size to design to.\n\nFind out before you design, and before you ask. Research whenever the request names something that exists outside the person's hands (a product, a vehicle and its year, a phone, a case, a tool, an appliance, a standard part, a material, the place the part mounts) or a decision turns on a fact about the world (how hot it gets there, what the surface is made of, what adhesive holds on it, where the buttons, ports, vents or airbags are). Do not research what exists only with the person: which of their own things, how something felt, what they prefer, an object they measured or scanned. This takes a few minutes, not an hour, and it works the same with any model that has web tools:\n1. Write down the few facts that decide this design, usually three to seven: each interface's size, where the part mounts and what surrounds that spot, what the surface is made of, the environment, the load.\n2. Search each fact by the exact name, model and year or generation plus the fact itself (\"dimensions mm\", \"technical drawing\", \"accessory design guidelines\", \"spec sheet\", \"parts diagram\", \"teardown\", \"material\"). Run the searches together when the tools allow. Makers of fitted accessories for the same object (mounts, cases, installation kits, replacement panels) publish where things go and how big the openings are; owners publish photos with a tape measure; parts catalogues show each panel's outline. Look there, not only at the maker of the object.\n3. Open the page and read the number. A search-result snippet is not a source. Prefer, in order: the maker's drawing or specification, a standard, a fitted-accessory maker, a reviewer's or owner's measurement, a retailer's listing. Two independent sources that agree beat one.\n4. When a first search finds nothing, rephrase before concluding anything: the generation or chassis code, the part number, another market's name for it, the accessory that fits it instead of the thing itself. \"Not found\" is true only after that, and you say where you looked.\n5. Keep each fact with its value, its source and its kind (maker, standard, accessory maker, measurement, listing), labelled as published, and design to it.\n6. For what is still unknown after about two rounds per fact, shape the design so that fact does not decide whether it works (an adjustable or sprung interface, a foot that suits more than one surface), or state a bounded assumption as an assumption. Ask the person only as the last resort, one short question, and only for what exists nowhere but with them. Never ask for something a search answers: a photo of their car's dashboard, the size of a named product, what a named surface is made of.\nWithout web tools, say so in the result, use what you recall labelled as recalled rather than published, and lean harder on step 6.\n\nChoose each fit by what that interface has to do: drop in and lift out, slide, locate without rattle, grip so it does not slip or turn, snap over, or press in to stay. There is no single fit number. Keep three things apart for each interface: the object's size and how sure it is, the correction this printer and orientation need (its own observed corrections first, when the context supplies them), and the fit the function calls for. When the size's uncertainty is wider than the function tolerates, do not answer with a better number: choose a mechanism that absorbs the difference (crush ribs, a split closed by a screw, a flexure, a snap), or ask for the one measurement that settles it. The same object changes with time and use: full and nearly empty, new and worn, soft and stiff. A fit that relies on the object giving way must still work in its stiffest, largest state, and a pocket is sized to the widest section the object passes through on the way in, with support where the object actually bears, not to its bounding box.\n\nEvaluate printability locally. Distinguish a progressively supported overhang, a bridge anchored at both ends, and a disconnected island. State overhang angles from vertical: 0 degrees is a vertical wall; 90 degrees is a horizontal underside. Convert conventions before setting slicer angles. Use relevant measured capability ahead of generic rules. A 45-degree threshold is not a universal support requirement, and a steep surface is not automatically unprintable. Judge bridge length along the actual unsupported extrusion path, with its anchors, cooling, material, and required underside quality. A feature that survives printing may still miss a cosmetic or dimensional requirement.\n\nResolve a difficult region with the least disruptive effective change: a better orientation, local geometry, suitable process settings, accessible support, a deliberate breakaway feature, or a split. Supports are an ordinary manufacturing option. Preserve attractive curves and useful complexity when modest support or cleanup achieves them. Check support removal and tool access, especially inside cavities. Avoid changing the whole object to solve a local problem.\n\nChoose layer orientation, material, walls, and joints for the actual loads and environment. Check the load path, flexing features, fastener access, and installation sequence. A reduction in supports or color changes must not silently weaken the part or defeat its fit.\n\nWhen a part must flex, grip, snap, clip, spring, or hold something, consider a compliant mechanism first: one piece that bends on purpose often beats rigid jaws plus a clamp bolt, with fewer parts, no fastener to buy or lose, and a hold that follows the object. Spread the bending over a long band, leaf, or arch rather than a short stub; keep the rest of the body stiff so the stroke goes where you intend; give a hand enough leverage; design the preload in; use an over-centre or cam where a hold must lock; and give every flexing direction a hard stop so a hard pull meets solid material. Keep the bending in the layer plane, where the filament runs along the strain; bending that pulls layers apart is far weaker and fails with little warning. Choose the strain by duty (bent once to assemble, bent every day, and held bent for months are different designs) and by material and direction, using the printer's own observed values when the context supplies them. Modern PLA and PETG grades are not brittle in this role: proven printed springs work daily at strains that older moulded-plastic tables would forbid. What usually ends a flexure is not a clean snap at a magic percentage but whitening and set at a sharp root, layers parting where the bend crosses them, or a held bend creeping loose, faster when warm. In sustained heat such as a parked car, a part held bent relaxes and a sun-heated dashboard can exceed what PLA or PETG carry under load: prefer a rest state that sits unstrained, and say so when the material cannot honestly do the job. A part a hand works has to be easy to work, and that is checked like its hold: say where the fingers go, how hard they push to open it, how far it opens, and how the object goes in and comes out with one hand. A grip that meets its force and is a fight to use has failed the brief.\n\nOn a shared-nozzle multicolor setup, reason about filament transitions across layers, including support-interface material. Total color count alone is a poor cost estimate. Consider color placement, shallow inlays, separately printed accents, and part orientation while preserving the requested appearance. Separate bodies on one layer-printed plate can still cause repeated swaps. Use the slicer's actual schedule and estimates when available; do not invent a fixed cost per color change.\n\nUse assembly when its benefit is worth the user's additional work. Design alignment, clearance, engagement, and assembly access deliberately. Glue is a valid planned joining method for suitable materials and loads; make joints self-locating and give them useful bonding area. Use mechanical retention when loads, repeated flexing, or serviceability call for it. State needed glue, hardware, tools, and assembly effort plainly. Avoid adding parts when a modest support or a simple one-piece print is the better result. A printed screw, nut, or threaded hole is an ordinary choice at hand sizes (M8 and up as the usual starting point, about M6 as the floor) with a coarse profile shaped to print without supports; below that floor, under sustained preload that must not relax, in heat, or under shock, a metal screw or insert is the honest choice. Keep threads out of the main load path where a shoulder, tenon, key, or serrated face can carry shear and torque, and let the thread only hold the joint closed.\n\nVerify the chosen geometry in its actual print orientation and inspect the slice when tools permit. Check critical fits, missing or floating features, toolpaths, supports, color assignments, total time, and material consumption. Treat a slicer prediction as a prediction, not a physical test. Fix consequential problems and re-slice relevant changes. Stop when the design meets the brief and no remaining improvement justifies its cost. State \"prints without supports\", \"holds\", or \"fits\" only when the engine's own checks or the slice show it, and give the number that shows it; otherwise call it an untested prediction.\n\nKeep the user-facing result short: the recommended design, why its manufacturing approach makes sense, how it prints and assembles, and any consequential unresolved assumption. Distinguish measured dimensions, slicer estimates, and untested predictions. Say where each critical size came from (measured, published, or assumed) and what each interface is meant to do and how it fits. Keep detailed analysis in the working process.";
|
|
13
|
+
export declare const FDM_CORE = "Design the finished object the user wants, with the manufacturing plan as part of the design. Preserve its function, fit, and visual identity. Use your design ability freely to make that outcome practical through geometry, orientation, materials, color placement, supports, and assembly.\n\nUse the actual printer and material context: nozzle arrangement and filament routing, build volume, nozzle and line widths, layer profile, cooling, available filaments, and relevant successful prints or calibration. Missing information is unknown, not a capability the printer automatically has. Use reasonable, labeled assumptions for reversible choices; ask only when an unknown materially changes the result.\n\nBefore committing to detailed geometry, choose a plausible way to manufacture and assemble it. For a consequential tradeoff, compare the strongest one-piece approach with a meaningfully different orientation or split. Simple parts do not need a design tournament. Judge total effort to obtain a good finished object: printing, consumed filament, likely rework, support cleanup, assembly, and extra hardware. Respect the user's priorities instead of applying fixed numerical weights.\n\nKeep assembled orientation and print orientation distinct. Preserve critical dimensions and mating surfaces. Account for measurement uncertainty and fit clearance separately; a scan or printed measuring tool does not establish its own accuracy. Use the smallest useful fit sample when uncertainty could otherwise waste a substantial print. A size the person confirmed without changing a prefilled number is not a measurement. If a case, cover, or attachment is mentioned, the bare product's size is not the size to design to.\n\nFind out before you design, and before you ask. Research whenever the request names something that exists outside the person's hands (a product, a vehicle and its year, a phone, a case, a tool, an appliance, a standard part, a material, the place the part mounts) or a decision turns on a fact about the world (how hot it gets there, what the surface is made of, what adhesive holds on it, where the buttons, ports, vents or airbags are). Do not research what exists only with the person: which of their own things, how something felt, what they prefer, an object they measured or scanned. This takes a few minutes, not an hour, and it works the same with any model that has web tools:\n1. Write down the few facts that decide this design, usually three to seven: each interface's size, where the part mounts and what surrounds that spot, what the surface is made of, the environment, the load.\n2. Search each fact by the exact name, model and year or generation plus the fact itself (\"dimensions mm\", \"technical drawing\", \"accessory design guidelines\", \"spec sheet\", \"parts diagram\", \"teardown\", \"material\"). Run the searches together when the tools allow. Makers of fitted accessories for the same object (mounts, cases, installation kits, replacement panels) publish where things go and how big the openings are; owners publish photos with a tape measure; parts catalogues show each panel's outline. Look there, not only at the maker of the object.\n3. Open the page and read the number. A search-result snippet is not a source. Prefer, in order: the maker's drawing or specification, a standard, a fitted-accessory maker, a reviewer's or owner's measurement, a retailer's listing. Two independent sources that agree beat one.\n4. When a first search finds nothing, rephrase before concluding anything: the generation or chassis code, the part number, another market's name for it, the accessory that fits it instead of the thing itself. \"Not found\" is true only after that, and you say where you looked.\n5. Keep each fact with its value, its source and its kind (maker, standard, accessory maker, measurement, listing), labelled as published, and design to it.\n6. For what is still unknown after about two rounds per fact, shape the design so that fact does not decide whether it works (an adjustable or sprung interface, a foot that suits more than one surface), or state a bounded assumption as an assumption. Ask the person only as the last resort, one short question, and only for what exists nowhere but with them. Never ask for something a search answers: a photo of their car's dashboard, the size of a named product, what a named surface is made of.\nWithout web tools, say so in the result, use what you recall labelled as recalled rather than published, and lean harder on step 6.\n\nBefore choosing a mechanism, establish what every working bought or published version of the thing has, and keep all of it. For example, a car phone holder turns and tilts to face the driver; a mount's base is sized by the moment of what it holds, not just its weight; an adhesive mount uses a full pad of the tape's grade, not a strip, on a surface the tape suits. Start from the complete product a capable designer would describe at once, then make it printable. A design that leaves out a feature they all have says what it lost and why that is acceptable for this person.\n\nChoose each fit by what that interface has to do: drop in and lift out, slide, locate without rattle, grip so it does not slip or turn, snap over, or press in to stay. There is no single fit number. Keep three things apart for each interface: the object's size and how sure it is, the correction this printer and orientation need (its own observed corrections first, when the context supplies them), and the fit the function calls for. When the size's uncertainty is wider than the function tolerates, do not answer with a better number: choose a mechanism that absorbs the difference (crush ribs, a split closed by a screw, a flexure, a snap), or ask for the one measurement that settles it. The same object changes with time and use: full and nearly empty, new and worn, soft and stiff. A fit that relies on the object giving way must still work in its stiffest, largest state, and a pocket is sized to the widest section the object passes through on the way in, with support where the object actually bears, not to its bounding box.\n\nEvaluate printability locally. Distinguish a progressively supported overhang, a bridge anchored at both ends, and a disconnected island. State overhang angles from vertical: 0 degrees is a vertical wall; 90 degrees is a horizontal underside. Convert conventions before setting slicer angles. Use relevant measured capability ahead of generic rules. A 45-degree threshold is not a universal support requirement, and a steep surface is not automatically unprintable. Judge bridge length along the actual unsupported extrusion path, with its anchors, cooling, material, and required underside quality. A feature that survives printing may still miss a cosmetic or dimensional requirement.\n\nResolve a difficult region with the least disruptive effective change: a better orientation, local geometry, suitable process settings, accessible support, a deliberate breakaway feature, or a split. Supports are an ordinary manufacturing option. Preserve attractive curves and useful complexity when modest support or cleanup achieves them. Check support removal and tool access, especially inside cavities. Avoid changing the whole object to solve a local problem.\n\nChoose layer orientation, material, walls, and joints for the actual loads and environment. Check the load path, flexing features, fastener access, and installation sequence. Judge a connection (tape, screws, a snap) against products that demonstrably work. If a check says a bought product that holds for years would fail, the check is wrong: correct it, then apply it to your design. A reduction in supports or color changes must not silently weaken the part or defeat its fit.\n\nWhen a part must flex, grip, snap, clip, spring, or hold something, consider a compliant mechanism first: one piece that bends on purpose often beats rigid jaws plus a clamp bolt, with fewer parts, no fastener to buy or lose, and a hold that follows the object. That choice is for the element that grips, clips or springs, not for the product: it is never a reason to make the whole thing one piece or to drop a joint, adjustment or base the bought versions have. Spread the bending over a long band, leaf, or arch rather than a short stub; keep the rest of the body stiff so the stroke goes where you intend; give a hand enough leverage; design the preload in; use an over-centre or cam where a hold must lock; and give every flexing direction a hard stop so a hard pull meets solid material. Keep the bending in the layer plane, where the filament runs along the strain; bending that pulls layers apart is far weaker and fails with little warning. Choose the strain by duty (bent once to assemble, bent every day, and held bent for months are different designs) and by material and direction, using the printer's own observed values when the context supplies them. Modern PLA and PETG grades are not brittle in this role: proven printed springs work daily at strains that older moulded-plastic tables would forbid. What usually ends a flexure is not a clean snap at a magic percentage but whitening and set at a sharp root, layers parting where the bend crosses them, or a held bend creeping loose, faster when warm. In sustained heat such as a parked car, a part held bent relaxes and a sun-heated dashboard can exceed what PLA or PETG carry under load: prefer a rest state that sits unstrained, and say so when the material cannot honestly do the job. A part a hand works has to be easy to work, and that is checked like its hold: say where the fingers go, how hard they push to open it, how far it opens, and how the object goes in and comes out with one hand. A grip that meets its force and is a fight to use has failed the brief.\n\nOn a shared-nozzle multicolor setup, reason about filament transitions across layers, including support-interface material. Total color count alone is a poor cost estimate. Consider color placement, shallow inlays, separately printed accents, and part orientation while preserving the requested appearance. Separate bodies on one layer-printed plate can still cause repeated swaps. Use the slicer's actual schedule and estimates when available; do not invent a fixed cost per color change.\n\nUse assembly when its benefit is worth the user's additional work. Design alignment, clearance, engagement, and assembly access deliberately. Glue is a valid planned joining method for suitable materials and loads; make joints self-locating and give them useful bonding area. Use mechanical retention when loads, repeated flexing, or serviceability call for it. State needed glue, hardware, tools, and assembly effort plainly. Avoid adding parts when a modest support or a simple one-piece print is the better result. A printed screw, nut, or threaded hole is an ordinary choice at hand sizes (M8 and up as the usual starting point, about M6 as the floor) with a coarse profile shaped to print without supports; below that floor, under sustained preload that must not relax, in heat, or under shock, a metal screw or insert is the honest choice. Keep threads out of the main load path where a shoulder, tenon, key, or serrated face can carry shear and torque, and let the thread only hold the joint closed.\n\nVerify the chosen geometry in its actual print orientation and inspect the slice when tools permit. Check critical fits, missing or floating features, toolpaths, supports, color assignments, total time, and material consumption. Treat a slicer prediction as a prediction, not a physical test. Fix consequential problems and re-slice relevant changes. Stop when the design meets the brief and no remaining improvement justifies its cost. State \"prints without supports\", \"holds\", or \"fits\" only when the engine's own checks or the slice show it, and give the number that shows it; otherwise call it an untested prediction.\n\nKeep the user-facing result short: the recommended design, why its manufacturing approach makes sense, how it prints and assembles, and any consequential unresolved assumption. Distinguish measured dimensions, slicer estimates, and untested predictions. Say where each critical size came from (measured, published, or assumed) and what each interface is meant to do and how it fits. Keep detailed analysis in the working process.";
|
|
14
14
|
export declare const FDM_MULTICOLOR = "Apply this guidance when multiple colors or support materials share a print.\n\nPreserve the requested visual pattern. Evaluate its colors in build coordinates and across layers before committing to color geometry. On a shared nozzle, a small accent spanning many layers can create more transitions than a large region confined to a few layers. Count the slicer's actual transitions when available, including swaps back to a prior filament and support-interface swaps; color count and colored volume are only screening clues. On printers with multiple nozzles, evaluate each shared melt path; AMS slots are not independent nozzles.\n\nFor a costly pattern, consider the most promising alternatives: a different build orientation, color regions confined to fewer layers, shallow face inlays, or separately printed single-color pieces with intentional assembly. A vertical stripe in use may become a low-change feature in a different print orientation. Judge each option against load direction, surface quality, support burden, and the user's exact visual requirements. Finer layers can help an overhang while adding color-change layers; evaluate local adaptive layers and re-slice the combined plan.\n\nSeparating color bodies does not by itself eliminate swaps. Check plate scheduling. Single-color plates can remove repeated color changes; by-layer printing of different-color objects together usually cannot. Use sequential object printing only when supported and its clearance constraints are satisfied. Batch copies only when the user wants them.\n\nUse the actual directional flushing matrix and filament compatibility. Purging clears previous material; priming restores consistent extrusion. Track those separately when the slicer does. Flushing into compatible infill or supports may reduce discarded material, but it does not remove switching time, has finite capacity, and can affect appearance or strength. Do not add unnecessary infill or objects merely to hide waste.\n\nCompare the same requested quantity and finish. Report total filament and time across all plates, plus purge, tower, and support quantities only where available without double counting. Unknown metrics remain unknown. Recommend the original multicolor approach when the user values its seamless result enough to justify its cost.";
|
|
15
15
|
export declare const FDM_ASSEMBLY = "Apply this guidance when a split, insert, or joint may materially improve the result.\n\nCompare assembly against the best practical one-piece approach, including reasonable supports. A split earns its place by improving important surfaces, layer strength, fit, color efficiency, support access, repairability, or bed fit enough to justify handling and joining the pieces. Prefer a one-piece solution when its support cleanup is easier than assembly and the alternatives meet the other important requirements comparably well. Respect an explicit one-piece or no-glue requirement.\n\nPut boundaries where they are structurally sensible and visually deliberate. Use shoulders, keys, overlapping faces, tabs, or pins to locate parts and resist sliding or rotation as appropriate. Include fit clearance, lead-ins, adhesive space where needed, and a feasible insertion path. Check the assembled geometry and the order of operations, not only the separated pieces. Avoid joints whose screws, clamps, or mating faces become inaccessible during assembly.\n\nFor suitable lightly loaded rigid details, a locating pocket plus a compatible adhesive can be the simplest reliable solution. For a loaded clamp, a joint under peel or repeated bending, or a serviceable assembly, consider fasteners or mechanically captured geometry. Do not assume a tiny glued butt joint can carry the same load as an intact printed section. Select adhesive from evidence for the actual materials and conditions; superglue is an option, not a universal material property.\n\nState the practical consequence directly: which parts print in which orientations and colors, how they locate, how they are retained, which supplies are needed, and the estimated hands-on work. Keep hands-on time separate from adhesive cure time. Check a small joint sample only when its uncertain fit or strength would change the design decision.\n\nPrinted threads need a profile made for printing, not a copy of a metal V-thread. A coarse, truncated thread whose flanks sit within the printer's proven overhang (one widely printed all-plastic kit uses about a 96-degree included angle, 42 degrees from vertical, at pitches of roughly 2-3 mm for M8-M12 sizes, cleared by roughly two tenths of a millimetre per side at the pitch line) prints upright without supports and keeps its teeth in solid wall loops. Keep the pitch exactly the same on screw and hole; make clearance by shifting the profile radially, never by scaling the screw, which changes the pitch and wedges after a few turns. Give a hand screw several full turns of engagement and a knob that limits how hard it can be torqued. A long, slender screw that must pull or bend is better printed flat or split so filament runs along its length than stood upright across its layers. Where preload must survive months, heat, or shock, or the size is below about M6-M8, use a metal screw or heat-set insert and say so. When the context supplies this printer's own thread fit observation, use it ahead of any generic allowance.";
|
|
16
16
|
export declare const FDM_AFTER_SLICE = "Review this slice against the user's brief and the selected manufacturing plan. Use the returned slice, geometry, profile, and calibration evidence; do not assume missing metrics are zero.\n\nCheck that the actual toolpaths preserve critical features, fit, connected material, intended colors, and load-bearing sections. Inspect consequential first layers, bridges, islands, supported undersides, and removal access. Compare expected total print time, total material across all plates, and manual work with the best credible alternative. Keep purge, prime-tower, support, and model quantities distinct only when the data provides a non-overlapping breakdown.\n\nIf the plan is unexpectedly costly or fragile, identify the dominant cause and make the smallest change that preserves the brief. Re-slice after a relevant geometry, orientation, material, or process change. Do not optimize a minor imperfection at the expense of function or appearance, and do not invent a redesign simply to produce criticism. Check every support, fit, and hold claim in the summary against a number from the slice or the engine's checks (support area and worst overhang, engagement and gap, estimated bite at the forced opening). A claim without its number comes out or is labelled a prediction.\n\nReturn a concise decision: keep, revise, or validate one specific uncertainty. Include the decisive evidence and the exact next action. A clean slice supports a printability prediction; it does not verify physical fit, strength, or bridge quality.";
|
|
17
|
-
export declare const FDM_FLEXURES = "Apply this guidance when a part must flex, grip, snap, clip, spring, or hold something by bending. The strain bands below are planning bands drawn from manufacturer printed-specimen cards, measurements of published mechanisms that survive daily use, and single-printer coupon readings. They are not guarantees and not rejection thresholds. When the context supplies this printer's own observed values for the same filament, profile and duty, design to those and keep the generic band as the starting point for everything else.\n\nA compliant design earns its place when one bending piece replaces rigid jaws, a hinge and a clamp bolt: fewer parts, nothing to buy or lose, one print, and a hold that follows the object as it varies. Prefer it for holders, clips, snaps, lids and latches a hand operates. Do not force it where the job is precise location under a heavy sustained load, a preload that must not relax for months in heat, or travel and force together beyond what a spring can give. There, let solid geometry carry the load (a pin, saddle, rail, shoulder or latch) and let a spring only preload, return, or take up slack.\n\nChoose the architecture before the dimensions. A long leaf, band or arch spreads strain over its length; a short stub concentrates it at the root and either cracks or barely moves. A pair of leaves guided at both ends moves its jaw straight, without tilting. Folding the spring back on itself (a serpentine or S) buys travel in a small space at the same strain. A thick curved arch gives a strong bite over a short opening. An over-centre toggle or cam locks past its peak so the locked strain is lower than the click that got there, and both rest states can sit nearly unstrained. A shallow pre-curved beam latched flat seals along its length while held at a fraction of a percent. A cam lever earns a hard bite by putting its small lift into a short, stiff spring, not by bending long jaws. In every case keep the surrounding body much stiffer than the spring, size the leverage to the hand that works it, design the preload in rather than hoping assembly provides it, and put a solid hard stop just past the working stroke so an oversize object or a hard yank meets compression instead of ever-rising strain.\n\nJudge bite at the opening the object actually forces, where the force is taken. The same clip is several times stiffer when a flat rigid object holds its jaws from turning than when a round finger lets them turn; one measured clip changed about fivefold between those contacts. Grip that must not slip is force times friction; feel and marking are pressure. A narrow ridge concentrates a modest force into a high pressure that seals, grips and, on skin, hurts; a broad flat jaw needs roughly an order of magnitude more force for the same pressure. State the opening, the contact you assumed, and the friction you used. Published dry static friction for printed PLA on itself spans roughly 0.12-0.38 (one printer read 0.25-0.31 on both faces) and PETG on itself roughly 0.13-0.21: use the low end when checking that a hold retains, the high end when checking that a hand can still insert it. Friction against the held object (a phone case, glass, paint) is unknown unless the context gives it; do not substitute the self-contact range for it.\n\nKeep the bending in the layer plane. Filament laid along the strained length carries the bend; a bend that pulls layers apart works at a fraction of that strength (across-layer tensile strength is roughly half to nine-tenths of in-plane depending on grade and test) and parts with little warning. Turn the part, split it, or reshape the spring so its length lies in the layers. If a bend across layers is truly unavoidable, keep its strain well below the in-plane bands, give it generous roots, and bring its hard stop close. Make the spring from continuous wall loops: choose its thickness as whole extrusion widths and enough walls that no sparse infill sits inside the neck. Taper toward the tip where travel allows, fillet every root or curve continuously through it, and never hang a spring from a sharp internal corner.\n\nChoose strain by duty first, then material. In the layer plane, as planning bands: held bent for months at room temperature, keep PLA to about 0.5% or less and PETG to about 1.4% or less, and prefer a shape whose rest state is unstrained so holding costs nothing; bent every day for hundreds to thousands of cycles, proven mechanisms commonly work at about 1.5-2.6% in PLA and about 2-3.4% in PETG; bent once to assemble, or touched only at the hard stop, PLA on one coupon-tested printer survived 3.3% once and ten times in both orientations without cracking, and proven PETG designs peak at about 4-4.3%. Treat those peaks as no-crack evidence, not proof of full spring-back: past roughly 3.3-3.4% PLA begins to whiten and take set in published printed-specimen testing, long before its published break elongation (about 12% in-plane for one current PLA grade), because break includes permanent deformation a spring cannot use. Older moulded-plastic snap allowances near 1-1.7% are not printed fracture limits; designing every spring to them produces weak, timid parts. Grade matters as much as polymer family: current cards put one PETG grade's tensile modulus near 2780 MPa and another's near 1810 MPa, so size force from the actual grade's card or an observed deflection (one printer's PLA measured about 2600 MPa, close to its 2580 MPa card), never from the family name alone.\n\nExpect, in order: a sharp root whitens, yields and takes set; a bend across layers delaminates; a held bend creeps and its force fades; only then does a well-shaped in-plane spring crack. Design so the first failure you would meet is harmless and visible, and so the hard stop prevents the rest.\n\nHeat changes the answer before it melts anything. PLA grades soften under load from roughly the mid-50s C (heat deflection about 54-57 C, glass transition about 60 C) and PETG grades from roughly the low 60s to about 70 C depending on grade and load (glass transition about 66-69 C); published creep tests already move faster after brief warming near 46 C. A sun-parked dashboard has been documented around 70 C within an hour. Judge by exposure and load together: a shaded, unloaded trim piece is not a loaded spring on a dashboard. For sun-exposed parts that must stay bent or carry load, neither PLA nor PETG is an honest default; prefer a higher-temperature filament the printer actually has, a rest state at zero strain while parked empty, and positive capture (lips, shelves, a latch) so friction alone never decides whether the object stays. Say plainly when the loaded filaments cannot do the thermal job instead of silently printing it anyway.\n\nIn the result, give the duty you designed for, how a hand operates it (where the fingers go and the force to open it at the tabs), the working and hard-stop strains and how you estimated them, the bite or spring force at the stated opening with its contact and friction assumptions, the rest strain, and the heat verdict. A force without its opening, or a strain without its duty, is not yet a claim.";
|
|
17
|
+
export declare const FDM_FLEXURES = "Apply this guidance when a part must flex, grip, snap, clip, spring, or hold something by bending. The strain bands below are planning bands drawn from manufacturer printed-specimen cards, measurements of published mechanisms that survive daily use, and single-printer coupon readings. They are not guarantees and not rejection thresholds. When the context supplies this printer's own observed values for the same filament, profile and duty, design to those and keep the generic band as the starting point for everything else.\n\nA compliant design earns its place when one bending piece replaces rigid jaws, a hinge and a clamp bolt: fewer parts, nothing to buy or lose, one print, and a hold that follows the object as it varies. Prefer it for holders, clips, snaps, lids and latches a hand operates, as the element that grips or latches, never in place of a joint, adjustment or base the bought versions have. Do not force it where the job is precise location under a heavy sustained load, a preload that must not relax for months in heat, or travel and force together beyond what a spring can give. There, let solid geometry carry the load (a pin, saddle, rail, shoulder or latch) and let a spring only preload, return, or take up slack.\n\nChoose the architecture before the dimensions. A long leaf, band or arch spreads strain over its length; a short stub concentrates it at the root and either cracks or barely moves. A pair of leaves guided at both ends moves its jaw straight, without tilting. Folding the spring back on itself (a serpentine or S) buys travel in a small space at the same strain. A thick curved arch gives a strong bite over a short opening. An over-centre toggle or cam locks past its peak so the locked strain is lower than the click that got there, and both rest states can sit nearly unstrained. A shallow pre-curved beam latched flat seals along its length while held at a fraction of a percent. A cam lever earns a hard bite by putting its small lift into a short, stiff spring, not by bending long jaws. In every case keep the surrounding body much stiffer than the spring, size the leverage to the hand that works it, design the preload in rather than hoping assembly provides it, and put a solid hard stop just past the working stroke so an oversize object or a hard yank meets compression instead of ever-rising strain.\n\nJudge bite at the opening the object actually forces, where the force is taken. The same clip is several times stiffer when a flat rigid object holds its jaws from turning than when a round finger lets them turn; one measured clip changed about fivefold between those contacts. Grip that must not slip is force times friction; feel and marking are pressure. A narrow ridge concentrates a modest force into a high pressure that seals, grips and, on skin, hurts; a broad flat jaw needs roughly an order of magnitude more force for the same pressure. State the opening, the contact you assumed, and the friction you used. Published dry static friction for printed PLA on itself spans roughly 0.12-0.38 (one printer read 0.25-0.31 on both faces) and PETG on itself roughly 0.13-0.21: use the low end when checking that a hold retains, the high end when checking that a hand can still insert it. Friction against the held object (a phone case, glass, paint) is unknown unless the context gives it; do not substitute the self-contact range for it.\n\nKeep the bending in the layer plane. Filament laid along the strained length carries the bend; a bend that pulls layers apart works at a fraction of that strength (across-layer tensile strength is roughly half to nine-tenths of in-plane depending on grade and test) and parts with little warning. Turn the part, split it, or reshape the spring so its length lies in the layers. If a bend across layers is truly unavoidable, keep its strain well below the in-plane bands, give it generous roots, and bring its hard stop close. Make the spring from continuous wall loops: choose its thickness as whole extrusion widths and enough walls that no sparse infill sits inside the neck. Taper toward the tip where travel allows, fillet every root or curve continuously through it, and never hang a spring from a sharp internal corner.\n\nChoose strain by duty first, then material. In the layer plane, as planning bands: held bent for months at room temperature, keep PLA to about 0.5% or less and PETG to about 1.4% or less, and prefer a shape whose rest state is unstrained so holding costs nothing; bent every day for hundreds to thousands of cycles, proven mechanisms commonly work at about 1.5-2.6% in PLA and about 2-3.4% in PETG; bent once to assemble, or touched only at the hard stop, PLA on one coupon-tested printer survived 3.3% once and ten times in both orientations without cracking, and proven PETG designs peak at about 4-4.3%. Treat those peaks as no-crack evidence, not proof of full spring-back: past roughly 3.3-3.4% PLA begins to whiten and take set in published printed-specimen testing, long before its published break elongation (about 12% in-plane for one current PLA grade), because break includes permanent deformation a spring cannot use. Older moulded-plastic snap allowances near 1-1.7% are not printed fracture limits; designing every spring to them produces weak, timid parts. Grade matters as much as polymer family: current cards put one PETG grade's tensile modulus near 2780 MPa and another's near 1810 MPa, so size force from the actual grade's card or an observed deflection (one printer's PLA measured about 2600 MPa, close to its 2580 MPa card), never from the family name alone.\n\nExpect, in order: a sharp root whitens, yields and takes set; a bend across layers delaminates; a held bend creeps and its force fades; only then does a well-shaped in-plane spring crack. Design so the first failure you would meet is harmless and visible, and so the hard stop prevents the rest.\n\nHeat changes the answer before it melts anything. PLA grades soften under load from roughly the mid-50s C (heat deflection about 54-57 C, glass transition about 60 C) and PETG grades from roughly the low 60s to about 70 C depending on grade and load (glass transition about 66-69 C); published creep tests already move faster after brief warming near 46 C. A sun-parked dashboard has been documented around 70 C within an hour. Judge by exposure and load together: a shaded, unloaded trim piece is not a loaded spring on a dashboard. For sun-exposed parts that must stay bent or carry load, neither PLA nor PETG is an honest default; prefer a higher-temperature filament the printer actually has, a rest state at zero strain while parked empty, and positive capture (lips, shelves, a latch) so friction alone never decides whether the object stays. Say plainly when the loaded filaments cannot do the thermal job instead of silently printing it anyway.\n\nIn the result, give the duty you designed for, how a hand operates it (where the fingers go and the force to open it at the tabs), the working and hard-stop strains and how you estimated them, the bite or spring force at the stated opening with its contact and friction assumptions, the rest strain, and the heat verdict. A force without its opening, or a strain without its duty, is not yet a claim.";
|
|
18
18
|
export declare const FDM_CAPABILITY_GUIDANCE = "# Bridges and overhangs: useful capability without arbitrary bans\n\nLoad this reference only when the feature matters to the manufacturing decision. These are proposed planning bands, not manufacturer guarantees, support-generation settings, or automatic acceptance/rejection rules.\n\n## Scope and terminology\n\nThe provisional baseline is an ordinary modern Bambu P-series-class FDM setup, a 0.4 mm nozzle, a suitable PLA profile, normal planar toolpaths, and effective part cooling. Actual printer/material/profile evidence takes priority. Do not transfer the same expectations unchanged to PETG, flexible materials, a different layer height, or a different cooling arrangement.\n\nAngles in the proposed review bands are measured **from vertical**: a vertical wall is 0 degrees; a horizontal underside is 90 degrees. Source values retain their stated or unresolved convention as noted. Slicer controls and test models can use a different convention. Establish their convention before comparing or entering a value. For a simple planar slope, the angle from the build plate is 90 degrees minus the angle from vertical.\n\nAn overhang grows sideways from material below. A conventional bridge has extruded paths anchored at both ends. A disconnected island begins with no suitable underlying material or anchorage. They require different decisions.\n\n## What the retrieved evidence establishes\n\n- Prusa's current modeling documentation gives a general 45\u201360 degree range depending on nozzle/settings, and describes up to 75 degrees for its specifically named Nextruder/360-degree-cooling machines. That is evidence against a universal 45-degree limit. It does not certify 75 degrees on every Bambu printer. [C1]\n- A Fab Academy 2026 hands-on comparison of Bambu P2S and H2S used matte-white PLA and reported 50 mm unsupported bridge strands without a visible problem. It also reported some drooping above 60 degrees on the overhang test. This is a useful documented result on particular geometry, not a population benchmark or proof of flat mating-surface accuracy. [C2]\n- An MIT HTMAA 2025 P1S characterization reported no noticeable defects on its longest tested bridge, 20 mm, and explicitly left the actual maximum unmeasured. A largest passing sample is not the machine's limit. [C3]\n- Bambu's PETG Basic V3.0 data sheet lists approximately 30 mm maximum bridging length and approximately 70 degrees maximum overhang; its PLA Tough+ V3.0 sheet lists 30 mm and 55 degrees. These are material-specific reference values. The retrieved sheets do not define the overhang angle convention or a bridge sag/finish acceptance criterion, so keep the angle values as reported rather than silently normalizing them. Do not assume the mechanical-specimen print conditions also describe these feature tests. [C4, C5]\n\nThe material sheets provide useful 30 mm reference points; the firsthand longer prints show why a published or configured maximum should not become a universal geometric prohibition. Filament formulation matters. Avoid a rule that all PLA must outperform all PETG.\n\n## Proposed review bands\n\nThese bands decide how much attention to give a feature. They never force a flat design, a split, supports, or a calibration print by themselves.\n\n| Feature on the provisional PLA setup | Working stance |\n| --- | --- |\n| Progressively supported overhang around 45\u201360 degrees | Keep an unsupported version as an ordinary candidate. Inspect local curvature, overlap, cooling, and required finish. |\n| Overhang around 60\u201370 degrees | Retain the shape as a candidate; examine local layer height, geometry, cooling, and relevant prior results more closely. Modest support is also an ordinary option. |\n| Overhang around 70 degrees or more | Require a stronger process/geometry justification to rely on a clean unsupported result. Consider a representative sample when its result would decide between substantially different plans. |\n| Conventional bridge up to about 20 mm | Treat as a plausible ordinary candidate when anchors, toolpaths, and underside requirements are suitable. |\n| Bridge roughly 20\u201350 mm | Keep bridging as a real design option. Pay more attention to actual unsupported path length, anchorage, width, cooling, and sag acceptance. |\n| Bridge beyond about 50 mm | Keep it in the design space; seek relevant prior evidence or a small representative test before depending on its quality for an expensive or precise part. |\n\nThe 60\u201370-degree and 20\u201350-mm bands are deliberate engineering priors for this app. They are not claims that a manufacturer has validated the whole interval. A 12 mm bridge can be unacceptable for a tight sliding surface; a much longer one may be adequate above a noncritical cavity. Avoid turning these bands into a hidden `max_bridge` or `max_overhang` rejection threshold.\n\n## A useful geometric check\n\nFor an idealized straight overhang at angle alpha from vertical, layer height h produces a lateral step:\n\n`step = h * tan(alpha)`\n\nUsing a nominal extrusion width w, a simple projected overlap estimate is:\n\n`overlap_fraction = max(0, 1 - step / w)`\n\nFor a 60-degree overhang and a 0.45 mm line width:\n\n| Layer height | Lateral step | Nominal overlap |\n| --- | --- | --- |\n| 0.20 mm | 0.346 mm | About 23% |\n| 0.12 mm | 0.208 mm | About 54% |\n\nThese values follow from geometry, not a printer test. The model omits bead shape, curved toolpaths, cooling, adhesion, and other effects. It explains why layer height can change the outlook; it cannot prove a print will succeed. Use the actual extrusion widths when known.\n\nOrdinary overhang-layer reasoning does not prescribe the best bridge extrusion. OrcaSlicer's documented thick-bridge mode uses a line height equal to nozzle diameter and trades a rougher surface for stronger, more reliable bridges and potentially longer spans. Inspect the actual selected mode instead of assuming bridge height equals ordinary layer height. [C6]\n\nReducing layer height throughout a multicolor part can also increase the number of color-change layers. Prefer a local intervention when appropriate and re-slice the whole manufacturing plan to see the tradeoff.\n\n## Local interventions to consider\n\nKeep the intervention proportionate to the specific problem. Useful candidates include changing build orientation, adjusting only a hidden underside, replacing the top of a horizontal hole with a suitable printable roof while preserving its necessary clearance, using local adaptive layers, improving a bridge's anchors or extrusion direction, adding a small removable sacrificial feature, placing accessible support, or splitting at a sensible joint.\n\nPreserve roundness where a mating shaft genuinely needs it. Preserve curves where they matter visually. An unremovable support inside a duct is not a valid plan. Do not trade away layer bonding to improve cooling without considering the part's mechanical job.\n\nTreat the slicer's support-generation thresholds as policy settings, not measured capability. For example, OrcaSlicer's `max_bridge_length` decides which anchored spans tree supports leave unsupported. Its configured value does not establish what the machine can physically bridge. [C7]\n\n## What to learn from physical prints\n\nRecord the feature and its conditions, not merely a global pass/fail label. Useful evidence includes:\n\n- Largest tested span or angle, plus known failures and untested regions.\n- Actual printer, filament identity, nozzle, layer/line profile, cooling, and build orientation.\n- Bridge direction, width, anchors, and nearby geometry.\n- Whether the criterion was survival, cosmetic quality, measured sag, fit, or load performance.\n\nA small combined coupon at onboarding can complement the printed measuring tool, but it should be optional. Later, print a targeted sample when an important unknown would otherwise put a much larger print at risk. Routine geometry should not repeatedly trigger calibration work.\n\n## Primary sources\n\n[C1] Prusa, Modeling with 3D printing in mind:\n\nhttps://help.prusa3d.com/article/modeling-with-3d-printing-in-mind_164135\n\n[C2] FabLab Nagoya, Fab Academy 2026 Week 05, firsthand P2S/H2S characterization:\n\nhttps://fabacademy.org/2026/labs/nagoya/assignments/week05/\n\n[C3] Ryan Hoffman, MIT HTMAA 2025, firsthand P1S characterization:\n\nhttps://fab.cba.mit.edu/classes/863.25/people/RyanHoffman/week3.html\n\n[C4] Bambu PETG Basic Technical Data Sheet V3.0:\n\nhttps://store.bblcdn.com/s1/default/cb94589bf7994fdcbfa833badefae9cd/Bambu_PETG_Basic_Technical_Data_Sheet.pdf\n\n[C5] Bambu PLA Tough+ Technical Data Sheet V3.0:\n\nhttps://store.bblcdn.com/s7/default/80a85371db2e40bda97069d283fed76c/BambuPLA_Tough_TechnicalData_Sheet_%282%29.pdf\n\n[C6] OrcaSlicer bridge settings:\n\nhttps://github.com/OrcaSlicer/OrcaSlicer/wiki/quality_settings_bridging\n\n[C7] OrcaSlicer advanced support settings:\n\nhttps://github.com/OrcaSlicer/OrcaSlicer/wiki/support_settings_advanced\n\nAll sources inspected 3 November 2026.";
|
|
19
19
|
export declare const FDM_CAPABILITY_URI = "guidance://fdm/capability-guidance";
|
|
20
20
|
export declare const FDM_CAPABILITY_RESOURCE: {
|
package/dist/design-guidance.js
CHANGED
|
@@ -16,15 +16,17 @@ Find out before you design, and before you ask. Research whenever the request na
|
|
|
16
16
|
6. For what is still unknown after about two rounds per fact, shape the design so that fact does not decide whether it works (an adjustable or sprung interface, a foot that suits more than one surface), or state a bounded assumption as an assumption. Ask the person only as the last resort, one short question, and only for what exists nowhere but with them. Never ask for something a search answers: a photo of their car's dashboard, the size of a named product, what a named surface is made of.
|
|
17
17
|
Without web tools, say so in the result, use what you recall labelled as recalled rather than published, and lean harder on step 6.
|
|
18
18
|
|
|
19
|
+
Before choosing a mechanism, establish what every working bought or published version of the thing has, and keep all of it. For example, a car phone holder turns and tilts to face the driver; a mount's base is sized by the moment of what it holds, not just its weight; an adhesive mount uses a full pad of the tape's grade, not a strip, on a surface the tape suits. Start from the complete product a capable designer would describe at once, then make it printable. A design that leaves out a feature they all have says what it lost and why that is acceptable for this person.
|
|
20
|
+
|
|
19
21
|
Choose each fit by what that interface has to do: drop in and lift out, slide, locate without rattle, grip so it does not slip or turn, snap over, or press in to stay. There is no single fit number. Keep three things apart for each interface: the object's size and how sure it is, the correction this printer and orientation need (its own observed corrections first, when the context supplies them), and the fit the function calls for. When the size's uncertainty is wider than the function tolerates, do not answer with a better number: choose a mechanism that absorbs the difference (crush ribs, a split closed by a screw, a flexure, a snap), or ask for the one measurement that settles it. The same object changes with time and use: full and nearly empty, new and worn, soft and stiff. A fit that relies on the object giving way must still work in its stiffest, largest state, and a pocket is sized to the widest section the object passes through on the way in, with support where the object actually bears, not to its bounding box.
|
|
20
22
|
|
|
21
23
|
Evaluate printability locally. Distinguish a progressively supported overhang, a bridge anchored at both ends, and a disconnected island. State overhang angles from vertical: 0 degrees is a vertical wall; 90 degrees is a horizontal underside. Convert conventions before setting slicer angles. Use relevant measured capability ahead of generic rules. A 45-degree threshold is not a universal support requirement, and a steep surface is not automatically unprintable. Judge bridge length along the actual unsupported extrusion path, with its anchors, cooling, material, and required underside quality. A feature that survives printing may still miss a cosmetic or dimensional requirement.
|
|
22
24
|
|
|
23
25
|
Resolve a difficult region with the least disruptive effective change: a better orientation, local geometry, suitable process settings, accessible support, a deliberate breakaway feature, or a split. Supports are an ordinary manufacturing option. Preserve attractive curves and useful complexity when modest support or cleanup achieves them. Check support removal and tool access, especially inside cavities. Avoid changing the whole object to solve a local problem.
|
|
24
26
|
|
|
25
|
-
Choose layer orientation, material, walls, and joints for the actual loads and environment. Check the load path, flexing features, fastener access, and installation sequence. A reduction in supports or color changes must not silently weaken the part or defeat its fit.
|
|
27
|
+
Choose layer orientation, material, walls, and joints for the actual loads and environment. Check the load path, flexing features, fastener access, and installation sequence. Judge a connection (tape, screws, a snap) against products that demonstrably work. If a check says a bought product that holds for years would fail, the check is wrong: correct it, then apply it to your design. A reduction in supports or color changes must not silently weaken the part or defeat its fit.
|
|
26
28
|
|
|
27
|
-
When a part must flex, grip, snap, clip, spring, or hold something, consider a compliant mechanism first: one piece that bends on purpose often beats rigid jaws plus a clamp bolt, with fewer parts, no fastener to buy or lose, and a hold that follows the object. Spread the bending over a long band, leaf, or arch rather than a short stub; keep the rest of the body stiff so the stroke goes where you intend; give a hand enough leverage; design the preload in; use an over-centre or cam where a hold must lock; and give every flexing direction a hard stop so a hard pull meets solid material. Keep the bending in the layer plane, where the filament runs along the strain; bending that pulls layers apart is far weaker and fails with little warning. Choose the strain by duty (bent once to assemble, bent every day, and held bent for months are different designs) and by material and direction, using the printer's own observed values when the context supplies them. Modern PLA and PETG grades are not brittle in this role: proven printed springs work daily at strains that older moulded-plastic tables would forbid. What usually ends a flexure is not a clean snap at a magic percentage but whitening and set at a sharp root, layers parting where the bend crosses them, or a held bend creeping loose, faster when warm. In sustained heat such as a parked car, a part held bent relaxes and a sun-heated dashboard can exceed what PLA or PETG carry under load: prefer a rest state that sits unstrained, and say so when the material cannot honestly do the job. A part a hand works has to be easy to work, and that is checked like its hold: say where the fingers go, how hard they push to open it, how far it opens, and how the object goes in and comes out with one hand. A grip that meets its force and is a fight to use has failed the brief.
|
|
29
|
+
When a part must flex, grip, snap, clip, spring, or hold something, consider a compliant mechanism first: one piece that bends on purpose often beats rigid jaws plus a clamp bolt, with fewer parts, no fastener to buy or lose, and a hold that follows the object. That choice is for the element that grips, clips or springs, not for the product: it is never a reason to make the whole thing one piece or to drop a joint, adjustment or base the bought versions have. Spread the bending over a long band, leaf, or arch rather than a short stub; keep the rest of the body stiff so the stroke goes where you intend; give a hand enough leverage; design the preload in; use an over-centre or cam where a hold must lock; and give every flexing direction a hard stop so a hard pull meets solid material. Keep the bending in the layer plane, where the filament runs along the strain; bending that pulls layers apart is far weaker and fails with little warning. Choose the strain by duty (bent once to assemble, bent every day, and held bent for months are different designs) and by material and direction, using the printer's own observed values when the context supplies them. Modern PLA and PETG grades are not brittle in this role: proven printed springs work daily at strains that older moulded-plastic tables would forbid. What usually ends a flexure is not a clean snap at a magic percentage but whitening and set at a sharp root, layers parting where the bend crosses them, or a held bend creeping loose, faster when warm. In sustained heat such as a parked car, a part held bent relaxes and a sun-heated dashboard can exceed what PLA or PETG carry under load: prefer a rest state that sits unstrained, and say so when the material cannot honestly do the job. A part a hand works has to be easy to work, and that is checked like its hold: say where the fingers go, how hard they push to open it, how far it opens, and how the object goes in and comes out with one hand. A grip that meets its force and is a fight to use has failed the brief.
|
|
28
30
|
|
|
29
31
|
On a shared-nozzle multicolor setup, reason about filament transitions across layers, including support-interface material. Total color count alone is a poor cost estimate. Consider color placement, shallow inlays, separately printed accents, and part orientation while preserving the requested appearance. Separate bodies on one layer-printed plate can still cause repeated swaps. Use the slicer's actual schedule and estimates when available; do not invent a fixed cost per color change.
|
|
30
32
|
|
|
@@ -64,7 +66,7 @@ If the plan is unexpectedly costly or fragile, identify the dominant cause and m
|
|
|
64
66
|
Return a concise decision: keep, revise, or validate one specific uncertainty. Include the decisive evidence and the exact next action. A clean slice supports a printability prediction; it does not verify physical fit, strength, or bridge quality.`;
|
|
65
67
|
export const FDM_FLEXURES = `Apply this guidance when a part must flex, grip, snap, clip, spring, or hold something by bending. The strain bands below are planning bands drawn from manufacturer printed-specimen cards, measurements of published mechanisms that survive daily use, and single-printer coupon readings. They are not guarantees and not rejection thresholds. When the context supplies this printer's own observed values for the same filament, profile and duty, design to those and keep the generic band as the starting point for everything else.
|
|
66
68
|
|
|
67
|
-
A compliant design earns its place when one bending piece replaces rigid jaws, a hinge and a clamp bolt: fewer parts, nothing to buy or lose, one print, and a hold that follows the object as it varies. Prefer it for holders, clips, snaps, lids and latches a hand operates. Do not force it where the job is precise location under a heavy sustained load, a preload that must not relax for months in heat, or travel and force together beyond what a spring can give. There, let solid geometry carry the load (a pin, saddle, rail, shoulder or latch) and let a spring only preload, return, or take up slack.
|
|
69
|
+
A compliant design earns its place when one bending piece replaces rigid jaws, a hinge and a clamp bolt: fewer parts, nothing to buy or lose, one print, and a hold that follows the object as it varies. Prefer it for holders, clips, snaps, lids and latches a hand operates, as the element that grips or latches, never in place of a joint, adjustment or base the bought versions have. Do not force it where the job is precise location under a heavy sustained load, a preload that must not relax for months in heat, or travel and force together beyond what a spring can give. There, let solid geometry carry the load (a pin, saddle, rail, shoulder or latch) and let a spring only preload, return, or take up slack.
|
|
68
70
|
|
|
69
71
|
Choose the architecture before the dimensions. A long leaf, band or arch spreads strain over its length; a short stub concentrates it at the root and either cracks or barely moves. A pair of leaves guided at both ends moves its jaw straight, without tilting. Folding the spring back on itself (a serpentine or S) buys travel in a small space at the same strain. A thick curved arch gives a strong bite over a short opening. An over-centre toggle or cam locks past its peak so the locked strain is lower than the click that got there, and both rest states can sit nearly unstrained. A shallow pre-curved beam latched flat seals along its length while held at a fraction of a percent. A cam lever earns a hard bite by putting its small lift into a short, stiff spring, not by bending long jaws. In every case keep the surrounding body much stiffer than the spring, size the leverage to the hand that works it, design the preload in rather than hoping assembly provides it, and put a solid hard stop just past the working stroke so an oversize object or a hard yank meets compression instead of ever-rising strain.
|
|
70
72
|
|
package/package.json
CHANGED
package/src/cad/contracts.ts
CHANGED
|
@@ -110,7 +110,7 @@ export const CAD_TOOLS = [
|
|
|
110
110
|
{
|
|
111
111
|
name: "cad_run",
|
|
112
112
|
description:
|
|
113
|
-
"Build parametric CAD headlessly in OS confinement. Read cad_design first: declare literal P = {...} and build() returning a build123d Shape. Supply script OR script_path; parameters overrides saved named values in one call before derived dimensions. Calls wait for the environment’s exclusive execution slot up to their own deadline and report queue_wait_ms. Each call creates a private immutable subfolder under allowed output_dir, never overwriting previous artifacts. The saved .py and .parameters.json are the recovery checkpoint even after cancellation. Returns independently measured geometry, STL/STEP, six renders and a contact sheet; valid geometry is
|
|
113
|
+
"Build parametric CAD headlessly in OS confinement. Read cad_design first: declare literal P = {...} and build() returning a build123d Shape. Supply script OR script_path; parameters overrides saved named values in one call before derived dimensions. Calls wait for the environment’s exclusive execution slot up to their own deadline and report queue_wait_ms. Each call creates a private immutable subfolder under allowed output_dir, never overwriting previous artifacts. The saved .py and .parameters.json are the recovery checkpoint even after cancellation. Returns independently measured geometry, STL/STEP, six renders and a contact sheet, the closest approach between every pair of solids (bodies), problems, and what was checked and not checked; valid means only that the exported geometry is sound, never that the part fits, holds, moves or prints.",
|
|
114
114
|
inputSchema: {
|
|
115
115
|
type: "object" as const,
|
|
116
116
|
properties: {
|
|
@@ -208,6 +208,19 @@ export const CAD_TOOLS = [
|
|
|
208
208
|
type: "object",
|
|
209
209
|
additionalProperties: { type: ["boolean", "null"] },
|
|
210
210
|
},
|
|
211
|
+
bodies: {
|
|
212
|
+
type: "object",
|
|
213
|
+
description:
|
|
214
|
+
"Solid mode: near pairs of solids screened on tessellations and measured exactly on the STEP where the screen cannot clear them, against a print-in-place clearance from P.print_in_place_clearance_mm or 0.3 mm (touching or overlap only when P.print_in_place is false); touching or overlapping pairs, pairs under the clearance, pairs only screened, solids below the print plate (Z = 0) or above it with no solid under them that reaches it, and labelled bodies that are not exactly one solid.",
|
|
215
|
+
},
|
|
216
|
+
problems: {
|
|
217
|
+
type: "array",
|
|
218
|
+
items: { type: "string" },
|
|
219
|
+
description:
|
|
220
|
+
"Defects found by the checks that valid does not cover (fused or too-close bodies, a severed body, a solid below the plate or starting in mid-air, pairs not measured). Each kind lists up to eight, then a count of the rest. Empty when none were found, which is not a pass on anything listed in not_checked.",
|
|
221
|
+
},
|
|
222
|
+
checked: { type: "array", items: { type: "string" } },
|
|
223
|
+
not_checked: { type: "array", items: { type: "string" } },
|
|
211
224
|
renders: { type: "object", additionalProperties: { type: "string" } },
|
|
212
225
|
seconds: { type: "number" },
|
|
213
226
|
},
|
|
@@ -307,13 +320,14 @@ export const CAD_DESIGN_PROMPT = {
|
|
|
307
320
|
description:
|
|
308
321
|
"MCP-owned rules for headless build123d designs and one-call parameter revisions.",
|
|
309
322
|
text: `Use code-CAD for dimensioned functional designs and parameter edits. Build in millimetres with build123d 0.13.0; the MCP owns the Python environment, execution, export, validation and rendering. Check cad_status and use cad_setup with install: true when needed. No Blender, Fusion, network or printer access is available to your script.
|
|
310
|
-
Declare exactly one top-level P = {...} dictionary of JSON-compatible literal named parameters. Put every functional dimension in P; derive geometry from P. Define build() to return a build123d Shape or Compound of disjoint solid parts. Do not put construction or exports in a __main__ block: cad_run calls build() and exports the result. Imports, functions and derived P entries are fine. Parameters are applied to the literal defaults before derived expressions execute. For solid designs without inputs, the script and parameters file alone reconstruct it. For input-dependent designs, declare inputs as an array of {name, path} files: cad_run snapshots only those allowed files, exposes INPUTS[alias] to your script, and saves an inputs manifest. Retain the snapshots too for recovery; subsequent script_path edits reuse them unless inputs is explicitly supplied. No other personal files are readable. For a mesh-only experiment use mode: "mesh" and return a trimesh.Trimesh from build(); it exports and checks STL plus six renders, with step: null and an explicit reason. It does not manufacture a fake parametric STEP or promise scan-cleanup capability.
|
|
323
|
+
Declare exactly one top-level P = {...} dictionary of JSON-compatible literal named parameters. Put every functional dimension in P; derive geometry from P. Define build() to return a build123d Shape or Compound of disjoint solid parts. When a design has separate bodies (print-in-place parts, a captive wheel, links of a fabric), return Compound(children=[...]) with a label on each body: cad_run then checks that each labelled body is exactly one solid, so a piece cut off one body cannot hide behind two bodies fused into one. Near pairs of solids are screened and, where the screen cannot clear them, measured exactly against P["print_in_place_clearance_mm"] when you declare it, else 0.3 mm. If the bodies are shown assembled rather than printed in place (a shaft in its hole at a fit clearance), set P["print_in_place"] = False: only touching or overlap is then a problem. Export in print orientation with the plate at Z = 0: a solid below it, or above it with nothing under it that reaches it, is a problem. Do not put construction or exports in a __main__ block: cad_run calls build() and exports the result. Imports, functions and derived P entries are fine. Parameters are applied to the literal defaults before derived expressions execute. For solid designs without inputs, the script and parameters file alone reconstruct it. For input-dependent designs, declare inputs as an array of {name, path} files: cad_run snapshots only those allowed files, exposes INPUTS[alias] to your script, and saves an inputs manifest. Retain the snapshots too for recovery; subsequent script_path edits reuse them unless inputs is explicitly supplied. No other personal files are readable. For a mesh-only experiment use mode: "mesh" and return a trimesh.Trimesh from build(); it exports and checks STL plus six renders, with step: null and an explicit reason. It does not manufacture a fake parametric STEP or promise scan-cleanup capability.
|
|
311
324
|
Call cad_run with script, output_dir and a plain name. It saves <name>.py and <name>.parameters.json before running, then exports <name>.stl and <name>.step in a fresh subfolder. For an edit, one cad_run with script_path pointing to the earlier .py, parameters containing just the changed dimension, output_dir and name regenerates it without resending the script. Existing parameter values are retained; unknown names and type changes are refused. A killed run can be retried from its checkpoint in a new workspace; mutations are never replayed automatically.
|
|
312
325
|
Captured mesh preparation: load_scan(name, source_units="m" or "mm", up_axis="x"|"-x"|"y"|"-y"|"z"|"-z", ground=True) is provided to build(). Name must be a declared input. Declare source units and the object's usage-up axis explicitly: the helper converts metres to millimetres, applies a rigid up-axis rotation and translates the lowest Z to zero; it never guesses scale or fits to calipers. Geometry/texture references must be declared inputs too; snapshots preserve distinct original filenames. Exports must be millimetres, Z up, in the orientation the object is used.
|
|
313
326
|
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.
|
|
314
327
|
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.
|
|
315
328
|
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.
|
|
316
|
-
|
|
329
|
+
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.
|
|
330
|
+
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) and contact sheet. Fix every entry in problems before selecting a result; an empty problems list proves nothing listed in not_checked. Inspect all six; revise visible defects. 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.
|
|
317
331
|
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.
|
|
318
332
|
Check insertion and articulated poses with cad_check_fit against each object state that matters (the bare product, the product in its case, and the case with its attachment as its own reference envelope), including the widest section on the way in. Report interference and minimum gap per state. In your summary, attach each "fits", "holds", and "prints without supports" claim to the check or slice number that shows it; a valid flag alone shows none of them. Apply fdm_design and fdm_slicing too, with fdm_fit and fdm_flexures when they apply; never invoke a printer as part of constructing CAD.`,
|
|
319
333
|
};
|
package/src/cad/geometry.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Independent geometry checks, six orthographic views and triangle-exact surface separation."""
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
import json
|
|
3
4
|
import math
|
|
4
5
|
import numpy as np
|
|
5
6
|
import trimesh
|
|
@@ -31,13 +32,216 @@ def inspect(request):
|
|
|
31
32
|
checks = {'watertight': bool(m.is_watertight), 'winding_consistent': bool(m.is_winding_consistent), 'positive_volume': bool(m.is_volume),
|
|
32
33
|
'manifold': mm.status() == mf.Error.NoError, 'step_valid': bool(step.is_valid) if step is not None else None,
|
|
33
34
|
'stl_step_bounds_agree': bool(np.max(np.abs(m.bounds - np.array(step_bounds))) <= 0.2) if step_bounds is not None else None}
|
|
35
|
+
try:
|
|
36
|
+
assembly = bodies(step, request) if step is not None else None
|
|
37
|
+
except Exception as e: # a failed measurement must not cost the person the export; it is reported, not passed
|
|
38
|
+
assembly = {'error': f'{type(e).__name__}: {e}'[:300]}
|
|
34
39
|
return {'valid': all(v for v in checks.values() if v is not None), 'units': 'mm', 'bounds_mm': bounds,
|
|
35
40
|
'size_mm': m.extents.tolist(), 'volume_mm3': float(m.volume) if m.is_volume else None,
|
|
36
41
|
'step_volume_mm3': float(step.volume) if step is not None else None, 'solid_count': len(step.solids()) if step is not None else len(m.split(only_watertight=True)),
|
|
37
42
|
'mesh_components': len(m.split(only_watertight=False)), 'checks': checks,
|
|
43
|
+
**evidence(assembly),
|
|
38
44
|
'renders': render(m, base.parent / (base.name + '.renders'))}
|
|
39
45
|
|
|
40
46
|
|
|
47
|
+
# Starting print-in-place gap between separate bodies: Prusa's first value for movable parts is "at least 0.3 mm"
|
|
48
|
+
# (design guidance, fdm_fit [F3]). A script sets its own with a literal P["print_in_place_clearance_mm"], and says
|
|
49
|
+
# its bodies are shown assembled (not printed in place) with P["print_in_place"] = False.
|
|
50
|
+
PIP_CLEARANCE_MM = 0.3
|
|
51
|
+
BED_TOLERANCE_MM = 0.05
|
|
52
|
+
SCREEN_ANGLE = 0.1 # tessellation angular deflection (radians) for the gap screen
|
|
53
|
+
EXACT_CAP = 32 # exact B-rep distance calls per result
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def clearance_setting(request):
|
|
57
|
+
try:
|
|
58
|
+
params = json.loads(Path(request['parameters']).read_text()) if request.get('parameters') else {}
|
|
59
|
+
except (OSError, ValueError):
|
|
60
|
+
params = {}
|
|
61
|
+
params = params if isinstance(params, dict) else {}
|
|
62
|
+
value = params.get('print_in_place_clearance_mm')
|
|
63
|
+
in_place = params.get('print_in_place', True) is not False
|
|
64
|
+
if isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) and 0 <= value <= 10:
|
|
65
|
+
return float(value), 'P["print_in_place_clearance_mm"]', in_place
|
|
66
|
+
return PIP_CLEARANCE_MM, 'default: Prusa\'s "at least 0.3 mm" for movable parts (fdm_fit)', in_place
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def bodies(step, request, budget_s=20.0):
|
|
70
|
+
"""Every pair of solids in the exported STEP: closest approach (screened on tessellations, measured exactly on the
|
|
71
|
+
B-rep for every pair the screen cannot clear), overlap, whether each labelled body the script returned is still one
|
|
72
|
+
solid, and whether each solid stands on the print plate (Z = 0) or on a solid that does. Council 2026-11-11
|
|
73
|
+
(scan-to-make #734): chainmail links fused at 48 interfaces, a pawl grazing its wheel while a severed bar kept the
|
|
74
|
+
solid count right, discs starting in mid-air, all with valid: true."""
|
|
75
|
+
import time
|
|
76
|
+
from build123d import Compound
|
|
77
|
+
clearance, source, in_place = clearance_setting(request)
|
|
78
|
+
started = time.monotonic()
|
|
79
|
+
over = lambda: time.monotonic() - started > budget_s
|
|
80
|
+
# Declared bodies: the top-level children of a returned Compound, named by their labels.
|
|
81
|
+
declared, names = [], []
|
|
82
|
+
children = list(step.children) if isinstance(step, Compound) else []
|
|
83
|
+
# STEP import names an unlabelled shape after its type ("SOLID", "COMPOUND"): only the script's own labels declare
|
|
84
|
+
labelled = lambda c: bool(c.label) and c.label != type(c).__name__.upper() and c.label.upper() not in ('SOLID', 'COMPOUND', 'COMPSOLID', 'SHELL')
|
|
85
|
+
if children and all(labelled(c) for c in children):
|
|
86
|
+
for child in children:
|
|
87
|
+
pieces = child.solids()
|
|
88
|
+
declared.append({'body': child.label, 'solids': len(pieces)})
|
|
89
|
+
names += [child.label if len(pieces) == 1 else f'{child.label} piece {k + 1}' for k in range(len(pieces))]
|
|
90
|
+
solids = [s for c in children for s in c.solids()]
|
|
91
|
+
else:
|
|
92
|
+
solids = list(step.solids())
|
|
93
|
+
names = [f'solid {k + 1}' for k in range(len(solids))]
|
|
94
|
+
boxes = [s.bounding_box() for s in solids]
|
|
95
|
+
r3 = lambda v: [round(v[0], 3), round(v[1], 3), round(v[2], 3)]
|
|
96
|
+
mid = lambda pa, pb: r3(((pa.X + pb.X) / 2, (pa.Y + pb.Y) / 2, (pa.Z + pb.Z) / 2))
|
|
97
|
+
# The screen's error on a curved face is its chord sag, at most R a^2 / 8 per surface for angular deflection a; R is
|
|
98
|
+
# bounded by half the pair's larger box diagonal. Every pair the screen reads within the clearance + 0.2 mm + that
|
|
99
|
+
# sag is measured exactly on the B-rep.
|
|
100
|
+
sag = lambda i: (boxes[i].diagonal / 2) * SCREEN_ANGLE ** 2 / 8
|
|
101
|
+
window = lambda i, j: clearance + 0.2 + sag(i) + sag(j)
|
|
102
|
+
def solid_manifold(s):
|
|
103
|
+
v, f = s.tessellate(0.01, SCREEN_ANGLE)
|
|
104
|
+
t = trimesh.Trimesh(np.array([[p.X, p.Y, p.Z] for p in v], dtype=float), np.array(f, dtype=np.int64), process=True)
|
|
105
|
+
t.merge_vertices()
|
|
106
|
+
return manifold(t)
|
|
107
|
+
meshes = [None] * len(solids)
|
|
108
|
+
rows, unmeasured, errors, exact_calls, screened_only = [], [], [], 0, 0
|
|
109
|
+
near_pairs = [] # (i, j, gap) for every pair within its window: what rests on what
|
|
110
|
+
for i in range(len(solids)):
|
|
111
|
+
for j in range(i + 1, len(solids)):
|
|
112
|
+
a, b = boxes[i], boxes[j]
|
|
113
|
+
gap = math.sqrt(sum(max(0.0, lo2 - hi1, lo1 - hi2) ** 2 for lo1, hi1, lo2, hi2 in
|
|
114
|
+
((a.min.X, a.max.X, b.min.X, b.max.X), (a.min.Y, a.max.Y, b.min.Y, b.max.Y), (a.min.Z, a.max.Z, b.min.Z, b.max.Z))))
|
|
115
|
+
w = window(i, j)
|
|
116
|
+
if gap >= w: continue
|
|
117
|
+
if over():
|
|
118
|
+
unmeasured.append((names[i], names[j], 'time budget'))
|
|
119
|
+
continue
|
|
120
|
+
try:
|
|
121
|
+
for k in (i, j):
|
|
122
|
+
if meshes[k] is None: meshes[k] = solid_manifold(solids[k])
|
|
123
|
+
if meshes[i].status() == mf.Error.NoError and meshes[j].status() == mf.Error.NoError:
|
|
124
|
+
d = meshes[i].min_gap(meshes[j], w)
|
|
125
|
+
else: # a tessellation that does not close: only the exact measurement can say
|
|
126
|
+
d = 0.0
|
|
127
|
+
if d >= w: continue
|
|
128
|
+
exact = exact_calls < EXACT_CAP and not over()
|
|
129
|
+
if exact:
|
|
130
|
+
exact_calls += 1
|
|
131
|
+
d, pa, pb = solids[i].distance_to_with_closest_points(solids[j])
|
|
132
|
+
at = mid(pa, pb)
|
|
133
|
+
holds = lambda x, y: all(getattr(x.min, c) <= getattr(y.min, c) and getattr(y.max, c) <= getattr(x.max, c) for c in 'XYZ')
|
|
134
|
+
if d > 1e-6 and (holds(a, b) or holds(b, a)) and not over() and getattr(solids[i] & solids[j], 'volume', 0.0) > 1e-6:
|
|
135
|
+
d = 0.0 # one wholly inside the other: the surfaces never meet
|
|
136
|
+
else: # past the exact cap or the time budget: the screened gap, marked as such
|
|
137
|
+
screened_only += 1
|
|
138
|
+
at = r3([(max(getattr(a.min, c), getattr(b.min, c)) + min(getattr(a.max, c), getattr(b.max, c))) / 2 for c in 'XYZ'])
|
|
139
|
+
rows.append({'a': names[i], 'b': names[j], 'gap_mm': round(d, 4), 'at': at, 'exact': exact})
|
|
140
|
+
near_pairs.append((i, j, d))
|
|
141
|
+
except Exception as e: # one pair that cannot be measured does not cost the others
|
|
142
|
+
errors.append(f'{names[i]} / {names[j]}: {type(e).__name__}: {e}'[:200])
|
|
143
|
+
unmeasured.append((names[i], names[j], 'error'))
|
|
144
|
+
fused = [r for r in rows if r['gap_mm'] <= 1e-6]
|
|
145
|
+
under = [r for r in rows if 1e-6 < r['gap_mm'] < clearance - 1e-9]
|
|
146
|
+
# a screened-only row read at or past the clearance is still within the screen's error of it: not cleared
|
|
147
|
+
unsure = [r for r in rows if not r['exact'] and r['gap_mm'] >= clearance - 1e-9]
|
|
148
|
+
closest = min(rows, key=lambda r: r['gap_mm']) if rows else None
|
|
149
|
+
# The print plate is Z = 0 of the exported frame. A solid below it is cut off by the plate; one above it prints on
|
|
150
|
+
# air unless it rests on a solid that reaches the plate: material directly under its first layer, within the pair's
|
|
151
|
+
# window (print-in-place stacks).
|
|
152
|
+
below = [{'solid': names[k], 'lowest_z_mm': round(boxes[k].min.Z, 3)} for k in range(len(solids)) if boxes[k].min.Z < -BED_TOLERANCE_MM]
|
|
153
|
+
grounded = {k for k in range(len(solids)) if abs(boxes[k].min.Z) <= BED_TOLERANCE_MM}
|
|
154
|
+
rests, support_unknown, supports = {}, set(), {}
|
|
155
|
+
def held_up(up, low):
|
|
156
|
+
# Support is material of low directly under up's first layer: the footprint of up's lowest 0.2 mm overlaps
|
|
157
|
+
# the footprint of low within the pair's window below it. A neighbour beside the solid is not under it
|
|
158
|
+
# (Codex review, 2026-11-11: a box 10 mm up, 0.4 mm beside a taller grounded box, read as resting on it).
|
|
159
|
+
if (up, low) not in supports:
|
|
160
|
+
z, w = boxes[up].min.Z, window(up, low)
|
|
161
|
+
if meshes[up] is None or meshes[low] is None or meshes[up].status() != mf.Error.NoError or meshes[low].status() != mf.Error.NoError:
|
|
162
|
+
supports[(up, low)] = None
|
|
163
|
+
else:
|
|
164
|
+
lo = [min(boxes[up].min.X, boxes[low].min.X) - 1, min(boxes[up].min.Y, boxes[low].min.Y) - 1]
|
|
165
|
+
size = [max(boxes[up].max.X, boxes[low].max.X) + 1 - lo[0], max(boxes[up].max.Y, boxes[low].max.Y) + 1 - lo[1]]
|
|
166
|
+
band = lambda m, z0, z1: (m ^ mf.Manifold.cube((size[0], size[1], z1 - z0)).translate((lo[0], lo[1], z0))).project()
|
|
167
|
+
supports[(up, low)] = (band(meshes[up], z, z + 0.2) ^ band(meshes[low], z - w, z + BED_TOLERANCE_MM)).area() > 1e-3
|
|
168
|
+
return supports[(up, low)]
|
|
169
|
+
changed = True
|
|
170
|
+
while changed:
|
|
171
|
+
changed = False
|
|
172
|
+
for i, j, d in near_pairs:
|
|
173
|
+
for up, low in ((i, j), (j, i)):
|
|
174
|
+
if up not in grounded and low in grounded and boxes[low].min.Z < boxes[up].min.Z - BED_TOLERANCE_MM:
|
|
175
|
+
try:
|
|
176
|
+
held = held_up(up, low)
|
|
177
|
+
except Exception as e:
|
|
178
|
+
held = None
|
|
179
|
+
errors.append(f'support of {names[up]} on {names[low]}: {type(e).__name__}: {e}'[:200])
|
|
180
|
+
if held is None: support_unknown.add(up)
|
|
181
|
+
elif held: grounded.add(up); rests[up] = (low, d); changed = True
|
|
182
|
+
above = []
|
|
183
|
+
for k in range(len(solids)):
|
|
184
|
+
z = boxes[k].min.Z
|
|
185
|
+
if z <= BED_TOLERANCE_MM: continue
|
|
186
|
+
row = {'solid': names[k], 'starts_mm_above_bed': round(z, 3), 'at': r3(((boxes[k].min.X + boxes[k].max.X) / 2, (boxes[k].min.Y + boxes[k].max.Y) / 2, z))}
|
|
187
|
+
if k in rests: row.update(rests_on=names[rests[k][0]], gap_below_mm=round(rests[k][1], 4))
|
|
188
|
+
elif k in support_unknown: row['support_not_measured'] = True
|
|
189
|
+
above.append(row)
|
|
190
|
+
floating = [r for r in above if 'rests_on' not in r]
|
|
191
|
+
severed = [d for d in declared if d['solids'] != 1]
|
|
192
|
+
def capped(items, say, kind):
|
|
193
|
+
out = [say(x) for x in items[:8]]
|
|
194
|
+
if len(items) > 8: out.append(f'... and {len(items) - 8} more {kind} (see bodies)')
|
|
195
|
+
return out
|
|
196
|
+
weld = 'they weld when printed' if in_place else 'a fit, not checked against print-in-place (P["print_in_place"] is False)'
|
|
197
|
+
problems = (capped(fused, lambda r: f'{r["a"]} and {r["b"]} touch or overlap at {r["at"]}: they print as one piece', 'touching or overlapping pairs') +
|
|
198
|
+
(capped(under, lambda r: f'{r["a"]} and {r["b"]} are {r["gap_mm"]} mm apart at {r["at"]}{"" if r["exact"] else " (screened, not measured exactly)"}, under the {clearance} mm print-in-place clearance: {weld}; if these bodies are shown assembled rather than printed in place, set P["print_in_place"] = False', 'pairs under the clearance') if in_place else []) +
|
|
199
|
+
capped(unsure, lambda r: f'{r["a"]} and {r["b"]} screen at {r["gap_mm"]} mm, within the screen error of the {clearance} mm clearance, and were not measured exactly (exact cap or time budget)', 'unconfirmed pairs') +
|
|
200
|
+
[f'body "{d["body"]}" is {d["solids"]} separate solids: something cuts it apart' if d['solids'] > 1 else f'body "{d["body"]}" has no solid' for d in severed] +
|
|
201
|
+
capped(below, lambda r: f'{r["solid"]} reaches {r["lowest_z_mm"]} mm, below the print plate (Z = 0): the plate cuts it off', 'solids below the plate') +
|
|
202
|
+
capped(floating, lambda r: f'{r["solid"]} starts {r["starts_mm_above_bed"]} mm above the print plate (Z = 0) and whether a solid under it reaches the plate could not be measured (a tessellation that does not close)' if r.get('support_not_measured') else f'{r["solid"]} starts {r["starts_mm_above_bed"]} mm above the print plate (Z = 0) with no solid under it that reaches the plate: its first layer is printed on air', 'floating solids'))
|
|
203
|
+
if unmeasured:
|
|
204
|
+
problems.append(f'{len(unmeasured)} near pair(s) were not measured ({", ".join(sorted({u[2] for u in unmeasured}))}); see bodies.pairs_not_measured')
|
|
205
|
+
return {'solids': len(solids), 'clearance_mm': clearance, 'clearance_source': source, 'print_in_place': in_place,
|
|
206
|
+
'declared_bodies': declared or None, 'pairs_measured': len(rows), 'exact_measurements': exact_calls, 'screened_only': screened_only,
|
|
207
|
+
'pairs_not_measured': [{'a': u[0], 'b': u[1], 'why': u[2]} for u in unmeasured], 'errors': errors,
|
|
208
|
+
'fused': fused, 'too_close': under, 'unconfirmed': unsure, 'closest': closest,
|
|
209
|
+
'above_bed': above, 'below_bed': below, 'severed': severed, 'problems': problems,
|
|
210
|
+
'seconds': round(time.monotonic() - started, 3)}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def evidence(assembly):
|
|
214
|
+
"""What this result does and does not establish, so valid geometry is never read as a working part."""
|
|
215
|
+
checked = ['the exported mesh is closed, manifold and consistently wound, and the STEP agrees with it (valid, checks)',
|
|
216
|
+
'bounds, size, volumes and solid count of the exported files']
|
|
217
|
+
not_checked = ['fit to the real object or a mating part (use cad_check_fit per state)',
|
|
218
|
+
'strength, stiffness or how it holds under load',
|
|
219
|
+
'motion, articulated poses and snap or flex behaviour',
|
|
220
|
+
'printing: supports, bridges and bed adhesion are the slicer\'s answer']
|
|
221
|
+
if assembly is None:
|
|
222
|
+
not_checked.append('gaps between separate bodies and contact with the print plate (mesh mode has no solids)')
|
|
223
|
+
return {'checked': checked, 'not_checked': not_checked, 'problems': []}
|
|
224
|
+
if 'error' in assembly:
|
|
225
|
+
not_checked.append('gaps between separate bodies: the measurement failed (' + assembly['error'] + ')')
|
|
226
|
+
return {'bodies': assembly, 'checked': checked, 'not_checked': not_checked, 'problems': ['bodies could not be measured: ' + assembly['error']]}
|
|
227
|
+
checked.append('whether each solid stands on the print plate (Z = 0 of the exported frame) or rests on a solid that does, and whether any reaches below it (bodies; failures are in problems)')
|
|
228
|
+
if assembly['solids'] > 1:
|
|
229
|
+
pairs = f'the closest approach of each near pair of the {assembly["solids"]} solids'
|
|
230
|
+
rule = (f'against a {assembly["clearance_mm"]} mm print-in-place clearance ({assembly["clearance_source"]})' if assembly['print_in_place']
|
|
231
|
+
else 'for touching or overlap only: the script says its bodies are shown assembled (P["print_in_place"] is False)')
|
|
232
|
+
if assembly['pairs_not_measured'] or assembly['unconfirmed']:
|
|
233
|
+
not_checked.append(f'{pairs} {rule}: {len(assembly["pairs_not_measured"])} pair(s) were not measured and {len(assembly["unconfirmed"])} only screened (bodies)')
|
|
234
|
+
else:
|
|
235
|
+
checked.append(f'{pairs} {rule}, screened on tessellations and measured exactly where the screen could not clear them (bodies; failures are in problems)')
|
|
236
|
+
if not assembly['print_in_place']:
|
|
237
|
+
not_checked.append('print-in-place clearance: the bodies are declared as shown assembled')
|
|
238
|
+
if assembly['declared_bodies']:
|
|
239
|
+
checked.append('whether each labelled body is exactly one solid (bodies.declared_bodies; failures are in problems)')
|
|
240
|
+
elif assembly['solids'] > 1:
|
|
241
|
+
not_checked.append('which solids are meant to be separate bodies: return Compound(children=[...]) with a label on each body so a severed piece cannot pass for one')
|
|
242
|
+
return {'bodies': assembly, 'problems': assembly['problems'], 'checked': checked, 'not_checked': not_checked}
|
|
243
|
+
|
|
244
|
+
|
|
41
245
|
def render(m, folder):
|
|
42
246
|
folder.mkdir(exist_ok=True)
|
|
43
247
|
tri, centres, normals = m.triangles, m.triangles.mean(axis=1), m.face_normals
|