ObjectARX-圆

ObjectARX



//定义圆心、法向向量
AcGePoint3d center(9.0,3.0,0.0);
AcGeVector3d normal(0.0,0.0,1.0);

//初始化圆对象实例
AcDbCircle * pCirc =new AcDbCircle(center,normal,2.0);

//打开块表
AcDbBlockTable * pBlockTable;
acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);

//打开模型空间块表,获得当前块表记录,并关闭块表
AcDbBlockTableRecord * pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
pBlockTable->close();

//向当前块表记录中添加圆对象
AcDbObjectId circleId;
pBlockTableRecord->appendAcDbEntity(circleId,pCirc);

//关闭块表记录及圆对象
pBlockTableRecord->close();
pCirc->close();

你可能感兴趣的:(ObjectARX-圆)