@mlightcad/data-model
Version:
The data-model package provides the core classes for interacting with AutoCAD's database and entities. This package mimics AutoCAD ObjectARX's AcDb (Database) classes and implements the drawing database structure that AutoCAD developers are familiar with.
82 lines • 3.03 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { defaults } from '@mlightcad/common';
import { AcDbObject } from '../base/AcDbObject';
/**
* Base class for all symbol table records.
*
* This class provides the fundamental functionality for all symbol table records,
* including name management and common attributes. Symbol table records represent
* entries in various symbol tables such as layer tables, linetype tables, text
* style tables, etc.
*
* @template ATTRS - The type of attributes this symbol table record can have
*
* @example
* ```typescript
* class MySymbolTableRecord extends AcDbSymbolTableRecord<MySymbolTableRecordAttrs> {
* constructor(attrs?: Partial<MySymbolTableRecordAttrs>) {
* super(attrs);
* }
* }
* ```
*/
var AcDbSymbolTableRecord = /** @class */ (function (_super) {
__extends(AcDbSymbolTableRecord, _super);
/**
* Creates a new AcDbSymbolTableRecord instance.
*
* @param attrs - Input attribute values for this symbol table record
* @param defaultAttrs - Default values for attributes of this symbol table record
*
* @example
* ```typescript
* const record = new AcDbSymbolTableRecord({ name: 'MyRecord' });
* ```
*/
function AcDbSymbolTableRecord(attrs, defaultAttrs) {
attrs = attrs || {};
defaults(attrs, { name: '' });
return _super.call(this, attrs, defaultAttrs) || this;
}
Object.defineProperty(AcDbSymbolTableRecord.prototype, "name", {
/**
* Gets or sets the name of the symbol table record.
*
* This property corresponds to DXF group code 2 and is used for
* identifying and referencing the symbol table record.
*
* @returns The name of the symbol table record
*
* @example
* ```typescript
* const recordName = record.name;
* record.name = 'NewRecordName';
* ```
*/
get: function () {
return this.getAttr('name');
},
set: function (value) {
this.setAttr('name', value);
},
enumerable: false,
configurable: true
});
return AcDbSymbolTableRecord;
}(AcDbObject));
export { AcDbSymbolTableRecord };
//# sourceMappingURL=AcDbSymbolTableRecord.js.map