(API) Get groups through API

(API) Get groups through API

shulwh
Enthusiast Enthusiast
879 Views
2 Replies
Message 1 of 3

(API) Get groups through API

shulwh
Enthusiast
Enthusiast

Hi everyone

I set some member groups in RSA manually.  

And then, I want to get one of these groups through the following API, but it needs the index of the group. How should get the index?

shulwh_2-1659253888246.png

 

shulwh_0-1659253856796.png

 

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

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

hi @shulwh

Sub ListGroupBars()
  Dim RobApp As IRobotApplication, RGroups As RobotGroupServer
  Set RobApp = New RobotApplication
  Set RGroups = RobApp.Project.Structure.Groups
  
  Dim Group As RobotGroup, GroupCnt As Integer, ObjTyp As IRobotObjectType
  ObjTyp = IRobotObjectType.I_OT_BAR
  GroupCnt = RGroups.GetCount(ObjTyp)
  If GroupCnt <> 0 Then
    For j = 1 To GroupCnt
      Set Group = RGroups.Get(ObjTyp, j)
      Debug.Print j, Group.Name, Group.SelList, Group.Color
    Next j
  End If
  Set RobApp = Nothing
End Sub

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to click the Accept Solution button and leave a < like !
EESignature
0 Likes
Message 3 of 3

shulwh
Enthusiast
Enthusiast
Thank you for your quick reply, it's quite convenient!
0 Likes