Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 1.14 KB
#********* Return the top most group name of an object ****************************************#
#********* by Djordje Spasic ******************************************************************#
#********* 6-May-2014 **************************************************#
This small function replicates the "ObjectTopGroup" RhinoScript function, which still hasn't been implemented
into PythonScript.
Returns the top most group name that an object is assigned. This function primarily applies to objects that are
members of nested groups.
import rhinoscriptsyntax as rs
import scriptcontext as sc
def objectTopGroup(_id):
groupNames = sc.doc.Groups.GroupNames(False)
groupName = False
for i in range(rs.GroupCount()):
groupRO = sc.doc.Groups.GroupMembers(i)
for ele in groupRO:
if ele.Id == _id:
groupName = groupNames[i]
if groupName:
print groupName
print "The element you chose does not belong to any group"
id = rs.GetObject()
You can’t perform that action at this time.