xzos / PyZDDE

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

Error of zGetSurfaceData #87

Closed tnakaicode closed 5 years ago

tnakaicode commented 5 years ago

I tried to run following code and got error.

ValueError: could not convert string to float: 'BAD COMMAND'

I want to know how to avoid this error. I use Python 3.6 and Zemax 150624.

import numpy as np
import matplotlib.pyplot as plt
import pyzdde.zdde as pyz
import os

ln = pyz.createLink()
print("Hello Zemax version: ", ln.zGetVersion())
ln.zSetSurfaceData (0, 1, "0.0")
ln.zSetSurfaceData (0, 3, 0.0)
ln.zSetSurfaceData (1, 3, 0.0)
ln.zSetSurfaceData (2, 3, 0.0)
print(ln.zGetSurfaceParameter (3, 3))
ln.zSetSurfaceData (3, 3, 0.0)

ln.close()
indranilsinharoy commented 5 years ago

The function zSetSurfaceData expects integers as input but you have provided a float ln.zSetSurfaceData (0, 1, "0.0")