Can you confirm the fly's eye homogenizer is unmodified and Object 4 is actually a Detector Rectangle? Line 185 in the example is hard-coded to point to Object 4 and this object in the unmodified file is a Detector Rectangle. You will typically get this error if you're trying to read a parameter (NumberXPixels) on an object which doesn't have that parameter.
Hi @MichaelH, thank you for pushing me to double check. Unfortunately, the .zmx is unmodified, and object 4 is a Detector Rectangle, as expected:
Furthermore, I have found a similar issue with all the non-sequential examples that try to modify a property.
Maybe some useful information: obj.ObjectData returns an IObject, and not an IObjectDetectorRectangle, which is what I'd expect (although I'm new to the API, so I might be easily wrong). Of course, an IObject, being a general object, does not have the NumberXPixels attribute:
I hope this helps!
Hi svilches,
The example works for me in 22.2.1.
You are saying:
Unfortunately, the .zmx is unmodified
However, the code uses the *.ZOS file (this is the new file extension):
#! !e02s01_py] # Open file testFile = os.path.join(os.sep, sampleDir, r'Non-sequential\Miscellaneous\Digital_projector_flys_eye_homogenizer.zos')
Could you check this file as well? I’m attaching my Digital_projector_flys_eye_homogenizer.zos file for which the code works.
Lastly, try rebooting the computer, it does wonder sometimes for me at least.
Take care,
David
I have found the issue: The sample code does not work with the latest pythonnet (3.0.0.post1)! Re-installing it with an older version (pythonnet 2.5.2) solved it.
There is still an issue with this example, but I’m not able to install the older pythonnet version. There is no pre-build wheel for pythonnet 2.5.2 for my python version (3.12) and building from source fails.
Does anybody know whether there is any effort made to fix the problems with pythonnet 3.x.x?
@Tilmann.Piffl,
It’s mostly fixed if you read the following:
However, the examples have not been modified to take this into account yet as far as I know.