Acad::ErrorStatus CEntityUtil::Rotate(AcDbObjectId entId,const AcGePoint2d &ptBase,double rotation) { //几何变换矩陈 AcGeMatrix3d xform; //向量 AcGeVector3d vec(0.0,0.0,1.0); //设置需要进行的变换 xform.setToRotation(rotation,vec,CConvertUtil::ToPoint3d(ptBase)); //定义实体指针 AcDbEntity *pEnt=NULL; //试图打开实体 Acad::ErrorStatus es=acdbOpenObject(pEnt,entId,AcDb::kForWrite,false); //如果不出错则执行转换 if (es==Acad::eOk) { es=pEnt->transformBy(xform); pEnt->close(); } return es; }