CAD Part: STL

The STL object is a very general user-defined object. It can be used to define an open polygon surface or a closed polygon volume such as a prism or other solid. The STL Object format is based upon a collection of 3D triangles. This format is widely supported by mechanical CAD programs. Both the text and the binary variations of the STL file format are supported. See the section "Defining STL objects" which follows for details. See also " User Defined Object " , " Polygon Object " , and " CAD Part: STEP/IGES/SAT " .
There are no fixed limits to the total number of vertices or polygons.
The STL file name is referenced in the "comments" column of the STL Object row. For example, if the STL file myobject.STL is placed in the <objects>\CAD Files folder (see " Folders " ), then specify "myobject.STL" in the comment column of the STL Object type row in the NSC Editor.
The reference coordinate is locally (0, 0, 0), and the polygons that compose the object may be placed anywhere relative to the reference point. Some STL export implementations only allow objects to be placed such that all vertex coordinates are positive. OpticStudio does not require this to be the case, and will import triangle vertices anywhere in 3D space.
Using an STL object as a detector is supported, see "Objects as detectors" . When the STL object is used as a detector, If "Fast Ray Trace" (see "Type tab" ) is checked, OpticStudio will alter the order of the triangles defined in the STL file to speed up the ray trace. If "Fast Ray Trace" is unchecked, the order of the triangles is unmodified, which slows the ray tracing but preserves the original order of the triangles defined in the STL file.
STL objects require two parameters:
| Parameter # | Description | Face Name | Face # |
| 1 | A scale factor. All vertices in the STL file are multiplied by this parameter. | NA | NA |
| 2 | A flag to indicate if the STL file defines a volume or a surface. If the "Is Volume?" parameter is zero, then OpticStudio assumes the STL file defines an open surface. Rays must either reflect or absorb from such a surface; refraction is not allowed. If the "Is Volume?" parameter is any non-zero value, then OpticStudio assumes the STL file defines a closed volume. The volume may be reflecting, refracting, or absorbing. | NA | NA |
Face Numbers: All faces Face 0.
Defining STL Objects
The STL format is commonly supported by mechanical CAD programs to describe arbitrary objects. Objects are modeled as a collection of triangles, and the global vertices of the triangles are written out to a file. STL is a good format for faceted objects. For smoothly curved objects, such as lenses, STL is an approximation which may be of acceptable accuracy for some non-imaging systems.
There are binary and text formats for STL files; and OpticStudio supports both formats.
To use an STL object, choose the object type to be an "STL Object" and enter the name of the file (without the STL extension) in the comments column of the STL Object row. The STL file must be placed in the folder <objects>\CAD Files (see " Folders " ).
Maximum triangles in STL objects
There is upper limit on the number of triangles an STL object may contain.That is 2.5 million triangles. If your computer has small RAM, the limit is determined by the amount of real or virtual RAM the computer has available. Each triangle takes up about 100 bytes of memory. However, OpticStudio often maintains multiple copies of the lens data simultaneously, and so a good rule of thumb is that OpticStudio will need 500 bytes of RAM for each triangle. A 2000 triangle object will require about 1 Mb of free RAM. A more practical limit is computer speed; OpticStudio will slow down noticeably if the number of triangles becomes very large.
Example STL files
Several example STL files may be found in the <objects>\CAD Files folder (see " Folders " ).
Exporting to 3D Printers

The STL (STereolithography Language) is particularly useful for sending OpticStudio designs to 3D printing manufacturers. Some manufacturers can also accept STEP export files.
Next: