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.

Using the OpticStudio Dynamic CAD Link with Assemblies

This article explains how to dynamically open and explode SolidWorks®, Autodesk Inventor® and PTC Creo Parametric® assembly files inside OpticStudio.
Dr. Sanjay Gangadhara, Updated by Thomas Pickering
07/20/2016
OpticStudio
CAD Exchange
Non Sequential Ray Tracing
Illumination & Stray Light
Optimization
First Time Users
Frequently Asked Questions 

Introduction

OpticStudio Premium supports the ability to dynamically link to CAD parts and assemblies in SolidWorks® 2017, Autodesk Inventor® 2018, and PTC Creo Parametric® 4.0. This dynamic link allows native SolidWorks part files, Autodesk Inventor part files, and PTC Creo Parametric part files to be opened and modified in OpticStudio, via the non-sequential CAD Part objects.  This is explained in the article entitled “Using the OpticStudio Dynamic CAD Link”.

Similarly, assemblies which have been created in SolidWorks, Autodesk Inventor, or PTC Creo Parametric can also be opened in OpticStudio, via the CAD Assembly objects. With assembly files, OpticStudio assumes that each of the individual parts of the assembly correspond to finished products which will no longer need modification. This is generally the case once an assembly has been designed inside of the CAD program. Thus, OpticStudio will initially load the entire assembly as a single file. 

However, if the assembly is modeled as a single object in OpticStudio, the entire assembly may only be given one set of volumetric properties (volume material, bulk scattering distribution, etc.). In addition, there may be a limit on the surface properties (thin-film coatings, surface scattering distributions) that can be assigned to the assembly.  This is because surface properties are defined on the object faces, and the total number of unique faces in an object is limited to 51.

The solution is to break-up, or explode, the assembly into its constituent parts. Then, each part may be assigned unique properties. In this article, we will review how to load an assembly file into OpticStudio via the CAD Assembly objects, and how to explode that assembly into its constituent parts.

Loading an Assembly File

The first step required to use OpticStudio’s dynamic CAD capability is to install the appropriate CAD software package: 
  • Autodesk Inventor® 2018 must be installed* to use the “CAD Assembly: Autodesk Inventor®” object, which dynamically links to Autodesk Inventor assembly files (*.IAM)
  • PTC Creo Parametric® 4.0 must be installed* to use the “CAD Assembly: Creo Parametric®” object, which dynamically links to PTC Creo Parametric assembly files (*.ASM)
  • SolidWorks® 2017 must be installed* to use the “CAD Assembly: SolidWorks®” object, which dynamically links to SolidWorks assembly files (*.SLDASM)
*Please note that the OpticStudio technical support team cannot assist with SolidWorks, Autodesk Inventor, or PTC Creo Parametric installation.

The native CAD assembly files are loaded into OpticStudio via the Non-Sequential Component (NSC) Editor, and there are separate object types for each CAD program:


Figure 1: Separate objects for SolidWorks®, Autodesk Inventor® and PTC Creo Parametric® assembly files

When using either the CAD Assembly: Creo Parametric object or the CAD Assembly: SolidWorks object, the corresponding application must be opened prior to loading a part into OpticStudio, and should remain open as long as OpticStudio is running, to ensure that communication is always available between OpticStudio and the creating program.

Conversely, when using the CAD Assembly: Autodesk Inventor object, it is not necessary to start Autodesk Inventor prior to loading an Inventor part into OpticStudio. OpticStudio will automatically open Inventor in silent mode, meaning that the Inventor application will not appear anywhere on the user's monitor but a process will be visible in the user's Task Manager listing. This process should be allowed to run as long as OpticStudio is running, in order to ensure that communication is always available between OpticStudio and Autodesk Inventor.

Autodesk Inventor Example

In this example, we’ll open up an assembly file created in Autodesk Inventor. This file and its constituent part files are included as attachments at the end of the article. The files were created by one of the engineers at Inventor 3d (http://inventor3d.blogspot.it/) and obtained from the free CAD distribution website GrabCad (www.grabcad.com).

Note that for the assembly to load correctly into OpticStudio, OpticStudio must have access to both the assembly file as well as the part files for all of the constituents of the assembly. All of these files must be in the same folder (more details below). If some part files are missing, the resulting assembly will still be constructed with the remaining parts (if OpticStudio cannot find any of the part files for the assembly, an error message will be issued). It is therefore up to the user to ensure accuracy of the assembly.

The assembly file chosen for this example represents a filament-type source embedded inside of a structural housing.  Here is the assembly, as shown in Autodesk Inventor:


Figure 2: Assembly file containing a filament and housing in Autodesk Inventor.

To load this assembly into OpticStudio, we first need to place the assembly (.IAM) file and the constituent part (.IPT) files in the appropriate folder. The default folder for Autodesk Inventor files is <…\Documents\Zemax\OBJECTS\Inventor Files>, though this location may be user-defined in the Folders section of the Project Preferences:


Figure 3: Location for Autodesk Inventor files in the Project Preferences.

Note that there are separate folders for the SolidWorks and Creo Parametric files as well. 

Once the assembly file is in the correct folder, open OpticStudio, and switch to Non-Sequential mode.  In the Non-Sequential Component (NSC) Editor, expand the Object Properties, and select “CAD Assembly: Autodesk Inventor” from the Type drop-down menu:


Figure 4: Select “CAD Assembly: Autodesk Inventor” in the NSC Editor.

Then, select the *.IAM assembly file, and click OK:


Figure 5: Select the *.IAM assembly file.

Note that any assembly file with an *.IAM extension (and that is present in the correct folder) can be selected as the input file.  After clicking OK, you will see the following notification, indicating that Autodesk Inventor is being opened, and the assembly is being loaded into OpticStudio:


Figure 6: Notification that OpticStudio is loading CAD file(s).

Exploding the Assembly

Once the assembly file has been loaded, OpticStudio will automatically ask if you wish to explode the assembly into its constituent parts:


Figure 7: Option to explode the assembly is automatically shown.

If you select “No” above, then the assembly will not be exploded, and it will simply be read in as a single file.  If the option to explode the assembly is not selected upon first load, it may be subsequently selected by expanding the CAD tools in the NSC Editor toolbar, and choosing “Explode Autodesk Inventor Assembly”:


Figure 8: CAD tools in the NSC Editor toolbar. 

In order for the appropriate CAD tool to be enabled, the CAD Assembly object row must be selected in the editor.  For example, if a “CAD Assembly: SolidWorks” object were selected, then the “Explode SolidWorks Assembly” tool would be enabled instead. 

Choosing to explode the Autodesk Inventor assembly will open the following dialog:


Figure 9: Explode Autodesk Inventor settings dialog. 

Selecting the “Get Part Count” button will return the number of constituent parts in the assembly:


Figure 10: Get part count in the assembly file. 

Selecting the “Explode” button will break the assembly into its constituent parts.  After clicking Explode, all other buttons in the dialog will momentarily be disabled, and you should see the status update to say “Please Wait…“:


Figure 11: Status shown during assembly explosion.   

Once the assembly has been exploded, the buttons in the above dialog will be enabled again.  Click Exit, and view the NSC Editor:


Figure 12: Assembly and its constituent parts in the NSC Editor.  

Each of the constituent parts is written to a file in the Zemax object format (.ZOF), and loaded into OpticStudio via the CAD Part: STEP/IGES/STL object. Thus, the geometry of the constituent parts is fixed in OpticStudio, consistent with our expectation that parts inside of the assembly do not require further modification.

If you would like to model an assembly in which each of the parts can be dynamically modified inside of OpticStudio, you’ll instead need to load each of the individual parts in their native file format.  In this example, we would use the CAD Part: Autodesk Inventor object.  See the article entitled “Using the OpticStudio Dynamic CAD Link” for more details. 

After explosion, the position and orientation for each of the constituent parts is referenced to the parent assembly via the “Ref Object” parameter in the NSC Editor.  For more information on reference objects, see the section of the Help Files entitled “Reference objects”.

Expand the Object Properties of the parent assembly. Although this object remains in the editor, it will be ignored by rays:


Figure 13: Parent assembly object is set to be ignored. 

This “Rays Ignore Object” setting is automatically changed to “Always” during the explosion. In addition, go to the Draw section of the Object Properties, and you’ll see that the parent assembly object will not be drawn in the 3D Layout or Shaded Model viewers:


Figure 14: Parent assembly object will not be drawn. 

The parent assembly is used as a reference object, and its constituent parts are now the only meaningful objects in the system.  If the assembly is not needed in the editor, then it can be manually deleted, but there is also an option to delete the assembly in the Explode Assembly Settings dialog:


Figure 15: Option to delete CAD assembly during explosion. 

If this were turned on, the subsequent NSC Editor would look like this:


Figure 16: NSC Editor with parent assembly deleted. 

The position and orientation of each of the constituent parts is still referenced to that of the parent assembly, but the assembly itself has been replaced by a Null object. There are two advantages of deleting the assembly object after explosion: (1) The file will require less memory, which may be an issue if the initial assembly is large and memory intensive; (2) The file will no longer require a dynamic link to Autodesk Inventor (or the appropriate CAD program), increasing the speed at which updates may be made to the file (e.g. during optimization). 

However, if the parent assembly is subsequently modified in the creating program (Autodesk Inventor in this example), those modifications will not be acknowledged by OpticStudio if the parent assembly is deleted after explosion, because the link to the creating program has been lost. Thus, even if the parent assembly is ignored by rays inside of OpticStudio, keeping this file in the NSC Editor ensures that any changes made to the assembly in the creating program are subsequently read in the next time you open your OpticStudio file containing the exploded assembly.

Defining Optical Properties

Now, since the assembly has been exploded, different properties may be assigned to the filament source and the housing. For example, we may specify that the housing is made from polycarbonate.  To do this, type POLYCARB into the Material cell of object #2 in the NSC editor.  Note that this will automatically add the MISC catalog into the list of current Material Catalogs:


Figure 17:  Adding a material to the filament housing. 

Next, we can set the filament (object #3 in the NSC Editor) to be a metallic reflector. We can do this in two steps:
(1) First, we need to group all of the surfaces of the filament geometry into a single face.  To do this, expand the Object 3 Properties, and go to the CAD settings.  Click the “Select All” button, and then the “Change To->” button, with the input set to Face 0:


Figure 18:  Change all surfaces of the filament to Face 0. 

 (2) Then, we can apply a reflective metal coating Face 0.  Go to the Coat/Scatter section of the Object 3 Properties.  Set the Face Is to Reflective, and select the METAL coating:


Figure 19: Apply a reflective metal coating to the filament. 

The METAL coating is a thin layer of aluminum, which is commonly used to make beamsplitters.  In addition, the Face Is set to Reflective, so that only the reflected rays are considered.  If this were left as “Object Default”, then the face would be either refractive, reflective, or absorbing, depending upon the material type. 

In reality, the physical properties of both the filament and the housing may be much more complicated than given here. For example, light may be scattered from each of these objects via complex surface scattering distributions.  If the scatter distribution for each object can be measured (e.g. with the IS-SA Imaging Sphere), then this data can be directly incorporated into OpticStudio via the BSDF scatter model. For more information on this model, see the article entitled “How to Use Tabular BSDF Data to Define the Surface Scattering Distribution”.

Tracing Rays

We can now place a Source Filament object in the system to simulate rays that are generated from our CAD-defined filament. The source object must be defined to be inside of the housing, using the “Inside Of” parameter:


Figure 20: The Source Filament is inside of the housing (object 2). 

To match the properties of the CAD-defined filament:
(1) Set the Z Position of the source to 13.5 mm, the number of layout rays to 100, and the number of analysis rays to 1 million:


Figure 21: Source Filament Z Position = 13.5 mm, # Layout Rays = 100, # Analysis Rays = 1000000.

(2) Set the length of filament to 4.5 mm, the radius to 1.15 mm, and the number of turns in the filament to 15:


Figure 22: The Source Filament is highlighted in orange in the NSC 3D Layout.

In the above screenshot, the Source Filament is highlighted in orange in the NSC 3D Layout, and you can see that the geometry follows the curvature of the filament in the CAD object.  To view this in the NSC 3D layout, select the “Ignore Trace Errors” setting in the toolbar of the NSC Editor.  This will suppress ray trace errors in the layout viewers.  Valid systems will occasionally have error rays due to finite computer precision, or other minor problems, and this is common for imported CAD parts. 

(3) Lastly, define the spectral distribution of the filament via its equivalent color temperature in the Source section of the Object 4 Properties.  In the Color/Spectrum settings, select Color Temperature and enter 6500 K:


Figure 23: The Source Filament spectral distribution is set to Color Temperature at 6500 K.

For more information about these source settings, see the article entitled “How to Model Colored and Tristimulus Sources”.

Now, let’s add a far-field detector to capture the light from rays emitted by the source. Insert a new object in the NSC Editor, and change the Type to Detector Color.  Set the Z Position to 500 mm, the Material to ABSORB, the X & Y Half Width to 2000 mm, and the # X Pixels & # Y Pixels to 100. 


Figure 24: Detector Color Z Position = 500 mm, Material = ABSORB, X & Y Half Width = 2000 mm, # X Pixels & # Y Pixels = 100.

To view the irradiance distribution on this detector, we have to run a ray trace.  Go to the Analyze tab, and open the Ray Trace control.  Use the following settings, and click Clear & Trace to trace the 1 million analysis rays:


Figure 25: Use Polarization, Split NSC Rays, and Ignore Errors in the Ray Trace Control.

Once the ray trace is complete, click Exit, and open a Detector Viewer.  The results show the far-field behavior of a filament source inside of this CAD model.


Figure 26: True color irradiance on the far-field detector.

This model is sensitive to the material properties defined for both the filament and the housing.  In this example, the physical model for the source (i.e. the CAD-defined filament) allows us to accurately characterize the interaction of light with the real source of emission.  This means that light reflected back toward the filament will correctly interact with the CAD object, and this is a phenomenon which is not accounted for with the source model alone. 

Summary

The CAD Assembly objects allow OpticStudio to dynamically link to SolidWorks®, Autodesk Inventor®, and PTC Creo Parametric®, and read in assembly files in their native file format. The assemblies may then be exploded into their constituent parts inside of OpticStudio, so that individual material properties may be assigned to each part. This allows for accurate characterization of the full assembly during ray tracing in OpticStudio.