Creates a new AcDbDatabase instance.
ReadonlyeventsEvents that can be triggered by the database.
These events allow applications to respond to various database operations such as entity modifications, layer changes, and progress updates.
Fired when an object in the dictionary is removed
Fired when an object is set to the dictionary
Fired when an entity is appended to the database
Fired when an entity is erased from the database
Fired when an entity is modified in the database
Fired when a header system variable is changed
Fired when a layer is appended to the database
Fired when a layer is erased from the database
Fired when a layer is modified in the database
Fired during database opening operations to report progress
StaticMLIGHTCAD_The zero (0) base angle with respect to the current UCS in radians.
The direction of positive angles.
Gets the attributes object for this AcDbObject.
The AcCmObject instance containing all attributes
Gets the angle units for the database.
This is the current AUNITS value for the database.
The angle units value
Sets the angle units for the database.
The new angle units value
The line type scaling for new objects relative to the ltscale setting. A line created with celtscale = 2 in a drawing with ltscale set to 0.5 would appear the same as a line created with celtscale = 1 in a drawing with ltscale = 1.
The layer of new objects as they are created.
The layer of new objects as they are created.
Gets the object ID of the AcDbBlockTableRecord of the current space.
The current space can be either model space or paper space.
The object ID of the current space
Sets the current space by object ID.
The object ID of the block table record to set as current space
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 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
The current Model Space EXTMAX value
The current Model Space EXTMIN value
Gets the drawing-units value for automatic scaling of blocks, images, or xrefs.
This is the current INSUNITS value for the database.
The insertion units value
Sets the drawing-units value for automatic scaling.
The new insertion units value
Gets the line type scale factor.
The line type scale factor
Sets the line type scale factor.
The new line type scale factor
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 all nongraphical objects in this drawing database.
Object containing all nongraphical objects in the database
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
Point display mode. Please get more details on value of this property from this page.
Point display size.
0: Specifies an absolute size
Gets all tables in this drawing database.
Object containing all the symbol tables in the database
Gets the version of the database.
The version of the database
Sets the version of the database.
The version value of the database
Create default layer, line type, dimension type, text style and layout.
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
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
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
Read AutoCAD DXF or DWG drawing specified by the URL into the database object. The method automatically detects the file type based on the URL extension:
Input the URL linked to one AutoCAD DXF or DWG file
Input options to read drawing data
Reads drawing data from a string or ArrayBuffer.
This method parses the provided data and populates the database with the resulting entities, tables, and objects. The method supports both DXF and DWG file formats.
The drawing data as a string or ArrayBuffer
Options for reading the database
The type of file being read (defaults to DXF)
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.
The application ID whose XData should be removed
Sets the value of an attribute.
The name of the attribute to set
Optionalval: AcDbObjectAttrs[A]The value to assign to the attribute
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:
This method is conceptually similar to AcDbObject::setXData() in ObjectARX.
The result buffer containing the XData to attach
The AcDbDatabase class represents an AutoCAD drawing file.
Each AcDbDatabase object contains the various header variables, symbol tables, table records, entities, and objects that make up the drawing. The AcDbDatabase class has member functions to allow access to all the symbol tables, to read and write to DWG files, to get or set database defaults, to execute various database-level operations, and to get or set all header variables.
Example