LuaCAD is a scripting library which uses OpenSCAD's engine to create 2D and 3D objects with the power and flexibility of Lua.
The LuaCAD library creates OpenSCAD code, which is then used to create DXF, SVG, or STL files.
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);
}
require("luacad")
my_cube = cube { size = { 1, 2, 3 } }
function my_sphere(radius)
return sphere({ r = 2 }):translate(5, 0, 0)
end
model = my_cube + my_sphere(2)
model:export("simple.scad")
<name>.lua
model file
(including a …:export("out.scad")
line)bin/luacad <name>.lua
out.scad
file with OpenSCAD