Skip to main content

 Hello Everyone,

Does anybody have an idea about how to read out the coordinate values of 3D object corners? In either merit function or ZPL environment is welcomed.

 

Hi Onder,

Unless there is very simple geometry like a tilted (use Global Rotation Matrix) rectangle (use Half Width X/Y), then you’ll probably have to use ray tracing to determine the extent of the surface or object you’re trying to investigate.  OpticStudio itself doesn’t really even keep track of values like the extent of a geometry part and when it does calculate the extent on the fly, it uses ray tracing. 

Whether you are in sequential or non-sequential mode, you have 2 options: use the Sag Map to determine the edge/corner of the part (and rotate to global coordinates if needed) or manually calculate the edge of the part in ZPL or MFE.  

Sequential Mode

The Sag Map is located under Analyze > Surface > Sag and the following KBA goes into detail about the rotation matrix.

Rotation Matrix and Tilt About X/Y/Z in OpticStudio – Knowledgebase (zemax.com)

For manual calculations: 

  • Make sure your surface has a hard aperture on it (don’t use None or Floating Aperture)
  • In ZPL:
    • Create a 2D grid of rays which approximates the extent of the part
    • Use RAYTRACEX with the starting surface being the surface under investigation
    • Use RAYV(n) on the surface under investigation to see if the result is 0:
      • If RAYV(n) is 0, then the ray hit the part and you haven’t found the corner yet
      • If RAYV(n) is 0, then ray is vignetted (outside the aperture of the part)
      • It’s at this 0-to-non-0 threshold that is the extent of your part
    • Sequential always gives raytrace values in local coordinates, so use the Euler rotation matrix (MFE operand of GLCR) to convert from local to global coordinates if needed

Non-Sequential Mode

The Sag Map is located under Analyze > NSC Sag.

For manual calculations:

  • Place a Source Ray in front of your object and set the Number of Analysis Rays to 1
  • Add a NSRA operand to the MFE
    • Use Scr# as the Source Ray object number, keep Splt? and Pol? as 0, Seg# as 1 (assuming the Source Ray is placed so that the first interaction is with the object under investigation) and Data as 3
  • Use a Universal 2D plot and set the Independent X as the X Position of the Source Ray and the Independent Y as the Y Position of the Source Ray
  • Make sure the extent of the X and Y movement is enough so you can get a Sag Map of the entire surface
  • When there is a discontinuity in the sag, this is the edge of your part and you can use the Text Tab to look at where the corners are.

Reply