Ansys Learning Forum › Forums › Discuss Simulation › Optics › Zemax: creating an array of tilted source › Reply To: Zemax: creating an array of tilted source
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.