Monday, March 19. 2012
If you're reading this post you probably know that to print in 3D you need a 'good' or 'clean' STL file exported from your 3D CAD program; models seemingly perfect on-screen may be filled with defects which make 3D printing difficult if not impossible. You might have even heard of the apparent black magic that is STL repair. Chances are though that you have no inkling as to what that really means or how you could do it yourself.
In this post we're going to go through a simple example showing how to use a great free tool, netfabb Studio Basic ("netfabb") to automatically 'repair' STL files for 3D printing. Although the program allows for manual and semi-automatic repairs (we'll cover some of these in a later post) automatic fixing seems to work for about 90% of current STL files. Best of all it's fast and you don't need to understand much about STL files or their defects; you just need to be able to find your way around the sometimes unintuitive user interface.
If you don't have netfabb download it from here. There are versions for Linux, Mac and Windows. For this example, we're using the just released Windows v 4.9.0 and a Porsche STL from here. The process we'll follow is roughly as follows.
- Load your file and check netfabb's preliminary analysis
- Perform a Standard Analysis
- Perform Repairs
- Apply repairs to your file
- Export the repaired file as a new STL
1) Load your STL file and check netfabb's preliminary analysis
Load your file by choosing 'Open' under the 'Project" menu in netfabb. When opening an STL file, netfabb performs a preliminary analysis to determine if there are issues that could cause problems during 3D printing. The most common issues include holes, 'naked' edges, and triangles with invalid orientations (i.e they are inside-out).
If problem(s) are found, a large, red "!" will be displayed in the lower right hand corner and (usually) a part volume will not be calculated. In the case of our porsche file netfabb has found problems and alerted us:
If you do not see the red attention warning, congratulations, your file is very likely ready for 3D printing and nothing further is needed.
2) Perform a Standard Analysis
Now that we know that netfabb has found problem(s) we'll perform a more thorough analysis. Find the menu icon in the upper right which looks like a circle with a magnified section. Under this select the option for 'Standard Analysis'. netfabb will work for a bit and a new 'layer' will appear with the part now rendered in gray and defects in different colors (as defined under Settings>Colors>Repairs).
Nothing has changed with your original file. The information panel on the right will now include a summary of the type and number of problems. Pay attention to the number of problems but especially take a look a little further down to see if the surface is closed and/or some of the mesh seems to be pointing inside-out.
In our case, a red 'No' tells us that our surface is not closed. 3D printers don't like unclosed (non-manifold, non-watertight) surfaces and will often not print or will print additional artifacts when they are encountered. They are usually caused by small holes or edges that don't meet and may not even be visible in an on-screen rendering. A green 'Yes' indicates that our file is 'orientable' and therefore seems to be free of another common defect: inside-out triangles. Now that we have loaded and analyzed the part we are ready to attempt to automatically repair the file.
3) Perform Repairs
To repair our file, find the red cross menu item in the upper right next to the analysis button and press it:
You'll notice that yet another 'layer' is created underneath the 'Part Analysis'. The triangular mesh is now shown on the model and new options and information are available in the lower pane. Press 'Update' to see a count of each type of error. Next, select 'Automatic Repair' and then choose 'Default'.
netfabb will now go through a series of repair algorithms to attempt to make the STL file printable. (You can see what these steps are by clicking on the Repair Scripts tab in the lower right of the information pane.) This may take a little while especially if your part has a large number of triangles. For example, on a dual core 2.4 GHz computer this 7.4MB, 151k triangle file took just over 6 seconds to be run all of the default repair scripts. A not-so-obvious status bar in the lower right hand corner will show progress.
When the process is complete you can again press the 'update' button under the status tab. You should see zero border edges, invalid orientations and holes. If your part is a single object (vs. an assembly) it will likely indicate the preferred 1 shell. While not optimum multiple shells will not usually cause printing problems. You should also visually verify that your model still looks the same as your original. In some cases, netfabb automatic repairs may create solids where in fact a hole was intended. This is rare but you should still check visually.
At this point you could continue with manual repairs if needed/desired but we'll stop here since it looks like the default automatic repairs by netfabb have been sufficient. In a subsequent post we'll look at some common manual repairs in netfabb.
4) Apply Repairs to your file
We're not quite done as we still need to apply the repairs to the originally loaded file by pressing 'Apply Repairs' in the lower right hand corner. This removes the analysis and repair layers and fixes the original rendering. You should see the original green rendering - but without the red attention warning. You should also see a volume calculation.
(If you still see an attention warning and/or lack of volume calculation it means that netfabb was unable to completely repair your file. The file may still be printable or it may require further manual repairs beyond the scope of this post.)
5) Export the repaired file as a new STL
At this point it is important to understand that you have made no changes to your original file. If you choose "Save" you will create a new netfabb 'Project'. Since we started this process to create a clean STL file we now need to create a new (repaired) file.
Under the Part menu select "Export as" STL. This will bring up a new window. First, check that the file name and location are what you would like. netfabb will automatically create a filename composed of the original with '(repaired)' appended so you don't have to worry about inadvertently overwriting your original file. However, the location will be not necessarily be in the same folder but rather the last folder saved into.
When you press 'Save' a new dialog will appear with another analysis of the file to be created and possible errors. It seems that this may occur because the netfabb file format contains more information than, for example, the STL format; some of the repairs it has made might therefore not be carried over. Again though, automatic repairs can be made. Press the 'Repair' button if you see a large red 'x'.
If successful, instead of a large red 'x' you will see a green check mark. In this case, 9 seconds and a single iteration were sufficient to repair the 422 manifold edges. In other cases it might take multiple iterations and you may still have a non-zero number of errors. The most recent release of netfabb Studio Basic seems to have improved this functionality. Just keep trying until you either have a green check mark or a minimum non-changing number of errors. (if your totals go up you can cancel the export and select again to start fresh).
Once your file is 'repaired' you can press 'Export'. Congratulations, you now have a printable STL file. Want to learn more? See our post on using netfabb to manually repair STL files.
3D Additive Fabrication, Inc. (3dAddFab) is a start up company located in Colorado, USA. 3dAddFab provides high quality 3D printing that is easy to price and order, at a lower cost than existing fabricators.