Group members order


Hello again,

i need to have the last added item of a group. Therefore i tried to analyze the way Rhino adds objects to groups and added some points to a group. Then i added some text in the order group_table.GroupMembers(index) returns the group members.

object = rs.GetObject()
groups = rs.ObjectGroups(object)
group_table = rc.RhinoDoc.ActiveDoc.Groups
group_index = group_table.Find(groups[0], True)
group_members = group_table.GroupMembers(group_index)
count = 0
for group_member in group_members:
    count = count + 1

The last item had the index 0. The order was kept but reversed.
I then saved the File and reopened it. Now index 0 was the first item - the order was reversed again.
I am struggling to get my problem solved and would be very glad if someone could help.
Thanks in advance!


(Steve Baer) #2

The order of objects in the Rhino document reverses when the file is saved and reread. I would recommend using the Id of the object if you need to track it between sessions of Rhino.


Thanks for your fast answer. If I can rely on the reversed order while the document is open - more precisely while the script is running - i can work with this. Or are there any other things, that could change the order while the document is open or while a script is running?

(Steve Baer) #4

Sure, if other objects are added to or removed from the group.