How to Repair STL Files for 3D Printing With the 5 Best & Free Tools

Last modified: January 21, 2021
You are here:
Estimated reading time: 11 min

Designers and engineers often need software to adapt, repair, and finalize 3D models for 3D printing. Luckily, the era of manual mesh programming is long gone.

Today, there is a range of dedicated tools available offering both automatic and manual STL repair functions. Automatic wizards will suffice for most models and fix small errors such as holes and loose shells, but models with more critical errors will require a standalone solution.

In this guide, we describe the workflow for repairing STL files and walk through the process with five of the best STL repair software tools for fully repairing models towards 3D print-readiness.

Why Repair an STL File?

3D designers typically construct models using elaborate surfacing methods. This results in mathematically ‘perfect’ geometry defined by curves and splines. For 3D printing, surfaces are converted to a mesh format that describes geometry as a cloud of connected triangular faces and vertices.

Mesh conversion is like smashing a perfectly smooth mirror, then gluing back together all the bits and pieces to make it look like the original. Done badly, the result is a model with all kinds of edges, holes, and floating parts, as well as areas with many intersecting triangles that do not belong there. Done well, the 3D print is a manifold mesh without holes, indistinguishable from the original design.

A 3D model mesh with various flaws.

How to Repair an STL File

A typical STL file repair workflow contains the following steps:

  1. Auto-repair. The STL repair software’s wizard will attempt to fix all major errors, including holes, separate shells, and intersections.
  2. Separating shells. A mesh consists of collections of connected triangles. It can contain multiple continuous surfaces that ideally are joined together while obsolete ones need removal.
  3. Closing holes, bridging gaps. Some comprehensive STL repair programs allow different ways of hole filling, such as planar, tangent, ruled, or freeform.
  4. Resolving overlaps and intersections. This typically requires recalculating entire portions of the mesh.
  5. Filtering out double faces, double vertices, inverted normals, and sharp, narrow triangles.
  6. Stitching open edges and remaining holes.
  7. Manual repair by deleting and creating triangles.
  8. Remeshing to optimize triangle count.
  9. Exporting to the chosen mesh format.

The most popular and storage-friendly format is STL (StereoLiThography), which we will use for this article. We recommend saving the STL files in a Binary format since it further reduces file size. As described in our Meshmixer tutorial, there are several other useful formats such as AMF, Collada, OBJ, and PLY, with specialized qualities for storing material, color, rendering, 3D scanning, and 3D printing information.

Note: Several software packages contain mesh repair functionalities, such as FreeCAD, SketchUp, 3D Studio Max, and Rhinoceros, as well as online services such as Willit 3D Print, MakePrintable, 3DPrinterOS, SculptGL, and Shapeways.

Compare Software Tools for Repairing STL Files

EFFECTIVENESS EFFICIENCY UI VERSATILITY REMESHING AUTO-FIXING TOP FEATURES WHO IS IT FOR? COST
Meshmixer ★★★★ ★★★ ★★★★ ★★★★ ★★★★★ ★★★★ UI, Remesh, & Auto-Fix 3D Artists Free
Netfabb ★★★ ★★★ ★★★ ★★★★ ★★★ ★★★ Infill & Supports Engineers Free (edu)
Magics ★★★ ★★★ ★★★ ★★★★★ ★★★★ ★★★ Manual Repairs Engineers Paid
Blender ★★★★ ★★ ★★ ★★★ ★★★★ CG Artists Free
Meshlab ★★ ★★★★ ★★★★★ 3D Scanning Free

Based on our explorations, the best STL repair tool is Meshmixer. It combines a user-friendly interface with all the options needed to repair complex mesh errors. Its additional possibilities and free availability make it a clear number one.

Meshmixer is also a useful tool to edit STL files, resculpt entire sections, as well as optimize and finalize 3D models. Read our tutorial with 15 pro tips for editing STL files for 3D printing.

Autodesk’s Netfabb distinguishes itself by being geared towards engineers with its advanced 3D printing preparation capabilities.

Magics is a professional STL editor solution and offers an enormous variety of STL file repair functions, yet, it often takes more manual repair work. Therefore Magics enters the list in third place.

While Blender is geared more towards 3D modeling and has a complex interface, it still offers most of the required functionalities for successful mesh repairs.

Lastly, Meshlab is a must-have lightweight mesh viewer and editor that makes up for what it lacks in file repair capabilities and user-friendliness with its advanced remeshing scripts.

Advanced STL Repair Software Tutorials

The following section puts the five STL repair tools to the test using a complex 3D model of a coat hook that has several major errors including holes, gaps, intersections, and floating triangles. The hook needs to be combined with a mounting cylinder to result in a single watertight mesh.

Read on to walk through the step-by-step repair process with the five best STL repair programs.

Table of Contents:

  • Meshmixer
  • Meshlab
  • Magics
  • Blender
  • Netfabb

Meshmixer

Meshmixer is a versatile and user-friendly mesh editing program. It is not only possible to optimize a triangle mesh, but also to resculpt entire sections, stylize the model, or add useful features to it.

When loading the coat hook into Meshmixer and initiating Analysis → Inspector we find that indeed, it shows all the mesh errors. Under Shaders, choose the X-ray mode for better visibility. Make sure to select the right Hole Fill Mode before either fixing individual errors by clicking on the dot indicators or running Auto Repair All that in most cases does the job sufficiently.

Use the X-ray shader in the Inspector to view all errors.

An alternative hole repair process is to select the area surrounding the hole and use the Edit → Erase and Fill (F) operation from the popup menu. Setting Type to Smooth MVC produces a good continuous fill. Edit → Make Solid or Edit → Replace and Fill are other alternatives that result in a closed mesh. An additional pass with the RobustSmooth sculpting brush will blend the improved area completely into the model.

In case the model consists of separate shells, go to Edit → Separate Shells and open the Object Browser (Ctrl + Shift + O). Now, progressively select two shells at a time and hit Boolean Union from the popup window. In the newly opened submenu, Precise or Max Quality mode will maintain the intersection curve between both objects, while Fast Approximate is much quicker and usually suffices.

If the Boolean operation fails it results in two red colored objects. In that case, turn the Search Depth parameter up and lower the Target Edge Scale to increase the chance of success. Checking Use Intersection Curves also improves quality. If all else fails, moving one of the shells by a few hundredths of a millimeter in the Edit → Transform section will do the trick.

Auto Repair All will remove floating sections and patch up all boundary loops. In this case, we want to manually connect the gap in one of the struts. This is where the Bridge tool comes in. It works best on straight sections and since this is a gap between circular loops it is best patched up in sections. Choose Edit → Select and highlight the triangles on both sides to be connected. Then hit Edit → Bridge (Ctrl + B) from the popup menu and set the Refine parameter high enough for a smooth connection. Repeat the Bridge command for a few areas around the perimeter of the gap, then use the Inspector to fill the remaining holes. A good error prevention practice is to use Edit → Remesh before repairs in order to increase and homogenize the triangulation in the area concerned.

Connecting a cylindrical gap requires several bridging, remeshing and hole filling operations in Meshmixer.

Meshlab

Meshlab is a software suite that specializes in mesh operations related to 3D scanning data and provides many retriangulation and advanced repair algorithms. A useful one is Filters → Remeshing, Simplification, and Construction → Simplification (Quadratic Edge Collapse Decimation) because it recalculates a mesh towards a target number of faces. Checking Planar Simplification will preserve flat surfaces best. An alternative triangle reduction method is Filters → Cleaning and Repairing → Merge Close Vertices.

Floating elements can be detected by right-clicking on the part in the project window and selecting Split in Connected Components. Separate shells can then be individually deleted or combined back with CSG Operation using a Union operator.

Basic repair utilities in Meshlab: Close holes, Boolean, and brush selection.

It is possible to do basic mesh repairs as well with Meshlab. For example, Filters → Cleaning and repairing → Select Self Intersecting Faces → Apply will select all intersecting triangles which can then be removed by pressing Delete. Filters → Cleaning and repairing → Remove Duplicated Faces and Remove Duplicated Vertex are always useful actions to perform. The next step is healing up holes using Filters → Remeshing, Simplification and Construction → Close Holes. The Compute Geometric Measures operation under Filters → Quality Measure and Computations will indicate when a mesh is not watertight. If not, detect the involved areas with Render → Show Non Manif Edges and Show Non Manif Vertices.

For bridging gaps, groups of triangles can be deleted using the Select Faces in a Rectangular Region tool from the toolbar. Hold the Alt key to leave backfaces out of the selection, use Shift + Ctrl + D to deselect. For selecting individual triangles, click the Z-Painting tool on the toolbar and select the red brush icon. Left click to select triangles, right click to erase the selection and hit delete to remove triangles. Because Meshlab does not implement any triangle creation functions, we reside to the surface generation method under Filters → Remeshing, Simplification and Construction → Surface Reconstruction: VCG. With a low enough setting for Voxel Side and high enough value for Geodesic Weighting and Volume Laplacian Iterations, it will result in a smooth manifold mesh. This method is usually recommended over Filters → Remeshing, Simplification and Construction → Screened Poisson Surface Reconstruction. Another alternative method is to generate an Alpha Complex then generate an Alpha Shape which sometimes works with the right values. For remesh operations, Meshlab offers a voxeliser under Filters → Remeshing, Simplification and Construction → Uniform Mesh Resampling which results in a manifold mesh and offers an offset parameter useful for creating hollow parts.

Note: Save meshes after every important operation! Meshlab does not have an Undo function and will require reimporting the original mesh.

Advanced surface reconstruction functions in Meshlab, some more successful than others.

Magics

Materialise Magics is a professional 3D print data preparation tool that allows extensive manual control over meshes, including wall thickness analysis, hollowing, remeshing, smoothing, Boolean, and cutting operations, as well as fixing holes, bad edges, and the most complicated triangle errors.

Fixing errors is typically done using the Fix Wizard under the red cross icon. Click on Go to Advised Step opens a diagnostics table to check for different errors to be repaired. For large meshes, it is recommended to uncheck Overlapping triangles and Intersecting triangles and fix the major errors first. After selecting Update, again click Go to Advised Step and then on Automatic Fixing–this will fix most errors.

In case the fix wizard fails to repair bad edges and overlapping triangles, the Stitch function under Stitching in the Fix Wizard menu often proves useful with a high enough tolerance setting. For remaining overlapping triangles, either run the Fix Wizard again or choose Detect Overlapping from the Overlaps section in the Fix Wizard menu. This selects all overlaps that will then be removed by hitting Delete Marked. Similarly, this can be done for intersecting triangles under Triangles → Detect Intersecting. If stitching the remaining gaps does not complete the repair, the Create button now allows filling up the remaining gaps manually. Mesh sections can also manually be marked under the Marking tab on the main menu. Floating sections can be removed under the Noise Shells section. For large non-planar holes, manually filling these using the Freeform option under Holes in the Fix Wizard menu will result in the smoothest fill patch. The Ruled option allows specifying a direction for the hole to follow and is in this case used to bridge the cylindrical gap in one of the flower’s stamens after manually creating a few bridging triangles.

Sometimes the Fix Wizard will not merge different shells in the mesh. To fix that, right click on the part in the Part Pages → Part List menu on the main screen and choose Shells to Parts. This creates separate meshes that when checked can now be combined using the Tools → Boolean (Ctrl + B) function.

Advanced hole filling functions for organic and cylindrical shapes in Magics.

Blender

Blender is a free and open-source mesh creation environment, including 3D modeling, rigging, rendering, and animation. Several STL repair functions are available in Edit Mode on the Mesh menu on the lower toolbar. The CellBlender add-on provides a Mesh Analysis tool to check manifoldness and to look for manifold errors. Before commencing any repair scripts, make sure to have the relevant mesh or section selected.

Mesh → Normals → Recalculate Outside (Ctrl + N) flips any triangles with inverted normals. Check the info pane on top for results, in case quads are generated, these can be converted to triangles with Mesh → Faces → Triangulate Faces (Ctrl + T). Mesh → Degenerate → Dissolve removes edges and faces with no area. Remove duplicate vertices to weld edges together with Mesh → Vertices → Remove Doubles.

Bridging, hole filling, and Boolean functions are all represented in Blender.

The simplest way to fill a hole in Blender is to first select the boundary loop with Select → Select Boundary Loop or select all non-manifold edges with Select → Select All by Trait → Non Manifold (Shift + Ctrl + Alt + M) and then hit Mesh → Faces → Make Edge/Face (F) or Mesh → Faces → Fill (Alt + F) for an improved fill. Individual triangles can be created by right-clicking an edge or vertex, Shift + right-clicking the second one and pressing F. It is helpful during editing to switch between Vertex Select, Face Select, or Edge Select modes that are indicated by three icons at the bottom toolbar. Selecting a particular area can be done with Select → Circle Select (C) which works similar to brush selection. Change the brush size with the mouse wheel or the numerical plus/minus buttons, deselect holding the Shift key. Mesh → Faces → Beautify Faces (Shift + Alt + F) sometimes works to improve mesh quality in the selected area. Individual boundary loops can be selected using Alt + Right click. With two open boundary loops selected, choose Mesh → Edges → Bridge Edge Loops and the two areas will be smoothly connected.

Choosing Mesh → Vertices → Separate → By loose parts will create one object per shell in the project browser. This makes it possible to delete unwanted mesh objects. Separate shells can be joined together with a Boolean Modifier. If all else fails, implement a Remesh Modifier and increase the octree depth to around 8 or until results are satisfactory. For increasing wall thickness in certain areas, go to Sculpt Mode and use the Inflate brush from the lower menu Brush → Sculpt Tool.

Netfabb

Autodesk Netfabb is an advanced 3D print file preparation tool and its automated repair function is embedded in software such as Formlabs Preform. It is offered in a Standard, Premium and Ultimate version of which the first two are freely available for educational use.

Netfabb offers additional mesh editing procedures such as hollowing, custom support building, and the Lattice Assistant and Lattice Commander which are great aids in developing lightweight parts. The Ultimate version offers an Optimization Utility that structurally optimizes parts based on applied loads using FEA analysis.

With the File → Import CAD File as Mesh function it is possible not only to import mesh models in various formats, but also native files from Catia, Siemens NX, SolidWorks, SolidEdge, Rhinoceros, ProE, Sketchup plus support for STEP, IGES, SAT, and Parasolid XT files. To import a mesh click File → Add part and check Extended Repair in the dialog. This resolves most errors resulting in a 3D printable file.

Before starting the repair job it is useful to analyze parts. Under the Analysis icon in the taskbar or after right click on the part under Parts → Analyse → New Analysis → Add part it is possible to rapidly check wall thickness. Right-click the part then choose Analyse → New Measurement or pick the ruler icon from the taskbar which allows linear, radius, angular, and wall thickness measurements at specific points.

Advanced Netfabb functions: wall thickness analysis and lattice structures.

Open the Part Repair section by clicking the red Repair icon from the taskbar. If the automated repair script did its job well upon import, the Mesh is Closed and Mesh is Oriented items in the Status tab should be checked in green. In the Actions tab, it is possible to further optimize the file in case intersections pertain to exist. Under Self Intersections, choose Detect and then either opt for Trivial which does a default hole repair, Stitch Triangles, Remove Double Triangles, Remove Degenerate Faces, or Split Off and then Remove the intersections. Wrap Part Surface works similar to voxelisation procedures and leaves only a manifold outer skin. Also, make sure that no noise shells exist under the Shells tab.

Netfabb offers advanced STL repair capabilities.

When attempting to bridge gaps, Netfabb will rather fill the open holes which require further manual repairs. Tap the Select Surfaces icon on the main toolbar and select the entire hole, then hit Delete. Alternatively, use the Brush Selection tool and use Ctrl + Scrollwheel and the Plus/Minus buttons to alter brush size and selection. With the triangles selected, choose the Remove Selected Triangles icon and manually add missing triangles as well as a few bridging triangles with the Add Triangles button. The Repair → Close all Holes operation will complete the mesh repair task. Finally, we can opt to refine the mesh using the Mesh Edit → Remesh command which recomputes the model based on a Target Edge Length parameter. Check the Maintain Edge option to optimize model integrity around sharp edges.

Try Professional Stereolithography 3D Printing

Looking for the right tool to turn your designs into reality? High-resolution industrial stereolithography (SLA) 3D printers are fast and cost-effective tools to produce high detail models with a smooth surface finish. Contact us for a quote.

 

Tags:
Was this article helpful?
Dislike 0
Views: 1454

Continue reading

Previous: How To Strengthen 3D Printed Parts in 5 Simple Ways
Next: Using Ejector Pins Properly on Molded Parts
Shopping Basket