- UID
- 1
- 积分
- 15891
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
If you try to handover the object id of a Transaction resident object with a new object, you will receive an error eInvalidContext. In fact, you cannot call the function handOverTo() on Transaction resident objects. This means that you have to switch to common way to open the object (acdbOpenObject). This also applies to .NET. bool test()
{
ads_name ename;
ads_point ptResult;
ads_matrix adsmat;
struct resbuf *info;
// select one entity
int rt = acedNEntSelP(_T("\nselect an entity:"),
ename,
ptResult,
false ,
adsmat,
&info);
if( rt!= RTNORM)
{
acutPrintf(_T("\nFailure in acedNEntSelP"));
return false;
}
AcDbObjectId old__ent_id;
acdbGetObjectId(old__ent_id,ename);
AcDbCircle* newCircle =
new AcDbCircle(
AcGePoint3d(0,0,0),
AcGeVector3d(0,0,1),
10);
// correct usage
AcDbObject *pObj;
Acad::ErrorStatus es1 =
acdbOpenObject(pObj,old__ent_id,AcDb::kForWrite);
if (pObj == NULL)
return false;
Acad::ErrorStatus es =
pObj->handOverTo(newCircle);
if (es ==
Acad::eObjectToBeDeleted)
{
newCircle->close();
delete pObj;
return true;
}
else
{
pObj->close();
return false;
}
// wrong usage: with Transaction
/* AcTransaction *pTrans =
actrTransactionManager->startTransaction();
AcDbObject *pObj;
pTrans->getObject(pObj,
old__ent_id,
AcDb::kForWrite);
if (pObj == NULL)
return false;
// will get eInvalidContext
Acad::ErrorStatus es =
pObj->handOverTo(newCircle);
if (es ==
Acad::eObjectToBeDeleted)
{
delete pObj;
actrTransactionManager->endTransaction();
return true;
}
else
{
actrTransactionManager->abortTransaction();
return false;
}
*/
}
|
|