诸位朋友,如何 用setxdata 方法删除实体扩展数据?
我是这样做的,但是错了....我调了一晚上,郁闷的很.
void clearname(AcDbPolyline* pPolyline)
{ structresbuf*pRb=NULL;
pPolyline->upgradeOpen();
pPolyline->setXData(pRb);
pPolyline->close();
acutRelRb(pRb);
}
我 pRb->...type=1001也试过 不行. 我试过,可以的.
pRb->restype=1001;
pTemp = pRb;
pTemp->rbnext=NULL;
pObj->setXData(pRb)
//----------------------------------------------------------------------------------------------------
// created: 22/7/2006 17:53 ShangHai
// author:  iPi
// purpose: Delete X-Data of a entity, no matter if there is X-Data attached to the entity
// when we fail to store a flange,but some information has already been added as x data,
// we need to delete these x data for consistency
//----------------------------------------------------------------------------------------------------
bool DelXData(AcDbObjectId adoiEntity)
{
//Open the entity for editing
AcDbEntity *padEntity;
if (acdbOpenAcDbEntity(padEntity, adoiEntity, AcDb::kForWrite) != Acad::eOk) {
return false;
}//end if
//Get x data result buffer of the entity
resbuf *rbXdata = padEntity->xData(NULL);
//result buffer not null
if (rbXdata) {
rbXdata->rbnext = NULL;
padEntity->setXData(rbXdata);
acutRelRb(rbXdata);
}//end if
padEntity->close();
return true;
}//end of function : DelXData()
兄弟 太谢谢你了
页:
[1]