Skip to main content

Hi Zemax Community,



I wrote a macro to create a number of objects in Non-Sequential Mode and pass various details to be sent to a specified .dll, including the Split option, DLL, Orders, and all the other details required for the .dll. When I run the macro, the objects are created as expected with all typical details showing up in the NSC editor (e.g. positions, tilts, size, thickness, material, etc.). However, in the diffraction tab, only the correct Split, DLL, and Orders show up (correctly) while the edit boxes for the details for the .DLL are not present:





If I then change the DLL and then set it back to the original, desired DLL, the edit boxes appear with the values I passed to the object originally:





Is there a way to have this show up properly without manually changing the DLL to a different DLL, then back again for each object? The main reason I wrote the macro was to auto-create many objects instead of manually entering values into each element.



Additionally, if I copy an object and then paste it, the Properties window returns to hiding the edit fields. Is there a setting I have incorrectly set that is doing this?



Thanks in advance.

Hey Roger,



I think once you specify the dll, you need to issue an UPDATE to actually load it. Other than that, I'd need to see the code to comment further.



- Mark


Hi Roger and Mark,



I have actually confirmed this behavior. It appears to be a graphics glitch that occurs when we try to programmatically change from a setting which has no extra parameters to a setting which has at least one. 



So far, I have found that we can get around this by saving and re-loading the file after updating the DLL. This can be done with SAVELENS and LOADLENS as is shown below:



 



INSERTOBJECT 1, 1


SETNSCPROPERTY 1, 1, 0, 1, 'NSC_RBLK'


SETNSCPROPERTY 1, 1, 91, 1, 2


SETNSCPROPERTY 1, 1, 92, 1, 'diff_all_transmit.DLL'


UPDATE ALL


lensFile$ = 'C:\Users\...\test.zmx'


SAVELENS lensFile$


LOADLENS lensFile$


SETNSCPROPERTY 1, 1, 95, 1, 5


SETNSCPROPERTY 1, 1, 96, 1, 5


 



Let me know how this works for you, Roger!



Best,



Allie


Hi Mark and Allie,


Thanks for your replies. Similarly to Allie, I included the command 'UPDATE ALL' at the end of the macro.



Luckily, it seems to just be a graphics issue and the values are correctly passed from the macro to the system. Using the SAVELENS and LOADLENS functions works to get around this glitch.



Roger


Reply