compile_scad
Compiles OpenSCAD source code or a .scad file into an STL, validating included libraries and joined geometry before returning the file path.
Instructions
Compile OpenSCAD code into an STL file.
Takes OpenSCAD source code OR a path to a .scad file, compiles
it using the local OpenSCAD binary, and returns the path to the
generated STL. Kiln's bundled BOSL2 and MCAD libraries are on
OpenSCAD's library path (``include <BOSL2/std.scad>``).
For surface() heightmap operations (photo emboss, lithophane),
increase timeout to 600+ seconds.
Kiln checks the compiled part is joined up. A piece that floats
with nothing under it is joined to nothing and prints as a loose
part on supports, or not at all, so the make is REFUSED
(``code: "FLOATING_PIECES"``; ``error`` names the pieces, how
far they are from the nearest surface, and the fix): correct
the geometry and compile again. Separate parts that all sit on
the bed are a plate and pass; a piece held inside the part (a
ball in a cage, a pin in its knuckles) passes with a warning; a
piece that touches the rest without overlapping it is named in
``warnings``.
A compile where OpenSCAD could not find an included library, an
imported file or a module is refused too: OpenSCAD leaves that
part out and still exits cleanly, so the file would be missing
pieces. ``error`` names what was missing.
Colour: pass ``color`` (a name such as ``"teal"`` or a hex) when
the user asked for one, and the preview and the 3D stage show
the part in it. Left out, a single ``color("...")`` in the
source is used. It is how the part is SHOWN; it prints in
whatever filament is loaded, and the result's ``color`` block
says so.
Round shapes: leave ``$fn`` out and Kiln cuts each curve by its
size, writing that rule into the file it compiles. Set ``$fn``
only for a deliberate polygon (``$fn = 6`` for a hexagon). A
file that sets ``$fn``, ``$fa`` or ``$fs`` at the top compiles
exactly as written, and the result's ``curve_resolution`` note
says so.
Named parts: a source may define each part as its own module and
compose them in ``module main()``, drawing nothing at the top
level; it compiles to ``main()``. Kiln keeps generated designs
this way, so a kept source compiles as it is.
When you pass ``fastener``, the result carries a
``fastener_advice`` block saying the code compiled as written
and nothing resized the hole for that fastener. Kiln raises
it once per session across every tool that can raise it. Read
its ``agent_instruction`` before repeating any of it.
Args:
brief_id: The saved goal's id from ``design_session``, so this make
is recorded against the goal and checked against it. Empty when
there is no goal.
scad_code: Valid OpenSCAD source code (provide this OR scad_path).
scad_path: Path to a .scad file (provide this OR scad_code).
timeout: Maximum compilation time in seconds (default 300).
fastener: The fastener the user named, e.g. ``"M4"`` — pass
only if they actually said one. Kiln does NOT read your
OpenSCAD looking for screw holes; guessing intent out of
geometry would be wrong often. No argument, no advisory.
color: The colour the user asked for, shown on the preview and
the stage (a name or ``#rrggbb``). Not a print setting.INLINE 3D STAGE: on success this tool opens Kiln's interactive 3D stage — an inline viewer panel the user can orbit, zoom, and turn over — in hosts that render MCP Apps panels (Kiln's hosted connection attaches a browser stage link for hosts that don't). Oversized meshes are decimated automatically for the stage; the PNG preview is the floor, not the whole experience.
MAKE DOORS: design_session, Kiln's front door for making an object, is not installed here (signed in to Kiln it runs on Kiln's servers). On this install compile_scad IS the make → preview → iterate loop: make it, show the preview, iterate.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "compile_scad"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | The colour the user asked for, shown on the preview and the stage (a name or ``#rrggbb``). Not a print setting. Default: "". | |
| timeout | No | Maximum compilation time in seconds (default 300). Default: 300. | |
| brief_id | No | The saved goal's id from ``design_session``, so this make is recorded against the goal and checked against it. Empty when there is no goal. Default: "". | |
| fastener | No | The fastener the user named, e.g. ``"M4"`` — pass only if they actually said one. Kiln does NOT read your OpenSCAD looking for screw holes; guessing intent out of geometry would be wrong often. No argument, no advisory. Default: "". | |
| scad_code | No | Valid OpenSCAD source code (provide this OR scad_path). Default: "". | |
| scad_path | No | Path to a .scad file (provide this OR scad_code). Default: "". |