UNPKG

@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.

133 lines 6.03 kB
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 { AcGeBox3d, AcGePoint3d } from '@mlightcad/geometry-engine'; import { AcDbDimension } from './AcDbDimension'; /** * Represents an ordinate dimension entity in AutoCAD. * * Ordinate dimensions measure the "horizontal" (X axis) or "vertical" (Y axis) distance * from a specified origin point to some other specified point. They are commonly used * in mechanical drawings, architectural plans, and other technical documentation where * precise coordinate measurements are required. * * The dimension displays a leader line from the defining point to the leader end point, * with the annotation text located appropriately near the end of the leader. Ordinate * dimensions are particularly useful for dimensioning parts with multiple features that * need to be positioned relative to a common reference point. */ var AcDbOrdinateDimension = /** @class */ (function (_super) { __extends(AcDbOrdinateDimension, _super); /** * Creates a new ordinate dimension. * * @param definingPoint - The point where the ordinate leader should start. This is * the point being measured relative to the dimension's origin * @param leaderEndPoint - The point where the ordinate leader should end. This point * is used for the dimension leader's endpoint and in text * position calculations * @param dimText - Optional custom dimension text to display instead of the calculated * coordinate value. If null, the calculated coordinate will be displayed * @param dimStyle - Optional name of the dimension style table record to use for * formatting. If null, the current default style will be used */ function AcDbOrdinateDimension(definingPoint, leaderEndPoint, dimText, dimStyle) { if (dimText === void 0) { dimText = null; } if (dimStyle === void 0) { dimStyle = null; } var _this = _super.call(this) || this; _this._definingPoint = new AcGePoint3d().copy(definingPoint); _this._leaderEndPoint = new AcGePoint3d().copy(leaderEndPoint); _this.dimensionText = dimText; // TODO: Set it to the current default dimStyle within the AutoCAD editor if dimStyle is null _this.dimensionStyleName = dimStyle; return _this; } Object.defineProperty(AcDbOrdinateDimension.prototype, "definingPoint", { /** * Gets or sets the ordinate point to be measured. * * This is the point (in WCS coordinates) that defines the location being measured. * The dimension measures the X or Y distance between this point and the dimension's * origin point, depending on the orientation of the ordinate dimension. * * @returns The defining point of the ordinate dimension */ get: function () { return this._definingPoint; }, set: function (value) { this._definingPoint.copy(value); }, enumerable: false, configurable: true }); Object.defineProperty(AcDbOrdinateDimension.prototype, "leaderEndPoint", { /** * Gets or sets the leader end point. * * This point is used as the dimension leader's endpoint and is used in the text * position calculations. It determines where the leader line ends and where the * dimension text is positioned relative to the leader. * * @returns The leader end point of the ordinate dimension */ get: function () { return this._leaderEndPoint; }, set: function (value) { this._leaderEndPoint.copy(value); }, enumerable: false, configurable: true }); Object.defineProperty(AcDbOrdinateDimension.prototype, "geometricExtents", { /** * Gets the geometric extents (bounding box) of this dimension entity. * * The geometric extents define the minimum bounding box that completely contains * the dimension entity, including all its components like the leader line and text. * * @returns A 3D bounding box containing the dimension entity * @inheritdoc */ get: function () { // TODO: Finish it return new AcGeBox3d(); }, enumerable: false, configurable: true }); Object.defineProperty(AcDbOrdinateDimension.prototype, "arrowLineCount", { /** * Gets the number of arrow lines for this dimension. * * Ordinate dimensions typically don't use arrows since they are coordinate-based * measurements rather than distance measurements between two points. * * @returns The number of arrow lines (always 0 for ordinate dimensions) * @inheritdoc */ get: function () { return 0; }, enumerable: false, configurable: true }); /** The entity type name */ AcDbOrdinateDimension.typeName = 'OrdinateDimension'; return AcDbOrdinateDimension; }(AcDbDimension)); export { AcDbOrdinateDimension }; //# sourceMappingURL=AcDbOrdinateDimension.js.map