Read FE results API (Python)

Read FE results API (Python)

ngaspar_4
Explorer Explorer
1,110 Views
3 Replies
Message 1 of 4

Read FE results API (Python)

ngaspar_4
Explorer
Explorer

Hello. I'm used to deal with RSA API through VBA. This time around it would be handy to do so in Python, so I'm trying to write my first script.

I've been trying to replicate some code I already had in VBA, but I ran into some errors that I don't know how to solve. Namely:

 

import clr
clr.AddReference("C:\\Program Files\\Autodesk\\Autodesk Robot Structural Analysis Professional 2021\\System\\Exe\\Interop.RobotOM.dll")
import RobotOM
from RobotOM import *
from System import Object
app = RobotOM.RobotApplicationClass()

FEParams = IRobotFeResultParams
FEParams.Node = 1
FEParams.Layer(IRobotFeLayerType.I_FLT_MIDDLE)
FEParams.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN,1,0,0)

I get this error:

----> 2 FEParams.Node = 1
      3 FEParams.Layer(IRobotFeLayerType.I_FLT_MIDDLE)
      4 FEParams.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN,1,0,0)

TypeError: invalid target

 

Also, if I comment that line, I also get error when trying to set the layer:

FEParams = IRobotFeResultParams
# FEParams.Node = 1
FEParams.Layer(IRobotFeLayerType.I_FLT_MIDDLE)
FEParams.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN,1,0,0)
----> 3 FEParams.Layer(IRobotFeLayerType.I_FLT_MIDDLE)
      4 FEParams.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN,1,0,0)

TypeError: instance property must be accessed through a class instance

 

I was wondering if you could give me some guidance about this example. Thanks in advance!

0 Likes
1,111 Views
3 Replies
Replies (3)
Message 2 of 4

Stephane.kapetanovic
Mentor
Mentor

hi @ngaspar_4 

FEParams = ...

Object type is defined but object must be set. 

Best regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 3 of 4

ngaspar_4
Explorer
Explorer

Hello @Stephane.kapetanovic . Thank you so much for your answer.
What do you mean by setting an object? I hope I'm not asking too much, but could you complete your code snippet with an example so that I can understand?
Thanks for your help!

0 Likes
Message 4 of 4

Stephane.kapetanovic
Mentor
Mentor

hi @ngaspar_4 

it is necessary to create a new instance (RobotFeResultParams) which allows you to access to set the properties.

Your python code (FEParams = IRobotFeResultParams) seems defines only a variable type from the interface but not a new parameterizable object. Try this way, both works !  C# or VB.

Stephanekapetanovic_0-1644527627677.png

Stephanekapetanovic_1-1644528425199.png

I tried your code and got the same error, the new keyword does not exist and I don't have time to test other ways.

if you still want to continue in python contact technical support.

 

Best regards

 

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes