Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I created a code that creates a ‘load case’(works), and after the creation of the loadcase i want to add a load tot he bar in that particular loadcase. But this gives errors(see picture 1). And after adding the load tot he bar i want to calculate the structure, also with a python script. But the problem with this script is that it’s executed before the structure is drawn in robot.
I have 2 questions about these problems:
- What/where is something wrong in the code for adding the load tot the bar?
- How can i solve the problem that calculation will start after it’s drawn in robot.
Complete setup:
picture 1:
Error inside robot
Code for adding load to bars
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[0]
LoadPX = IN[1]
LoadPY = IN[2]
LoadPZ = IN[3]
LoadID = IN[4]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases
LoadCaseName = IRobotCaseServer.Get()
Uniform = []
Uniform.append(LoadCaseName.Records.New(IRobotLoadRecordType.I_LRT_BAR_UNIFORM))
LoadRecord = LoadCaseName.Records.Get(Uniform[0])
LoadRecord.SetValue(0,LoadPX)
LoadRecord.SetValue(1,LoadPY)
LoadRecord.SetValue(2,LoadPZ)
LoadRecord.Objects.FromText(objects)
#Assign your output to the OUT variable.
OUT = 0Code for calculations:(runs now to early)
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()All files are also added in the zip file.
Thanks in advance
Edward
Solved! Go to Solution.