How to Wrap RobotOM objects in DynamoSimulation.RSA.AnalyticalModel objects?

Hi there, I’m still on the quest to make Dynamo in RSA 2023 a bit more usable…

I developed a few python scripts to fill some Structural Analysis for Dynamo package gaps:

  • the creation of a panel from a list of points (without the discretization, that gives us strange results)
  • the creation of supports on the panel edges

These scripts use the RobotOM COM API, as illustrated in my Quick start guide.

Now I have the need to use the created panel as an input of the UniformSurfaceLoad.ByPanels node, but it only accepts the AnalyticalPanel created with dynamo nodes (ByCurves or BySurface).

I can access to the dynamo package objects by the following

import clr
clr.AddReference("DynamoSimulationRSA")
from DynamoSimulation.RSA.AnalyticalModel import AnalyticalPanel

but if I dir(AnalyticalPanel) I got the following (there are other members, but they are python/c# standard ones)

image

It seems that there are no (public) methods to get an existing panel (by name, Id or com object).

Doe anybody knows a way to wrap existing objects (that is, RobotOM COM objects) into DynamoSimulation.RSA.AnalyticalModel objects?

Update: I decompiled the DynamoSimulationRSA.dll and found that there is a CreateAnalyticalFromPoints method, which is exactly what I needed, but unfortunately it is a private method (why?).

So I tried to translate that method code in a python script, but then again I need to access to the AnalyticalPanel() constructor, which is private.

There is the EmptyPanel public method, but it returns null instead of a new instance of AnalyticalPanel (so it is pretty useless).

Where should I direct all my frustration and request for a patch in this library?

BTW: I just noted that there was another discussion that tried to address something similar to my problem, but no solution was found… Bummer.

A few StakOverflow searches later, I found a (very hackish) way to access the private methods of a third party library.
After a few trials and errors, I found that the right method to call was CreateFromLines.

import clr
from System.Collections.Generic import List
from System.Reflection import BindingFlags
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import Line
clr.AddReference("DynamoSimulationRSA")
from DynamoSimulation import TraceObjectManager
from DynamoSimulation.RSA.AnalyticalModel import AnalyticalPanel

lines = IN[0]

panel_type = clr.GetClrType(AnalyticalPanel)
mi = panel_type.GetMethod(
    "CreateFromLines",
    BindingFlags.Static | BindingFlags.NonPublic
)
panel = mi.Invoke(AnalyticalPanel, [List[Line](lines)])

OUT = panel

Here I’m using reflection to find the private method and invoke it.

It’s still a workaround, we should have a proper way to wrap/keep in sync RobotOM objects and DynamoSimulation.RSA objects!

In the current version is not possible to wrap RobotOM Panel object to the Dynamo RSA AnalyticalPanel. If you use RSA API then you can do everything by that API with panels object: assign loads, supports and modified panels properties. You can find information about RSA API in the document (after RSA installation) “%ProgramFiles%\Autodesk\Robot Structural Analysis Professional 2023\SDK\Robot API.pdf”

Hi @gwizdzm,
that’s what I was trying to avoid: writing nodes that do the same thing as Dynamo RSA nodes, but using RobotOM API.
What’s the point of having a half-baked node library without the option of integrating it with custom nodes/scripts?

Anyway, I took the liberty to decompile the Dynamo RSA library, and I think that the problem lies in the fact that the syncronization between Dynamo and Robot happens only at the end of the run of the entire dynamo project, instead of after each node run.
I suppose it could be an easy-ish fix for the dev team (of course it may bring some overhead and slow things down, but it will unlock the ability to use RobotOM to access newly created objects by their ids).