An Xline is a parametric entity that specifies an infinite straight line in world space, also named a construction line. The OdDbXline class is the Xline object that represents the interface for accessing an infinite line entity and manipulating its properties. The OdDbXlinePtr class is the typified smart pointer to an instance of the construction line entity and is used for storing and passing references to the Xline object.
To create an instance of the Xline object, use the createObject() method of the OdDbXline class that is the static pseudo-constructor. For example:
OdDbXlinePtr pXLine = OdDbXline::createObject();
The pseudo-constructor initializes the properties of a new instance using default values. After creating, the new instance must be added in model space, paper space, or a block using the appendOdDbEntity() method. The database associates the object ID with the infinite line instance. In examples, the pDb variable stores a pointer to the database object. For example:
// Add in the block
OdDbBlockTablePtr pBlocks = pDb->getBlockTableId().safeOpenObject(OdDb::kForRead);
OdDbBlockTableRecordPtr pBlock = pBlocks->getAt(L"BLOCK", OdDb::kForWrite)
OdDbObjectId idXLine = pBlock->appendOdDbEntity(pXLine);
// Add in the model space
OdDbBlockTableRecordPtr pModel = pDb->getModelSpaceId().safeOpenObject(OdDb::kForWrite);
pModel->appendOdDbEntity(pXLine);
// Add in the paper space
OdDbBlockTableRecordPtr pPaper = pDb->getPaperSpaceId().safeOpenObject(OdDb::kForWrite);
pPaper->appendOdDbEntity(pXLine);
The OdDbXline class is derived from the OdDbCurve class and inherits the common properties of parametric curves. The OdDbCurve class is derived from the OdDbEntity class, therefore the OdDbXline class also inherits the general properties of entities. A pointer to an Xline object can be converted to an entity object or a curve object. For example:
OdDbEntityPtr pEntity = pXLine;
OdDbCurvePtr pCurve = pXLine;
The Xline object has the AcDbXline class name. To verify an instance, use the isKindOf() and desc() methods. For example:
// Accurate comparing
if(pEntity->isA() == OdDbXline::desc())
odPrintConsoleString(L"\nEntity is the constructional line");
// Check on belonging
if(pEntity->isKindOf(OdDbXline::desc()))
odPrintConsoleString(L"\nEntity is derived from the Xline object");
Specific Infinite Line Properties
Computed Infinite Line Properties
Example of Working with the Xline Object
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|