Saturday, October 01, 2005

Machining From STL Files-Part 1

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.
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.

No comments: