Multi-line text is a text entity that defines a sequence of alphabetic, numeric, format, and various symbols as a geometric figure created from linear and circular segments in a restricted rectangular area and placed in multiple lines, one under another, on a plane. This geometric figure is used as a box of strings in drawings. The displacement method is used for plotting multi-line text, which is the same as single-line text.
The OdDbMText class is the multi-line text object that represents the interface for accessing this text entity and manipulating its properties. The OdDbMTextPtr class is the typified smart pointer to an instance of the multi-line text object and is used for storing and passing references to this object.
To create an instance of the multi-line text object, use the createObject() method of the OdDbMText class which is the static pseudo-constructor. For example:
OdDbMTextPtr pMText = OdDbMText::createObject();
The pseudo-constructor initializes the properties of a new instance using default values. After creation, the new text instance must be added in model space, paper space, or a block using the appendOdDbEntity() method. The database associates the object ID with the created instance. In the following 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 idMText = pBlock->appendOdDbEntity(pMText);
// Add in the model space
OdDbBlockTableRecordPtr pModel = pDb->getModelSpaceId().safeOpenObject(OdDb::kForWrite);
pModel->appendOdDbEntity(pMText);
// Add in the paper space
OdDbBlockTableRecordPtr pPaper = pDb->getPaperSpaceId().safeOpenObject(OdDb::kForWrite);
pPaper->appendOdDbEntity(pMText);
The OdDbMText class is derived from the OdDbEntity class and inherits the general properties of entities. A pointer to the multi-line text object can be converted to an entity object. For example:
OdDbEntityPtr pEntity = pMText;
The multi-line text object has the AcDbMText class name. To verify an instance, use the isKindOf() and desc() methods. For example:
// Accurate comparing
if(pEntity->isA() == OdDbMText::desc())
odPrintConsoleString(L"\nEntity is the multi-line text");
// Check on belonging
if(pEntity->isKindOf(OdDbMText::desc()))
odPrintConsoleString(L"\nEntity is derived from the multi-line text object");
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|