![](https://uploads-us-west-2.insided.com/zemax-en/attachment/48f7a6db-b766-41f7-97e1-11720bcda9d7.png)
I need to read out the X half width and Y half width of a Detector Rectangle. The above code used to work but now it says no AttributeError: 'IObject' object has no attribute 'XHalfWidth'. Could you tell me a way to circumvent this problem.
I need to read out the X half width and Y half width of a Detector Rectangle. The above code used to work but now it says no AttributeError: 'IObject' object has no attribute 'XHalfWidth'. Could you tell me a way to circumvent this problem.
Best answer by David.Nguyen
When using the ZOS-API with Python. If something was working before and got broken, I always suspect this:
In your case, I think if you do:
x_half_width = d.ObjectData.__implementation__.XHalfWidth
It should fix your issue. I think it got broken when you installed a more recent version of Pythonnet (>2.5.2). You could also roll back Pythonnet to 2.5.2, but I think its less desirable. Also, I highly suggest looking at ZOSPy (mentioned at the end of the post I linked above), which alleviate such issues.
Take care,
David
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.