- Home
- User Articles
- How to Create Surfaces of Revolution via User Defined Objects
- Home
- Programming ZEMAX
- User Defined Features
- How to Create Surfaces of Revolution via User Defined Objects
How to Create Surfaces of Revolution via User Defined Objects
- By Anatoli Trafimuk
- Published 7 August 2008
- User Articles , User Defined Features
-
Rating:




User-defined vs. imported objects
A user-defined DLLs sample for cubic spline and Bezier-based object can be found in the ZIP archive on the last page of this article. Filenames are bezier_r.dll, c_spline_r.dll. The C code is included in files bezier_r.c, c_spline_r.c. Note that both DLLs are compiled for the SSE2 processor instruction set (modern processors). With old processors, C files can be compiled and DLL needs to be built for the usable processor. Parameters 1 and 2 specify the facets numbers, while parameters from 3 to 22 specify data points.
The ZEMAX Bezier object is created as shown below. It has 10 radial and 10 angular facets. Raytraces are set up with source ellipse. Note how rays refract on the object: they cross exact surface geometry instead of at facets.
If the number of facets is increased, the picture is improved.
User-defined objects can be exported from ZEMAX to CAD formats (SAT, STEP or IGES). Note that the resulting file is not of a smooth surface, but rather a set of flat facets. To obtain the exact solid geometry, an external CAD software can be used such as Rhino3D, KOMPAS, AutoCAD, or ProEngineer. The Bezier curve points can then be set manually and the CAD file rotated and exported or saved for future work.
The file bezier_r.sat is created in CAD software. Raytrace is then run for the DLL object and the imported object with 1 million rays (test.zmx and testCAD.zmx files). Note to check memory usage. The analysis was done with a Core2Duo T5500 processor and the 6/24/08 ZEMAX version. Results are shown in the table below.
| Bezier DLL | Imported | |
| Memory Usage, MB | 102 | 225 |
| Raytrace time, min | 2.075 | 25.57 |
Optimization is possible for user-defined objects and control points can be set as variables. For improving the focusing properties of our object, see file optimize.zmx. After optimization, the object below is obtained.