Soon, we will launch a new and updated customer portal, which is an important step toward providing our customers with one place to learn, interact, and get help.
Learn more.

How to import CAD objects

This article describes how to import CAD objects into OpticStudio, using STL, IGES, STEP, and SAT formats.
 
The choice of CAD format you use is likely to be based on the CAD program you use. STL is good for objects that are inherently faceted, or where you will use stereolithography to generate rapid prototypes. IGES and STEP are CAD exchange standards, and the choice between them will probably be based on the quality of your CAD program's export routines. SAT format will be used if your CAD program is based on the ACIS engine.
Mark Nicholson
09/13/2005
CAD Exchange

Introduction

The ability to import CAD objects into OpticStudio is very important, particularly when undertaking complex opto-mechanical stray light simulations, where reflections and scattering from mounts is critical. It is also important in illumination system, where light may be directed down a complex-shaped light pipe, for example in automotive dashboard design. OpticStudio has powerful and flexible CAD import capabilities and supports common CAD exchange formats.

Importing CAD objects

Because CAD objects can be of arbitrary complexity, a ray may interact with it many times. As a consequence, we use non-sequential ray-tracing to describe the interaction of rays with CAD objects. CAD objects may be easily included in otherwise sequential optical systems by using hybrid mode non-sequential ray-tracing.

OpticStudio supports four static CAD formats: STL, IGES, STEP and SAT (in addition to dynamic formats, such as SLDPRT and ZPO, not discussed in this article). Of these, only STL uses facets to represent the object: the other three model the object as a smooth, continuous surface shape. Facets are only used to draw these objects on screen. Therefore ray-tracing to the continuous, smooth CAD surface is exact, at least to the limit of the accuracy of the CAD model, despite facets being used to draw the object.

It’s important to realize that although OpticStudio supports genuinely faceted objects, in most cases facets are only used for rendering purposes, and the real surface shape used for ray-tracing is exact.

STL format

STL (Stereolithography Tesselation Language) format is widely used in rapid prototyping, and allows easy definition of very general shapes. It is based on a tri-mesh representation of the object, in which the surface shape of the object is approximated by a set of triangular facets.

Reference 1 gives a useful overview of the STL format. Each facet in an STL file is defined by the {x,y,z} coordinates of the three corners, and the surface normal vector. Here, for example, is the first few lines of a sample STL file produced by AutoCAD:
  
 solid AutoCAD

facet normal 0.0000000e+000 0.0000000e+000 1.0000000e+000

outer loop

vertex 6.0000000e+000 4.0000000e+000 6.0000000e+000

vertex 6.0000000e+000 6.0000000e+000 6.0000000e+000

vertex 4.0000000e+000 6.0000000e+000 6.0000000e+000

endloop

endfacet

facet normal 0.0000000e+000 0.0000000e+000 1.0000000e+000

outer loop

vertex 6.0000000e+000 4.0000000e+000 6.0000000e+000

vertex 4.0000000e+000 6.0000000e+000 6.0000000e+000

vertex 4.0000000e+000 4.0000000e+000 6.0000000e+000

endloop

endfacet

(Note that OpticStudio imports both ASCII and binary versions of the STL format). The faceted nature of STL makes it ideal for modelling objects like faceted reflectors and prisms. However, it is less good at modelling smoothly curved objects, where the facetization errors are likely to affect ray-tracing accuracy.

STL objects are imported using the CAD Part: STL object type. The .stl file must be placed in the {Zemaxroot}\objects\CAD Files\ folder.

Non-sequential component editor

Once imported it is positioned like any other object.

In this example, the prism is exactly modelled by flat facets, but the sphere is only approximated:

The prism is exact, but the sphere is approximate

The sphere is formed by a tri-mesh approximation:

A close-up of the sphere shows the approximation

In this case, the facets drawn on screen are exactly those generated in the STL file, and rays interact with a series of flat facets.

IGES format

The Initial Graphics Exchange Specification (IGES) is an American National Standard whose intended purpose is to facilitate transfer of data between CAD programs. OpticStudio currently supports version 5.3 of the IGES standard. For more information on IGES, see  Reference 2.

IGES objects are stored in the {Zemaxroot}\objects\CAD Files\ folder, and are imported by the CAD Part: STEP/IGES/SAT object:

The Object properties dialog

This object is exported from SolidWorks:

A CAD object exported from Solid Works

Now this object is exported using whatever SolidWorks considers most appropriate, probably NURBS3. It is rendered on-screen using facets, because IGES objects can be extremely complex:

This view uses facets only for on-screen drawing

It is important to understand that OpticStudio uses these facets for only one reason: to draw the object on-screen. IGES objects are represented internally as exact, smooth objects, not as a set of facets like STL objects.

STEP format

STEP, the Standard for the Exchange of Product Model Data, is a comprehensive ISO standard (ISO 10303) that describes how to represent and exchange digital product information. Reference 4 contains a lot of information on STEP.

For the OpticStudio user there is little to choose between IGES and STEP. Both work well with OpticStudio, and your choice between these two standards is likely to be based on the quality of your CAD program's export routines. IGES is the older format, and several CAD vendors use their own export translator, which leads to some variation between vendors. STEP is newer, and most CAD vendors use bought-in libraries like Step Tools, which means that there may be more uniformity between different CAD packages' implementation of STEP.

STEP objects are accessed and behave exactly like IGES objects in OpticStudio.

SAT format

The SAT format is used by the ACIS geometry modeling engine developed by Spatial Technologies. It directly represents the internal data structures of the ACIS modeler. That means if you load an SAT file into an ACIS-based CAD program, there's normally no translation at all: the file goes straight in. Hence this is not a "CAD Exchange" format as such: it is a CAD format.

You will most likely use the SAT file format if you use an ACIS-based CAD program, and not use it at all if you don't. Again, this format is a smooth, continuous object representation. Usage is exactly as per the IGES file format.

Imported CAD object properties and parameters

There are a set of properties that you can use to control the imported object. These controls are found in the Non-Sequential Component Editor parameter cells and Object Properties window. This discussion applies all four CAD import types previously mentioned.


The properties of the Imported Object

The properties are:

Material. Only one material can be applied per object. As this coffee pot consists of a glass jar, plastic lid, plastic handle, aluminum ring to hold the handle onto the jug, and some metal screws that hold the handle onto the ring, these objects should be exported from the CAD package separately, and then imported into OpticStudio individually. Alternatively, the imported object can be Exploded to expose each individual component as a separate CAD object. Then each sub-object can be given the appropriate optical properties. The use of relative object references allows all sub-objects to be positioned relative to a master object, so that the whole coffee pot can be moved and rotated as a single unit.

Scale. This is a dimensionless scale factor that allows you to increase or decrease the size of the object.

The Mode flag controls the tradeoff between set-up time and ray tracing speed. Use mode 1 for fast set up time and slower ray tracing, mode 2 for medium set up time and medium ray tracing, and mode 3 for slow set up time and fast ray tracing. Generally, use mode 1 during set-up of the system in OpticStudio, and mode 3 for tracing a large number of rays for detailed analysis. Note that accuracy is not affected by the mode flag. Only ray-tracing speed and the initial loading time of the object is affected.

X, Y and Z Voxels define how many volume elements are used to define an invisible bounding box in which the object is defined. Voxel technology allows for fast ray tracing by precomputing which objects, or portions of objects, lie within a given voxel. A ray entering a voxelated space may only intersect some subset of the total number of voxels; and therefore only these voxels need to be checked for possible ray-object intersections. The greater the number of voxels, the longer the set-up time but the faster the ray tracing. It generally takes some experimenting to determine the optimum number of voxels. Note that accuracy is not affected by the number of voxels. Only ray-tracing speed and the amount of memory required to represent the object is affected.

Explode? A flag which indicates whether the CAD part has been exploded. This is used by OpticStudio, and not set by the user. In order to explode a CAD object, use the CAD > Explode CAD Assembly tool in the toolbar of the Non-Sequential Component Editor.

Chord Tolerance. This setting is available in the Object Properties > CAD tab. It affects only the rendering of the solid within the layout plots. To render the solid, OpticStudio converts the solid to list of triangles which approximate the shape. The tolerance is the maximum allowed distance in lens units between a single triangle and the actual surface of the solid. More triangles are added if the tolerance is set smaller which yields more accurate rendering, at the expense of speed and a larger memory requirement. The default value of zero will use a chord tolerance related to the size of the object sufficient to generate a coarse approximation of the object shape that will render quickly. Again, the accuracy of the ray-tracing is not affected by this setting.

Comments on accuracy and ray tracing speed

Objects from CAD packages import easily using the STL Object for faceted objects and Imported Object for continuous, smooth objects using IGES, STEP or SAT file formats.

Not all types of surface shapes may be ray traced with adequate accuracy using representations supported by CAD file formats, such as IGES, SAT, and STEP. For planes, spheres, and cylinders, the CAD representation, if done correctly, is of very high precision suitable for optical accuracy ray tracing. However, higher order shapes do not usually have a native representation in CAD formats.

For example, an aspheric surface with a polynomial term of the form r16 may have no equivalent representation in the chosen CAD format. A CAD program will generally approximate this shape using a segmented spline3, which is in general a piece-wise fit of the surface using multiple lower order polynomials. Typically, multiple third or fourth order polynomials are used to approximate the surface. This is probably adequate for mechanical design, but not for optical precision ray tracing, where surfaces must be known to tiny fractions of the wavelength of light.

This problem often arises when a high optical precision surface is modeled in OpticStudio, then exported as a CAD file, then imported as an CAD file for subsequent ray tracing. For example, the optical precision of the part is lost upon exporting the native OpticStudio asphere as a CAD spline.
 
For non-imaging optics, and when importing mechanical parts for stray-light analysis, the precision of the CAD representation is usually adequate. For imaging systems, great care must be taken to verify that the imported CAD part is a suitably accurate description of the desired shape. Note that OpticStudio uses a relative internal optical precision of about 1E-12 for ray tracing. Most CAD representations of objects are many orders of magnitude coarser.

Simple objects such as spherical lenses typically ray trace slower when imported in CAD format than the native OpticStudio object of identical shape. In general, always use OpticStudio's built-in objects where a suitable object exists. Ray tracing speed for imported objects is critically dependent upon the efficient representation of the solid shape within the imported file.

The identical object may be represented in a nearly infinite number of ways using the various solid and surface entity types supported by the CAD formats OpticStudio can import. For example, an efficient representation of an object may use only a few spline surfaces; while an inefficient representation of the object may use hundreds of smaller spline surfaces. Although from a mechanical modeling perspective the two representations may both be valid and the resulting solids identical, the representation with the larger number of spline surfaces will ray trace slower. The only remedy is to return to the source of the CAD file and see if a more efficient representation may be generated. We have experience of seeing several orders of magnitude difference in both exported object size and ray-tracing speed by tuning the CAD programs export routines to yield the most efficient representation.

Summary

Importing CAD objects allows OpticStudio to take advantage of the generality of design that mechanical CAD programs allow. This is particularly important when performing stray light analysis, as a full accounting of opto-mechanical effects can be made. CAD import is also useful in a wide range of illumination work, including automotive component testing.

The choice of CAD format you use is likely to be based on the CAD program you use. STL is good for objects that are inherently faceted, or where you will use stereolithography to generate rapid prototypes. IGES and STEP are CAD exchange standards, and the choice between them will probably be based on the quality of your CAD program's export routines. SAT format will be used if your CAD program is based on the ACIS engine

References

1. http://www.mmsonline.com/articles/019704.html

2. http://www.nist.gov/iges

3. The NURBS Book, Second Edition, by Les Piegl and Wayne Tiller, Springer-Verlag, ISBN 3-540-61545-8.

4. http://www.steptools.com/

5. http://www.spatial.com/


ACIS and SAT are registered trademarks of Spatial Corporation.