Nov 28, 2022

Using the OpticStudio Dynamic CAD Link

Category: Product News

Ansys Zemax OpticStudio (Premium and Enterprise) can open native Autodesk Inventor part (IPT) and assembly (IAM) files and native PTC Creo Parametric part (PRT) and assembly (ASM) files directly in non-sequential mode. This enables the modelling and control of objects that cannot be easily modelled using an analytic or parametric description. The native CAD part is easily incorporated into the Non-Sequential Component Editor using the associated object type and can then be dynamically modified or optimized.

Any explicit dimensions defined on the object within the CAD program used to create the object can be exposed and controlled within the Non-Sequential Component Editor. This allows optical engineers to be able to work with the same files that their mechanical engineers use without the need for format conversion. This article shows using a Creo part as an example.

Install CAD software

The first step required to use OpticStudio’s dynamic CAD capability is to confirm that the appropriate version of the CAD software has been installed on the same computer as OpticStudio. For the “CAD Part: Autodesk Inventor” or “CAD Assembly: Autodesk Inventor” objects, Inventor® 2018, or later must be installed* PTC Creo Parametric® 7.0 (or one of the following legacy releases of the software: Creo Parametric 6, 5, and 4) must be installed* to use the “CAD Part: Creo Parametric” or the “CAD Assembly: Creo Parametric” objects.

Creo Parametric example

The following example uses a Creo Parametric part file which was obtained from the free CAD distribution website GrabCADI . In this example we’ll bring in a CAD model of a CFL lamp.. The PRT file used in this post can be downloaded from the GrabCAD website: CFL Lamp (Bulb) | 3D CAD Model Library | GrabCAD

Let’s begin by investigating the part in Creo Parametric. The FeatureManager Model Tree shows the features and dimensions which were used to create the CFL Light Bulb:

By right-clicking on either the sketches or shapes in the Model Tree and clicking "Edit Dimensions" we see the associated dimensions in the window. In the following screenshot, you can see the dimensions that were used to create Sketch1:

The bulb dimensions are as follows:

  • d0 =500 mm

  • d1 = 85 mm

  • d19 = 25 mm

  • d20 = 23 mm

Once this PRT file is opened in OpticStudio, the bulb dimensions can be accessed and edited in the Non-Sequential Component Editor. OpticStudio will automatically label these dimensions with the default name dx, where x is the integer number assigned to the dimensions. 

Note that the names of the features and dimensions can be changed in Creo Parametric, and this may make further modification more intuitive in OpticStudio. To do this, Click on any dimension value in the graphic area. The Dimension tab will be opened where you can edit the dimension name and value.

Now, the PRT file should be saved and closed. 

OpticStudio dynamic CAD link

To open this Creo Parametric part in OpticStudio, the PRT file must be saved in the appropriate Zemax user data folder. There are two folders in the user data folder {Zemax}\Objects for the Autodesk Inventor, and PTC Creo Parametric files, shown below:

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

Once the *.prt file is saved in the “Creo Parametric 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, we expand the Object Properties and select “CAD Part: Creo Parametric®” in the Type drop-down menu:

Then we select the appropriate part file and click OK:

We open the NSC Shaded Model to view the part. The component looks identical to what was shown in Creo Parametric.

In this example, the units in the Creo Parametric part file are millimeters, which is also the default setting for Lens Units in OpticStudio. When opening an Autodesk Inventor or PTC Creo Parametric 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. In the Object Properties…CAD settings you will see a list of all the smart dimensions and configurations defined in the PRT file. 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.

In this example we select Expose All, so all the dimensions are available in the NSC Editor for dynamic modification. 

We can try changing some of the parameters and updating the NSC Shaded Model to see the changes. In the image below, we changed d0 from 500 mm to 550 mm, d1 changed from 85 mm to 90 mm and d19 from 25 mm to 40 mm.

 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 PRT part file, and for Inventor the objects would be saved as IPT 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:

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 PTC Creo Parametric, optical properties are saved as Annotation Notes, which may be found under the Model Tree for the part or assembly. In Autodesk Inventor, optical properties are saved under the Custom tab of the iProperties dialogue box

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.

The following screenshot shows the modified Creo Parametric part in OpticStudio. The Creo Parametric part has a N-BK7 material, and scatter profiles have been assigned to the outer surfaces of the light bulb and base. Two Filament sources have been defined inside the lamp bulb, and a Detector Polar shows the resulting angular far field distribution.

Find the full article and downloadable sample files on our Knowledgebase here.

Try Ansys Zemax optial design software for yourself, request a free trial today!

Mojtaba Falahati
Senior Application Engineer