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!