使用以下代码设置文字居中:
pText->setAlignmentPoint(OdGePoint3d(outlineCenter.x(), outlineCenter.y(), outlineCenter.z()));
并通过以下方式设置文字对齐:
pText->setHorizontalMode(OdDb::TextHorzMode::kTextCenter );
pText->setVerticalMode(OdDb::TextVertMode::kTextVertMid) ;
adjustAlignment()方法会在文字实体关闭时自动调用,但也可在添加到块后直接调用:
m_blockTableRecordPtr->appendOdDbEntity(pText);
pText->adjustAlignment(NULL);