Gets the attributes object for this AcDbObject.
The AcCmObject instance containing all attributes
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.
The database this object belongs to
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.
The database to associate with this object
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.
The DXF entity type name used during export
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().
The extension dictionary objectId, or undefined
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.
The extension dictionary objectId, or undefined
Gets whether this shape is planar.
Mirrors AcDbShape::isPlanar() in ObjectARX.
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.
Gets the name of the layer referenced by this entity.
The layer name
Sets the name of the layer for this entity.
The new layer name
Gets the line style for this entity.
This method returns the line style based on the entity's linetype and other properties.
The line style object
Gets the name of the line type referenced by this entity.
The linetype name
Sets the name of the line type for this entity.
The new linetype name
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.
The linetype scale factor
Sets the line type scale factor for this entity.
The new linetype scale factor
Gets the line weight used by this entity.
The line weight value
Sets the line weight for this entity.
The new line weight value
Gets the name of the shape within the associated SHX font.
Mirrors AcDbShape::name() in ObjectARX.
Sets the name of the shape within the associated SHX font.
Gets the normal vector of the plane containing this shape.
Mirrors AcDbShape::normal() in ObjectARX.
Sets the normal vector of the plane containing this shape.
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.
The object ID as a string
Sets the object ID.
The new object ID
Gets the oblique angle of this shape in radians.
Mirrors AcDbShape::oblique() in ObjectARX.
Sets the oblique angle of this shape in radians.
Gets the object ID of the owner of this object.
The owner object ID
Sets the object ID of the owner of this object.
The new owner object ID
Gets the insertion point of this shape in WCS coordinates.
Mirrors AcDbShape::position() in ObjectARX.
Sets the insertion point of this shape in WCS coordinates.
Returns the full property definition for this entity, including all property groups and runtime accessors.
This getter is used by the property inspector UI to:
The returned structure contains:
Note: The groups array contains AcDbEntityPropertyGroup objects whose
properties entries are runtime-resolved property descriptors that include
AcDbPropertyAccessor objects. Each property object therefore
conforms to AcDbEntityRuntimeProperty.
Gets the rotation angle of this shape in radians.
The angle is relative to the X axis of the shape OCS, with positive angles going counterclockwise when looking down the Z axis toward the origin.
Mirrors AcDbShape::rotation() in ObjectARX.
Sets the rotation angle of this shape in radians.
Gets the numeric shape code within the SHX font.
Mirrors AcDbShape::shapeNumber() in ObjectARX.
Sets the numeric shape code within the SHX font.
Gets the height of this shape.
Mirrors AcDbShape::size() in ObjectARX.
Sets the height of this shape.
Gets the object ID of the text style table record that references this shape's SHX font.
Mirrors AcDbShape::styleId() in ObjectARX.
Sets the text style table record by object ID.
Mirrors AcDbShape::setStyleId() in ObjectARX.
Gets the text style name associated with this shape.
Used when reading or writing DXF group code 3 (shape file/style name).
Sets the text style name associated with this shape.
Gets the thickness of this shape along normal.
Mirrors AcDbShape::thickness() in ObjectARX.
Sets the thickness of this shape.
Gets the transparency level of this entity.
The transparency value.
Sets the transparency level of this entity.
The transparency value.
Gets the type name of this entity.
This method returns the entity type by removing the "AcDb" prefix from the constructor name.
The entity type name
Gets whether this entity is visible.
True if the entity is visible, false otherwise
Sets whether this entity is visible.
True to make the entity visible, false to hide it
Gets the width factor applied to this shape.
Mirrors AcDbShape::widthFactor() in ObjectARX.
Sets the width factor applied to this shape.
ProtectedassignAssociates this object with a database. Subclasses may override database
and call this helper to avoid super setter restrictions.
Creates the extension dictionary for this object if it does not already exist.
This method closely mirrors the behavior of
AcDbObject::createExtensionDictionary() in ObjectARX.
The objectId of the extension dictionary
Writes DXF fields for this object.
DXF output writer.
The instance (for chaining).
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.
The name of the attribute to retrieve
The value of the specified attribute
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.
The name of the attribute to retrieve
The value of the specified attribute, or undefined if it doesn't exist
ProtectedgetProtectedgetCreates 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.
A fully resolved property group containing runtime-accessible properties.
ProtectedgetProtectedgetGets the text style that references the SHX font for this shape.
When styleName is empty, returns undefined so renderers search
shape-file definition entries in the STYLE table instead of falling back to
$TEXTSTYLE (which is for TEXT/MTEXT, not SHAPE entities).
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.
The application ID (registered AppId name) that owns the XData
The AcDbResultBuffer associated with the AppId, or undefined
if no XData exists for that AppId
ProtectedhasProtectedhasProtectedhasRemoves 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.
The application ID whose XData should be removed
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 layerCELTYPE – Current linetypeCELWEIGHT – Current lineweightCECOLOR – Current colorThe resolution follows AutoCAD semantics:
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.
ProtectedresolveSets the value of an attribute.
The name of the attribute to set
Optionalval: AcDbObjectAttrs[A]The value to assign to the attribute
ProtectedsetAttaches 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:
This method is conceptually similar to AcDbObject::setXData() in ObjectARX.
The result buffer containing the XData to attach
ProtectedshouldGets 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.
Array of grip points as 3D points
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.
The object snap mode
Array to populate with snap points
Draws this entity using the specified renderer.
This method should be implemented by subclasses to provide entity-specific drawing behavior.
The renderer to use for drawing
Optionaldelay: booleanThe 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.
The rendered entity, or undefined if drawing failed
Transforms this entity by the specified matrix.
This method applies a geometric transformation to the entity. Subclasses should override this method to provide entity-specific transformation behavior.
The transformation matrix to apply
This entity after transformation
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:
The renderer to use for drawing
Optionaldelay: booleanThe 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.
The rendered entity, or undefined if drawing failed
Represents a shape entity in AutoCAD.
A shape is a planar geometric object that references a shape definition from an SHX font file. Shapes are positioned by an insertion point, scaled by size and widthFactor, and oriented by rotation, oblique, and normal. This class mirrors AcDbShape in ObjectARX.
See
https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-AcDbShape
Example