Represents an ACIS/ASM REGION entity.

Supported binary SAB faces render as triangles in shaded styles. Other geometry uses the same best-effort wireframe fallback as 3D solids.

Hierarchy

  • AcDbModelerGeometry
    • AcDbRegion

Constructors

  • Creates modeler geometry from raw ACIS data.

    Parameters

    • acisData: string

      Raw ACIS SAT text (group 1/3 lines).

    • Optionalversion: number

      DXF group 70 ACIS version number, when present.

    Returns AcDbRegion

  • Creates modeler geometry from binary SAB and/or SAT text payloads.

    Parameters

    • options: AcDb3dSolidOptions

      Construction options with optional SAB bytes and SAT text.

    Returns AcDbRegion

Properties

typeName: string = 'Region'

The entity type name.

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 dxfTypeName(): string
  • Gets the DXF entity type name written to the file.

    This value is the literal DXF record type emitted for the entity during DXF export, such as LINE, INSERT, or DIMENSION.

    Every concrete entity class must explicitly define this property so the DXF export contract stays local to the entity implementation rather than being inferred by the base class.

    Returns string

    The DXF entity type name used during export

  • 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 hasRenderableGeometry(): boolean
  • Whether mesh, wireframe or fallback point data could be extracted from the supplied SAB/SAT payload.

    Returns boolean

  • get historyObjectSoftId(): undefined | string
  • Soft-pointer handle to ACSH_HISTORY_CLASS (DXF group 350), when present. Resolved later when OBJECTS-section data is available.

    Returns undefined | string

  • set historyObjectSoftId(value: undefined | string): void
  • Parameters

    • value: undefined | string

    Returns void

  • 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 layer(): string
  • Gets the name of the layer referenced by this entity.

    Returns string

    The layer name

    const layerName = entity.layer;
    
  • set layer(value: string): void
  • Sets the name of the layer for this entity.

    Parameters

    • value: string

      The new layer name

    Returns void

    entity.layer = 'MyLayer';
    
  • get lineType(): string
  • Gets the name of the line type referenced by this entity.

    Returns string

    The linetype name

    const lineType = entity.lineType;
    
  • set lineType(value: string): void
  • Sets the name of the line type for this entity.

    Parameters

    • value: string

      The new linetype name

    Returns void

    entity.lineType = 'DASHED';
    
  • get linetypeScale(): number
  • Gets the line type scale factor of this entity.

    When an entity is first instantiated, its line type scale is initialized to an invalid value. When the entity is added to the database, if a linetype scale has not been specified for the entity, it is set to the database's current line type scale value.

    Returns number

    The linetype scale factor

    const scale = entity.linetypeScale;
    
  • set linetypeScale(value: number): void
  • Sets the line type scale factor for this entity.

    Parameters

    • value: number

      The new linetype scale factor

    Returns void

    entity.linetypeScale = 2.0;
    
  • 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';
    
  • get type(): string
  • Gets the type name of this entity.

    This method returns the entity type by removing the "AcDb" prefix from the constructor name.

    Returns string

    The entity type name

    const entity = new AcDbLine();
    console.log(entity.type); // "Line"
  • get visibility(): boolean
  • Gets whether this entity is visible.

    Returns boolean

    True if the entity is visible, false otherwise

    const isVisible = entity.visibility;
    
  • set visibility(value: boolean): void
  • Sets whether this entity is visible.

    Parameters

    • value: boolean

      True to make the entity visible, false to hide it

    Returns void

    entity.visibility = false; // Hide the entity
    

Methods

  • Adds a persistent reactor (ObjectARX AcDbObject::addPersistentReactor).

    Parameters

    • id: string

      Object id of the reactor object (e.g. an AcDbAssocDependency attached to this object).

    Returns void

  • Paints traits with a color taken from a style (DIMCLRD, MLEADER style colors) instead of this entity's own color.

    worldDraw records on the traits whether the entity color was ByLayer. A substituted color carries its own provenance: leaving the entity's flag in place makes renderers treat an explicit style color as layer-bound and repaint it with the layer color.

    Parameters

    • traits: AcGiSubEntityTraits

      Renderer traits to update.

    • color: AcCmColor

      Color to draw with.

    • isByLayer: boolean = color.isByLayer

      Whether color follows the layer. Defaults to color.isByLayer; pass true for a layer color already resolved to a concrete value.

    Returns () => void

    A callback restoring the previous color and provenance.

  • Creates a deep clone of this object.

    The cloned object is a detached in-memory object:

    • It has a new temporary objectId
    • It is not attached to any database instance

    Returns this

  • 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

  • Consumes a DXF group-102 control-string block that was already opened (the opening 102 value is startValue, typically {ACAD_XDICTIONARY or {ACAD_REACTORS).

    For {ACAD_XDICTIONARY, the first soft-owner handle (360) is stored as extensionDictionary. Other control strings are skipped until the matching closing 102 / }.

    Parameters

    Returns void

  • Writes this object to the DXF output.

    Parameters

    • ...args: unknown[]

    Returns unknown

    The instance (for chaining).

  • Writes the 102 {ACAD_REACTORS group. AutoCAD puts it before the extension dictionary group. Only reactors that are OBJECTS-section records of the current export are written, so no handle dangles.

    Parameters

    Returns void

  • Erase the current entity from the associated database.

    Returns boolean

    — true if an entity in the database existed and has been removed, or false if the entity does not exist.

  • Breaks this entity into a set of simpler entities, mirroring ObjectARX AcDbEntity::explode().

    The returned entities are new, non-database-resident objects expressed in WCS. This entity is not modified: as in ObjectARX, it is up to the caller (for example the EXPLODE command) to append the returned entities to a block table record and to erase the original entity.

    An empty array means the entity cannot be exploded (ObjectARX returns Acad::eNotApplicable in that case), e.g. lines, arcs, circles, single line text, MINSERT block references or blocks whose definition disallows exploding.

    This method is non-virtual: subclasses customize the behavior by overriding subExplode.

    Returns AcDbEntity[]

    The entities this entity breaks into, or an empty array when it cannot be exploded.

    const parts = polyline.explode()
    if (parts.length > 0) {
    db.tables.blockTable.modelSpace.appendEntity(parts)
    polyline.erase()
    }
  • 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 the stored entity color, initializing it from CECOLOR if needed.

    Entities marked by applyDxfFileDefaults are materialized as the ByLayer default instead of the CECOLOR seed, which is exactly what the eager allocation used to store for them.

    Returns AcCmColor

  • Creates the "General" property group for this entity.

    This group contains common metadata attributes shared by all CAD entities (e.g., handle, layer). Each property includes a runtime AcDbPropertyAccessor allowing the property inspector to read and update live values.

    Subclasses may override this method to append additional general-purpose properties while still preserving this base set.

    Returns AcDbEntityPropertyGroup

    A fully resolved property group containing runtime-accessible properties.

  • 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[]

  • Gets the color of the layer this entity belongs to.

    This method retrieves the color from the layer table for the layer this entity belongs to.

    Returns null | AcCmColor

    The layer color, or undefined if the layer doesn't exist

    const layerColor = entity.getLayerColor();
    
  • Returns the persistent reactor ids attached to this object (ObjectARX AcDbObject::getPersistentReactors).

    Returns readonly string[]

  • Returns a new entity that is a clone of this entity transformed by matrix, mirroring ObjectARX AcDbEntity::getTransformedCopy().

    The default implementation clones this entity and calls transformBy on the clone. Subclasses that need database-context during the transform (for example TEXT/MIRRTEXT) may override this.

    Parameters

    • matrix: AcGeMatrix3d

      Transformation matrix to apply to the copy.

    Returns AcDbEntity

    A non-database-resident transformed copy.

  • 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
    }
  • Returns whether transparency has been explicitly assigned on this entity.

    Returns boolean

  • Finds intersection points between this entity and another entity.

    This method mirrors ObjectARX AcDbEntity::intersectWith. Intersection points are returned in WCS. The optional projPlane argument corresponds to the ObjectARX overload that intersects the projections of both entities onto a plane (apparent intersection). gsMarker subentity filtering is not implemented.

    Subclasses should override subGetIntersectCurves instead of this method.

    Parameters

    • entity: AcDbEntity

      The other entity

    • intType: AcDbIntersect = AcDbIntersect.OnBothOperands

      Whether to extend this entity, the other entity, both, or neither

    • OptionalprojPlane: AcGePlane

      Optional projection plane for apparent intersection

    Returns AcGePoint3d[]

    Intersection points in WCS; empty when the entities do not intersect

  • 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
    }
  • Joins others into a new entity with this as the primary, mirroring ObjectARX AcDbEntity::joinEntities().

    Same contract as joinEntity: returns a new entity and does not mutate or erase inputs. Subclasses that support batch rules (gapped collinear lines, concentric arcs, polyline chains) override subJoinEntities.

    Parameters

    • others: readonly AcDbEntity[]

      Secondary entities to join with this primary.

    Returns undefined | AcDbEntity

    The joined entity, or undefined when join is not applicable.

  • Joins other into a new entity with this as the primary, mirroring ObjectARX AcDbEntity::joinEntity().

    The returned entity is a new, non-database-resident object. This entity and other are not modified: the caller (for example the JOIN command) must append the result and erase the sources.

    Returns undefined when the two entities cannot be joined (ObjectARX Acad::eNotApplicable), e.g. closed curves, non-collinear lines, or unsupported types.

    This method is non-virtual: subclasses customize behavior by overriding subJoinEntity.

    Parameters

    • other: AcDbEntity

      Secondary entity to join with this primary.

    Returns undefined | AcDbEntity

    The joined entity, or undefined when join is not applicable.

  • Notifies subclasses that XData for appId changed.

    Parameters

    • appId: string

      The AppId whose XData was written, replaced or removed.

    Returns void

  • Called when this object is re-associated with a different database.

    Subclasses that cache database-derived state (for example a dimension style resolved from the style table) override this to drop that cache.

    Parameters

    • _db: AcDbDatabase

      The database that this object now belongs to.

    Returns void

  • 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

  • Removes a persistent reactor (ObjectARX AcDbObject::removePersistentReactor).

    Parameters

    • id: string

    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')
    
  • Resolves the effective properties of this entity.

    This method determines the final, usable values for entity properties such as layer, linetype, lineweight, color, and other display-related attributes. If a property is not explicitly set on the entity (for example, it is undefined or specified as ByLayer / ByBlock), the value is resolved according to the current AutoCAD system variables and drawing context.

    Typical system variables involved in the resolution process include, but are not limited to:

    • CLAYER – Current layer
    • CELTYPE – Current linetype
    • CELWEIGHT – Current lineweight
    • CECOLOR – Current color

    The resolution follows AutoCAD semantics:

    • Explicitly assigned entity properties take precedence
    • ByLayer properties are inherited from the entity’s layer
    • ByBlock properties are inherited from the owning block reference
    • If no explicit value can be determined, the corresponding system variable or default drawing value is used

    This method does not change user-defined property settings; it only computes and applies the final effective values used for display, selection, and downstream processing.

    Returns void

  • Replaces the SAT/ACIS payload and rebuilds wireframe / point caches. Used by DXF import after constructing an empty entity.

    Parameters

    • satText: string
    • Optionalversion: number

    Returns void

  • Sets the value of an attribute.

    Type Parameters

    • A extends string

    Parameters

    • attrName: A

      The name of the attribute to set

    • Optionalval: AcDbObjectAttrs[A]

      The value to assign to the attribute

    Returns void

    obj.setAttr('objectId', 'new-id-123');
    
  • 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

  • Copies the general entity properties of source to this entity, mirroring ObjectARX AcDbEntity::setPropertiesFrom().

    The copied properties are layer, color, linetype, linetype scale, lineweight, transparency and visibility. Unset (lazily resolved) values stay unset so that database defaults still apply when this entity is appended to a database.

    Parameters

    • source: AcDbEntity

      Entity whose properties are copied.

    Returns this

    This entity.

  • Attaches binary SAB/ASM bytes (typically from ACDSDATA) and rebuilds wireframe / point caches. Preferred over SAT text when both are present.

    Parameters

    • sabBytes: undefined | Uint8Array

      Raw ASM_Data payload for this entity.

    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)
  • Returns whether unresolved entity color should be initialized from CECOLOR. ByLayer-default entities (from DXF without color group) must NOT be seeded with CECOLOR — they should stay as ByLayer.

    Returns boolean

  • Explodes this entity. Called by explode; mirrors ObjectARX AcDbEntity::subExplode().

    Overrides must return new, non-database-resident entities in WCS and must not modify this entity. The default implementation returns undefined, meaning the entity cannot be exploded.

    Returns undefined | AcDbEntity[]

    The exploded entities, or undefined / an empty array when this entity cannot be exploded.

  • Gets the grip points for this entity.

    Grip points are the control points that can be used to modify the entity. This method should be overridden by subclasses to provide entity-specific grip points.

    Returns AcGePoint3d[]

    Array of grip points as 3D points

    const gripPoints = entity.subGetGripPoints();
    
  • Gets the object snap points for this entity.

    Object snap points are the points that can be used for precise positioning when drawing or editing. This method should be overridden by subclasses to provide entity-specific snap points.

    Parameters

    • osnapMode: AcDbOsnapMode

      The object snap mode

    • pickPoint: AcGePoint3dLike

      The pick point

    • lastPoint: AcGePoint3dLike

      The last point

    • snapPoints: AcGePoint3dLike[]

      Array to populate with snap points

    • OptionalgsMark: any

      The object id of subentity. For now, it is used by INSERT entity only. In AutoCAD, it uses AcGiSubEntityTraits::setSelectionMarkerInput to set GS marker of the subentity involved in the object snap operation. For now, we don't provide such a GS marker mechanism yet. So passed id of subentity as GS marker. Maybe this behavior will change in the future.

    • OptionalinsertionMat: AcGeMatrix3d

      Cumulative insertion transform matrix from nested block references. This parameter is primarily used by INSERT entities.

    Returns void

    const snapPoints: AcGePoint3d[] = [];
    entity.subGetOsnapPoints(AcDbOsnapMode.Endpoint, 0, pickPoint, lastPoint, snapPoints);
  • Moves the grip points at the specified indices by the given offset.

    This method should be overridden by subclasses to provide entity-specific grip editing behavior, matching AutoCAD AcDbEntity::subMoveGripPointsAt.

    Parameters

    Returns this

    This entity after the grip edit

    entity.subMoveGripPointsAt([0], new AcGeVector3d(1, 0, 0));
    
  • Moves the stretch points at the specified indices by the given offset.

    Matches AutoCAD AcDbEntity::subMoveStretchPointsAt. The default translates the whole entity via transformBy, ignoring which indices were selected. Entities that support local stretch must override this to move only the selected points.

    Parameters

    Returns AcDbRegion

    This entity after the stretch

  • Called by cad application when it wants the entity to draw itself in WCS (World Coordinate System) and acts as a wrapper / dispatcher around subWorldDraw(). The children class should never overidde this method.

    It executes the following logic:

    • Skips drawing when the entity's layer is not drawable under the database AcDbDatabase.drawNoPlotLayers policy
    • Handles traits (color, linetype, lineweight, transparency, etc.)
    • Sets AcGiRenderer.context database for draw-time database lookups
    • Calls subWorldDraw() to do the actual geometry output

    Parameters

    • renderer: AcGiRenderer<AcGiEntity>

      The renderer to use for drawing

    • Optionaldelay: boolean

      The flag to delay creating one rendered entity and just create one dummy entity. Renderer can delay heavy calculation operation to avoid blocking UI when this flag is true. For now, text and mtext entity supports this flag only. Other types of entities just ignore this flag.

    Returns undefined | AcGiEntity

    The rendered entity, or undefined if drawing failed

  • Names of the applications (APPID records) this object carries XData for, in output order.

    Returns string[]