Robot API and Python 3.11

Robot API and Python 3.11

bjoern_steinhagen8PD9X
Observer Observer
315 Views
0 Replies
Message 1 of 1

Robot API and Python 3.11

bjoern_steinhagen8PD9X
Observer
Observer

I am having an issue importing a .dll library in Python 3.11.

For IronPython, the import is successfull and looks as follows:

import clr
clr.AddReferenceAndFilePath('C:\Program Files\Autodesk\Robot Structural Analysis Professional 2023\Exe\Interop.RobotOM.dll')
import RobotOM as rbt
print(dir(rbt))

And the output is a comprehensive list of all members functions, methods and attributes of the library:

['DontUseIt', 'DontUseItClass', 'IDontUseIt', 'IRBestBendType', 'IRBestCalcErrors', 'IRBestCalcParamsData',  ...]

Following a similar syntactical approach in Python 3.11, I was expecting the same results as that of IronPython:

import ctypes
RobotOM = ctypes.WinDLL(r'C:\Program Files\Autodesk\Robot Structural Analysis Professional 2023\Exe\Interop.RobotOM.dll')
print(dir(RobotOM))

The output is as follows:

['_FuncPtr', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_func_flags_', '_func_restype_', '_handle', '_name']

Various other approaches yield the same results, such as:

import ctypes
RobotOM = ctypes.cdll.LoadLibrary(r'C:\Program Files\Autodesk\Robot Structural Analysis Professional 2023\Exe\Interop.RobotOM.dll')

My question: how can I replicate the successfull import of the .dll library in Python 3.11? With IronPython it is possible, surely the same should be possible for Python 3.11?

0 Likes
316 Views
0 Replies
Replies (0)