Optics

Optics

Topics related to Speos.

Zemax: creating an array of tilted source

TAGGED: 

    • binyuw
      Subscriber

      Hi there,

      I'm trying to create an array of titled source, and I got something like this:

      I want to have something like this. I know I can do it for object array but I do not find a place to do it for source array

      Really appreciate it if anyone can help me with it.

      Thank you so much :)

      Best

    • Christophe Weisse
      Ansys Employee

      Hello,

      To the best of my knowledge, you won’t find an object that readily does that.

      However, you could use a macro or the ZOS-API to place and orient the array of sources to your will.

      Here’s a (hopefully close enough) 1D example of what you could do with a ZPL macro. All sources aim at the same point, you use-case being simplier it is rather easy to edit the code to match your needs:

       

      # "Focal" distance of the detectors
      distance = 25

      # Distance between detectors as a factor of the index value
      factor = 4

      FOR det_index, -5, 5, 1
          # Insert new object in first line of editor
          INSERTOBJECT 1, 1
          
          # Change object type to Detector Rectangle
          SETNSCPROPERTY 1, 1, 0, 0, "NSC_DETE"
          
          # Calculate Detector Y Position
          y_pos = factor * det_index
          
          # Change Detector Y Position
          SETNSCPOSITION 1, 1, 2, y_pos
          
          # Calculated required Tilt About X in deg
          IF (det_index == 0)
              tilt_x = 0
          ELSE
              tilt_x = 90 - ATAN( distance / y_pos ) / 3.14159265359 * 180
          ENDIF
          
          # Adjust Detector Tilt About X
          SETNSCPOSITION 1, 1, 4, tilt_x
      NEXT

       

      If you run this macro, this is what the 3D Layout will look like:

       


      If you need the array to be parametric and/or if your array is very large, it could then be more convenient to program the source the way you need with the Source DLL option.


    • binyuw
      Subscriber

      Thank you so much.

      my rectangle sources have specific position and sizes. They all have a defined spacing and titled angle. May I just manually create multiple "source rectangles" in the editor (or any other ways)? I check the DLL and API and still confuse about the coding.

      Eventually I want to create something like this:

      x:1.5mm, y:0.05mm title angle 45 degree C

       

      Best

      Binyu

    • Christophe Weisse
      Ansys Employee

      Dear Binyu,

      You're right, creating every object by hand is always possible (you can copy/paste any object, which may make it somewhat convenient) but you'd need to edit some parameters manually. Also, API or DLL can be quite intense if your task is rather simple. This is why my first suggestion was to use macros (ZPL).
      This is an easier to use, simplier programming option that excells at automating tasks.

      I gave it a quick go to illustrate how ZPL could be used in your set-up:



      I hope this helps,
      Christophe

Viewing 3 reply threads
  • You must be logged in to reply to this topic.