马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
接受LISP参数,交换两个实体的OBJECTID
![](source/plugin/imc_colorcode/images/loading.gif) - int ObjectSwapId()
- {
- resbuf *rb=ads_getargs();
- if (!rb)
- return RSRSLT;
- if (rb->restype != RTENAME)
- return RSRSLT;
- AcDbObjectId srcId,destId,ownId;
- Acad::ErrorStatus es;
- es=acdbGetObjectId(srcId,rb->resval.rlname);
- if (es !=Acad::eOk)
- return RSRSLT;
- AcDbObject *pObj1,*pObj2;
- es=acdbOpenObject(pObj1,srcId,AcDb::kForWrite,true);
- if (es != Acad::eOk)
- return RSRSLT;
- rb=rb->rbnext;
- if (rb->restype != RTENAME)
- return RSRSLT;
- es=acdbGetObjectId(destId,rb->resval.rlname);
- if (es !=Acad::eOk)
- return RSRSLT;
- es=acdbOpenObject(pObj2,destId,AcDb::kForRead,true);
- if (es != Acad::eOk)
- {
- pObj1->close();
- return RSRSLT;
- }
- pObj2->close();
- es=pObj1->swapIdWith(destId,TRUE,TRUE);
- if (es == Acad::eOk)
- ads_rett();
- pObj1->close();
- return RSRSLT;
- }
|