Thursday, December 13, 2012

Open Source Topology Optimization for 3D Printing

Rough Hex Output & Smooth Surface Reconstruction for Dogleg
This post describes a set of open source tools for simple topology optimization for parts destined for 3D printing. The two Matlab codes (both are plain vanilla Matlab, so they work successfully in Octave too) are good introductions to topology optimization. The papers that go along with the codes provide great documentation and examples of tweaking and changing the scripts to treat various problems. The python implementation is more capable (and a few more lines of code).

  • 99 line Matlab code: 2D, multiple load cases, works in Octave
  • 88 line Matlab code: 2D, faster, multiple load cases, filtering options, works in Octave
  • ToPy: implementation of 99 line method, extension to 3D, can also do heat conduction topology optimization, VTK output
The ToPy code outputs results in VTK format. I used paraview to convert the VTK file to an x3d file. I then read the x3d file into Meshlab. Once in meshlab I delete all of the faces, Filters-->Selection-->Select All, Filters-->Selection-->Delete Selected Faces, and then reconstruct the surface from the remaining point cloud, Filters-->Remeshing, simplification and reconstruction-->Surface Reconstruction: Poisson.

The default settings seem to give pretty nice results that can be exported in stl format for 3D printing.

Here's the dogleg part printed on Dayton Diode's printrbot: