I’m currently working on some scripts to automate the design proces in our company with the use of Dynamo.
And because the structural packages doesn’t include some load options and loadcombinations i ended up writing the whole proces in python scripts inside dynamo. the picture below show the representation of the proces.
The whole script works fine for the first run. but when i run it a second time(change for example the bar section due wrong UC) the loads[red box picture above] will duplicate in the robot structural model.(see pictures below)
This is the representation of adding load to a bar.
Add load to bar(5)
import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * from System import Environment user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll") from RobotOM import * from System import Object objects = IN LoadCaseID = IN ILRT = IN LoadPX = IN LoadPY = IN LoadPZ = IN application = RobotApplicationClass() project = application.Project structure = project.Structure labels = structure.Labels loads = structure.Cases CreatedLoads =  simplecase = loads.Get(LoadCaseID) Uniform =  Uniform.append(simplecase.Records.New(ILRT)) LoadRecord = simplecase.Records.Get(Uniform) LoadRecord.SetValue(0,LoadPX) LoadRecord.SetValue(1,LoadPY) LoadRecord.SetValue(2,LoadPZ) LoadRecord.Objects.FromText(objects) CreatedLoads.append(LoadRecord.UniqueID) #Assign your output to the OUT variable. OUT = CreatedLoads
This is the code i use now. but what i want to do is make an if statement if there is a load applied inside a loadcase, delete the load and add again(load input will sometimes change); If not add load to desired bar.
The problem i have at the moment is that i can’t find which API code has the applied load ID.
I thought i could be inside IRobotLoadRecordMngr(see attached picture). but don’t know if this is true?
I hope someone can help me a little bit?
@Maciek_Kubica don’t know if you have some examples(vba,c#,python) or know someone who can help me with this.
Thanks in advance
PS: dynamo file attached.
Loads keeps adding 0_01.dyn (49.3 KB)
The versions of the programs i use are:
Robot structural analysis 2020
Dynamo studio 188.8.131.526/Dynamo core 184.108.40.20666