Hi all,
Hopefully someone can help me a little bit. I wrote i big script to make design calculations on a cantilever bar including load cases and combinations, all based on input from an excel file.
When i run it for the first time it works good(picture 1). but when changing the “bar section” or the “material” and running again(gives an message that robot is changing, picture 2) and the bar is getting removed(picture 3)

This is the dynamo script i use(simplified for this forum)
The red marks around the sliders are there to change the bar section and the material.(normally done in Excel, but works the same).
Hopefully someone can explain me why is the bar removed in the second run?
PS Dynamo file is attached.Test draw bar multiple times_rem.dyn (36.7 KB)
Here a the Python scripts i used.
Create nodes and bar(1)
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
#The inputs to this node will be stored as a list in the IN variables.
pnt = IN[0]
Barsection = IN[1]
Barnumber = IN[2]
Barmaterial = IN[3]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases
ProjectPrefs = project.Preferences
#output
for i in range(len(pnt)):
structure.Nodes.Create(pnt[i][0],pnt[i][1],pnt[i][2],pnt[i][3])
structure.Bars.Create(Barnumber,1,2)
selectionBars = structure.Selections.Get(IRobotObjectType.I_OT_BAR)
selectionBars.FromText(Barnumber)
steelsections = ProjectPrefs.SectionsActive
steelsections.Add("RCAT")
label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION,Barsection)
labels.Store(label)
structure.Bars.SetLabel(selectionBars,IRobotLabelType.I_LT_BAR_SECTION,Barsection)
structure.Bars.SetLabel(selectionBars,IRobotLabelType.I_LT_BAR_MATERIAL,Barmaterial)
OUT = pnt
Creating and adding support(2)
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
#The inputs to this node will be stored as a list in the IN variables.
nodeSupportName = IN[0]
nodeSupportData = IN[1]
supportnodes = IN[2]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
#Assign your output to the OUT variable.
out = labels.Create(IRobotLabelType.I_LT_NODE_SUPPORT, nodeSupportName)
out.Data.UX = nodeSupportData[0]
out.Data.UY = nodeSupportData[1]
out.Data.UZ = nodeSupportData[2]
out.Data.RX = nodeSupportData[3]
out.Data.RY = nodeSupportData[4]
out.Data.RZ = nodeSupportData[5]
labels.Store(out)
SelectionNodes = structure.Selections.Get(IRobotObjectType.I_OT_NODE)
SelectionNodes.FromText(supportnodes)
structure.Nodes.SetLabel(SelectionNodes,IRobotLabelType.I_LT_SUPPORT,nodeSupportName)
OUT = out.Name
Own weight(3)
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
#The inputs to this node will be stored as a list in the IN variables.
LoadCaseNumber = IN[0]
LoadCaseName = IN[1]
IRCN = IN[2]
IRCAT = IN[3]
LCLabel = IN[4]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases
#output
if(loads.Exist(LoadCaseNumber)):
OUT = LoadCaseName
if not(loads.Exist(LoadCaseNumber)):
Caseeigengewicht = structure.Cases.CreateSimple(LoadCaseNumber,LoadCaseName,IRCN,IRCAT)
Caseeigengewicht.Label = LCLabel
Caseeigengewicht.Records.New(IRobotLoadRecordType.I_LRT_DEAD)
LoadRecord = Caseeigengewicht.Records.Get(1)
LoadRecord.SetValue(IRobotDeadRecordValues.I_DRV_Z,-1)
LoadRecord.SetValue(IRobotDeadRecordValues.I_DRV_ENTIRE_STRUCTURE,True)
OUT = LoadCaseNumber
Calculate(4)
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
#The inputs to this node will be stored as a list in the IN variables.
objects = IN[0]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
project.CalcEngine.AnalysisParams.IgnoreWarnings = True
calcEngine = project.CalcEngine
calcEngine.AutoGenerateModel = True
calcEngine.UseStatusWindow = True
OUT = calcEngine.Calculate()