Decimate STL Working Times with Decimate Mesh
With the proliferation of model sharing sites such as 3D ContentCentral, GrabCAD, and Thingiverse, sharing parametric model files (SW files, STEP, IGES, etc.) has never been easier. Even more prolific than parametric model files are Mesh Files (STL, OBJ, etc.). Most 3D printing software require an STL file to generate the toolpaths to 3D print a model, making STLs pretty much ubiquitous in the model sharing space. When you click on a project on these model sharing sites some of them may have parametric files (such as STEP files), or even proprietary files (such as SOLIDWORKS files). In that case, you have struck editability gold. However, you will not always find those file types. More often than not you will find an STL file, which is why it’s important to have techniques to deal with them.
STL is one of the oldest and most limited file types, dating back all the way to 1987. It’s widespread due to how easy it is to generate for many CAD systems. While it has many limitations (such as being unitless), one of the most annoying challenges is that STLs cannot have any smooth curves. That’s right, an STL is just a list of coordinates in a specific order that allow a CAD system to linearly interpolate between each point to form a closed polyhedron. In layman’s terms, they’re just made of a bunch of little triangles. It’s this limitation, specifically, that we will discuss.
Ahead of the Curve
You may be asking, “If there’s no curves in an STL, how do curvy things get represented?” This is a valid question, since STLs would largely be useless without any way to represent curved surfaces. The way an STL accomplishes that is by approximation. By using smaller and smaller triangles, an STL can represent a curved surface more and more accurately. Observe the figures below, where I have modeled a football, and then exported it to STLs of varying degrees of fineness.
As can be seen, the more triangles an STL file has the closer the approximation is to the original shape. However, if there are too many triangles in an STL it causes problems. The first is file size. The extreme example of the football is a whopping 96 MB and has 1.9 million triangles. This makes it hard to send to others (most email services limit attachments to 25 MB) and fills up hard drive space quickly. But most damagingly, these massive STLs are very difficult to process by most CAD systems and 3D printing slicers. Sure, accuracy is nice, but it is completely worthless if I can’t even open the file to make modifications. And here is where we get to the problem….
Many modelers LOVE to save their STLs in the finest possible setting, leaving them full of these triangles, regardless of the effective resolution a 3D printer can provide. These STLs are everywhere. What results from this is a “What you see is what you get” effect when you download someone’s model to modify or print. If the file doesn’t work for you, that’s too bad, it can’t be processed with anything short of a supercomputer. You will have to model it from scratch yourself or go find another file online.
Never Fear, SOLIDWORKS 2020 is Here!
Now it may seem like all hope is lost on this, but I am happy to report that SOLIDWORKS 2020 will have a feature to deal with these menaces: Decimate Mesh.
Decimate Mesh is a command in SOLIDWORKS 2020 that takes a mesh with a certain amount of triangles and reduces them while keeping the overall shape. Keep in mind that this process will reduce the level of detail in the mesh file, but the idea is to remove the unnecessary level of detail so that I can apply modifications in SOLIDWORKS easier, my 3D printing slicer will generate toolpaths quicker, and the file size of the resulting STL will be smaller.
Let’s try an example!
Below, I have a game controller that I would like to have inside of SOLIDWORKS. There’s plenty of things I can do with this file such as 3D print a prop controller, or model custom grips, or maybe even a cradle to put the controller down on. But in any of those cases, the first thing I need to do is get the file in SOLIDWORKS and then reduce the facet count so that it processes easier!
Let’s start. In SOLIDWORKS 2020, go to File > Open. Change the file type to “Mesh” (This enables the options) and locate the file you wish to open. Select it, but don’t hit Open yet. We need to check a setting first.
Click on “Options…” and check that the STL is set to set to import as a Graphics Body. This is important because Decimation only applies to Graphics bodies.
When SOLIDWORKS opens up a file as a graphic, it offers a convenient way to look at the file without too much information being loaded. As can be seen here, there’s quite a few triangles to this model. Let’s reduce them.
With the graphics body open, go to Insert > Mesh > Decimate Mesh. In the first blue selection box, click the mesh in the graphics area to select it. Now the fun part…playing with all the settings!
Below the selection box, there are 3 spin boxes to play around with.
The first two drive each other. If you want to think about a percent reduction, type in the percent. If you want it to have a certain number of facets, type that into the second box. The raw mesh has 125000 facets, so a 20% reduction would leave it with 100000 facets. For this example, let’s say that I want no more than 10000 facets. Let’s punch that in! The percent box changes automatically to 92%.
The third box is the max allowable error. Recall earlier that I mentioned that decimation implies removing a level of detail and smoothness, but you can tell the tool how much you are willing to part with! This is saying that the new facets will be no more than 0.15mm away from the original mesh. That more than suffices for my purposes!
Once you have the settings checked, hit calculate and let SOLIDWORKS do the rest!
Now you can see that the new mesh still represents the shape of the controller very well, but the reduction in facets allows me to work with it a lot easier and faster!
Thanks for reading along and stay tuned for more articles on Mesh Editing, SOLIDWORKS 2020, and more!