Class Hierarchy
AcRxObject AcGiDrawable AcDbObject AcDbGroup
C++
class AcDbGroup : public AcDbObject;
File
dbgroup.h
Description
The AcDbGroup class represents a collection of entities referred to by a single name. All AcDbGroup objects belong to a dictionary object which can be obtained through the AcDbDatabase::getGroupDictionary() method.
Unlike a block, entities within a group can be individually manipulated.
This class contains a dynamic array of object IDs that are the objects in the group.
Remarks
AcDbGroup plants persistent reactors on its entries when the entries are added to the group. To accomplish this, it must have an objectId. When the group is added to the group dictionary, it is also added to the database, and thus it obtains an objectId. Therefore, do not attempt to add entries to a newly created group before adding the group to the group dictionary.
For example, the code for creating a group should be similar to:
AcDbGroup *pGroup = new AcDbGroup; AcDbObjectId groupObjectId; AcDbDictionary *pGroupDict = NULL; acdbCurDwg()->getGroupDictionary(pGroupDict, AcDb::kForWrite); pGroupDict->setAt("GroupName", pGroup, groupObjectId); pGroupDict->close(); pGroup->append(objectId1); // objectId1 and objectId2 // are objId's of the pGroup->append(objectId2); // entities which will be in the group. pGroup->close();
In addition, AcDbGroup's pointer cannot be closed until all of its iterators have been deleted.
Links
AcDbGroup Constructor, AcDbGroup Methods
See Also
AcDbGroupIterator, AcDbEntity, AcDbObjectId