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: 

(API) ROBOT / VBA - Steel Section Attribution

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
462 Views, 1 Reply

(API) ROBOT / VBA - Steel Section Attribution

Dears,
I’m trying to write a code to automatically create a structure.
I’ve noted that 95% of the spent time is when I attribute the steel sections. Here it’s this part of my code:

 

Dim robapp0 As IRobotApplication
Dim bar1 As IRobotBar
Dim str As IRobotStructure
Dim RLabel As RobotLabel
Dim RLabelData As RobotBarSectionData

 

Set robapp0 = New RobotApplication
Set str = robapp0.Project.Structure

 

robapp0.Project.Preferences.SetCurrentDatabase I_DT_SECTIONS, "OTUA"
robapp0.Project.Preferences.SetCurrentDatabase I_DT_SECTIONS, "RTRKK"

 

For i = 1 To ns
      leg_section = Cells(18 + i, 19) & " " & Cells(18 + i, 20)
      Set RLabel = str.Labels.Create(I_LT_BAR_SECTION, leg_section)
      Set RLabelData = RLabel.Data
      RLabelData.LoadFromDBase leg_section
      str.Labels.Store RLabel
      Robot.Project.Structure.Bars.Get(1 + 3 * (i - 1)).SetLabel I_LT_BAR_SECTION, leg_section
      Robot.Project.Structure.Bars.Get(2 + 3 * (i - 1)).SetLabel I_LT_BAR_SECTION, leg_section
      Robot.Project.Structure.Bars.Get(3 + 3 * (i - 1)).SetLabel I_LT_BAR_SECTION, leg_section
Next i

 

There is another way to select the 3 bars at the same time and attribute the steel section in one single line?

 

Robot.Project.Structure.Bars.Get(1 + 3 * (i - 1), 2 + 3 * (i - 1), 3 + 3 * (i - 1)).SetLabel I_LT_BAR_SECTION, leg_section


I think that will boost my app.

1 REPLY 1
Message 2 of 2
Rafal.Gaweda
in reply to: Anonymous

Hi @Anonymous

 

Create Selection and the apply Section to this selection

 

Robot.Project.Structure.Bars.SetLabel(....)


Rafal Gaweda

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

Post to forums  

Autodesk Design & Make Report