Menu

LuaCAD
📰

LuaCAD

Hacker News·2 months ago
#WAcXKsDV
#luacad#model#openscad#format#convert
Reading 0:00
15s threshold

Scriptable CAD with Lua. Write parametric 2D and 3D models in Lua and export them to 3MF, STL, OBJ, PLY, OFF, AMF, or SCAD, or render them straight to a PNG.

LuaCAD embeds Lua 5.4 in a Rust engine that evaluates CSG operations directly (via Manifold ) or generates OpenSCAD code for external rendering.

Why Lua?

Similar syntax as the OpenSCAD language, but better: More powerful

More consistent

Faster

Easily embeddable

Operator overloading for natural CSG syntax ( a + b , a - b , a * b )

Already used in other CAD software like LibreCAD and Autodesk Netfabb

Example

LuaCAD:

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); }

Getting Started

cargo install luacad # CLI for running and converting LuaCAD scripts cargo…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.