Scriptable CAD with Lua for parametric 2D and 3D models
LuaCAD is a scriptable CAD tool that lets you write parametric 2D and 3D models in Lua and export them to common formats like 3MF, STL, OBJ, PLY, OFF, AMF, or SCAD, or render them directly to PNG. It embeds Lua 5.4 in a Rust engine that evaluates CSG operations directly (via Manifold) or generates OpenSCAD code for external rendering. LuaCAD is designed for users who want a more powerful, consistent, and faster scripting experience than OpenSCAD's native language, while remaining embeddable and supporting operator overloading for natural CSG syntax (a + b, a - b, a * b). The tool is suitable for makers, engineers, and developers who need to create parametric models programmatically and export them for 3D printing, further processing, or integration into other workflows.
Use Lua (5.4) to define models. CSG operations like union, difference, and intersection are expressed naturally with +, -, and * (e.g., my_cube + my_sphere).
Export models to 3MF, STL, OBJ, PLY, OFF, AMF, or SCAD. The format is inferred from the output extension, with an option to override via --format.
Render models straight to PNG images using the luacad render command, without needing an external slicer or viewer.
Full support for the Belfry OpenSCAD Library v2, reimplemented in LuaCAD itself, so it can render, preview, and export BOSL2 models without installing OpenSCAD or BOSL2.
The text() function outlines system fonts into a sketch and text3d() extrudes them into 3D, turning text into actual geometry rather than SCAD output.
import() reads every mesh format LuaCAD writes (e.g., STL, OBJ) and returns a solid that can be transformed and combined. SVG and DXF files return 2D sketches ready for extrusion.
The luacad command-line tool includes convert, watch (rebuild on file change), render, info (triangle counts and bounding box), lint (via selene), and run for side-effect only execution.
Every value a script returns becomes its own 3MF object, and scripts can use :name(...) to label objects, allowing slicers to see them as separate movable parts.
LuaCAD can export to 3MF, STL, OBJ, PLY, OFF, AMF, and SCAD. The format is inferred from the output file extension, or can be overridden with the --format flag.
No. LuaCAD builds meshes directly using Manifold for CSG operations. However, an optional --via-openscad flag can be used to hand the export to an installed OpenSCAD binary if desired.
Yes. LuaCAD includes a full reimplementation of BOSL2 (v2) built into the tool, so you can use functions like bosl.cuboid, bosl.regular_prism, and bosl.spur_gear without installing OpenSCAD or BOSL2 separately.
You can install it via Cargo: 'cargo install luacad' for the CLI and 'cargo install luacad-studio' for the GUI desktop app with live 3D preview. Alternatively, clone the repository and run 'make install' (requires Rust and a C++ compiler with CMake).
For 3MF format, every value your script returns becomes its own 3MF object, and you can label them with :name(...) to control how they appear. Other formats (like STL) flatten everything into a single mesh because they cannot express separate objects.
The 'luacad lint' command lints your Lua script using selene, helping you catch syntax and style issues. It can also take directories as arguments to lint multiple scripts at once.