ZPL Macro:Fit CAD surface as a sequential surface

  • 20 April 2022
  • 2 replies
  • 752 views

Userlevel 5
Badge +3

This ZPL fits a CAD surface to a sequential surface by extracting the coordinates and generating a merit function that contains the coordinates as target. This macro is compatible with
a tilted surface.

 

Click here to download

Date Version OpticStudio Version Comment
2022-04-20 1.0 22.1 Creation

2 replies

Hello Yuan.Chen,

it seems your this zpl is very useful for converting CAD part surface to freeform surfaces. Now I have a few questions about this zpl application program:

  1. what is the converting precision between CAD part surface and the surfaces fitted?
  2. Doe it suitable for any CAD part surfaces including off-axis and non-symmetric surfaces?  During the replacement of the CAD file in the demo.zar file with the CAD parts which is needed to fit,  are there some parameters need be adjusted? such as the z position of source ray et al?
  3. In the optimization process with the fitting.MF generated by the zpl application, how to the set the parameters in the sequential mode: object distance, object field height, size of aperture, stop aperture size, initial parameters of the surfaces such as radius, conic, and other non-linear terms coefficients? Do you have a description of the work principle of this step?  In the optimization processes, will the stop aperture move?
  4. usually, how much the time is needed for a sample array size 1024X1024/

Thank you.

 

Bailin Zhang

 

Userlevel 5
Badge +3

Hi Bailin,

There is an alternative way to do this:

Python fit object face (ex. for CAD) | Zemax Community

Regarding the questions you listed:

  1. It depends how well the CAD surface can be fitted by the existing surface type. This could be told by the value of the merit function, the smaller, the better. 
  2. Depending on the surface type you choose to optimize, you could fit the surface to off-axis and non-symmetric surfaces. 
  3. As mentioned in the ZPL_Macro_Fit_CAD_Surface_Sequential.pdf, you can directly replace the CAD file by the one you want to fit. 
  4. Unfortunately, I could not give you a reference time as it really depends on the surface type we choose and the CAD surface we want to fit. The most time-consuming part is the optimization step using Fitting.MF. The 1024*1024 is supposed to be quite heavy for an optimization. As you can see, we have 3 operands for one data point, this means the density you choose is going to create 3,000,000+ operands.

Reply