Tips and tricks for successful CAD import

This article provides several tips and tricks to ensure smooth conversion of data between mechanical CAD programs and OpticStudio.

Authored By Mark Nicholson


Article Attachments


OpticStudio imports data from CAD programs via the IGES, STEP, SAT and STL formats, and exports data in the same formats. This allows simple and fast exchange of design data between OpticStudio and mechanical design packages.

However, the quality of exports from CAD programs is highly variable, which can lead to problems when objects are imported into OpticStudio. Generally speaking, the tolerances required for optical-precision ray tracing are 100 to 1000 times tighter than typical mechanical tolerances. A little care taken at the export stage can eliminate many common problems on import.

Choose the best data format

STEP and SAT are far more rigorously adhered-to standards than IGES. When exporting from your mechanical package, if you have a choice, choose STEP or SAT instead of IGES.

STL is often overlooked. STL files are used in rapid prototyping, and they use a tri-mesh representation. Therefore, STL objects are faceted, not smooth (NURBS) entities. Because STL objects are always faceted, they are fast to ray-trace. If your object contains many flat faces, consider using STL. Also, if you are mainly concerned with opto-mechanical stray light, STL is fast and effective. There is no point in computing ray-object intersections to exquisite precision, and then computing the surface normal to equally exquisite precision, if we then randomize the departing direction cosines with some scattering function!

In OpticStudio, STL files are read in via the CAD Part: STL object, whereas NURBS (IGES, STEP, SAT) files are read via the CAD Part: STEP/IGES/SAT object.

Make valid solids

This may sound obvious, but it is the single biggest cause of interoperability problems.

Open the file bad_lightpipe.stp (from the zip file attached to this article) in OpticStudio or your mechanical CAD program. At first glance the object looks fine:


but set the opacity to say 50%, or use a wireframe view, and a problem is apparent:



This file contains internal faces which have no physical meaning. There is no way to manufacture a lightpipe with internal faces like this. The CAD object should represent a 'shrink-wrapped', simply-closed volume without internal faces, but this file really represents how the designer made the object, and not the object itself!

Prior to export, the designer should Boolean the six individual pipes together to form a single volume. Open the file good_lightpipe.stp to see the difference:



This is a valid solid object. Just to make this really clear, the following gif shows the badly-formed object and the well-formed object alternately:


A similar problem arises when a volume object is defined in the CAD program by multiple surface objects. Imagine a cylinder volume, designed by taking a cylindrical pipe surface, and two circles (one at each end):


Numerical precision means that there can be gaps formed between the cylinder pipe and the circular end face. Prior to export, the surfaces must be 'stitched' together to form a continuous join:


The commands for stitching faces together vary from CAD program to CAD program, of course. However, the exported object must be a watertight, valid solid object. If rays encounter small gaps between surfaces in the solid, geometry errors will occur. Use whatever commands your CAD program provides to ensure you export a valid, watertight solid object, with no internal faces.

Note that the export file can contain multiple objects. Each object should be a valid, watertight solid. If two or more objects overlap, they should be Booleaned together to form a single object prior to export. On import to OpticStudio all objects inside a single CAD file will be given the same material properties (although the surface properties, like thin-film coatings and scattering functions, can be different). If you require different objects to be made of different materials, export them as separate files.

Use a third-party validator

The previous advice is great if you have access to the generating CAD program. But for many people, and especially design consultants, this is not possible. It is very common to be simply given a CAD file, and be expected to 'just' trace rays though it or to perform a full opto-mechanical stray light analysis using it.

OpticStudio attempts to repair many common problems with CAD objects on load. However, an entire industry has grown up around the problem of badly formed CAD objects, and the interoperability of CAD objects created in one program being loaded into another. We use TransMagic, available from, to analyze and repair problem files. If your work involves you receiving CAD files from multiple sources, and you have little control over how those files are generated, consider obtaining a license so you can fix problem files easily.


Was this article helpful?
2 out of 2 found this helpful



Please sign in to leave a comment.