Edit an STL File in SOLIDWORKS - It’s Easier Than You Think

STL File SOLIDWORKSIf you work with 3D Printers regularly, then you know what an STL file is. And you know what a pain they can be to work with. There are some very good STL editors out there, but they tend not to be “parametric” modelers, which can be difficult to use accurately. More importantly, this style of editing can be unfamiliar to Design Engineers. Luckily, if you have access to SOLIDWORKS 2018, you may be surprised how easy it is to edit STL files. Read on to learn how.

For the uninitiated, STL has become the de facto standard file format for 3D Printing. This may be an accident of history since STL was originally used for (and is an acronym for) stereolithography, back when that was the only 3D printing technology. In a nutshell, STL files are polygonal approximations of mathematical geometry. When a geometric model is converted to STL, all of its surfaces become represented by triangular faces of varying size and shape.

It’s very difficult to reverse that conversion and extract mathematical geometry from an STL (imagine trying to reproduce The Great Gatsby based solely on Cliff’s Notes). Although SOLIDWORKS Premium has a tool for this (ScanTo3D), it has a steep learning curve. Luckily SOLIDWORKS 2018 includes tools for working with STL files and other mesh files natively.

Today I’ll be working with the Xwing TMG Token Holder by GMBridge downloaded from Thingiverse.

STL File SOLIDWORKS

This looks great for keeping my card and tokens organized for the X-Wing Miniature Tabletop Game, but it’s a bit more detailed than I need. I’d like to create a simplified version of this model that I can edit in the future.

I could File>Open the STL file using the “All Files” filter (or just drag the file into the SOLIDWORKS window). But there are some additional options you’ll only see if you use the “Mesh Files” filter.

STL file SOLIDWORKS

Specifically, this is where you’ll define the import units (to avoid having to manually scale the part later), and where you choose how to import this mesh. In this article, I’ll import with the default options.

STL file SOLIDWORKS

STL files can get very large and often take a while to open. When it does, I see a Surface-Imported feature in the tree with an unfamiliar icon identifying this as a Mesh Body. Mesh Bodies are new for SOLIDWORKS 2018 and allow these models to be manipulated as a single entity, rather than a (huge) collection of individual faces, as had been the case. Although I won’t be able to select individual facets or edges, performance is much better. Plus it gives me access to the new Mesh Tools, which make editing and reverse-engineering much easier.

In this case, SOLIDWORKS encountered mesh errors* in the model and was unable to generate a solid body. So I won’t be able to perform any boolean operations (e.g., cuts or bosses) directly to the model. Instead, I’ll extract usable surfaces from this mesh and use those to create a model. I’ll begin by using the Surface From Mesh tool to define a flat surface.

*(While Import Diagnostics should normally be used to fix import errors, the tool doesn’t fix Mesh Bodies in my experience).

STL File SOLIDWORKS

I’ve selected (in blue) some of the polygons on top of the model which should be a planar face; pressing Calculate highlights (in brown) all the adjacent faces. STL files are approximate though, so there’s also a “facet tolerance” slider to define how close to coplanar is close enough for adjacent faces to be highlighted. Pressing OK (green check) creates a new Surface Body from my selection.

STL file solidworks

I’ll continue to use Surface From Mesh to extract as much detail from the model as I want. The command is ‘pinned’ by default, so every time I click OK, a new Surface Body is created.

STL file SOLIDWORKS

If I wanted to completely reverse engineer the part, I’d extract all the surfaces in the model and eventually stitch them together. But for this tutorial, I’m keeping it simple. The faces I’ve extracted so far (colored blue here for contrast) define the top surface of the part, the position and dimensions of all the token pockets, and their depth. I’m pretty much done with the mesh at this point, so I’ll Delete that body.

Next, I’ll start a Sketch on the top surface and Convert the edges to model geometry. In the image below I’ve selected all the “Inner loops one by one” to get all the edges I need.

STL file SOLIDWORKS

Notice that the circular profiles are made up of lots of very small line segments, a byproduct of the inherent faceting of STL files. If I weren’t so picky, I’d use the sketch as-is. But I want this model to be as parametric as possible. So I’ll toggle the visibility of Temporary Axes and use them to define the centers of sketch circles, which I trim back to the surrounding geometry.

stl files solidworks

Bear in mind, the STL format introduces some inherent inaccuracies, and I have no idea how this was originally modeled, so I expect some of the axes to be a bit off, and for the endpoints not to connect perfectly; that’s what Power Trim is for.

STL files solidworks

Now I can use familiar solid modeling tools to Extrude the sketch and add any other features using the surfaces to constrain them. When I’m satisfied, I’ll delete those surface bodies to clean up the model a bit. And of course, since all my editing has been done in SOLIDWORKS, it’s all parametric! I can easily edit or suppress any of the features. Below you can see the original STL, alongside my edited version.

STL Files solidworks

The technique used in this blog is what I’ve used most often for editing STL files in SOLIDWORKS, but it’s not the only route. In future blogs, I’ll convert an entire Mesh Body to SOLIDWORKS geometry, and demonstrate how to make edits directly to Mesh Bodies using boolean features. If you use STL files regularly (especially if you’ve tried the ScanTo3D tool in the past), I hope you’ll give the new Mesh Tools in SOLIDWORKS 2018 a try.


Related Articles

SOLIDWORKS Frequently Asked Questions: Top 10 Tips and Tricks of 2017

Forgotten SOLIDWORKS Tools and Reasons to Use Them

Where is the SOLIDWORKS Command That Lets Me Do...

About the Author

Dan EricksonDan Erickson is a student of life. With a BS in Mechanical Engineering Technology from Michigan Tech University and a penchant for tinkering, he is driven to understand how the world works and improve wherever possible. After several career iterations, Dan came to Fisher Unitech in 2011 as a SOLIDWORKS Support Engineer. He has since followed his passion for tranrsformative technology to the 3D Printing department, supporting the Sales and Marketing teams as 3DP Application Engineer.