I had earlier posted a question as a follow up to Syntax help. Reposting here for the benefit of others and to go further with the topic.
What I’m actually after is how to tilt an object in the Non-sequential Lens Data Editor, from Matlab. The Matlab connection is working (using the NSE Ray Trace example).
Thanks,
Josh
David Nguyen has replied:
Hi Josh,
Assuming the Interactive Extension works for you, you’ll need those lines of code:
TheObject = TheSystem.NCE.GetObjectAt(1)
TheObject.TiltAboutX = 15
The property TilteAboutX is read and write so you can access it directly. The same property exists for Y, and Z. GetObjectAt() will return the corresponding object from the NSC editor (it starts at 1).
Let me know if that works for you.
Take care,
David
Thanks David,
It does seem like it’s working, thanks!
Playing around with it more, it seems that Matlab just requests OpticStudio to open a file, do the manipulation, run a ray trace, return the values and does not interact with whatever may have been already open in OpticStudio. Is that true?
How can I use OpticStudio to execute the visualization from Matlab? One of the nicest features of OpticStudio is the built-in graphical layouts, which make it easy to visualize and see what is going on. It would be really handy for me to be able to see changes made from Matlab in the Lens Data Editor and in the NSC 3D layout update. Do I need to open the ZOS file in OpticStudio first? Is there a ZOS-API function like “Update All” as used in the Macros?
Thanks,
Josh