Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

API/VBA select Bars within Storeys and retrieve Fx max

WALIDGIO
Advocate

API/VBA select Bars within Storeys and retrieve Fx max

WALIDGIO
Advocate
Advocate

Hello,

I want to create a VBA Macro to find and list the maximum axial force (FX) for each bar in each storey of a building, along with the relevant load case details.

what I'm struggling with is to select bars by storey and then fitch for each bar the maximum Fx value with the corresponding Combination number, Also I'm struggling to output the Bar Label (section) not the name this is the step I'm following

  1. Iterate over each storey.
  2. Select all bars within the current storey. ( if possible only columns)
  3. Get all combination 
  4. Find the maximum FX value for each bar with the corresponding Combination within the storey. 
  5. Write the results to the worksheet.

to result in the end with a table like this : I'm  attaching Excel to what i arrived so far thank you.

StoreyBar LabelFX Max (kN)Bar MemberBar NodeBar Case
Level 0CC 35x35824193237
Level 1CC 35x358152151147
Level 2CC 35x357512402775
Level 3CC 30x3061128735516
0 Likes
Reply
Accepted solutions (2)
569 Views
6 Replies
Replies (6)

Stephane.kapetanovic
Advisor
Advisor

Hi community,

I understand that there may be questions within the community regarding specific developments. Suggestions provided here are in the spirit of collaboration and are generally focused on promoting the use of Robot software and its API. It is important to note that the solutions provided here may not be specific to complex individual cases.

Best Regards

0 Likes

Stephane.kapetanovic
Advisor
Advisor
Accepted solution

hi @WALIDGIO 

you'll find below a code to search for the bars on each floor. For the lists to be initialized, the model must be consolidated.

Public Sub FindStoreyBarList()
  Dim RobApp As RobotApplication
  Set RobApp = New RobotApplication
  
  Dim Storeys As RobotStoreyMngr, Storey As RobotStorey, Selection As RobotSelection
  With RobApp.Project.Structure
    Set Selection = .Selections.Create(I_OT_BAR)
      Set Storeys = .Storeys
  End With
  
  For i = 1 To Storeys.Count
    Set Storey = Storeys.Get(i)
    
    Selection.FromText Storey.Objects
    For j = 1 To Selection.Count
      BarNumber = Selection.Get(j)
      '[...]
       
    Next j
  Next i
  
  Set RobApp = Nothing
End Sub

See also :

https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-api-find-storey-that-a-element-...

 

 

Best Regards

0 Likes

Stephane.kapetanovic
Advisor
Advisor

hi @WALIDGIO 

you should read this topic

https://forums.autodesk.com/t5/robot-structural-analysis-forum/getting-internal-forces-from-rsa-to-x...

 

If one or more questions have been resolved, for the benefit of the community, it is recommended to approve the solutions.

Best Regards

0 Likes

Stephane.kapetanovic
Advisor
Advisor

hi @WALIDGIO 

you can get help through the approved solutions on the forum, for example by searching for API. 

Different languages exist such as C#, Python and VB, you will be able to adapt your code to your use.

Note that you also have files and example delivered with the SDK located in the installation subdirectory ...\SDK.

 

You can also find information such as the API tutorial, videos (12) and useful addins already developed and the app store.

Best Regards

0 Likes

WALIDGIO
Advocate
Advocate

thank you stephane i used your code and adapted it in mine it worked perfectly, thank you so much 
I also was wondering how to extract bar section to output it in excel i found the solution I'll put here if anyone will find it helpful in the future

BarName = BarObject.GetLabel(I_LT_BAR_SECTION).Name

Thanks.

0 Likes

Stephane.kapetanovic
Advisor
Advisor
Accepted solution

see also :

BarName = BarObject.GetLabelName(I_LT_BAR_SECTION)