|
接受LISP参数,交换两个实体的OBJECTID
- 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;
- }
复制代码 |
|