Wednesday, January 9, 2019

InverseCSG recovers CAD from model

The MIT Computational Fabrication Group has a page up with the abstract and links to the paper and video. The InverseCSG folks took a program synthesis approach to enable them to generate CAD boolean operation "programs" from the 3D model "specification."

The method seems pretty robust. It can handle noise in the input mesh, and it will approximate the input mesh with primitives that it knows even if the mesh was generated by primitives that it does not.

The github repository for InverseCSG is empty (email with the author said they are still planning on posting it after some tiddying up of the code), but a snapshot of the code is available in the source material on the ACM digital library site. I had no trouble getting the code to compile on Fedora 29. You'll also need to install sketch by following the instructions, and make sure Maven and Scikit Learn are installed (likely packages are available for your distro).

I ran the example as it suggested in the README

python3 ../build/ one_cube

You'll need to comment out line 7 in

#import genetic_algorithm_pipeline

This little bit of code clean up should be taken care of if you get the version off the github site once it goes live. With that small fix the test cases run as expected.
One Cube Test Case OpenSCAD results

One of the other interesting things about this work is that they built a 50 CAD model benchmark data set. It will be cool to see if more researchers take up this benchmark to test new and improved algorithms. As it says in the README you can browse through the benchmark database in the example folder, and open up the results in OpenSCAD.

Other coverage:


  1. Hi,

    Do you think the repo will still be published (after one year..) ?

    Do you know also what was the genetic_algorithm_pipeline part ?


    1. I do not know what that commented out section was for. The author says it was a deprecated piece of code (this is research after all, they probably tried a bunch of stuff to get to this result). Not sure about the github repo. I get a 404 now on that link.

  2. This post was helpful, thank you.
    To make it easier for others to get this running: