Using the OpticStudio Dynamic CAD link

Effective December 31, 2021, SOLIDWORKS integrations with Zemax products are deprecated and will not be available in future software releases of OpticsBuilder or OpticStudio. Learn more.

OpticStudio Premium can open native SolidWorks part files (SLDPRT), Autodesk Inventor part files (IPT), and PTC Creo Parametric part files (PRT) directly in non-sequential systems. Theses parts can then be dynamically modified on optimized. This article shows how, using a SolidWorks part as an example.

Authored By Akash Arora, Kristen Norton, Thomas Pickering and Flurin Herren


Article Attachments


OpticStudio Premium can dynamically open SolidWorks, Autodesk Inventor, and PTC Creo Parametric part files in Non-Sequential Mode in order to model and parametrically control objects that aren't easily modelled by primitive or common shapes. The native CAD part is easily incorporated into the Non-Sequential Component Editor using the associated object type.

Any explicit dimensions defined on the object can be exposed and controlled within the Non-Sequential Component Editor. This will allow optical engineers to be able to work with the same files that their mechanical engineers use, without the need for format conversion. Using a SolidWorks file as an example, this article will walk through how to use the dynamic CAD capability.

Install CAD software

The first step required to use OpticStudio’s dynamic CAD capability is to install the appropriate CAD software package:  

  • SolidWorks® 2017, or later, must be installed* to use the “CAD Part: SolidWorks” object, which dynamically links to a SolidWorks part file (*.sldprt).
  • Autodesk Inventor® 2018, or later, must be installed* to use the “CAD Part: Autodesk Inventor” object, which dynamically links to an Autodesk Inventor part file (*.ipt).
  • PTC Creo Parametric® 4.0 must be installed* to use the “CAD Part: Creo Parametric” object, which dynamically links to a Creo Parametric part file (*.prt).

*Please note that the OpticStudio technical support team cannot assist with SolidWorks, Autodesk, or Creo installation.

When using either the CAD Part: Creo Parametric object or the CAD Part: 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 Part: Autodesk Inventor object, it is not necessary to start Autodesk Inventor prior to loading an Inventor part into OpticStudio. In this latter case, 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. In all cases, constant communication between OpticStudio and the creating program is necessary to allow modification of the part inside of OpticStudio.

SolidWorks example

The following example uses a SolidWorks part file which was obtained using the free CAD distribution website GrabCAD. Let’s say we want to parametrically model the following lamp in OpticStudio: 

lamp rendering

The SLDPRT file is included as an attachment in this article, or can be downloaded from the GrabCAD website:

Let’s begin by investigating the part in SolidWorks. The FeatureManager Design Tree shows the features and dimensions which were used to create the lamp:

lamp features in SolidWorks

Click on the features in the FeatureManager Design Tree to see the associated dimensions in the window. In the following screenshot, you can see the dimensions that were used to create Sketch1:

lamp dimensions

For reference, the Sketch1 dimensions are as follows:

  • D1 =100 mm
  • D2 = 10 mm
  • D3 = 70 degrees
  • D4 = 125 mm
  • D5 = 50 mm
  • D6 = 120 mm
  • D7 = 70 degrees

Once this SLDPRT file is opened in OpticStudio, the Sketch1 dimensions can be accessed and edited in the Non-Sequential Component Editor. OpticStudio will automatically label these dimensions with the default name Dx@Sketch1, where x is the integer number assigned to the dimensions of Sketch1. Similarly, the Revolve2 dimension (it has only one dimension = 360 degrees) will be labeled as D1Revolve2. 

Note that the names of the features and dimensions can be changed in SolidWorks, and this may make further modification more intuitive in OpticStudio. To do this, right-click the feature name in the FeatureManager Design Tree, and select Feature Properties from the menu.

right click on Sketch1

Sketch1 feature properties

The same can be done for dimensions within Sketch1. Select Sketch1 in the Design Tree as shown above, and then right-click on a dimension in the layout. Select Configure Dimension in the right-click menu, and then right-click on the cell name (D4 in the example below) to rename the dimension.

right click on D4

right click on d4 cell to rename

For this example, however, we’ll continue to use the default feature and dimension names. Next, the SLDPRT file should be saved and closed, but leave SolidWorks open and running in the background. 

SolidWorks is open

OpticStudio dynamic CAD link

In order to open this SolidWorks part in OpticStudio, the SLDPRT file must be saved in the appropriate Zemax user data folder.  There are three folders in the user data folder {Zemax}\Objects for the SolidWorks, Autodesk Inventor, and PTC Creo Parametric files, shown below:

Zemax user folders

Note that these folder locations may be customized in the OpticStudio Setup...Project Preferences...Folders settings:

user data folders

Once the *.SLDPRT file is save in the “SolidWorks Files” folder, it can be opened through the Non-Sequential Component (NSC) Editor in OpticStudio.  To do this, open a new, Non-Sequential system.  In the NSC Editor, expand the Object Properties and select “CAD Part: SolidWorks®” in the Type drop-down menu:

Select Cad Part

Select the appropriate SLDPRT file:

select Lamp.SLDPRT

Press OK and open a new NSC Shaded Model to view the part. The component looks identical to what was shown in SolidWorks.

NSC Shaded Model

In this example, the units in the SolidWorks part file are millimeters, which is also the default setting for Lens Units in OpticStudio. When opening an Autodesk Inventor, PTC Creo Parametric, or SolidWorks part file, OpticStudio will automatically determine if the units match the current Lens Units setting. If the units are different, it will issue a warning. To avoid potential confusion and error, it is strongly recommended that the user set the Lens Units in OpticStudio and the system units of the CAD program to be the same. 

Once opened in OpticStudio, the CAD object may have optical properties such as coatings, materials, and scattering functions applied. In addition, the dimensions for the part may be displayed directly in the NSC Editor under the parameter columns, allowing for dynamic control of the defining characteristics of the part. Expand the Object Properties, and go to the CAD settings. Here you will see a list of all the smart dimensions and configurations defined in the SLDPRT file. The configuration capability in SolidWorks is very similar to the multiple configuration capability in OpticStudio. It allows you to define multiple variations of the same part in one file. The SolidWorks and OpticStudio capabilities can be linked using the SWCN multi-configuration operand, which controls this SolidWorks Configuration setting.

By default, these part dimensions are not exposed as parameters in the NSC Editor, but any of the dimensions may be exposed by selecting it in the Part Dimension Name combo-box, and clicking Expose. Note that there are identical settings for exposing the dimensions of Inventor and Creo parts. 

cad settings in NSC editor

For this example, click Expose All. All the dimensions are now available in the NSC Editor for dynamic modification.

exposed CAD dimensions in NSC editor

Try changing some of the parameters, and update the NSC Shaded Model to see the changes. In the image below, we changed D2 from 10 mm to 15 mm, and D7 changed from 70 degrees to 80 degrees.  

changing sketch1 dimensions in opticstudio

Dynamic Link for Creo 7

If a client machine has OpticsBuilder for Creo 7 installed and the OpticsBuilder for Creo Parametric 7 Steps on following articles have not been performed:

Zemax OpticStudio can potentially run into issues while creating or loading a CAD Part: Creo Parametric object.  Hence, when using the Dynamic Link with Creo Parametric 7, the steps explained in the article which is linked above are essential.

Save the modified file

Any changes made to the CAD object in OpticStudio can be saved in the object’s native file format. In this case, we would save the modified object as a SLDPRT part file, and for Inventor or Creo the objects would be saved as IPT or PRT files. To do this, go to the toolbar of the NSC Editor, expand the CAD tools, and select Save Modified Part from the drop-down menu:

CAD tools in the NSC Editor toolbar

The modified object may be saved into a new file, or into the same file name as the original CAD object, thus overwriting the original. Note that saving the object as a new CAD file will not automatically replace the CAD file that is currently in use in OpticStudio. To change the current CAD file, go back to the Type settings in the Object Properties, and select the newly created CAD file from the Data File drop-down menu.  

In addition to saving the modified part dimensions, any optical properties assigned in OpticStudio, like coatings or materials, can also be saved with the native CAD file. In SolidWorks, optical properties are saved under the Configuration Specific tab of the File... Properties menu. In Autodesk Inventor, optical properties are saved under the Custom tab of the iProperties dialog box. In PTC Creo Parametric, optical properties are saved as Annotation Notes, which may be found under the Model Tree for the part or assembly (as long as Display Annotations is checked under the Model Tree Filters menu).  In Autodesk Inventor and SolidWorks, the name of the optical property starts with the word “OpticStudio”, while in Creo Parametric, the name of the Annotation Note starts with the letter “Z” (in this latter case the full property is not given by the note name but by the note text).

The information saved in the creating program will have no meaning to that program, but is provided only for reference. However, if the same file is subsequently loaded into another OpticStudio design, the property information from that file may be read in by OpticStudio, and used to assign optical properties to that object in the new OpticStudio design.

The following screenshot shows the modified SolidWorks part in OpticStudio. The SolidWorks part has a MIRROR material, and scatter profiles have been assigned to the inside surfaces of the lamp. There is an array of point sources inside the lamp, to simulate the placement of white LEDs, and a Detector Color shows the resulting True Color irradiance distribution. This example is saved as a *.ZAR archive file in the article attachment.   

modified SolidWorks part in OpticStudio



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



Please sign in to leave a comment.