您的位置:首页 > 移动开发 > Objective-C

ObjectARX学习笔记(十)----如何创建单行文本AcDbText

2014-03-01 16:29 801 查看
AcDbText(
const AcGePoint3d& position,
const ACHAR* text,
AcDbObjectId style = AcDbObjectId::kNull,
double height = 0,
double rotation = 0
);


Parameters

Parameters
Description
const AcGePoint3d& position
Input insertion point for the text
const ACHAR* text
Input text string to be used as displayed text.
AcDbObjectId style = AcDbObjectId::kNull
Input object ID of the
AcDbTextStyleTableRecord to use
double height = 0
Input height of the shape
double rotation = 0
Input rotation angle (in radians) for the text about its OCS Z axis 
AcGePoint3d ptSart(0,0,0);
AcDbText  *pTextEntity = new AcDbText(ptSart,_T("你好啊"),AcDbObjectId::kNull,100,0);
if (pTextEntity == NULL)
return;
  //将实体添加到模型空间是固定的代码,
AcDbDatabase* pDb = NULL;
pDb = acdbHostApplicationServices()->workingDatabase();
if (pDb == NULL)
return ;

AcDbBlockTable * pBlkTable ; 
if(pDb->getBlockTable(pBlkTable , AcDb::kForRead) != Acad::eOk ) 
return ;

AcDbBlockTableRecord * pRec ;
if(pBlkTable->getAt(ACDB_MODEL_SPACE , pRec , AcDb::kForWrite) != Acad::eOk) 
return ;
pBlkTable->close();

AcDbObjectId objId = AcDbObjectId::kNull;

if(pRec->appendAcDbEntity(objId, pTextEntity) != Acad::eOk)  //将线添加到dwg中
return ;

pTextEntity->close() ;
pRec->close() ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息