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.

What is the Zemax Part Designer?

What is Zemax Part Designer?
The Zemax Part designer is an interface that allows users to create and manipulate Part Designer Object (PDO)geometries in an environment separate of Zemax IE.  Special features such as the “Ghost View” and On-The-Go Geometry creation allow users to quickly build, assess, and modify individual steps leading up to the final object.  Using the ZPD’s robust toolset, users may quickly modify and add commands and operations to a Zemax Part Object (ZPO) file and generate results within moments.  Overall, the Zemax Part Deisgner (ZPD) allows for a streamlined process to incorporate solid 3-D geometry into the user’s Zemax Non-Sequential designs.  
This article illustrates the following:
• Basic introduction to the user interface of the Zemax Part Designer
• Creating an elementary Part Designer Object for use in Zemax
• Manipulating and viewing the part
Frequently Asked Questions

This article introduces the ZPD and instructs the user on the creation of a basic 3-D geometry to be used in Zemax.  Users will learn a set of basic commands that can be used for a wide array of applications.  Once a .ZPO(The file extension for a Part Designer Object) is “built”, this article will guide the user through the process of modifying and viewing individual commands.  In this tutorial, users will learn the basic workflow required to design geometries efficiently within the ZPD.   
This article will detail the creation of a CFL Light Bulb as shown below:

Getting Started
To start the Zemax Part Designer, switch Zemax into Non-Sequential mode.  To access sample parts or other ZPO files stored within the Zemax Objects folder, right click the “Null Object” square within the Non-Sequential Component Editor.

This will spawn a dialog prompting the user for an object type and file for use.  Select “Part Designer Object” from the pull-down menu for “Type” and select a ZPO file from the “Data File” pull-down menu.  This pull down menu browses the default “Part Designer Object” folder saved within the Zemax settings and lists the .ZPO files in that directory.  We will be creating a Part Designer Object from scratch, so using a Null Object will suffice.  Press the “Cancel” button to exit the dialog.

Back at the Zemax Menu, select Tools… Design… Zemax Part Designer.  This should launch the ZPD and spawn a new part window.

The left side of the main window consists of the Script, Sketch, and Gallery Mode Tabs.  The Script Mode is a text console in which users may input ZPD commands.  The ZSCRIBE window is just below the main text editor and assists the user by displaying commands related to the current line of text.  To build the object detailed in the Script Mode Editor, press the “Build” button (Ctrl + G) on the script mode tool bar. Menu Items allow for File I/O, alteration of preferences (various visual settings), Camera Controls, and Command Insert Options.  All commands created from the “Insert” Menu are translated into ZPD commands and placed at the last caret position within the Script Mode editor window.  For more details on the Menu Items, please refer to the ZPD Documentation.  
Inserting New Commands
A user may input commands manually via the text editor, choose specific inputs from the “Insert” menu and ZSCRIBE feature, and  selections from the tool bar.  While the menu and toolbar items may provide easy access and input of all parameters for commands, it can be slower than typing commands manually or utilizing the ZSCRIBE window.  With time, the user should be able to insert commands manually.  
Begin the CFL Bulb Part Object by clicking into the console window.  This tutorial will begin the script with the spiraled glass section of the bulb.   It is very important to organize the script into sections for user clarity.  To create a “commented” line of code (a line of code that is not read by the script editor upon building), enter a line of text to indicate the start of the spiral bulb, for example “!BULB.” An exclamation point precedes any line of commented text and tells ZPD not to build that line of text.
Access the “Insert” Menu and add a “Spiral” command to the script.


Ignore the default values present within the Spiral Dialog box and enter the appropriate parameters as shown below.  

Press “OK” to insert the specified command into the Script Mode Console.  Press “Build” to save and view the spiral we just created.  Note: “Build” can also be found in the Menu under “File.”

All new geometries have their “Lengths” aligned along the +Z axis.  We now have the foundations of the bulb.  A CFL bulb consists of two spiraled sections linked via a cylindrical tube (A).  The bulb is connected to the plastic base via two stilts (B) as shown below. 

Figure I. Cylindrical Tube(A) 
Figure II. Rounded Stilts (B)

Building the Stilts
As all new geometries created are aligned along the Z-Axis, It would be easier to merge the stilts with our initial spiral if we moved the end of the spiral onto the Origin using the “Move” command.  To move a specified object, Navigate to “Insert”->”Operations”->”Move” and enter the following values.  

Now, create the following shapes to build a single leg of the stilts:


Build the part.  Note: before using the “Insert” Menu Items, ensure that the console is inputting on a blank line by placing the cursor on a new line.  

Although multiplying certain values by 1.05 may seem very arbitrary and unnecessary, it is essential to include a scaling offset for parts that are to have boolean operations performed on them.  For example: The stilts are to be combined with the spiral (with radial thickness of 0.4).  Without the offset, the radial thickness of the stilts will be the same as that of the spiral.  Combining the two parts will create surfaces that appear flush with each other.  This is not desired as converting the geometries into other 3D formats with flush surfaces will create undesired results.  Therefore, flush/tangent faces and edges can be avoided by creating parts with slight offsets.      

The user may also notice that the same values are used multiple times, namely the offset value and the radial thickness of the spiral.  Users can make these values into preset parameters.  Assigning these as parameters prior to their use can reduce confusion and allow easy modification of all commands utilizing these values in the future.  Enter the following commands above the first spiral command and replace all values with their appropriate parameters.  Build the script.  

The console should now read:


PARAMETER offset, 1.05

PARAMETER bulbRad, 0.4

PARAMETER rad, 2.0

SPIRAL Spiral1,bulbRad,rad,rad,3,2.0

MOVE Spiral1, -2.0,0,0.60

CYL cylBulbBase,bulbRad*offset,0.6

SPHERE bulbBase,bulbRad*offset

Clicking each individual line, the user can view each command separately.  The transparent ghost objects symbolize each of the prior commands associated with each object.  In the script’s current configuration, the ZSO Editor is unable to view all parts at once.  There are two ways to rectify this:

         1) Navigate to “Preferences”-> “Options” and under “Ghost View” activate “Show All Steps.” Choosing this setting may be beneficial in seeing where to place new or current objects.  

Conversely, using this setting will also create on screen clutter as shown below.  The ghost settings may be switched and adjusted at any time.

    2) The best method for seeing all necessary parts is to preemptively combine or boolean the commands that will be relevant.  For example: We know that the sphere and the cylinder will be combined to create a stilt, and the resulting part will be combined with the spiral to create a spiral shape connected to a rounded stilt.  By preemptively declaring the boolean unions:

UNION bulbBaseround,bulbBase,cylBulbBase
UNION SpiralOneSide,Spiral1, bulbBaseround

At the end of the script, we can view these parts and easily adjust prior commands as needed.  By preemptively declaring such statements, the ZPD knows exactly what shapes will be relevant in the near future and will not factor them out of the rendering process.  Knowing when and where to preempt such commands will dramatically improve the efficiency of designs within the Part Designer.   

The resulting script is shown below:

The console should read:


PARAMETER offset, 1.05

PARAMETER bulbRad, 0.4

PARAMETER rad, 2.0

SPIRAL Spiral1,bulbRad,rad,rad,3,2.0

MOVE Spiral1, -2.0,0,0.60

CYL cylBulbBase,bulbRad*offset,0.6

SPHERE bulbBase,bulbRad*offset

UNION bulbBaseround,bulbBase,cylBulbBase

UNION SpiralOneSide,Spiral1, bulbBaseround

Now, the sphere, “bulbBase,” needs to be positioned at the base of the spiral.  Here is where ZPD’s “Ray” computation commands come in handy.  Click an empty line of the Script View Console preceding the newly inserted Union Commands.  
Enter the following “Ray” Computation from the “Insert” Menu: 


This specific Ray Computation will shoot a ray from the point (0, 0, 1) in free space along the negative Z axis towards the cylindrical section of the stilt.  Although it may be fairly obvious where the end points and mid points of the cylinder are; this is only a simple demonstration of the Ray Computations usages.  Performing this calculation will create 3 new parameters: <DataTitle>.X, <DataTitle>.Y, and <DataTitle>.Z.  Note that the X, Y, and Z must be capitalized.  The three data points represent the 3-D Coordinates of the point of intersection between the Ray and the object.  In this case, it returns the junction in which we need to position the sphere.  Insert a “Position” command using the newly acquired Data Values.  



The result of these two actions will produce two new commands:


RAY bulbBasePlacement,0,0,1,0,0,-1,cylBulbBase

POSITION bulbBase,bulbBasePlacement.X,bulbBasePlacement.Y,bulbBasePlacement.Z,0,0,1

Finishing the bulb
Move the center of resulting part over the origin and duplicate it.  Duplicating a part is performed with the COPY command and creates a newly named instance of the original part at the same location.  To achieve the desired spiral effect, a union of two spirals must be formed, with one spiraling in the opposite direction.  A MIRROR operation cannot be used as our base object needs to be flipped along the X and Y axis.  To perform this action, the SCALE command is used:


The resulting shape retains its size and shape along the Z-axis, but is flipped along the X and Y axis.  

Following the prior UNION command, the resulting script is shown below:


MOVE SpiralOneSide,2,0,0

COPY SpiralOtherSide, SpiralOneSide

SCALE SpiralOtherSide,-1,-1,1

UNION Bulb, SpiralOtherSide, SpiralOneSide

Finally, to finish the bulb, a bridge between the two ends of the bulb must be created.  This is performed in a similar fashion to the stilts using the following part commands:


SPHERE bulbTip0,bulbRad*offset

CYL bulbTipCon,bulbRad*offset,4

UNION bulbTip1, bulbTipCon,bulbTip0

SPHERE bulbTip2, bulbRad*offset

MOVE bulbTip2,0,0,4

UNION bulbTipFin, bulbTip2,bulbTip1

POSITION bulbTipFin,-2,0,6.61,1,0,0

UNION finalCFLBulb,bulbTipFin,Bulb

The Z-Coordinate (6.61) of the POSITION command (POSITION bulbTipFin,-2,0,6.61,0,0)  was attained by multiplying the pitch of the initial spiral command (2.0) by the number of turns (3) and adding an offset based off the Radial Thickness.  This method is not exact, therefore it may be necessary to double click certain elements of the final part to view and make fine adjustments to the positioning of the bridge.  To alter an existing ZSO command, left click the command in question and then perform a right click.  This should spawn a dialog box for recreating the command with the parameters set as the existing values.  Pressing “OK” to replaces the current command.
The resulting bulb is shown below:


The Base

The base of the CFL Bulb is composed of multiple Unions of a variety of Cylinders and other shapes.  
Bulb End Caps:

A small cylinder is created at the Origin.  If the mirroring plane used for a MIRROR command is centered at the origin, the base object must be offset first.  


CYL bulbPlasticBase, bulbRad+0.1, 0.3

MOVE bulbPlasticBase, -2,0,0

MIRROR bulbPlasticBase,0,0,0,1,0,0

UNION finalB0, finalCFLBulb, bulbPlasticBase
The Rest of the Base:

The remainder of the base is formed from multiple unions of cones, cylinders, and spheres.  Shown below are the ZPD commands for the remainder of the base:


CYL cflPlasticBase, 2.7,2

MOVE cflPlasticBase, 0,0,-2

CONE cflPlasticBase1,1,2.7,2.2

MOVE cflPlasticBase1, 0,0,-4

UNION cflPlasticBaseFin, cflPlasticBase1,cflPlasticBase

FILLET cflPlasticBaseFin,0.05

CYL metalConnect, 1,2

MOVE metalConnect, 0,0,-5.5

SPHERE conductor,1.0*0.9

MOVE conductor, 0,0,-4.5-(1.0*0.9)

UNION contact,conductor,metalConnect

UNION wholeBase,cflPlasticBaseFin,contact

UNION cflTotal, wholeBase, finalB0

Take care to only “union” surfaces that are not flush with one another.  For example, cflPlasticBase1 (the CONE command) was given a length of 2.2 units as opposed to 2.0 units and moved 4 units along the –Z axis to obstruct the cflPlasticBase and create an overlap between the geometries.  

Finish the part by rotating the entire object -90 degrees about the X-Axis.  The CFL bulb is now complete!

This article has illustrated the following:
Basic introduction to the user interface of Zemax Part Designer
Creating an elementary ZPD for use in Zemax
Manipulating and viewing the Part
The finished .ZPO file can be utilized within Zemax 12 IE for any non-sequential processes. 
Download the completed Script here.