Extacting List of nodes by Using API

Extacting List of nodes by Using API

faisal.aaouatif
Collaborator Collaborator
634 Views
5 Replies
Message 1 of 6

Extacting List of nodes by Using API

faisal.aaouatif
Collaborator
Collaborator

Good Morning / Evenning

Is there anyway to extract the list of nodes belonging of walls ( even calculation nodes ) by using API

Thank you.

0 Likes
Accepted solutions (1)
635 Views
5 Replies
Replies (5)
Message 2 of 6

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Hint:

 

Dim OD As RobotObjObject
Dim NodesList As String
NodesList = OD.Nodes

 



Rafal Gaweda
0 Likes
Message 3 of 6

faisal.aaouatif
Collaborator
Collaborator
Thank you very much
0 Likes
Message 4 of 6

Anonymous
Not applicable

Hi,

 

I would like to do a macro like that but with bars. I'll select some bars in the model and the macro will add the points of selected bar to a listbox. but i'm can't do this. My code is:

 

Public Sub Pontos_Barras()

    Set RobApp = New RobotApplication
    Dim Bar As IRobotBar
    Dim Sec As RobotBarSection
    Dim sectData As IRobotBarSectionData
    
'    With ListBox1
'        .Clear
'    End With

'#################################################
    Dim BarSel As RobotSelection
    Set BarSel = RobApp.Project.Structure.Selections.Get(I_OT_BAR)
    
    Dim NodeSel As RobotSelection
    Set NodeSel = RobApp.Project.Structure.Selections.Create(I_OT_NODE)
    
    Dim Barras As RobotObjObjectCollection
    Set Barras = RobApp.Project.Structure.Objects.GetMany(BarSel)
    Dim ListaBarras As String
    ListaBarras = ""

    Dim Barra As RobotObjObject
    Dim PontosBarras As String
    PontosBarras = ""

    Cells(18, 1) = Barras.Count
    
    Set Barra = Barras.Get(2)
    PontosBarras = Barra.Nodes
    NodeSel.FromText Barra.Nodes
    Cells(19, 1) = NodeSel.Count
    
       
'    For idx = 1 To Barras.Count
'        Set Barra = Barras.Get(idx)
'        PontosBarras = Barra.Nodes
'        NodeSel.FromText PontosBarras
'        Cells(19, 1) = NodeSel.Count

'    With ListBox1
'        .AddItem "Z= " & PontosBarras & " m"
'    End With

'    Next idx

      Set BarSel = Nothing
      Set Obj = Nothing
      RobApp.Interactive = True
      Set RobApp = Nothing

End Sub

 

Could you Help me?!

0 Likes
Message 5 of 6

Rafal.Gaweda
Autodesk Support
Autodesk Support

Barra is not ObjObject, Barras also wrong collection in your code

 

Example:

 

Private Sub CommandButton1_Click()

    Set RobApp = New RobotApplication
    
    Dim BarSel As RobotSelection
    Set BarSel = RobApp.Project.Structure.Selections.Get(I_OT_BAR)

    
    Dim Barras As RobotBarCollection
    Set Barras = RobApp.Project.Structure.Bars.GetMany(BarSel)

    Dim Barra As RobotBar
    Dim PontosBarras As String
    PontosBarras = ""

   
       
    For idx = 1 To Barras.Count
        Set Barra = Barras.Get(idx)
        PontosBarras = Str(Barra.StartNode) + " " + Str(Barra.EndNode)
     Cells(19 + idx, 1) = Barra.Number
     Cells(19 + idx, 2) = PontosBarras

    Next idx


End Sub

 



Rafal Gaweda
0 Likes
Message 6 of 6

Anonymous
Not applicable
It works great!

Thank you a lot!
0 Likes