Nongraphical GROUP object (DXF GROUP / ObjectARX AcDbGroup).

A group is an ordered, named persistent selection set of database entities. It does not own its members. The group name is the key in the ACAD_GROUP dictionary; DXF group code 300 stores the description.

ObjectARX requires the group to be added to the group dictionary (so it has an object id) before members are appended.

Hierarchy (View Summary)

Constructors

Accessors

  • get database(): AcDbDatabase
  • Gets the database in which this object is resident.

    When an object isn't added to a database, this property returns the current working database. After it is added to a database, it will be set automatically. You should never set this value manually.

    Returns AcDbDatabase

    The database this object belongs to

    const db = obj.database;
    
  • set database(db: AcDbDatabase): void
  • Sets the database for this object.

    This is typically set automatically when the object is added to a database. Manual setting should be avoided unless you know what you're doing.

    Parameters

    Returns void

    obj.database = myDatabase;
    
  • get extensionDictionary(): undefined | string
  • Gets the objectId of the extension dictionary owned by this object.

    If the object does not have an extension dictionary, this returns undefined.

    In ObjectARX terms, this is equivalent to AcDbObject::extensionDictionary().

    Returns undefined | string

    The extension dictionary objectId, or undefined

    const dictId = obj.extensionDictionary
    if (dictId) {
    console.log('Has extension dictionary:', dictId)
    }
  • set extensionDictionary(value: undefined | string): void
  • Sets the objectId of the extension dictionary owned by this object.

    This does not create or delete the dictionary object itself ??it only establishes or clears the ownership relationship.

    Passing undefined removes the association.

    Parameters

    • value: undefined | string

      The extension dictionary objectId, or undefined

    Returns void

    obj.extensionDictionary = dict.objectId
    
  • get isTemp(): any
  • Returns true if this object is temporary and not yet committed to the database.

    A temporary object is identified by its objectId starting with the TEMP prefix.

    Returns any

  • get objectId(): string
  • Gets the object ID.

    AutoCAD uses 64-bit integers to represent handles, which exceed the maximum integer value of JavaScript. Therefore, strings are used to represent object handles.

    Returns string

    The object ID as a string

    const id = obj.objectId;
    console.log(`Object ID: ${id}`);
  • set objectId(value: string): void
  • Sets the object ID.

    Parameters

    • value: string

      The new object ID

    Returns void

    obj.objectId = 'new-object-id';
    
  • get ownerId(): string
  • Gets the object ID of the owner of this object.

    Returns string

    The owner object ID

    const ownerId = obj.ownerId;
    
  • set ownerId(value: string): void
  • Sets the object ID of the owner of this object.

    Parameters

    • value: string

      The new owner object ID

    Returns void

    obj.ownerId = 'parent-object-id';
    

Methods

  • Copies all member object ids into out (when provided) and returns the member count.

    Mirrors ObjectARX AcDbGroup::allEntityIds.

    Parameters

    • Optionalout: string[]

      Optional array cleared and filled with member ids.

    Returns number

    The number of member ids.

  • Appends one or more member ids to the end of the group.

    Duplicate ids already in the group are ignored. Mirrors ObjectARX AcDbGroup::append.

    Parameters

    • idOrIds: string | readonly string[]

      A single object id or an array of object ids.

    Returns void

  • Closes the object.

    All changes made to the object since it was opened are committed to the database, and a "closed" notification is sent. This method can be overridden by subclasses to provide specific cleanup behavior.

    Returns void

    obj.close();
    
  • Creates the extension dictionary for this object if it does not already exist.

    This method closely mirrors the behavior of AcDbObject::createExtensionDictionary() in ObjectARX.

    • If the object already owns an extension dictionary, no new dictionary is created and the existing dictionary's objectId is returned.
    • Otherwise, a new AcDbDictionary is created, added to the same database, owned by this object, and its objectId is stored on this object.

    Returns undefined | string

    The objectId of the extension dictionary

    const dictId = obj.createExtensionDictionary()
    
  • Clones this object for AcDbDatabase.deepCloneObjects.

    Mirrors AcDbObject::deepClone() in ObjectARX. The returned object is a detached copy with a temporary id; the caller appends it to its owner, which assigns the real handle. The pair this.objectId -> clone.objectId is recorded in idMap, and is updated by the clone engine once the clone has a committed handle.

    The clone does not share this object's extension dictionary: AutoCAD would clone it too, but extension dictionaries are not cloned yet, so the clone simply drops it instead of pointing into the source database.

    Subclasses that own other objects override this to clone them as well.

    Parameters

    • ownerObject: undefined | AcDbObject<AcDbObjectAttrs>

      The object that will own the clone, if known.

    • idMap: AcDbIdMapping

      Id mapping of the current clone operation.

    • isPrimary: boolean = true

      True when this object was explicitly asked to be cloned.

    Returns AcDbObject<AcDbObjectAttrs>

    The detached clone.

  • Reads this object from a DXF filer (ObjectARX dxfIn).

    Reads common handle/owner fields, then delegates to dxfInFields. XData (group 1001+) is consumed when present after object fields.

    Group-102 control strings ({ACAD_XDICTIONARY, {ACAD_REACTORS, …) are consumed here so subclass readers still see handle/owner/subclass markers that follow them. Many real DXF writers emit these blocks on LAYER and entity records; skipping them would leave name/layer unset.

    Parameters

    Returns this

  • Gets the value of the specified attribute.

    This method will throw an exception if the specified attribute doesn't exist. Use getAttrWithoutException() if you want to handle missing attributes gracefully.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute

    When the specified attribute doesn't exist

    try {
    const value = obj.getAttr('objectId');
    } catch (error) {
    console.error('Attribute not found');
    }
  • Gets the value of the specified attribute without throwing an exception.

    This method returns undefined if the specified attribute doesn't exist, making it safer for optional attributes.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute, or undefined if it doesn't exist

    const value = obj.getAttrWithoutException('optionalAttribute');
    if (value !== undefined) {
    // Use the value
    }
  • Returns ids of objects hard-owned by this object through a pointer other than a dictionary entry or the extension dictionary (DXF group 360), e.g. the action body and dependencies of an AcDbAssocAction.

    DXF export follows these ids so owned objects are written with their owner. Defaults to none.

    Returns string[]

  • Returns the zero-based index of a member id, or -1 when not found.

    Mirrors ObjectARX AcDbGroup::getIndex.

    Parameters

    • id: string

      Member object id to look up.

    Returns number

    Index in the group, or -1.

  • Retrieves the XData associated with this object for a given application ID.

    Extended Entity Data (XData) allows applications to attach arbitrary, application-specific data to an AcDbObject. Each XData entry is identified by a registered application name (AppId) and stored as an AcDbResultBuffer.

    This method is conceptually equivalent to AcDbObject::xData() in ObjectARX, but simplified to return the entire result buffer for the specified AppId.

    Parameters

    • appId: string

      The application ID (registered AppId name) that owns the XData

    Returns undefined | AcDbResultBuffer

    The AcDbResultBuffer associated with the AppId, or undefined if no XData exists for that AppId

    Imported XData stays compact until the first call for that AppId. The call materializes an AcDbResultBuffer and keeps it, so later reads and in-place edits use that buffer. DXF output order does not change. Avoid calling this while importing when the compact form should be retained.

    const xdata = obj.getXData('MY_APP')
    if (xdata) {
    // Read values from the result buffer
    }
  • Inserts one or more member ids at the given index.

    Duplicate ids already in the group are ignored. Mirrors ObjectARX AcDbGroup::insertAt.

    Parameters

    • index: number

      Zero-based insertion index (clamped to [0, length]).

    • idOrIds: string | readonly string[]

      A single object id or an array of object ids.

    Returns void

  • Returns whether the group is not accessible.

    Mirrors ObjectARX AcDbGroup::isNotAccessible. This port always returns false (inaccessible/proxy groups are not modeled).

    Returns boolean

    Always false.

  • Iterates the XData of one application without materializing it.

    Behaves like getXData for readers, but never converts the compact imported form into an AcDbResultBuffer. Use this on hot paths that only read XData (for example drawing dimension-style overrides), so a drawing keeps its lossless compact representation and pays no per-entity allocation. Use getXData when the returned values may be edited.

    Parameters

    • appId: string

      The application ID (registered AppId name) that owns the XData

    Returns IterableIterator<AcDbTypedValue<unknown>>

    The typed values of that AppId, or an empty iterable when absent

    for (const item of obj.iterateXData('ACAD')) {
    // inspect item.code / item.value
    }
  • Called whenever XData for an AppId changes.

    Subclasses that cache values derived from XData (for example the effective dimension style assembled from ACAD/DSTYLE) override this to drop the stale cache instead of re-parsing the stream on every read.

    Parameters

    • _appId: string

    Returns void

  • Prepends one or more member ids to the start of the group.

    Duplicate ids already in the group are ignored. Mirrors ObjectARX AcDbGroup::prepend.

    Parameters

    • idOrIds: string | readonly string[]

      A single object id or an array of object ids.

    Returns void

  • Removes one or more members by object id.

    Mirrors ObjectARX AcDbGroup::remove.

    Parameters

    • idOrIds: string | readonly string[]

      A single object id or an array of object ids to remove.

    Returns void

  • Removes a member at index, or removes the given ids starting from that index when ids is provided.

    Mirrors ObjectARX AcDbGroup::removeAt.

    Parameters

    • index: number

      Zero-based index of the first member to consider.

    • Optionalids: readonly string[]

      Optional subset of ids to remove from index onward.

    Returns void

  • Removes the XData associated with the specified application ID.

    After removal, calls to getXData() for the same AppId will return undefined. If no XData exists for the given AppId, this method has no effect.

    This mirrors the behavior of clearing XData for a specific application in ObjectARX rather than removing all XData from the object.

    Parameters

    • appId: string

      The application ID whose XData should be removed

    Returns void

    obj.removeXData('MY_APP')
    
  • Replaces one member id with another.

    If newId is already in the group, oldId is simply removed. Mirrors ObjectARX AcDbGroup::replace.

    Parameters

    • oldId: string

      Existing member object id.

    • newId: string

      Replacement object id.

    Returns void

  • Sets the ACI color of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setColorIndex.

    Parameters

    • index: number

      AutoCAD Color Index (0–256).

    Returns void

  • Sets the highlight state of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setHighlight. Currently a no-op because this model has no per-entity highlight persistence.

    Parameters

    • _highlight: boolean

      Desired highlight state.

    Returns void

  • Lossless parser/import fast path.

    Each 1001 group starts an AppId. That AppId stays in the compact list until getXData, setXData, or removeXData touches it. Replacing an AppId keeps its DXF position; a new AppId is appended.

    getXData materializes that AppId into an AcDbResultBuffer and keeps the buffer afterwards, so later reads observe in-place edits. Calling it during import gives up the compact representation for that AppId.

    Parameters

    • values: Iterable<{ code: number; value: string | number }>

    Returns void

  • Sets the layer of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setLayer. When layerOrId is an object id of a layer table record, the record's name is used.

    Parameters

    • layerOrId: string

      Layer name or layer-table-record object id.

    Returns void

  • Sets the linetype of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setLinetype. When linetypeOrId is an object id of a linetype table record, the record's name is used.

    Parameters

    • linetypeOrId: string

      Linetype name or linetype-table-record object id.

    Returns void

  • Sets the linetype scale of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setLinetypeScale.

    Parameters

    • scale: number

      Linetype scale factor.

    Returns void

  • Sets the material of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setMaterial. Currently a no-op because entities keep material as a raw DXF extra without a typed setter.

    Parameters

    • _materialOrId: string

      Material name or material object id.

    Returns void

  • Sets the group name and, when database-bound, renames its ACAD_GROUP dictionary entry to match.

    Mirrors ObjectARX AcDbGroup::setName.

    Parameters

    • name: string

      The new group name.

    Returns void

  • Sets the visibility of every resolvable member entity.

    Mirrors ObjectARX AcDbGroup::setVisibility.

    Parameters

    • visible: boolean

      true to show members; false to hide them.

    Returns void

  • Attaches or replaces XData for this object.

    If XData already exists for the given AppId, it is replaced by the provided AcDbResultBuffer. The caller is responsible for ensuring that:

    • The AppId is registered in the database's AppId table
    • The result buffer follows valid DXF/XData conventions (e.g. starts with a 1001 group code for the AppId)

    This method is conceptually similar to AcDbObject::setXData() in ObjectARX.

    Parameters

    Returns void

    const rb = new AcDbResultBuffer([
    { code: AcDbDxfCode.ExtendedDataRegAppName, value: 'MY_APP' },
    { code: AcDbDxfCode.ExtendedDataAsciiString, value: 'custom value' }
    ])

    obj.setXData('MY_APP', rb)
  • Moves num members starting at fromIndex so they begin at toIndex.

    Mirrors ObjectARX AcDbGroup::transfer.

    Parameters

    • fromIndex: number

      Start index of the block to move.

    • toIndex: number

      Destination index for the block.

    • num: number

      Number of members to move.

    Returns void

  • Rewrites references held by a freshly cloned object so that they point at the destination database.

    This is the "translation" phase of an ObjectARX deep clone. It is called on the clone (not on the source) after every dependency and every entity of the operation has been cloned, so idMap holds the final names and ids, including those of other cloned entities. References to entities that were not cloned along (the annotation of a leader, ...) should be dropped, as AutoCAD does. Overrides should call super.

    Parameters

    Returns void