autocad2008利用objectarx二次开发,从画出的圆中得到它的圆心坐标和半径,怎样编程实现

2020-05-22 社会 81阅读
void GetCircleInfo()
{
ads_name ent;
ads_point p1;
while(acedEntSel(_T("\n选择圆:"),ent,p1)==RTNORM){
AcDbObjectId id;
if(Acad::eOk != acdbGetObjectId(id,ent)) continue;
AcDbEntity* pEnt;
if (Acad::eOk != acdbOpenAcDbEntity( pEnt, id, AcDb::kForRead, Adesk::kFalse )) continue;
if(pEnt->isKindOf(AcDbCircle::desc())){
AcDbCircle *pCircle = (AcDbCircle *)pEnt;
double radius = pCircle->radius();
AcGePoint3d pCen = pCircle->center();
CString msg;
msg.Format(_T("圆心:(%.f,%.f), 半径:%.f"),pCen.x,pCen.y,radius);
AfxMessageBox(msg);
}
else
{
AfxMessageBox(_T("不是圆弧!"));
}
pEnt->close();
}
return;
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com