Solid 3D CAD modeling with Lua.
Write parametric 2D and 3D models in Lua and export them to 3MF, STL, OBJ, PLY, OFF, AMF, or SCAD.

LuaCAD embeds Lua 5.4 in a Rust engine that evaluates CSG operations directly (via Manifold) or generates SCAD code for external rendering.
cargo install luacad # CLI for running and converting LuaCAD scripts
cargo install luacad-studio # GUI desktop app with live 3D preview
Requires Rust.
git clone https://github.com/ad-si/LuaCAD.git
cd LuaCAD
make install
luacad convert model.lua output.3mf # Convert to 3MF
luacad convert model.lua output.stl # Convert to STL
luacad convert model.lua output.scad # Export as SCAD for OpenSCAD
luacad watch model.lua output.3mf # Rebuild on file changes
luacad run model.lua # Execute (side-effects only)
luacad-studio
Desktop app with a code editor and 3D viewport. Edit Lua code on the right, see the model update on the left.
my_cube = cube { size = { 1, 2, 3 } }
function my_sphere(radius)
return sphere({ r = radius }):translate(5, 0, 0)
end
model = my_cube + my_sphere(2)
render(model)
Equivalent OpenSCAD:
module my_cube() {
cube(size=[1,2,3]);
}
module my_sphere(radius) {
translate([5,0,0]) sphere(r = radius);
}
union() {
my_cube();
my_sphere(2);
}
More examples in the examples/ directory.
Check out the website to see all supported features!
For easier usage, LuaCAD has full support for the Belfry OpenSCAD Library v2. You can use its functions like this:
bosl.cuboid { {40, 40, 40}, rounding = 2 }
bosl.regular_prism { 5, r = 10, h = 25 }
bosl.spur_gear { circ_pitch = 5, teeth = 20, thickness = 5 }
The OpenSCAD language is limited and has several issues:
Therefore, a real programming language should be used and it should ideally be interpreted and have good operator overloading support
Lua is a better fit:
a + b, a - b)Other CAD software with programmatic model creation:
The initial Lua implementation was done by Michael Lutz at thechillcode/Lua_CAD. The project was later rewritten in Rust.
$ claude mcp add LuaCAD \
-- python -m otcore.mcp_server <graph>