### Install @mlightcad/libredwg-converter Source: https://mlightcad.com/realdwg-web/media/README.md Install the package using npm. ```bash npm install @mlightcad/libredwg-converter ``` -------------------------------- ### Install @mlightcad/graphic-interface Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_graphic-interface.html Use npm to install the package into your project. ```bash npm install @mlightcad/graphic-interface ``` -------------------------------- ### startPoint (get) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbLine.html Gets the starting point of the line as a 3D point. ```APIDOC ## startPoint (get) ### Description Gets the starting point of this line. ### Property `startPoint` (read-only) ### Returns - **AcGePoint3d** - The starting point as a 3D point ### Example ``` const startPoint = line.startPoint; console.log(`Line starts at: ${startPoint.x}, ${startPoint.y}, ${startPoint.z}`); ``` ``` -------------------------------- ### Install @mlightcad/data-model Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_data-model.html Use npm to install the package into your project. ```bash npm install @mlightcad/data-model ``` -------------------------------- ### Initialize AcDbHostApplicationServices and set working database Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbHostApplicationServices.html Demonstrates how to retrieve the singleton instance, assign a new database, and access the layout manager. ```typescript const services = acdbHostApplicationServices(); services.workingDatabase = new AcDbDatabase(); const layoutManager = services.layoutManager; ``` -------------------------------- ### Get startPoint Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Retrieves the start point of the arc, calculated based on the center, radius, and start angle. ```typescript const startPoint = arc.startPoint; console.log(`Arc start point: ${startPoint.x}, ${startPoint.y}, ${startPoint.z}`); ``` -------------------------------- ### run Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_common.AcCmTaskScheduler.html Starts execution of the task queue with the given initial input. ```APIDOC ## run ### Description Starts execution of the task queue with the given initial input. ### Signature run(initialData: TInitial): Promise ### Parameters - initialData: TInitial - Initial data to pass to the first task. ### Returns Promise ``` -------------------------------- ### get startPoint(): AcGePoint2d Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeCurve2d.html Returns the start point of the curve. For closed curves, the start and end coordinates are equal. ```APIDOC ## get startPoint(): AcGePoint2d ### Description Start point of this curve. If the curve is closed, coordinates of start point will be equal to coordinates of end point. ### Returns AcGePoint2d ``` -------------------------------- ### closed (get) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_geometry-engine.AcGeLine2d.html Gets a boolean indicating whether the line is closed (start point equals end point). ```APIDOC ## closed (get) ### Description Return true if its start point is identical to its end point. Otherwise, return false. ### Signature get closed(): boolean ### Returns - **boolean** - True if the line is closed, false otherwise. ``` -------------------------------- ### Setup private dwg-converter locally Source: https://mlightcad.com/realdwg-web/index.html Commands for maintainers to clone and build the private @mlightcad/dwg-converter package locally. ```bash pnpm setup:private pnpm install pnpm --filter @mlightcad/dwg-converter build ``` -------------------------------- ### xLine2Point (get) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbAlignedDimension.html Gets the start point for the second extension line of the dimension. Returns the point in WCS coordinates. ```APIDOC ## xLine2Point (get) ### Description Gets the start point for the second extension line of the dimension. ### Returns - **AcGePoint3d** - The second extension line point in WCS coordinates ### Example ``` const xLine2Point = alignedDim.xLine2Point; console.log(`Extension line 2 point: ${xLine2Point.x}, ${xLine2Point.y}, ${xLine2Point.z}`); ``` ``` -------------------------------- ### startPoint Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGePolyline2d.html Gets the start point of the polyline. ```APIDOC ## startPoint ### Description Gets the start point of this polyline. ### Accessor get startPoint(): AcGePoint2d ### Returns AcGePoint2d ``` -------------------------------- ### Initialize and use AcDbBatchProcessing Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbBatchProcessing.html Example showing how to instantiate the batch processor and use processChunk to iterate over items. ```javascript const batchProcessor = new AcDbBatchProcessing(1000, 10, 50); await batchProcessor.processChunk(async (start, end) => { // Process items from start to end for (let i = start; i < end; i++) { // Process item i } }); ``` -------------------------------- ### AcDbOleFrame Constructor and Example Usage Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbOleFrame.html Example showing how to create an AcDbOleFrame instance, set the OLE version, and set the OLE object binary payload. ```APIDOC ## AcDbOleFrame Class ### Description Represents a legacy OLE 1 frame entity in AutoCAD. AcDbOleFrame stores the raw OLE binary payload for an embedded OLE object. Prefer AcDbOle2Frame for OLE 2 objects, which also expose frame geometry and display attributes. ### See - https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-AcDbOleFrame - https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-__MEMBERTYPE_Methods_AcDbOleFrame ### Example ``` const oleFrame = new AcDbOleFrame() oleFrame.oleVersion = 1 oleFrame.setOleObject(binaryPayload) ``` ### Hierarchy - AcDbFrame - AcDbOleFrame - AcDbOle2Frame ### Constructors - constructor ### Properties - typeName ### Accessors - attrs - color - database - dxfTypeName - extensionDictionary - geometricExtents - isTemp - layer - lineStyle - lineType - linetypeScale - lineWeight - objectId - oleObjectData - oleVersion - ownerId - properties - resolvedColor - transparency - type - visibility ### Methods - assignDatabase - clone - clonePreservingIdentity - close - createExtensionDictionary - dxfIn - dxfInControlString - dxfInFields - dxfInXData - dxfOut - dxfOutFields - dxfOutXData - erase - getAttr - getAttrWithoutException - getEntityColor - getGeneralProperties - getLayerColor - getOleObject - getOleProperties - getXData - hasExplicitColor - hasExplicitLayer - hasExplicitTransparency - intersectWith - loadOleObjectFromDxf - onOleObjectChanged - removeXData - resolveEffectiveProperties - resolveStandardColor - restoreFrom - setAttr - setEntityColor - setImportedXData - setOleObject - setXData - shouldResolveColorFromCecolor - subGetGripPoints - subGetIntersectCurves - subGetOsnapPoints - subMoveGripPointsAt - subWorldDraw - transformBy - worldDraw ``` -------------------------------- ### startPoint Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeLoop2d.html Gets the start point of the loop. ```APIDOC ## get startPoint(): AcGePoint2d ### Description Start point of this polyline. ### Returns AcGePoint2d ``` -------------------------------- ### startPoint Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Gets the start point of this arc. ```APIDOC ## startPoint ### Description Gets the start point of this arc. The start point is calculated based on the center, radius, and start angle. ### Property - **startPoint** (AcGePoint3d) - Read-only ### Getter - **get startPoint(): AcGePoint3d** - Returns the start point as a 3D point. ### Returns - **AcGePoint3d** - The start point as a 3D point. ### Example ``` const startPoint = arc.startPoint; console.log(`Arc start point: ${startPoint.x}, ${startPoint.y}, ${startPoint.z}`); ``` ``` -------------------------------- ### Initialize and configure an AcDbOleFrame Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbOleFrame.html Demonstrates how to instantiate an AcDbOleFrame, set its OLE version, and assign a binary payload. ```javascript const oleFrame = new AcDbOleFrame() oleFrame.oleVersion = 1 oleFrame.setOleObject(binaryPayload) ``` -------------------------------- ### startAngle Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Gets or sets the start angle of this arc. ```APIDOC ## startAngle ### Description Gets or sets the start angle of this arc. ### Property - **startAngle** (number) - Read/Write ### Getter - **get startAngle(): number** - Returns the start angle in radians. ### Setter - **set startAngle(value: number): void** - Sets the new start angle in radians (0 to 2π). #### Parameters - **value** (number) - The new start angle in radians (0 to 2π). ### Returns - **number** - The start angle in radians. ### Example ``` const startAngle = arc.startAngle; console.log(`Arc start angle: ${startAngle} radians (${startAngle * 180 / Math.PI} degrees)`); arc.startAngle = Math.PI / 4; // 45 degrees ``` ``` -------------------------------- ### Create and Configure an AcDbViewportTableRecord Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbViewportTableRecord.html Example showing how to instantiate a new viewport table record and set its basic properties like name, circle sides, and corner coordinates. ```javascript const viewportRecord = new AcDbViewportTableRecord(); viewportRecord.name = ACTIVE_VPORT_NAME; viewportRecord.circleSides = 100; viewportRecord.lowerLeftCorner = new AcGePoint2d(0, 0); viewportRecord.upperRightCorner = new AcGePoint2d(1, 1); ``` -------------------------------- ### Get startAngle Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbEllipse.html Retrieves the start angle of the ellipse in radians. ```javascript const startAngle = ellipse.startAngle; console.log(`ellipse start angle: ${startAngle} radians (${startAngle * 180 / Math.PI} degrees)`); ``` -------------------------------- ### Set the working database Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbHostApplicationServices.html Demonstrates how to instantiate a new database and assign it as the current working database. ```typescript const services = acdbHostApplicationServices(); const db = new AcDbDatabase(); services.workingDatabase = db; ``` -------------------------------- ### Install @mlightcad/emf-converter Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_emf-converter.html Use pnpm to add the package to your project dependencies. ```bash pnpm add @mlightcad/emf-converter ``` -------------------------------- ### Get startAngle Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Retrieves the start angle of the arc in radians. ```typescript const startAngle = arc.startAngle; console.log(`Arc start angle: ${startAngle} radians (${startAngle * 180 / Math.PI} degrees)`); ``` -------------------------------- ### constructor Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_common.AcCmColorUtil.html Creates a new instance of AcCmColorUtil. ```APIDOC ## new AcCmColorUtil() ### Description Creates a new instance of the AcCmColorUtil class. ### Returns - **AcCmColorUtil** - A new instance of the class. ``` -------------------------------- ### Get extArcStartAngle Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbRadialDimension.html Retrieves the extension arc start angle in radians. ```typescript const startAngle = radialDim.extArcStartAngle; console.log(`Extension arc start angle: ${startAngle} radians`); ``` -------------------------------- ### Create and Configure an AcCmLoadingManager Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_common.AcCmLoadingManager.html Demonstrates how to instantiate a custom loading manager and define callbacks for start, progress, completion, and error events. ```typescript import { AcCmLoadingManager } from './AcCmLoadingManager' // Create a custom loading manager const manager = new AcCmLoadingManager() // Set up callbacks manager.onStart = (url, loaded, total) => { console.log(`Started loading: ${url} (${loaded}/${total})`) } manager.onProgress = (url, loaded, total) => { console.log(`Progress: ${url} (${loaded}/${total})`) } manager.onLoad = () => { console.log('All loading completed!') } manager.onError = (url) => { console.error(`Failed to load: ${url}`) } ``` -------------------------------- ### AcDbMLine.suppressStartCaps Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbMLine.html Gets or sets whether start caps are suppressed during rendering. ```APIDOC ## Property: suppressStartCaps ### Description Gets or sets whether start caps are suppressed during rendering. ### Getter - **Returns**: boolean - `true` when the `SuppressStartCaps` flag is set. ### Setter - **Parameters**: - value (boolean) - `true` to suppress start caps. - **Returns**: void ``` -------------------------------- ### startPosition Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbMLine.html Gets or sets the MLINE start point in world coordinates. ```APIDOC ## get startPosition(): AcGeVector3dLike ### Description Gets the MLINE start point in world coordinates. ### Returns - **AcGeVector3dLike** - Start point instance. ## set startPosition(value: AcGeVector3dLike): void ### Description Sets the MLINE start point in world coordinates. ### Parameters - **value** (AcGeVector3dLike) - New start point. ### Returns - **void** ``` -------------------------------- ### Constructor Example Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArcAlignedText.html Demonstrates how to instantiate a new AcDbObject. ```typescript const obj = new AcDbObject({ objectId: '123' }); ``` -------------------------------- ### Initialize and render an AcDbProxyEntity Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbProxyEntity.html Demonstrates creating a new proxy entity, setting its original DXF name, assigning binary proxy graphic data, and rendering it using subWorldDraw. ```javascript const proxy = new AcDbProxyEntity() proxy.originalDxfName = 'AECC_TIN_SURFACE' proxy.setProxyGraphic(binaryData) const drawable = proxy.subWorldDraw(renderer) ``` -------------------------------- ### startPoint (get/set) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeLine3d.html Gets or sets the start point of the line in WCS coordinates. ```APIDOC ## startPoint (get/set) ### Description Gets or sets the start point of the line in WCS coordinates. ### Accessor `get startPoint(): AcGePoint3d` `set startPoint(value: AcGeVector3dLike): void` ### Parameters (set) - **value** (AcGeVector3dLike) - Required - The new start point value. ### Returns (get) - **AcGePoint3d** - The start point in WCS coordinates. ### Returns (set) - **void** ``` -------------------------------- ### Get startPoint property Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbLine.html Retrieves the starting point of the line as an AcGePoint3d object. ```javascript const startPoint = line.startPoint; console.log(`Line starts at: ${startPoint.x}, ${startPoint.y}, ${startPoint.z}`); ``` -------------------------------- ### AcDbPolyline Constructor and Basic Usage Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbPolyline.html Example showing how to create a polyline, add vertices, close it, and access properties. ```APIDOC ## AcDbPolyline ### Description Represents a polyline entity in AutoCAD. A polyline is a complex geometric object composed of connected line segments and/or arc segments. Polylines can have straight line segments, bulge (arc segments) between vertices, constant and variable width, thickness, and multiple vertices. ### Constructor - `new AcDbPolyline()` - Creates a new polyline instance. ### Example ```javascript // Create a polyline const polyline = new AcDbPolyline(); // Add vertices to create a rectangle polyline.addVertexAt(0, new AcGePoint2d(0, 0)); polyline.addVertexAt(1, new AcGePoint2d(10, 0)); polyline.addVertexAt(2, new AcGePoint2d(10, 5)); polyline.addVertexAt(3, new AcGePoint2d(0, 5)); polyline.closed = true; // Close the polyline // Access polyline properties console.log(`Number of vertices: ${polyline.numberOfVertices}`); console.log(`Is closed: ${polyline.closed}`); ``` ### Properties - `typeName` - The type name of the entity. ### Accessors - `area` - The area of the polyline. - `attrs` - Attributes of the polyline. - `closed` - Whether the polyline is closed. - `color` - The color of the polyline. - `database` - The database the polyline belongs to. - `dxfTypeName` - The DXF type name. - `elevation` - The elevation of the polyline. - `extensionDictionary` - The extension dictionary. - `geometricExtents` - The geometric extents. - `isTemp` - Whether the polyline is temporary. - `layer` - The layer of the polyline. - `lineStyle` - The line style. - `lineType` - The line type. - `linetypeScale` - The linetype scale. - `lineWeight` - The line weight. - `normal` - The normal vector. - `numberOfVertices` - The number of vertices. - `objectId` - The object ID. - `ownerId` - The owner ID. - `properties` - Properties of the polyline. - `resolvedColor` - The resolved color. - `thickness` - The thickness. - `transparency` - The transparency. - `type` - The type. - `visibility` - The visibility. ### Methods - `addVertexAt(index, point)` - Adds a vertex at the specified index. - `removeVertexAt(index)` - Removes a vertex at the specified index. - `getPoint2dAt(index)` - Gets the 2D point at the specified index. - `getPoint3dAt(index)` - Gets the 3D point at the specified index. - `getOffsetCurves(distance)` - Gets offset curves. - `getOffsetSideAtPoint(point)` - Gets the offset side at a point. - `intersectWith(other)` - Intersects with another entity. - `transformBy(transform)` - Transforms the polyline. - `clone()` - Clones the polyline. - `erase()` - Erases the polyline. - `close()` - Closes the polyline. - `createExtensionDictionary()` - Creates an extension dictionary. - `dxfIn` - Reads DXF data. - `dxfOut` - Writes DXF data. - `dxfOutAs2dPolyline` - Writes DXF data as a 2D polyline. - `getXData` - Gets XData. - `setXData` - Sets XData. - `removeXData` - Removes XData. - `setEntityColor` - Sets entity color. - `getEntityColor` - Gets entity color. - `setAttr` - Sets an attribute. - `getAttr` - Gets an attribute. - `getGeneralProperties` - Gets general properties. - `getLayerColor` - Gets layer color. - `hasExplicitColor` - Checks if explicit color is set. - `hasExplicitLayer` - Checks if explicit layer is set. - `hasExplicitTransparency` - Checks if explicit transparency is set. - `resolveEffectiveProperties` - Resolves effective properties. - `resolveStandardColor` - Resolves standard color. - `shouldResolveColorFromCecolor` - Checks if color should resolve from cecolor. - `subGetGripPoints` - Gets grip points. - `subGetIntersectCurves` - Gets intersect curves. - `subGetOsnapPoints` - Gets osnap points. - `subMoveGripPointsAt` - Moves grip points. - `subWorldDraw` - World draw. - `worldDraw` - World draw. - `from2dPoints` - Creates a polyline from 2D points. - `fromGePolyline` - Creates a polyline from a geometric polyline. ### Inheritance - Inherits from `AcDbCurve`. ``` -------------------------------- ### xLine1Point Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbAlignedDimension.html Gets or sets the start point for the first extension line of the dimension. ```APIDOC ## xLine1Point ### Description Gets or sets the start point for the first extension line of the dimension. ### Property - **get xLine1Point(): AcGePoint3d** - Gets the first extension line point. - **set xLine1Point(value: AcGeVector3dLike): void** - Sets the first extension line point. ### Parameters (setter) - **value** (AcGeVector3dLike) - The new first extension line point. ### Returns (getter) - **AcGePoint3d** - The first extension line point in WCS coordinates. ### Example ``` const xLine1Point = alignedDim.xLine1Point; console.log(`Extension line 1 point: ${xLine1Point.x}, ${xLine1Point.y}, ${xLine1Point.z}`); ``` ``` alignedDim.xLine1Point = new AcGePoint3d(0, 0, 0); ``` ``` -------------------------------- ### Initialize and configure an AcDbOle2Frame Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbOle2Frame.html This example demonstrates how to instantiate an AcDbOle2Frame, set its location, dimensions, user type, and object type. ```typescript const ole = new AcDbOle2Frame() ole.setLocation(new AcGePoint3d(0, 10, 0)) ole.setWcsWidth(100) ole.setWcsHeight(75) ole.userType = 'Paintbrush Picture' ole.oleObjectType = AcDbOleObjectType.Embedded ``` -------------------------------- ### extArcStartAngle Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDiametricDimension.html Gets or sets the extension arc start angle. This angle defines the starting point of the extension arc that may be drawn to connect the dimension line to the curve being dimensioned. ```APIDOC ## extArcStartAngle ### Description Gets or sets the extension arc start angle. This angle defines the starting point of the extension arc that may be drawn to connect the dimension line to the curve being dimensioned. ### Getter - **Returns** number - The extension arc start angle in radians ### Setter - **Parameters** - value (number) - The extension arc start angle in radians - **Returns** void ``` -------------------------------- ### Create and configure an AcDbViewTableRecord Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbViewTableRecord.html Demonstrates how to instantiate a new view table record and set its name, width, and height properties. ```javascript const viewRecord = new AcDbViewTableRecord(); viewRecord.name = 'Front'; viewRecord.viewWidth = 2000; viewRecord.gsView.viewHeight = 1000; ``` -------------------------------- ### get startPoint() Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeLine2d.html Accessor that returns the line's start point in WCS coordinates. ```APIDOC ## get startPoint() ### Description Returns the line's start point in WCS coordinates. ### Method Getter ### Returns AcGePoint2d ``` -------------------------------- ### dimexo Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDimStyleTableRecord.html Gets or sets the offset distance from the origin point to where the extension line starts. ```APIDOC ## dimexo ### Description Gets or sets the offset distance from the origin point to where the extension line starts. ### Methods #### get dimexo(): number Returns the current extension line offset. #### set dimexo(value: number): void Sets the extension line offset. ##### Parameters - **value** (number) - Required - The new extension line offset. ### Returns - **get**: number - **set**: void ``` -------------------------------- ### Initialize and configure an AcDbLayout object Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbLayout.html Demonstrates how to instantiate a new AcDbLayout object and set basic properties such as the layout name, tab order, and limits. ```javascript const layout = new AcDbLayout(); layout.layoutName = 'A4 Landscape'; layout.tabOrder = 1; layout.limits = new AcGeBox2d(); ``` -------------------------------- ### Install private packages from GitHub Source: https://mlightcad.com/realdwg-web/index.html Commands to install the data-model and the private dwg-converter package using the GitHub registry. ```bash pnpm add @mlightcad/data-model pnpm add @mlightcad/dwg-converter --registry https://npm.pkg.github.com ``` -------------------------------- ### subGetGripPoints Example Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Retrieves the grip points for an arc, which include the center, start, and end points. ```javascript const gripPoints = arc.subGetGripPoints(); // gripPoints contains: [center, startPoint, endPoint] ``` -------------------------------- ### Get attribute values Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_common.AcCmObject.html Examples of retrieving attribute values, checking for existence, and implementing strongly-typed getters. ```typescript // Get a single attribute value const name = obj.get('name') const visible = obj.get('visible') // Check if attribute exists if (obj.get('name') !== undefined) { console.log('Name is set') } // For strongly-typed subclasses get name(): string { return super.get("name") } ``` -------------------------------- ### Initialize and Read AcDbDatabase Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDatabase.html Demonstrates creating a new AcDbDatabase instance and reading data from a DXF source. ```javascript const database = new AcDbDatabase(); await database.read(dxfData, { readOnly: true }); const entities = database.tables.blockTable.modelSpace.entities; ``` -------------------------------- ### Create AcDbAlignedDimension instances Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbAlignedDimension.html Examples showing how to instantiate an aligned dimension with default settings and with custom text and style parameters. ```javascript // Create an aligned dimension with default text and style const alignedDim = new AcDbAlignedDimension( new AcGePoint3d(0, 0, 0), new AcGePoint3d(10, 5, 0), new AcGePoint3d(5, 2.5, 0) ); // Create an aligned dimension with custom text and style const alignedDim2 = new AcDbAlignedDimension( new AcGePoint3d(0, 0, 0), new AcGePoint3d(15, 10, 0), new AcGePoint3d(7.5, 5, 0), "15.0", "Architectural" ); ``` -------------------------------- ### get startPoint() Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_geometry-engine.AcGeCurve2d.html Returns the start point of the curve. If the curve is closed, the coordinates are equal to the end point. ```APIDOC ## get startPoint() ### Description Returns the start point of the curve. If the curve is closed, the coordinates are equal to the end point. ### Returns AcGePoint2d ``` -------------------------------- ### writeStart(value: string): AcDbDxfFiler Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDxfFiler.html Writes a start marker with the given value. Returns the filer for chaining. ```APIDOC ## writeStart(value: string): AcDbDxfFiler ### Description Writes a start marker with the given value. Returns the filer for chaining. ### Method writeStart ### Parameters - **value** (string) - Required - The value to write. ### Returns AcDbDxfFiler ``` -------------------------------- ### get endPoint() Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_geometry-engine.AcGeCurve2d.html Returns the end point of the curve. If the curve is closed, the coordinates are equal to the start point. ```APIDOC ## get endPoint() ### Description Returns the end point of the curve. If the curve is closed, the coordinates are equal to the start point. ### Returns AcGePoint2d ``` -------------------------------- ### startTable Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDxfFiler.html Starts a new DXF table with the given name. ```APIDOC ## startTable(name: string): AcDbDxfFiler ### Description Starts a new DXF table with the given name. ### Method startTable ### Parameters - **name** (string) - Required - The table name. ### Returns AcDbDxfFiler ``` -------------------------------- ### get closed(): boolean Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeCurve2d.html Returns true if the start point is identical to the end point, otherwise false. ```APIDOC ## get closed(): boolean ### Description Return true if its start point is identical to its end point. Otherwise, return false. ### Returns boolean ``` -------------------------------- ### AcDbOle2Frame Constructor and Example Usage Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbOle2Frame.html Creates a new AcDbOle2Frame instance and demonstrates setting location, width, height, user type, and OLE object type. ```APIDOC ## AcDbOle2Frame ### Description Represents an OLE 2 frame entity in AutoCAD. Provides a display frame for an OLE 2 object, storing frame geometry, display settings, link metadata, and the embedded OLE binary payload. ### Constructor - **constructor()** - Creates a new AcDbOle2Frame instance. ### Example ``` const ole = new AcDbOle2Frame() ole.setLocation(new AcGePoint3d(0, 10, 0)) ole.setWcsWidth(100) ole.setWcsHeight(75) ole.userType = 'Paintbrush Picture' ole.oleObjectType = AcDbOleObjectType.Embedded ``` ### Properties - **typeName** - The type name of the entity. ### Accessors - **attrs** - Attribute accessor. - **color** - Color property. - **database** - Database property. - **dxfTypeName** - DXF type name. - **extensionDictionary** - Extension dictionary. - **geometricExtents** - Geometric extents. - **image** - Image property. - **isTemp** - Temporary flag. - **layer** - Layer property. - **lineStyle** - Line style. - **lineType** - Line type. - **linetypeScale** - Linetype scale. - **lineWeight** - Line weight. - **lowerRightCorner** - Lower right corner. - **objectId** - Object ID. - **oleObjectData** - OLE object data. - **oleObjectType** - OLE object type. - **oleVersion** - OLE version. - **ownerId** - Owner ID. - **properties** - Properties. - **resolvedColor** - Resolved color. - **tileMode** - Tile mode. - **transparency** - Transparency. - **type** - Type. - **upperLeftCorner** - Upper left corner. - **userType** - User type. - **visibility** - Visibility. ### Methods - **assignDatabase** - Assigns a database. - **autoOutputQuality** - Gets or sets auto output quality. - **clone** - Clones the entity. - **clonePreservingIdentity** - Clones preserving identity. - **close** - Closes the entity. - **createExtensionDictionary** - Creates an extension dictionary. - **dxfIn** - Reads DXF input. - **dxfInControlString** - Reads DXF control string. - **dxfInFields** - Reads DXF fields. - **dxfInXData** - Reads DXF XData. - **dxfOut** - Writes DXF output. - **dxfOutFields** - Writes DXF fields. - **dxfOutXData** - Writes DXF XData. - **erase** - Erases the entity. - **getAttr** - Gets an attribute. - **getAttrWithoutException** - Gets an attribute without exception. - **getEntityColor** - Gets entity color. - **getGeneralProperties** - Gets general properties. - **getLayerColor** - Gets layer color. - **getLinkName** - Gets link name. - **getLinkPath** - Gets link path. - **getLocation** - Gets location. - **getOleClientItem** - Gets OLE client item. - **getOleObject** - Gets OLE object. - **getOleProperties** - Gets OLE properties. - **getType** - Gets type. - **getUserType** - Gets user type. - **getXData** - Gets XData. - **hasExplicitColor** - Checks for explicit color. - **hasExplicitLayer** - Checks for explicit layer. - **hasExplicitTransparency** - Checks for explicit transparency. - **intersectWith** - Intersects with another entity. - **loadOleObjectFromDxf** - Loads OLE object from DXF. - **lockAspect** - Locks aspect ratio. - **onOleObjectChanged** - Called when OLE object changes. - **outputQuality** - Gets or sets output quality. - **position** - Gets or sets position. - **removeXData** - Removes XData. - **resolveEffectiveProperties** - Resolves effective properties. - **resolveStandardColor** - Resolves standard color. - **restoreFrom** - Restores from another entity. - **rotation** - Gets or sets rotation. - **scaleHeight** - Gets or sets scale height. - **scaleWidth** - Gets or sets scale width. - **setAttr** - Sets an attribute. - **setAutoOutputQuality** - Sets auto output quality. - **setEntityColor** - Sets entity color. - **setImportedXData** - Sets imported XData. - **setLinkName** - Sets link name. - **setLinkPath** - Sets link path. - **setLocation** - Sets location. - **setLockAspect** - Sets lock aspect. - **setOleClientItem** - Sets OLE client item. - **setOleObject** - Sets OLE object. - **setOutputQuality** - Sets output quality. - **setPosition** - Sets position. - **setRotation** - Sets rotation. - **setScaleHeight** - Sets scale height. - **setScaleWidth** - Sets scale width. - **setType** - Sets type. - **setUserType** - Sets user type. - **setWcsHeight** - Sets WCS height. - **setWcsWidth** - Sets WCS width. - **setXData** - Sets XData. - **shouldResolveColorFromCecolor** - Determines if color should resolve from CECOLOR. - **subGetGripPoints** - Gets grip points. - **subGetIntersectCurves** - Gets intersect curves. - **subGetOsnapPoints** - Gets osnap points. - **subMoveGripPointsAt** - Moves grip points. - **subWorldDraw** - Draws in world coordinates. - **transformBy** - Transforms the entity. - **wcsHeight** - Gets or sets WCS height. - **wcsWidth** - Gets or sets WCS width. - **worldDraw** - Draws in world coordinates. ``` -------------------------------- ### Get xLine2Point property Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbAlignedDimension.html Retrieves the start point for the second extension line of the dimension in WCS coordinates. ```javascript const xLine2Point = alignedDim.xLine2Point; console.log(`Extension line 2 point: ${xLine2Point.x}, ${xLine2Point.y}, ${xLine2Point.z}`); ``` -------------------------------- ### Create AcDbSpline instances Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbSpline.html Demonstrates creating a spline using control points with knots, and creating a spline using fit points with uniform parameterization. ```javascript // Create a spline from control points const controlPoints = [ new AcGePoint3d(0, 0, 0), new AcGePoint3d(5, 5, 0), new AcGePoint3d(10, 0, 0) ]; const knots = [0, 0, 0, 1, 1, 1]; const spline = new AcDbSpline(controlPoints, knots); // Create a spline from fit points const fitPoints = [ new AcGePoint3d(0, 0, 0), new AcGePoint3d(5, 5, 0), new AcGePoint3d(10, 0, 0) ]; const spline2 = new AcDbSpline(fitPoints, AcGeKnotParameterizationType.Uniform); ``` -------------------------------- ### Managing entity layer Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbOrdinateDimension.html Examples for getting the current layer name of an entity and setting a new layer name. ```typescript const layerName = entity.layer; ``` ```typescript entity.layer = 'MyLayer'; ``` -------------------------------- ### get endPoint(): AcGePoint2d Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeCurve2d.html Returns the end point of the curve. For closed curves, the start and end coordinates are equal. ```APIDOC ## get endPoint(): AcGePoint2d ### Description End point of this curve. If the curve is closed, coordinates of start point will be equal to coordinates of end point. ### Returns AcGePoint2d ``` -------------------------------- ### constructor Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbDatabaseConverter.html Creates a new instance of the database converter with optional configuration. ```APIDOC ## Constructor ### Description Creates a new instance of the database converter. ### Signature new AcDbDatabaseConverter(config?: AcDbDatabaseConverterConfig): AcDbDatabaseConverter ### Parameters - **config** (AcDbDatabaseConverterConfig) - Optional - Configuration options for the converter. Includes settings such as worker URL for web workers used in the conversion process. If not provided, an empty configuration object will be used. ### Returns AcDbDatabaseConverter ### Example ``` // Create converter with default configuration const converter = new AcDbDxfConverter(); // Create converter with custom worker URL const converter = new AcDbDxfConverter({ parserWorkerUrl: '/assets/dxf-parser-worker.js' }); ``` ``` -------------------------------- ### subGetOsnapPoints Example Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArcAlignedText.html Gets the object snap points for this entity. Populates the snapPoints array with points for the given osnap mode. ```typescript const snapPoints: AcGePoint3d[] = []; entity.subGetOsnapPoints(AcDbOsnapMode.Endpoint, 0, pickPoint, lastPoint, snapPoints); Copy ``` -------------------------------- ### Install @mlightcad/common package Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_common.html Use npm to install the common package into your project. ```bash npm install @mlightcad/common ``` -------------------------------- ### basePoint (get/set) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbRay.html Gets or sets the base point of this ray. The base point is the starting point from which the ray extends infinitely. ```APIDOC ## basePoint (get/set) ### Description Gets or sets the base point of this ray. The base point is the starting point from which the ray extends infinitely. ### Property `get basePoint(): AcGePoint3d` `set basePoint(value: AcGePoint3d): void` ### Parameters (set) - **value** (AcGePoint3d) - Required - The new base point. ### Returns (get) - **AcGePoint3d** - The base point as a 3D point. ### Returns (set) - **void** ### Example (get) ``` const basePoint = ray.basePoint; console.log(`Ray base point: ${basePoint.x}, ${basePoint.y}, ${basePoint.z}`); ``` ### Example (set) ``` ray.basePoint = new AcGePoint3d(10, 20, 0); ``` ``` -------------------------------- ### Basic Entity Rendering with AcGiRenderer Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_graphic-interface.html Demonstrates how to initialize an AcGiRenderer and render a basic AcDbLine entity. ```typescript import { AcGiRenderer, AcGiEntity } from '@mlightcad/graphic-interface'; import { AcDbLine, AcGePoint3d } from '@mlightcad/data-model'; // Create a renderer const renderer = new AcGiRenderer(); // Create an entity const startPoint = new AcGePoint3d(0, 0, 0); const endPoint = new AcGePoint3d(10, 10, 0); const line = new AcDbLine(startPoint, endPoint); // Render the entity const drawableEntity = renderer.renderEntity(line); ``` -------------------------------- ### Create and Configure an AcDbShape Instance Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbShape.html Demonstrates how to instantiate an AcDbShape object and set its name, position, size, and rotation properties. ```javascript const shape = new AcDbShape(); shape.name = 'ARROW'; shape.position = new AcGePoint3d(10, 20, 0); shape.size = 2.5; shape.rotation = Math.PI / 4; ``` -------------------------------- ### subGetGripPoints Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbMLine.html Gets the grip points for this MLINE reference path. Grip points are placed at the start point and each segment vertex. ```APIDOC ## subGetGripPoints ### Description Gets the grip points for this MLINE reference path. Grip points are placed at the start point and each segment vertex, matching AutoCAD MLINE grip behavior on the reference path. ### Method subGetGripPoints ### Signature subGetGripPoints(): AcGePoint3d[] ### Returns AcGePoint3d[] - Array of grip points as 3D points ``` -------------------------------- ### Get First Extension Line Point Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbAlignedDimension.html Retrieves the start point for the first extension line of the dimension in WCS coordinates. ```typescript const xLine1Point = alignedDim.xLine1Point; console.log(`Extension line 1 point: ${xLine1Point.x}, ${xLine1Point.y}, ${xLine1Point.z}`); ``` -------------------------------- ### Build and Test the Module Source: https://mlightcad.com/realdwg-web/modules/_mlightcad_emf-converter.html Use pnpm filters to run build and test commands specifically for the @mlightcad/emf-converter package. ```bash pnpm --filter @mlightcad/emf-converter build pnpm --filter @mlightcad/emf-converter test ``` -------------------------------- ### startWidth Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDb2dVertex.html Gets or sets the start width for the vertex, used as the width at this vertex for the polyline segment from this vertex to the next vertex. ```APIDOC ## startWidth ### Description Gets or sets the start width for the vertex. The start width is used as the width at this vertex for the polyline segment from this vertex to the next vertex. ### Property - **get startWidth(): number** - Returns the start width for the vertex. - **set startWidth(value: number): void** - Sets the start width for the vertex. ### Parameters (setter) - **value** (number) - Required - The start width for the vertex. ### Returns - **get**: number - The start width for the vertex. - **set**: void ``` -------------------------------- ### buildFromEdges (Static) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcGeLoop2d.html Builds loops from a list of boundary edges. ```APIDOC ## buildFromEdges(edges: readonly AcGeBoundaryEdgeType[], tolerance?: number): AcGeLoop2d[] ### Description Build loops from a list of boundary edges. This method greedily connects the nearest edge endpoints to form one or more closed loops. If a loop cannot be closed within the given tolerance, it will still return the best-effort loop with the collected edges. ### Method buildFromEdges (Static) ### Parameters - **edges** (readonly AcGeBoundaryEdgeType[]) - Required - Input edges. - **tolerance** (number) - Optional - Distance tolerance to treat two points as connected. ### Returns AcGeLoop2d[] - Loops constructed from the input edges. ``` -------------------------------- ### closed (getter) Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbArc.html Gets whether this arc is closed. An arc is considered closed if the start and end angles are the same (forming a complete circle). ```APIDOC ## closed (getter) ### Description Gets whether this arc is closed. An arc is considered closed if the start and end angles are the same (forming a complete circle). ### Property `get closed(): boolean` ### Returns - **boolean** - True if the arc is closed (forms a complete circle), false otherwise. ``` -------------------------------- ### constructor Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbChangeApplier.html Creates an applier bound to one database. ```APIDOC ## constructor ### Description Creates an applier bound to one database. ### Method constructor ### Signature new AcDbChangeApplier(database: AcDbDatabase): AcDbChangeApplier ### Parameters - **database** (AcDbDatabase) - Required - Database whose containers and objects receive replayed changes ### Returns AcDbChangeApplier ``` -------------------------------- ### gradientOneColorMode Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbHatch.html Gets or sets whether the gradient hatch is transitioning from a start to a stop color (two-color) or from a color to an adjusted luminance version (one-color). ```APIDOC ## gradientOneColorMode ### Description Gets or sets whether the gradient hatch is transitioning from a start to a stop color (two-color) or from a color to an adjusted luminance version of the same color (one-color). In the latter case, the full luminance version is the "tint" and the zero luminance version is the "shade." ### Property - **get gradientOneColorMode(): boolean** - Returns true if one-color mode is enabled. - **set gradientOneColorMode(value: boolean): void** - Sets one-color mode. ### Parameters (setter) - **value** (boolean) - True for one-color mode, false for two-color mode. ### Returns (getter) - **boolean** - True if one-color mode is enabled. ### Returns (setter) - **void** ``` -------------------------------- ### constructor Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDbChangeRecorder.html Creates a new AcDbChangeRecorder instance. ```APIDOC ## new AcDbChangeRecorder() ### Description Creates a new AcDbChangeRecorder instance. ### Returns AcDbChangeRecorder ``` -------------------------------- ### setXData example Source: https://mlightcad.com/realdwg-web/classes/_mlightcad_data-model.AcDb2dPolyline.html Attaches XData to an object using an AcDbResultBuffer. The buffer must start with a 1001 group code for the AppId and follow DXF conventions. ```TypeScript const rb = new AcDbResultBuffer([ { code: AcDbDxfCode.ExtendedDataRegAppName, value: 'MY_APP' }, { code: AcDbDxfCode.ExtendedDataAsciiString, value: 'custom value' } ]) obj.setXData('MY_APP', rb) ```