Prusa Mendel RepRap Frame Vertex Topology Optimization Using ToPy

This post is about a free/open-source work-flow for topology optimization. At the last monthly meeting I showed a bunch of folks a neat real-time topology optimization app that is great for sketching out concepts quickly. That app has a good user interface for defining loads, boundary conditions, and solid/void regions. The thing that makes it good for getting a concept quickly fleshed out is that the optimization happens in real-time as you change the loads and constraints. One drawback with that app is that it is not really free software (no source available), so the opportunity for tinkering and learning is limited. ToPy, on the other hand, is free software, and it is well documented with a thesis and available source code. However, the user interface is a text file so it is a bit more work to set up a problem, and for this small 2-D problem it takes 90 iterations at about 15 seconds per iteration to converge to a final part (it may be possible to improve this by changing the solution method it uses for 2D problems).


I found this interesting discussion about optimizing infill for 3D printing a few weeks ago. I think the drawback to the sort of method put forward in that post by Gary Hodgson is related to this point he makes at the end of the post:

The main obstacles are computational intensity and ensuring the resulting model has sufficient strength, regardless of its form.
There is no way for an "infill algorithm" to be smart enough to do this without additional information about the design intent. By taking a topology optimization approach, that design intent is captured in the definition of the loads and boundary conditions that are input (which is mentioned in the thread). People recognize that topology optimization is a killer enabling app for additive manufacturing, and the barriers to entry are coming down:
While there is still some cost associated with adopting topology optimization, not least of which is a software license starting around $6000, a process that used to be “by PhDs for PhDs” and almost prohibitive to manufacture can now be incorporated into designs after only four hours of training and access to additive manufacturing.
The good thing about ToPy is that there is no licensing cost, so it is very accessible from that perspective. However, I did spend considerably more than 4 hours reading William Hunter's thesis, and digging into the code enough to understand it, YMMV.

There is some interesting related development along the lines of making RepRap parts faster/easier to print by making them hollow and filling with epoxy (or not). A couple examples that I thought were interesting:

Work Flow

Here's an outline of the work-flow I used:
  1. Define optimization problem: ToPy input deck (*.tpd, ToPy Problem Definition file) containing the type of problem (2D, 3D, stiffness/heat conduction), domain size, boundary conditions and any solid/void regions. I used Gimp to help me do this because I can define multiple layers for solid and void areas and view these simultaneously or one at a time. I export these layers to separate pngs and then process with a simple python script to generate text suitable for inclusion in a tpd file.
  2. Run the optimization problem: python [name of your file].tpd
  3. Import the output of the optimization (*.png in the 2-D case) into Inkscape, trace the bitmap to create a Path, and export as dxf. I followed the recipe given here.
  4. Extrude the profile in the dxf file in OpenSCAD and perform additional operations to make the complete part. Here's the scad file.
  5. Export the part as an stl from OpenSCAD.
  6. Slice and Print! Lately I've been using Cura for this, and have been pretty happy with the speed and results.
Here is the resulting stl:

One of the main stumbling blocks in this work-flow is in step 1. Defining an input deck for ToPy is a very manual affair. I used Gimp and a simple Python script to define the solid void regions. This works OK for 2D problems, but becomes cumbersome in 3-D. Also, the number of nodes is one greater in each dimension than the number of elements. The solid and void regions are defined element-wise, and the boundary conditions and loads are defined node-wise. I haven't found a clean way to handle this difference in an integrated way yet. My current approach consists of manually counting pixels in Gimp and then calculating the appropriate offset to find the right node numbers according to the ToPy convention. Not ideal. It makes experimenting (fiddling with resolution especially) pretty painful.

The solidThinking folks have some interesting demo videos showing a CAD-like GUI for defining a topology optimization problem. A pure graphical approach isn't really required, it would be great to be able to use OpenSCAD to define the problem instead of counting pixels in Gimp. I haven't figured out how to do that yet.

Future Work

The proof-of-concept frame vertex shown in this post is not a formally designed and validated part. No actual analysis was used in deciding what volume fraction (amount of material, comparable to "infill density") to use, or what the relative magnitudes and locations of the loads and boundary conditions should be. I just took a look at a picture of an assembled Prusa Mendel to get an idea of where the loads would be acting. The part demonstrated here is the vertex with a foot for the lower portion of the frame. A different part (different loads/boundary conditions) is needed for the "no foot" vertex used at the top of the frame.

Moving away from this particular application to open source topology optimization more broadly: there is a good amount of room for improvement in the user interface. Being able to use a CAD-like tool to define the design domain, boundary conditions, and solid/void regions would be a huge improvement that would lower the amount of work it takes to set-up a problem. In addition, ToPy can currently handle a single "load case", but multiple load cases are probably needed to design a "robust" part for many applications. Extending the software to handle multiple load cases would be a useful improvement.

Optimizing material layout in a single part is an interesting marginal improvement, but it would be better to think bigger: what about optimizing the layout of an entire RepRap frame? Interfaces to motors and electronics could be defined by suitable solid/void regions and boundary conditions. Improving the stiffness of the machines seems to be the direction that development is taking (e.g. Prusa Mendel i2 --> i3), and this is a tool that would be suitable for helping that effort with some improvements to lower the amount of "touch labor" in problem definition.

No comments:

Post a Comment