资源描述:
《Arx编程对实体的基本操作》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、////ObjectARXdefinedcommands,createdby[2010-9-30],,#include"StdAfx.h"#include"StdArx.h"#include"dbents.h"#include"geassign.h"#include"dbpl.h"#definePI3.141592653589793238462643383279502884197169399375105820974944592308BOOLAddEntityToDBS(AcDbEntity*pEntity,AcDbObj
2、ectId&Id){//获取块表AcDbBlockTable*pBlockTable=NULL;if(acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForRead)!=Acad::eOk){returnFALSE;}//获取模型空间的快表记录AcDbBlockTableRecord*pBlkTabRec=NULL;if(pBlockTable->getAt(ACDB_MODEL_SPACE,pBlkTa
3、bRec,AcDb::kForWrite)!=Acad::eOk){pBlockTable->close();returnFALSE;}pBlkTabRec->appendAcDbEntity(Id,pEntity);pEntity->close();pBlockTable->close();pBlkTabRec->close();returnTRUE;}//-----------绘制直线-----------------------------------------------------//Thisiscomman
4、d'CLINE,by[2010-9-30],,voidEICADDrawCLine(){#ifdefOARXWIZDEBUGacutPrintf("OARXWIZDEBUG-EICADDrawCLine()called.");#endif//OARXWIZDEBUG//TODO:Implementthecommandads_pointpt0;ads_pointpt;AcDbObjectIdEntId;if(ads_getpoint(NULL,_T("请指定起始点:"),pt0)!=RTNORM)return;if
5、(ads_getpoint(pt0,_T("请指定终点:"),pt)!=RTNORM)return;AcDbLine*pLine=newAcDbLine(asPnt3d(pt0),asPnt3d(pt));AddEntityToDBS(pLine,EntId);pLine->close();}//-----------编辑直线起点-----------------------------------------------------//Thisiscommand'EDITLSTARTPOINT,by[2010-9-
6、30],,voidEICADDRAWEditlstartpoint(){#ifdefOARXWIZDEBUGacutPrintf("OARXWIZDEBUG-EICADDRAWEditlstartpoint()called.");#endif//OARXWIZDEBUG//TODO:Implementthecommandads_pointpt0;ads_pointpt;ads_nameEnt;AcDbObjectIdEntId;AcDbLine*pLine=NULL;if(ads_entsel(_T("请选择对象
7、:"),Ent,pt0)!=RTNORM)return;if(ads_getpoint(NULL,_T("请选择起点:"),pt)!=RTNORM)return;if(acdbGetObjectId(EntId,Ent)!=Acad::eOk)return;if(acdbOpenObject(pLine,EntId,AcDb::kForWrite)!=Acad::eOk)return;pLine->setStartPoint(asPnt3d(pt));pLine->close();}//------------编辑直
8、线终点------------------------------------------------------//Thisiscommand'EDITLENDPOINT,by[2010-9-30],,voidEICADDRAWeditlendpoint(){#ifdefOARXWIZDEBUGacutPrintf