// HACKER NEWS — CYBERSECURITY
Show HN: LuaCAD – Parametric CAD Scripted in Lua
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.
Both crates vendor their C/C++ dependencies, so no system libraries need
to be installed — but a C++ compiler and CMake must be available to
build them. luacad builds Manifold and Clipper2;
luacad-studio additionally builds
OpenCSG, which needs OpenGL
development headers (on Debian/Ubuntu: libgl1-mesa-dev,
libx11-dev, libxcb1-dev,
libxkbcommon-dev, libxrandr-dev,
libwayland-dev).
convert and watch infer the format from the
output extension; --format overrides it, and
--via-openscad hands the export to an installed OpenSCAD
binary instead of building the mesh with Manifold.
LuaCAD has full support for the
Belfry OpenSCAD
Library v2, reimplemented in LuaCAD itself, so it renders,
previews and exports to a mesh without OpenSCAD or BOSL2 installed:
Exporting to .scad still writes the BOSL2 call itself,
which keeps the exported file as short as the script that produced it.
text() outlines a system font into a sketch and
text3d() extrudes it in one step, so text becomes real
geometry rather than SCAD output:
import() reads every mesh format LuaCAD writes and returns
a solid you can transform and combine like any primitive; SVG and DXF
return a 2D sketch instead, ready to extrude.
Every value your script returns becomes its own 3MF object, so slicers
load them as individually movable parts. Label them with
:name(…) to control how they appear in the object list.
The other formats cannot express separate objects, so they flatten
everything into a single mesh.