I am Looking for a possibility to get the objects from inside a Group. Is there a specific method in rhinocommon or in rhinoscriptsyntax that does that ?.
Thanks !. You owe me a favor. I was looking for it since two hours.
But What is the GroupTable ? I have recieved this error regarding the group name input that I have used.
Message: df does not exist in GroupTable
“df” is the name of the group that I have added to the method to get its objects.
Does “df” actually exist as a group?
Yes, it is the groups name
Groups = rs.GetObjects(“SelectBlockObjects”)
Name = rs.ObjectName(Groups, None)
pl = rs.ObjectsByGroup(Name, select=False)
Can you post a file containing the group and the code you used?
(note blocks and groups are not the same thing)
It could be that it considers the name I am using as an object name and not as a group name. I have assumed that also but then what is the solution ?
Yes, that is the problem. You only have one group in the file and it has been named automatically by Rhino as “Group31”. The names of the objects in that group are “dd”. Object names are independent of group names.
At the time of group creation, you have the option to give the group a name. If you do not, it gets a the default name “GroupXX” where "XX is a number (sequentially starting from 01).
To change an existing group’s name, use the Rhino command _SetGroupName and type the new name.
Okay, good to know. I have also looked for a method to get the Groupname but I havent found it so I thought this might work. Now I think I could use this object name to rename the group and afterwards use the new name to get the objects. It soesnt seem smart to me but the class group doesnt have a method to get the name looks like.
This is the solution:
I have found a method to get the names of all the groups
import rhinoscriptsyntax as rs
import Rhino as rh
groupsNames = rs.GroupNames()
for Name in groupsNames:
getObject = rs.ObjectsByGroup(Name, select=False)