I bought myself a 3D printer and I thought it would be cool to program the models in Jupyter. I am currently doing quite some development in Scala so a JVM based solution running in Jupyter would be my preferred option.

Most of the people use some GUI driven CAD or Graphics Modelling Tools like Blender to develop 3D models. There are only a few lean, easy to learn options that focus on specifying the design in code.

Constructive Solid Geometry (CSG) is a technique used in modelling to build objects from primitives by using Boolean operations. Here are a couple of the most popular implementations:

There are also a couple of Python projects (e.g. viewscad) which are based on OpenSCAD that can be used in Jupyter.

Unfortunately jcsg is based on javafx which prevents that it can be easily integrated into BeakerX.


Because it looked as if it is quite an easy task, I implemented my own OpenSCAD generator API in Java. Here is a quick introduction using the BeakerX kernel of Jupyter. We can use this library to implement our code in

  • Java
  • Scala
  • Kotlin
  • Groovy

The examples in this Juypter notebook have been implemented in Scala. If you want to use this solution you need to install the necessary components. The necessary details can be found in the notebook.



Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *