@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.
253 lines • 7.99 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 { AcGeBox2d, AcGeBox3d } from '@mlightcad/geometry-engine';
import { AcDbObject } from '../../base';
/**
* Represents the stored characteristics of each paperspace layout.
*
* Layout objects are stored in an AcDbDictionary object with an ACAD_LAYOUT key,
* allowing easy iteration and indexing. Each layout represents a paperspace
* configuration that can be used for printing or plotting.
*
* @example
* ```typescript
* const layout = new AcDbLayout();
* layout.layoutName = 'A4 Landscape';
* layout.tabOrder = 1;
* layout.limits = new AcGeBox2d();
* ```
*/
var AcDbLayout = /** @class */ (function (_super) {
__extends(AcDbLayout, _super);
/**
* Creates a new AcDbLayout instance.
*
* @example
* ```typescript
* const layout = new AcDbLayout();
* ```
*/
function AcDbLayout() {
var _this = _super.call(this) || this;
_this._tabOrder = -1;
_this._tabSelected = false;
_this._blockTableRecordId = '';
_this._layoutName = '';
_this._limits = new AcGeBox2d();
_this._extents = new AcGeBox3d();
return _this;
}
Object.defineProperty(AcDbLayout.prototype, "layoutName", {
/**
* Gets the user-friendly layout name that is displayed in the tab control.
*
* Currently there is no restriction on the name except that the length
* is limited to 256 characters.
*
* @returns The layout name
*
* @example
* ```typescript
* const name = layout.layoutName;
* console.log('Layout name:', name);
* ```
*/
get: function () {
return this._layoutName;
},
/**
* Sets the user-friendly layout name that is displayed in the tab control.
*
* @param value - The new layout name (limited to 256 characters)
*
* @example
* ```typescript
* layout.layoutName = 'A4 Landscape';
* ```
*/
set: function (value) {
this._layoutName = value.length > 256 ? value.slice(0, 256) : value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDbLayout.prototype, "tabOrder", {
/**
* Gets the tab order field, which controls the order in which layouts are displayed.
*
* The tab order should be unique and sequential for each layout in the database.
*
* @returns The tab order value
*
* @example
* ```typescript
* const order = layout.tabOrder;
* ```
*/
get: function () {
return this._tabOrder;
},
/**
* Sets the tab order field, which controls the order in which layouts are displayed.
*
* @param value - The new tab order value
*
* @example
* ```typescript
* layout.tabOrder = 1;
* ```
*/
set: function (value) {
this._tabOrder = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDbLayout.prototype, "tabSelected", {
/**
* Gets whether the layout tab is included in the selection set for operations.
*
* This flag indicates whether the layout tab is included in the selection set
* for operations that affect multiple tabs. The user can perform multiple
* selection via the user interface using shift-click.
*
* @returns True if the tab is selected, false otherwise
*
* @example
* ```typescript
* const isSelected = layout.tabSelected;
* ```
*/
get: function () {
return this._tabSelected;
},
/**
* Sets whether the layout tab is included in the selection set for operations.
*
* @param value - True to select the tab, false to deselect it
*
* @example
* ```typescript
* layout.tabSelected = true;
* ```
*/
set: function (value) {
this._tabSelected = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDbLayout.prototype, "blockTableRecordId", {
/**
* Gets the associated block table record ID of this layout.
*
* @returns The block table record ID
*
* @example
* ```typescript
* const blockId = layout.blockTableRecordId;
* ```
*/
get: function () {
return this._blockTableRecordId;
},
/**
* Sets the associated block table record ID of this layout.
*
* @param value - The new block table record ID
*
* @example
* ```typescript
* layout.blockTableRecordId = 'some-block-id';
* ```
*/
set: function (value) {
this._blockTableRecordId = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDbLayout.prototype, "limits", {
/**
* Gets the limits for this layout.
*
* Limits are defined by LIMMAX while this layout is current.
*
* @returns The layout limits as a 2D bounding box
*
* @example
* ```typescript
* const limits = layout.limits;
* console.log('Layout limits:', limits);
* ```
*/
get: function () {
return this._limits;
},
/**
* Sets the limits for this layout.
*
* @param value - The new layout limits as a 2D bounding box
*
* @example
* ```typescript
* layout.limits = new AcGeBox2d();
* ```
*/
set: function (value) {
this._limits.copy(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDbLayout.prototype, "extents", {
/**
* Gets the current extents setting of the layout.
*
* This value may not be the actual extents of the geometry in the layout,
* it is just the value last saved in the layout.
*
* @returns The layout extents as a 3D bounding box
*
* @example
* ```typescript
* const extents = layout.extents;
* console.log('Layout extents:', extents);
* ```
*/
get: function () {
return this._extents;
},
/**
* Sets the current extents setting of the layout.
*
* @param value - The new layout extents as a 3D bounding box
*
* @example
* ```typescript
* layout.extents = new AcGeBox3d();
* ```
*/
set: function (value) {
this._extents.copy(value);
},
enumerable: false,
configurable: true
});
return AcDbLayout;
}(AcDbObject));
export { AcDbLayout };
//# sourceMappingURL=AcDbLayout.js.map