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: 

[VBA/API] Select bars longer than..

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
kambed91
252 Views, 2 Replies

[VBA/API] Select bars longer than..

Hi,

Is it possible to select all bars longer than 1,5m?

I saw examples to select by section using "CreateByLabel(I_OT_BAR, but there isn't I_LT_BAR_LENGTH,>1.5)"

I would be grateful for any hint.

 

Tags (3)
2 REPLIES 2
Message 2 of 3

hi @kambed91 

 

Sub SelectAllBarsWithLengthGreaterThan()
  L = 1.5
  
  Dim RobApp As RobotApplication
  Set RobApp = New RobotApplication
  
  With RobApp
    If Not (.Visible = -1 And .Project.IsActive = -1) Then
      MsgBox "Open Robot and open a model", vbCritical, "Robot Error"
      Set RobApp = Nothing: Exit Sub
    End If
    Dim BarCol As RobotBarCollection, BarSel As RobotSelection
    With .Project.Structure
      Set BarCol = .Bars.GetAll
      Set BarSel = .Selections.Get(I_OT_BAR)
    End With
  End With
  
  For i = 1 To BarCol.Count
    With BarCol.Get(i)
      If .Length > L Then Txt = Txt & " " & .Number
    End With
  Next i
  BarSel.FromText Txt
  Set RobApp = Nothing
End Sub

 

Best Regards

Tags (4)
Message 3 of 3
kambed91
in reply to: kambed91

Thank you for help. It works great.

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

Post to forums  

Autodesk Design & Make Report