- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm currently working on a script, that needs to check if a node in my model has a support applied and also to check the name of the support.
I found a example code which uses the call HasLabel.
This is how i implemented it in my code:
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.
Sup_nodes = IN[0]
SUP_LAB = IN[1]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases
ProjectPrefs = project.Preferences
bars = structure.Bars
node = IRobotNode
node_col = structure.Selections.Get(IRobotObjectType.I_OT_NODE)
node_col = project.Structure.Nodes.Get("22")
node = node_col
if node.HasLabel(IRobotLabelType.I_LT_SUPPORT):
OUT = "Support aanwezig"
if node.HasLabel(IRobotLabelType.I_LT_SUPPORT,"2.705NAP"):
OUT = "Support en label aanwezig"
When running this script the first if statement returns "Support aanwezig". works perfect.
but on the second if statement i get the error "Traceback (most recent call last):
File "<string>", line 33, in <module>
StandardError: Error while invoking HasLabel."
Does anyone know how to check also if the label is applied?
@Rafal.Gaweda @cool.stuff @jokiller70
Thanks in advance
ps: what i want to achieve with this function is to speed up a 'brute force search' model. because know the script is overwriting the nodesupports in all runs, while there are only some small changes.
Gr Edward
files are attached.
Solved! Go to Solution.