In general, there are two major differences between Python COM and Python .NET:
1. In the COM setup, you need to use
CastTo
to use properties belonging to an alternate interface. For example, when running a ray trace in Non-Sequential Mode through the API, the ray trace is set up using the INSCRayTrace interface. To run the ray trace, the property
Run
is used, which belongs to the ISystemTool interface. In Python COM, we are forced to explicitely call the ISystemTool interface using the
CastTo
command. This is not necessary in .NET. I have provided a side-by-side comparison below.
Note: Click on the image for a higher resolution version of these images.
2. In the COM setup, enumerated variables are stored in the
constants
library. This means we can call an enumerated variable by typing something like
constants.EnumeratedVariable_Enumeration
. In the .NET interface, the enumerated variables use their full title (as displayed in the Help System) instead of using the constants library. I have provided an example of this below:
Note:
The graphics are re-sized to fit within the proportions of the Forum. You may right-click on the image and open it in a new tab for a higher-quality view.
If you haven't already, take a look at our overview of Python .NET in the Knowledgebase: '
ZOS-API using Python.NET
.' In that article, the differences I have discussed above are outlined. We also provide a step-by-step guide on setting up this new interface!
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
This file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.
To Chinese users:
Do not provide any information or data that is restricted by applicable law, including by the People’s Republic of China’s Cybersecurity and Data Security Laws (
e.g., Important Data, National Core Data, etc.).
不要提供任何受适用法律,包括中华人民共和国的网络安全和数据安全法限制的信息或数据(如重要数据、国家核心数据等)。