Better 3D Print Positioning: Free Open Source Software

The STL-tweaker, developed by Salzburg Research, is a python module which finds an optimal orientation for a 3D object on the printing platform to improve the efficiency of the 3D-print.

3D-Printing is a highly promising technology for agile multipurpose production systems of tomorrow and soon find its permanent place in the production cycle. So an important task is, to fully integrate 3D-Printing into the manufacturing process.

Figure 1: This Raspberry Pi casing cover must be turned into a printable position.

Figure 1: This Raspberry Pi casing cover must be turned into a printable position.

In our small lab environment, we use an Ultimaker² connected to a Raspberry Pi enabling remote printing from the web. The slicing of an STL-object to a gcode-toolpath is also done by the Raspberry via the CuraEngine. Often, a problem occurs at this point, which impedes the cohesive vertical workflow: Cura cannot recognize whether a model is printable or not, and it places objects on the printing platform in their default orientation. This then leads to poor or aborted prints until the operator intervenes and rotates the STL object into a printable position.

The print management software of high-priced 3D printing solutions such as StrataSys’ CatalystEX (references Version 4.4) already has some optimization of positioning leading to feasible prints. However, the CatalystEX’s algorithm tends to produce prints where a lot of support structure is used. This is still suboptimal, because in terms of economizing 3D-printing, it is important to use as little material as possible. Reducing the object‘s support structure will bring savings in material, time and energy and thus lead to greater efficiency. Reducing the need for support structure will also lead to a smoother surface and save the time to remove it!

Figure 2: STL-Format

Figure 2: STL-Format

So I decided to write some python code that assesses the printability and also auto-rotates the object into its optimal orientation for 3D-printing. The code analyses the stereolithographic representation and the optimization uses linear algebra. Here is how the algorithm works:

To begin with, we have to consider two characteristics: firstly the overhanging surfaces and secondly the size of the actual touching area on the buildplate. The naïve approach would be to focus on creating support structures that fix small touching areas and external surfaces which are facing towards the buildplate. But as mentioned above this can be wasteful of material and can lead to poor surface quality after removing the support structures. Hence, the STL-tweaker focuses on first optimizing the orientation of the surface facets of the STL description. This gives the 3D object an optimal orientation on the buildplate. The positioning of support structures is left to the slicing program.

The STL format consists of a huge amount of small triangles called facets, where each facet is represented by an area vector.

The algorithm works as follows: all facets which are steeper than the critical angle[1] CA (0°<CA<90°) against the perpendicular line, excluding the touching areas, are considered not printable. The STL-tweaker now determines the preferred orientations. These are calculated by a weighted sum of facet vectors where the weighting is proportional to the area of the facet. For practical reasons, we only consider six preferred orientations that are candidates for positioning on the buildplate. The intuition behind this is that we conceptually place the 3D in a cube and calculate the orientations w.r.t. the cube’s surfaces. In the next step, the touching area is masked out and only the remaining object surfaces are used to calculate the resulting overhangs. The algorithm finds the absolute minimum of and searches a minimum in the area-vector-field.

Figure 3a: Area-Vector Field Graphs

Figure 3a: Area-Vector Field Graphs – default

In figure 3a + 3b, you can see two area-vector field graphs with cones marking difficult-to-print surfaces (overhangs). Figure 3a shows the default printing direction, where all steep vectors are inside the cone.

Figure 3b: Area-Vector Field Graphs

Figure 3b: Area-Vector Field Graphs – tweaked

The STL-tweaker found a minimum of overhangs by rotating the object around the x-axes by 125°, so it generates an improved (“tweaked”) STL-file. This tweaked object can now be imported to any slicing engine like Cura or RepetierHost. In addition to that, the tweaker-module can also be embedded in other code to facilitate further usage.

Conclusion:

Figure 4: The "Trisection"-Cube

Figure 4: The “Trisection”-Cube

The STL-tweaker is probably the first open source auto-rotate script for 3D-printing. It calculates the lithographic surfaces of objects in a very detailed way and produces an optimal orientation, as seen in Figure 4 and 5. It also suggests if support material is needed and appends this information to the tweaked STL-file in the last line.

The direct comparison between CatalystEX’s autorotate and the STL tweaker on a set of 16 various objects, very different in their shape and printing difficulty, shows the following result:

file#
touching area
STL-tweaker
Catalyst
1 flat A A
2 not flat A A
3 flat A A
4 flat A B
5 flat A A
6 flat A A
7 flat A A
8 not flat B A
9 not flat B A
10 flat A A
11 flat A A
12 flat A A
13 flat A A
14 flat A C
15 flat A B
16 flat A A

The letters A, B and C express the positioning results, where A labels the unique optimum, B another sufficient solution and C an unsatisfactory orientation. As you can see from the chart, the success rate of both 3D positioning tools are very similar. More detailed analysis of the results shows that the success rate of the STL-tweaker deteriorates significantly when the touching surface is not flat (irrespective of whether the touching side is concave or convex), whereas a flat touching area leads to optimal results at least in the 16 prototypical test cases chosen. By contrast, we could not trace poor results of CatalystEX’s autorotate function to any specific object property. So the STL-tweaker succeeds in finding the optimal orientation of objects if there is a flat touching area, and also finds sufficiently good results for other objects.

Figure 5: a prototype with its tweaked clone

Figure 5: a prototype with its tweaked clone

Another difference of the two algorithms is their subjective performance – STL-tweaker typically takes between 1 and 2 seconds depending on file size and curvatures. CatalystEX could not be tested for performance because the calculations happen in the background when loading a new file. However, due to the fact that optimal orientation decreases both printing time and printing failures, the additional processing time is just a negligible disadvantage.

Summarizing, the STL-tweaker is an effective open-source object positioner which improves the printing quality of complex 3D objects. It is available under a LGPL license from github.
The file also includes instructions on how to integrate STL-tweaker into 3D printing tools such as Cura or how to invoke the positioning tool from the command line.

[1] The critical angle is a variable that can be set by the operator as it may depend on multiple factors such as material used, printing temperature, printing speed, etc.

Christoph Schranz

Christoph Schranz absolvierte die höhere technische Lehranstalt für Elektrotechnik und war als Freelancer für Skihersteller tätig, für welche er Hardware- und Softwarelösungen zur Erfassung und Verarbeitung von Messdaten implementierte. Seit 2013 studiert er Mathematik und Physik an der Universität Salzburg und seit 2015 ist er Junior Researcher der Forschungslinie „Internet of Things“, wobei sein inhaltlicher Fokus im Bereich Sensorik und Datenanalyse liegt.


Salzburg Research Forschungsbereich(e):
Salzburg Research Forschungsschwerpunkt(e): Publiziert am 17. Feb 2016
How to find us
Salzburg Research Forschungsgesellschaft
Jakob Haringer Straße 5/3
5020 Salzburg, Austria