Skip to content
Tech News
← Back to articles

Show HN: LuaCAD – Parametric CAD Scripted in Lua

read original more articles
Why This Matters

LuaCAD introduces a powerful, scriptable CAD environment embedded in Lua, offering enhanced flexibility and performance for creating parametric 2D and 3D models. Its integration with Rust and support for multiple export formats make it a versatile tool for both developers and designers, potentially streamlining workflows and fostering innovation in CAD applications.

Key Takeaways

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 install luacad-studio # GUI desktop app with live 3D preview

... continue reading