Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check if support Haslabel API

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
1234eddie
451 Views, 2 Replies

Check if support Haslabel API

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.

 

Tags (3)
Labels (2)
2 REPLIES 2
Message 2 of 3
Rafal.Gaweda
in reply to: 1234eddie

Hi @1234eddie 

 

There is no method with input mentioned by You.

 

haslabel.jpg So if it HAS label, Get it and check its name



Rafal Gaweda
Message 3 of 3
1234eddie
in reply to: Rafal.Gaweda

@Rafal.Gaweda 

Thanks for your reply. 

i have not implemented it yet.

but thanks to an answer you gave in an other topic i have used the function

'application.Interactive = False

(Setlabel part)

application.Interactive = True'

 

Which increased the speed of the script enough for now.

 

Many thanks

 

Gr Edward

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report