xzos / PyZDDE

Zemax/ OpticStudio Extension using Python
MIT License
154 stars 64 forks source link

Is there a set glass data functionality? #98

Open echatziz opened 4 years ago

echatziz commented 4 years ago

I want to be able to alter the glass data parameters, eg. the transmission data. In ZPL there is a function GETGLASSDATA. Have you implemented sth that behaves like that? But in my case I need sth like setglassdata.

I've searched the source code, but didn't see anything. Perhaps, I've missed it though.

Thank you.

echatziz commented 4 years ago

Since I am quite desperate for this, I am willing to implement it myself, if it can be done, given some direction. Otherwise, I'll have to throw out all my code and redo it in zos api

LucVV commented 4 years ago

Hi @echatziz,

I also cannot find an implementation of that funcition, maybe @indranilsinharoy has an idea but I guess you will have to do the implementation yourself. I estimate that it it possible. I guess that you can make a copy of any function that gets data through the DDE client, and change the string command to get this data out. You can also pass parameters through thus string command, you can have a look at e.g. zGetTextFile() in zdde.py. Does that help you?

echatziz commented 4 years ago

From what I've seen in the Zemax manual, although there is a ZPL command GETGLASSDATA, there isn't an ITEM with this functionality. Where ITEM is the function passed to the ZEMAX server. So, I guess it cannot be implemented, unless you can define your own item somehow.

Or did you mean to get the text file of the glass report with zGetTextFile() and edit it so I can change the glass parameters?

LucVV commented 4 years ago

Unfortunately, then I guess it is not possible this way. How many times do you need to change the glass data? Otherwise you might be able to make a catalogue by hand (or by using the zos-api) and then selecting it by zGetGlass() and zSetGlass()

indranilsinharoy commented 4 years ago

Hi @echatziz , @LucVV , Can you use the function zExecuteZPLMacro() ?