Group tables store the list of groups in a Rhino document.

Properties

ComponentType

#Since v6.0
public override ModelComponentType ComponentType { get; }

Count

public virtual int Count { get; }
Returns the count of all items, including deleted ones.
inherited fromCommonComponentTable<T>

Document

public RhinoDoc Document { get; }
Document that owns this table.
inherited fromRhinoDocCommonTable<T>

Indexers

this[]

#Since v8.5
public Group this[int index] { get; }
Conceptually, the group table is an array of groups. The operator[] can be used to get individual groups. A group is either active or deleted and this state is reported by Group.IsDeleted.
index (int)zero based array index.
Reference to the group. If index is out of range, null is returned. Note that this reference may become invalid after Add() is called.

Methods

Add

#Since v5.0
public int Add()
Adds a new empty group to the group table.
Remarks: In some cases, calling Add() can cause the group indices to become invalid.
>=0 index of new group. -1 group not added because a group with that name already exists.

Add

#ExampleSince v5.0
public int Add(IEnumerable<Guid> objectIds)
Adds a new group to the group table with a set of objects.
Remarks: In some cases, calling Add() can cause the group indices to become invalid.
objectIds (IEnumerable<Guid>)An array, a list or any enumerable set of object IDs.
>=0 index of new group.

-1 group not added because a group with that name already exists.

Add

#Since v5.0
public int Add(string groupName, IEnumerable<Guid> objectIds)
Adds a new group to the group table with a set of objects.
Remarks: In some cases, calling Add() can cause the group indices to become invalid.
groupName (string)Name of new group.
objectIds (IEnumerable<Guid>)An array, a list or any enumerable set of object IDs.
>=0 index of new group.

-1 group not added because a group with that name already exists.

Add

#Since v5.0
public int Add(string groupName)
Adds a new empty group to the group table.
Remarks: In some cases, calling Add() can cause the group indices to become invalid.
groupName (string)name of new group.
>=0 index of new group. -1 group not added because a group with that name already exists.

AddToGroup

#Since v5.0
public bool AddToGroup(int groupIndex, Guid objectId)
Adds an object to an existing group.
groupIndex (int)The group index value.
objectId (Guid)An ID of an object.
true if the operation was successful.

AddToGroup

#Since v5.0
public bool AddToGroup(int groupIndex, IEnumerable<Guid> objectIds)
Adds a list of objects to an existing group.
groupIndex (int)The group index value.
objectIds (IEnumerable<Guid>)An array, a list or any enumerable set of IDs to objects.
true if at least an operation was successful.

ChangeGroupName

#
public bool ChangeGroupName(int groupIndex, string newName)
Changes the name of a group.
groupIndex (int)The index of the group.
newName (string)The new group name.
true if successful, false otherwise.

Clear

public void Clear()
Marks all items as deleted.
inherited fromCommonComponentTable<T>

Delete

#Since v6.0
public override bool Delete(Group item)
item (Group)

Delete

#Since v5.0
public bool Delete(int groupIndex)
Deletes a group from this table.

Deleted groups are kept in the runtime group table so that undo will work with groups. Call IsDeleted() to determine if a group is deleted.

groupIndex (int)An group index to be deleted.
true if the operation was successful.

Find

#Since v5.0 Obsolete v6.0
[Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public int Find(string groupName, bool ignoreDeletedGroups)
obsoleteUse the overload without the ignoreDeletedGroups input. Note that the new method might return UnsetIntIndex.
Finds a group with a given name.
groupName (string)Name of group to search for. Ignores case.
ignoreDeletedGroups (bool)This parameter is ignored. Deleted groups are never searched.
>=0 index of the group with the given name. -1 no group found with the given name.

Find

#Since v6.0
[Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public int Find(string groupName)
Finds a group with a given name.
groupName (string)Name of group to search for. Ignores case.
>=0 index of the group with the given name. UnsetIntIndex no group found with the given name.

FindId

public virtual T FindId(Guid id)
Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
inherited fromCommonComponentTable<T>
id (Guid)ID of model component to search for.
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

#Since v6.0
public Group FindIndex(int index)
Retrieves a Group object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
index (int)The index to search for.
A Group object, or null if none was found.

FindName

#Since v6.0
public Group FindName(string name)
Finds a group given its name. Returns the instance, rather than the index.
name (string)The name of the group to be searched.
An group, or null on error.

FindNameHash

#Since v6.0
public Group FindNameHash(NameHash nameHash)
Finds a group given its name hash.
nameHash (NameHash)The name hash of the group to be searched.
An group, or null on error.

GetEnumerator

public virtual IEnumerator<T> GetEnumerator()
Returns the enumerator that yields all items.
inherited fromCommonComponentTable<T>

GroupMembers

#Since v5.0
public RhinoObject[] GroupMembers(int groupIndex)
Gets an array of all of the objects in a group.
groupIndex (int)The index of the group in this table.
An array with all the objects in the specified group.

GroupName

#Since v5.0
public string GroupName(int groupIndex)
Returns the name of a group.
groupIndex (int)The index of the group.
The group name.

GroupNames

#Since v5.0
public string[] GroupNames(bool ignoreDeletedGroups)
Returns an array of all group names.
ignoreDeletedGroups (bool)Ignore any groups that were deleted.
An array if group names if successful, null if there are no groups.

GroupObjectCount

#Since v5.0
public int GroupObjectCount(int groupIndex)
Returns the number of objects that are members of a group.
groupIndex (int)The index of the group.
The number of objects that are members of the group.

Hide

#Since v5.0
public int Hide(int groupIndex)
Hides all objects that are members of a group.
groupIndex (int)The index of the group.
The number of objects that were hidden.

IsDeleted

#
public bool IsDeleted(int groupIndex)
Verifies a group is deleted.
groupIndex (int)The index of the group.
true if the group is deleted, false otherwise.

Lock

#Since v5.0
public int Lock(int groupIndex)
Locks all objects that are members of a group.
groupIndex (int)The index of the group.
The number of objects that were locked.

PurgeUnused

#Since v9.0
public int PurgeUnused()
Purges any unused groups.
The number of unused groups that were purged.

RemapObjects

#Since v8.16
public int RemapObjects(IEnumerable<RhinoObject> rhinoObjects, out Dictionary<int, int> indexMap)
Remaps an enumeration of Rhino objects to new groups.
Remarks: In some situations, a bunch of Rhino objects are copied, new groups need to be created. This method handles the details.
rhinoObjects (IEnumerable<RhinoObject>)The enumeration of Rhino objects.
indexMap (out Dictionary<int, int>)A map from old group indices to new group indices.
The number of Rhino objects that were modified.

RemapObjects

#Since v8.16
public int RemapObjects(IEnumerable<RhinoObject> rhinoObjects)
Remaps an enumeration of Rhino objects to new groups.
Remarks: In some situations, a bunch of Rhino objects are copied, new groups need to be created. This method handles the details.
rhinoObjects (IEnumerable<RhinoObject>)The enumeration of Rhino objects.
The number of Rhino objects that were modified.

Show

#Since v5.0
public int Show(int groupIndex)
Shows, or unhides, all objects that are members of a group.
groupIndex (int)The index of the group.
The number of objects that were shown.
Explicit

ICollection<Group>.Add

#
void ICollection<Group>.Add(Group item)
item (Group)

Undelete

#Since v5.0
public bool Undelete(int groupIndex)
Undeletes a previously deleted group.
groupIndex (int)The index of the group.
true if successful, false otherwise.

Unlock

#Since v5.0
public int Unlock(int groupIndex)
Unlocks all objects that are members of a group.
groupIndex (int)The index of the group.
The number of objects that were unlocked.