Universe

maquette-scad logo

Typst Universe Live demo License: GPL v3

Render OpenSCAD files in Typst with maquette-scad.

Load .scad files, or use the Typst DSL to render them with maquette.

Try it live → edit SCAD source, orbit the result, tweak the render, and copy the generated Typst code snippet.

Download models to try it out on Thingiverse.

Usage

Three ways in:

  • a .scad file
  • the Typst DSL
  • a multi-file project
1. OpenSCAD file
// example.scad
$fn = 100;
module rod(d, h) cylinder(h, d = d, center = true);
hole = 25;
len = 62.5;
difference() {
  sphere(d = 50);
  rod(hole, len);
  rotate([90, 0, 0]) rod(hole, len);
}
color([0.5, 0.3, 0.1, 0.6])
rotate([0, 90, 0]) rod(hole, len);
#import "@preview/maquette-scad:0.1.0": render-scad

#render-scad(
  read("example.scad"),
  azimuth: 219,
  elevation: 33,
  up: (0, 1, 0),
  fov: 40,
  zoom: 1.2,
  background: none,
)
OpenSCAD logo compiled from source
2. DSL
#import "@preview/maquette-scad:0.1.0": *

#let bore = cylinder(30, r: 4.5, center: true, fn: 48)
#render-scad(
  color((0.16, 0.62, 0.71), difference(
    cube(20, center: true),
    sphere(12, fn: 64),
    ..((0, 0, 0), (90, 0, 0), (0, 90, 0)).map(r => rotate(r, bore)),
  )),
  smooth-normals: 25,
  azimuth: 32,
  elevation: 24,
  up: (0, 1, 0),
  specular: 0.35,
  antialias: 3,
  background: none,
)
CSG cube built with the Typst DSL
3. Multiple OpenSCAD files
#import "@preview/maquette-scad:0.1.0": *

#render-scad-tree(
  "Cyclone.scad",
  root: "cyclone-src/",
  read: p => read(p),
  ..openscad-view,
  azimuth: 35,
  elevation: 20,
  up: (0, 0, 1),
  background: none,
)
Cyclone-PCB-Factory CNC mill, a full multi-file OpenSCAD project

The Cyclone example is the Cyclone-PCB-Factory.

Documentation