码迷,mamicode.com
首页 > 其他好文 > 详细

ARX中实现实体的偏移

时间:2014-10-07 13:14:43      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:os   ar   for   c   on   cti   r   ad   as   

static AcDbObjectId OffsetEnty(const ACHAR* BlkName,AcDbObjectId entId,double OfsValue,AcDbDatabase *pDb=CrtEntity:: pPurDb);
//!(多段线特别处理)

AcDbObjectId EditEntity::OffsetEnty(const ACHAR* BlkName,AcDbObjectId entId,double OfsValue,AcDbDatabase *pDb)
{
AcDbEntity *pEnt;
AcDbCurve *pCurv;
AcDbVoidPtrArray offCurvs;
AcDbBlockTable *pBlkTable;
AcDbBlockTableRecord *pBlkTableRecord;
ErrorStatus es;
/*Acad::ErrorStatus es;*/
AcDbObjectId objctid;
es=acdbOpenObject(pEnt, entId, AcDb::kForRead);
if((pCurv = AcDbCurve::cast(pEnt)) == NULL){
pEnt->close();
return NULL;
}
es=pCurv->getOffsetCurves(OfsValue, offCurvs);
if(es!= Acad::eOk){
pEnt->close();
/*acedAlert("设置偏移失败!");*/
return AcDbObjectId::kNull;
}
pEnt->close();
if(!offCurvs.isEmpty()){
pDb->getBlockTable(pBlkTable, AcDb::kForRead);
pBlkTable->getAt(BlkName, pBlkTableRecord, AcDb::kForWrite);
pBlkTable->close();
for(int i = 0; i < offCurvs.length(); i++){
pEnt = (AcDbEntity*)offCurvs.at(i);
pBlkTableRecord->appendAcDbEntity(objctid, pEnt);
}
pEnt->close();
pBlkTableRecord->close();
return objctid;
}
else{
return AcDbObjectId::kNull;
}
}

ARX中实现实体的偏移

标签:os   ar   for   c   on   cti   r   ad   as   

原文地址:http://www.cnblogs.com/swtool/p/4009112.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!