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 to Get Storey name for the selected Bar

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
WALIDGIO
118 Views, 5 Replies

VBA to Get Storey name for the selected Bar

Hello,

is there a way to get the storey name of an element (bar) that I already get, i'm trying to get the force that belong to that bar and output them in Excel, but also i want to add a column of which storey that bar belong to, I'm looking for something like this 

Dim storeyName As String
storeyName = bar.GetLabelName(I_LT_STOREY(name or label))

 

is there a way or i have to iterate through each storey and then put the bar code

Tags (5)
5 REPLIES 5
Message 2 of 6
WALIDGIO
in reply to: WALIDGIO

So far workaround a code by finding the Noed related to that bar then get the Z elevation compared to the storey and get the storey name

        For Each bar In bars
            Dim bar_num As Long
            bar_num = bar.Number
            
            barNodeZ = bar.StartNode 
            Dim nodeStart As IRobotNode
            Set nodeStart = robapp.Project.Structure.Nodes.Get(barNodeZ)
            barHeight = nodeStart.Z

            Dim Storeys As RobotStoreyMngr, Storey As RobotStorey
            Set Storeys = robapp.Project.Structure.Storeys

            For S = 1 To Storeys.Count
                Set Storey = Storeys.Get(S)
                If Storey.Level = barHeight Then
                    storeyName = Storey.Name
                    Exit For
                End If
            Next S
....

 

if there isn't a direct call of storey Label from bar Object, I'll continue with this solution 

 

Message 3 of 6

hi @WALIDGIO 

has mentionned here and link in message 3

 

here's a selection of bars from the "story 1" storey

Dim BarSelection As RobotSelection
Set BarSelection = RobApp.Project.Structure.Selections.CreateByStorey(I_OT_BAR, "Story 1")

 

To find out whether a bar is part of a selection, you can, for example, use "Contains". 

Dim Bar_To_Find As Long, ExistInSelection As Boolean
Bar_To_Find = 45 ' Bar to find
ExistInSelection = BarSelection.Contains(Bar_To_Find)

Best Regards

Message 4 of 6

Hi @Stephane.kapetanovic 

Thank you for the replay, I think there is no proprety concerning the storey for a element yet, I thought i was Implemented after all these years, so we still need to worked around 
what i really want is to retrieve the storey of element directly without compare it, or get it from a group of selection.

like in this picture the bar proprety has a story that it belong to 

 

WALIDGIO_0-1720799180612.png

 

Message 5 of 6

hi @WALIDGIO 

This is a request you should make to the Autodesk team.

 

As explained, the suggestions provided here are in the spirit of collaboration and are intended to promote the use of Robot software and its API. The solutions do not need to be specific to your software architecture and are not intended as workarounds.

 

Regarding the use of the RobotBar class and the addition of direct-read properties from RobotStorey, I have a different point of view than changing the paradigm. The code provided consists of just a few lines and is based on selections made from text strings, which are very quick to process compared to some collections. overloading the bar class with properties that are only occasionally read is not ideal.

Instead, you can optimize access times in your code by better data management, changing your programming language, creating your own classes and parralelizing your queries. This approach would preserve the API's efficiency while allowing for the customization you need.

Best Regards

Message 6 of 6

Here you'll find an offline method that you can adapt to your own situation.

https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-get-the-group-that-the-bar-belong...

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report