OpenSCAD and Emacs

Yesterday I discovered OpenSCAD which is basically a tool where you program your 3D scene instead of interactively modeling it. Take a look at the following example.

difference () {
  cube([5, 5, 0.5], center=true);
  cylinder(r=2, h=1, center=true, $fn=72);
}

nil

By adding and subtracting primitives you can form modules (parts) and use them in more complex parts. There was of course already an emacs mode for OpenSCAD called scad-mode which ships with OpenSCAD but can also be found on MELPA. Together with scad-preview you can build parts within emacs and preview them. The big benefit here is that the preview can be controlled (rotating, zooming, …) from within emacs.

The only thing missing was org-babel support so you can integrate it in your org files. So I quickly hacked it together: ob-scad.el.

October 18, 2015 | emacs, openscad
about | blog | archives