API open table with specific cases and nodes filter

API open table with specific cases and nodes filter

WALIDGIO
Advocate Advocate
296 Views
2 Replies
Message 1 of 3

API open table with specific cases and nodes filter

WALIDGIO
Advocate
Advocate

hello 
I'm tryin to make VBA excel that 
open the displacement table
filter the desired node (ex : 2329 2330 2331 2332 2333 2334)
filter also the cases by name groupe (ex : Raideur)

WALIDGIO_0-1737194324471.png

 


untill now i cant find the methode to apply the filter to Robot 

code :

Sub OpenNodeDisplacementsTableWithSelection()
    ' Initialize Robot Application
    Dim robApp As IRobotApplication
    On Error Resume Next
    Set robApp = New RobotApplication
    On Error GoTo 0
    ' Open the Node Displacements Table
    Dim table As IRobotTable
    Set table = robApp.Project.ViewMngr.CreateTable(IRobotTableType.I_TT_NODE_DISPLACEMENTS, I_TDT_DEFAULT)

    ' Convert node collection to a comma-separated string
    Dim nodeNumbersStr As String
    nodeNumbersStr = "2329,2330,2331,2332,2333,2334" ' Node numbers to select

    ' Select the specified nodes
    Dim nodeSelection As IRobotSelection
    Set nodeSelection = robApp.Project.Structure.Selections.Create(I_OT_NODE)
    nodeSelection.FromText nodeNumbersStr ' here where i want to Apply the selection

    ' Filter cases by group
    Dim caseGroup As IRobotGroup
    Dim groupServer As IRobotGroupServer
    Set groupServer = robApp.Project.Structure.Groups

    ' Get the number of groups for cases
    Dim groupCount As Integer
    groupCount = groupServer.GetCount(I_OT_CASE)

    ' Iterate through all groups to find the one with the matching name
    Dim i As Integer
    For i = 1 To groupCount
        Dim currentGroup As IRobotGroup
        Set currentGroup = groupServer.Get(I_OT_CASE, i)
        If currentGroup.Name = "Raideur" Then
            Set caseGroup = currentGroup
            Exit For
        End If
    Next i

    ' Check if the group was found
    If caseGroup Is Nothing Then
        MsgBox "Case group 'Raideur' not found.", vbExclamation, "Error"
        Exit Sub
    End If

    ' Set the cases for the table based on the group
    Dim caseList As IRobotCaseList
    Set caseList = robApp.Project.Structure.Cases.GetAll()
    Dim caseSelection As IRobotSelection
    Set caseSelection = robApp.Project.Structure.Selections.Create(I_OT_CASE)
    caseSelection.FromText caseGroup.GetCases().ToText() ' here my problem Apply the selection


    ' Refresh the view manager to update the display
    robApp.Project.ViewMngr.Refresh
End Sub



0 Likes
Accepted solutions (1)
297 Views
2 Replies
Replies (2)
Message 2 of 3

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @WALIDGIO 

https://forums.autodesk.com/t5/robot-structural-analysis-forum/get-specific-nodes-and-case-data-in-t...

https://forums.autodesk.com/t5/robot-structural-analysis-forum/select-simple-cases-when-printing-tab...

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 3 of 3

WALIDGIO
Advocate
Advocate

thank you @Stephane.kapetanovic