Truescad
script based cad using implicit geometry
Install / Use
/learn @hmeyer/TruescadREADME
truescad
▶ Open TrueScad in your browser
TrueScad is a Lua-scripted CAD tool similar to OpenSCAD, running entirely in the browser as a WebAssembly app. Like ImplicitCAD, it uses implicit functions to represent geometry, offering precise surfaces and smooth rounded CSG.

Using the app
Write a Lua script in the left panel using the primitives below, then:
- Run — evaluates the script and shows a ray-marched preview
- Mesh — tessellates the geometry and shows a 3D mesh (drag to rotate)
- Export STL — downloads the tessellated mesh as an STL file
Drag on the preview canvas to rotate (left button) or pan (right button).
Lua API
Primitives
Sphere(radius)
Box(x, y, z, smooth?) -- smooth rounds the edges
Cylinder({l=length, r=radius, s=smooth?})
Cylinder({l=length, r1=r1, r2=r2, s=smooth?}) -- tapered
iCylinder(radius) -- infinite cylinder
iCone(slope) -- infinite cone
PlaneX(d) PlaneNegX(d) -- half-spaces
PlaneY(d) PlaneNegY(d)
PlaneZ(d) PlaneNegZ(d)
PlaneHessian({nx,ny,nz}, p)
Plane3Points({x,y,z}, {x,y,z}, {x,y,z})
Boolean operations
Union({obj, ...}, smooth?)
Intersection({obj, ...}, smooth?)
Difference({obj, ...}, smooth?) -- first minus the rest
Transformations (method syntax)
obj:translate(x, y, z)
obj:rotate(x, y, z) -- Euler angles in radians
obj:scale(x, y, z)
obj:clone()
Deformations
Bend(obj, width)
Twist(obj, height)
Output
build(obj) -- sets the object to render/export
print(...) -- output appears in the log panel
Example
cube = Box(1, 1, 1, 0.3)
sphere = Sphere(0.5)
result = Difference({cube, sphere}, 0.3)
result = result:scale(15, 15, 15)
build(result)
Development
Prerequisites
Build and run locally
# Install JS dependencies (once)
npm install
# Build the Rust WASM module
wasm-pack build --target web
# Bundle the frontend and start the dev server
npm run serve
# → http://localhost:8080
After changing Rust code, re-run wasm-pack build --target web and refresh the browser.
After changing JS/CSS in web/, the dev server rebuilds automatically.
Run Rust tests
cargo test
Production build
wasm-pack build --target web --release
npm run build:release
# Output in dist/
Architecture
src/luascad.rs— Lua scripting engine (piccolo), exposes all geometry primitivessrc/shader.rs— builds the GLSL fragment shader for GPU ray-marchingsrc/lib.rs—wasm-bindgenAPI surface (eval,render,rotate,pan,tessellate)web/— vanilla JS frontend: CodeMirror 6 editor, Three.js mesh viewbuild.mjs/serve.mjs— esbuild-based build and dev server
