AcDbCircle( const AcGePoint3d& cntr, const AcGeVector3d& nrm, double radius );
Parameters
|
Description
|
const AcGePoint3d& cntr
|
Input center point for the circle
|
const AcGeVector3d& nrm
|
Input normal vector for circle
|
double radius
|
Input radius for circle
|
Initializes the circle with the arguments cntr, nrm, and radius.
Both center and normal must be in WCS coordinates. normal must be nonzero length and radius must be greater than zero.
//创建圆
AcGePoint3d ptSart(0,0,0);AcDbCircle *pCircle = new AcDbCircle(ptSart,AcGeVector3d(0,0,1),200);
if (pCircle == NULL)
{
return;
}
pCircle->setColorIndex(1); //这里暂订设置为红色,根据需要自行修改
//将实体添加到模型空间是固定的代码,
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, pCircle) != Acad::eOk) //将线添加到dwg中
return ;
pCircle->close() ;
pRec->close() ;