Machining From STL Files

If you think the STL file format is just a convenient means for programming rapid prototyping machines, think again. Here's how STL can work for machinists too.

Article From: 1/1/1997 Modern Machine Shop, ,

If you are familiar with Stereolithography or other rapid prototyping processes, then you probably know all about STL files. If you only deal with CNC machining, then maybe you don't. But if your shop does a lot of 3D machining, the STL format is at least something to be aware of, and at most a tool that can speed and simplify the process of transferring and machining complex geometric forms.
The term STL, for Stereo-lithography tessellation language, refers to the representation of 3D forms as boundary representation solid models constructed entirely of triangular facets. In terms of the structure, it's rather like a geodesic dome, but one capable of representing -- as a single entity -- just about any free-flowing form that you'd ever want to machine. And machine from these forms you can, thanks to new developments in CAM technology.

The true beauty of the STL file lies not in its complexity, however, but quite the opposite, in its simplicity. The most basic of planar entities, the triangle, is used to describe everything. Each such "patch" is defined with just three points and an orientation vector. While it does take a lot of these triangles to represent 3D geometry, it liberates the file translation process and generation of tool path from many of the mistakes, missing data and ambiguous data inherent in working from translated surfaces and solids.

To find out more about where the STL format fits for machinists, we spoke with John Howes at Delcam International (Birmingham, England) -- one of the first CAD/CAM developers to use STL files for machining applications -- who has kindly provided most of the information for this article.

Mr. Howes is quick to point out that a faceted solid model is no panacea. It's not an original modeling tool, for design or for manufacturing. And while it can help make 3D file transfers and tool path generation less problematic, it won't make them foolproof. Still, the STL file can offer some very significant benefits in the proper applications, particularly to shops already in the business of machining prototypes, molds and dies. So read on and decide for yourself if STL files might have a place in your 3D machining operations.

Doing One Thing Well

The original intent of the STL format was to provide a means to unambiguously represent a solid model so that it could readily be turned into a physical prototype on a Stereolithography machine. The first STL specification was published by 3D Systems, Inc. (Valencia, California) -- developer of the Stereolithography process -- in July, 1988, and revised the following year.

The Stereolithography process is in many ways the exact opposite of machining. Rather than subtracting material from a solid piece of stock, a physical model is built from the ground up in thin horizontal layers by using a laser scanner to harden a liquid photosensitive polymer in the shape of the piece. The 3D CAD model, then, serves simply as a boundary from which this succession of 2D slices -- that correspond to each layer of the physical model -- is taken. To create "tool path" for the process, the laser beam is directed to trace about the boundaries of each slice to define its edges, and then to raster back and forth within the boundaries to harden the inner core. Though obviously serving a different purpose, the path is quite similar to that of a milling pocketing routine. And so it's not such a stretch to see that an STL model could also be used for machining, though now all the work is performed on the outside of the model, and often in three dimensions at a time, rather than just two.

By definition, an STL model is a completely closed boundary representation constructed entirely of triangular facets, the sizes of which are determined by a tolerance applied to an original surface or solid model. The STL format states that the facets are each described by the X-Y-Z coordinates of their three vertices and a surface normal vector that indicates the orientation of the facet and which side of it faces out. The format also includes rules to ensure that the triangles are all properly connected at the nodes.

Why are triangles such a good way of describing 3D models? "Obvious though it may sound," says Mr. Howes, "it is because there is really only one way to represent a triangle. By definition, they always have exactly three sides and vertices, so they are always planar and they can always be made to tile an area without gaps and overlaps. Every commercial surface or solid modeling system can generate accurate faceted representations of its models (even if only for color shading), whereas there are many different surface formulations. Even if you pick a single general representation like NURBS, there are still many different ways to represent the same geometry. Also, since STL is a much more tightly defined standard [due to its narrowly defined purpose and the proprietary environment in which it was developed], there are no different `flavors' from different CAD systems."

We should make clear at this point that no one initially creates geometry with an STL-type faceted model. Rather, 3D geometry is created with conventional modeling tools -- surfaces and solids -- and then converted to the faceted approximation of the original. A user-input tolerance is applied by a triangle-fitting algorithm, much in the same way that a cordal deviation tolerance is used to create 3D tool path from some form of reference geometry.

How Triangles Help Machining

Where do STL files pay off for machinists? According to Mr. Howes, "The key advantage of using the STL file format is that it communicates only the data that the NC programmer needs -- the geometry of the part. There is none of the extra information in the file to indicate the structure of the original CAD file." That helps simplify the process of transferring workpiece geometry from one system to another and also saves work and errors since the STL file is by definition a closed, unambiguous solid.

On the CAM side, not having access to all of the original surface data can at times prove to be a limitation, but that's certainly not a given. Indeed, if the STL file is properly constructed, it should preclude the NC programmer's need to get at the surface data in the first place. "Although the structure of a CAD model may be useful for machining, this is not always the case," says Mr. Howes. "Most toolmakers are familiar with the requirement to remodel parts of a job because the model structure didn't fit with their manufacturing requirements and the capabilities of their CAM software. Typically, many small surfaces may need to be combined so they can be machined as one, or fillets may need to be added to prevent gouging at surface boundaries that don't meet exactly. None of these modeling operations should be necessary when creating tool path from an STL file because the algorithms only rely on the shape of the part, not on the arrangement of component surfaces."

Moreover, Delcam contends that the original structure of a CAD model can adversely affect the tool path in some cases, depending on how the CAM system utilizes the surface information. For example, some CAM systems will ignore a fillet between two surfaces unless they are properly trimmed, and that will result in a gouge. And there's always the case where the CAD operator doesn't quite get around to making sure all the fillets are there to begin with, or to making sure all surfaces are properly joined, the latter of which may result in the tool "dropping through" an inadvertent hole in the geometry.

Delcam also argues that the calculation of tool path from a faceted model can be much faster than when working directly with complex surfaces. Because the mathematical representation of the faceted model is quite simple, the algorithms for generating tool path can be relatively simple as well, and more readily optimized. Conversely, when working from complex surface representations, the tool path algorithms must be able to cope with a much broader set of contingencies embodied in the math. The simplicity of the faceted model also permits the CAM developer to run many more tests on the quality of its tool path processor before each release of the software is shipped.

Limitations

There is a downside to working with STL files. Perhaps the most obvious is that a faceted model is an approximation of the original surface geometry, which calls its accuracy into question. Practically speaking, however, this issue is relatively minor from the machinist's standpoint. Why? Sooner or later the model will become faceted anyway because all contouring moves in a 3D part program will be composed of linear movements in all but a very few exceptions.

One could argue that there is a doubling effect of laying tool path on an approximated model -- an approximation of an approximation so to speak. But one should also take into account that the facets of a tessellated model can be quite small. It's common practice to set faceting tolerances in the range of 0.001 mm (about 0.00004 inch) for machining purposes, says Mr. Howes. Moreover, the tool path processor can apply some relatively simple logic to more closely adhere to the base geometry. For example, on a convex form, the center of a linear path across a facet will obviously come closer to the base geometry, where on a concave form the edges of the facet will come closer, and the tool path processor can take these factors into account.

A larger issue for most shops will be the size of an STL file. For one thing, it takes a lot of triangles to accurately approximate a 3D form of any complexity. The file also contains a great deal of redundant information because the vertex coordinates of every triangle are stated individually. Since any given vertex will be shared with two or more adjacent triangles, each point will be stated two, three or more times. Also, the surface normal of each triangle is explicitly defined as a vector, which helps improve processing speed for rapid prototyping but mostly just adds unnecessary data for three-axis machining applications.

This large volume of data creates the temptation to attempt to reduce file size by loosening the faceting tolerance; but that's a bad idea if the facets become large enough to be seen in the actual machined surface. The faceting tolerance must be chosen in anticipation of the tightest machining tolerance to be used, says Mr. Howes, even though this means that the initial roughing calculations will be slower than is strictly necessary.

So, STL users will have to get used to large files. There are ways to compress the data to make files somewhat more manageable, and the faster computational speeds do a lot to mitigate the downside aspects of their size. In fact, Delcam contends that tool path calculation performance is still faster overall. But anyone wanting to machine from STL files will need to commit more than a little extra memory to the task.

Another significant issue, particularly if you live on the CAM side of the fence, is that there is little opportunity to edit an STL file once it has been output. The CAM system therefor must rely on the originating CAD system to have produced a good STL representation and to a suitable tolerance. That all depends on the CAD system's ability to consistently output good, closed models and on the CAD operator's knowledge of what tolerances manufacturing will require as well as an inclination to make sure all the necessary geometry is created in the first placenone of which is a given.

There are ways to correct moderately defective STL files. Delcam, for instance, has a feature called TriFIX that can sort out the connectivity of the facets and fill in small gaps, remove duplicate nodes, correct overlapping triangles and so on. Moreover, intelligence can be built into the CAM processor that makes it more forgiving of imperfect models. For example, when Delcam's PowerMILL CAM system is creating tool path from an STL model, it will automatically pass over a hole in the geometry smaller than the diameter of the selected tool.

But no patch kit can compensate for a faceting tolerance too loosely set or for a badly flawed file that's missing fillets, radii, or other important geometry. Those cases will demand a return to the original surface or solid model.

And finally, there is some useful information that will be lost when surfaces are converted to a faceted model. Surface boundaries, for example, will be gone. In many cases, these boundaries can be recreated with CAM functionality, but not always. Some flow cuts that follow individual surfaces may be sacrificed as well. Functions such pencil milling (where a tool is automatically driven along sharp surface intersections) are still possible, however, by using algorithms that analyze the faceted model, looking for abrupt changes in the "surface" normals.

More Applications

These limitations are going to relegate the STL file to a niche role well into the foreseeable future. But that role is likely to grow larger with time. Besides Stereo-lithography, the STL format has already become the de facto standard for other rapid prototyping processes such as selective laser sintering, laminated object manufacturing, and fused deposition modeling. Simple, faceted solid models also have other obvious applications in casting and molding process simulation, stress and thermal analysis, and other engineering functions.

Machining applications are likely to become more prevalent as well. But whether shops choose to machine directly from faceted solid models or not, they had best be aware of the STL format, since they'll likely be seeing more of those files in the future.

Comments are reviewed by moderators before they appear to ensure they meet Modern Machine Shop’s submission guidelines.
blog comments powered by Disqus
• 2-5 Axis Milling
• Mill/Turn and Multi-Task Machining
• Solid Modeling & High Speed Machining
iMachining - the
Revolution in
CAM. 70% Time
Savings and More.
Greatly Extended
Tool Life!
HSMXpress is full
featured 2 1/2-axis
CAM for SolidWorks.
Best of all, HSMXpress
is absolutely FREE!
SmartCAM features New Mill/Turn Sub-Spindle and B-axis Support, Morph Pattern Roughing.
MMS ONLINE
Channel Partners
  • Techspex