autocad2008利用objectarx二次开发,从画出的圆中得到它的圆心坐标和半径,怎样编程实现
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 03:25:43
autocad2008利用objectarx二次开发,从画出的圆中得到它的圆心坐标和半径,怎样编程实现
autocad2008利用objectarx二次开发,从画出的圆中得到它的圆心坐标和半径,怎样编程实现
autocad2008利用objectarx二次开发,从画出的圆中得到它的圆心坐标和半径,怎样编程实现
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;
}