How t o Delete XData from an Object?

How t o Delete XData from an Object?

Anonymous
Not applicable
2,080 Views
4 Replies
Message 1 of 5

How t o Delete XData from an Object?

Anonymous
Not applicable
How can I delete, remove or erase XData from an Object?
0 Likes
Accepted solutions (1)
2,081 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
This is what technical document of Object ARX saying

To delete extended data
1. Call acdbEntGet() to retrieve the entity.
2. Add to the end of the list returned by acdbEntGet() a resbuf with a restype of -3.
3. Add to the end of the list another resbuf with a restype of 1001 and a resval.rstring set to .

Thanks !
KIMI
0 Likes
Message 3 of 5

Anonymous
Not applicable
Accepted solution
Hi, mbasa!
Try this sample:
[code]
=========Beginning of the citation==============
static void RemoveXdata(void)
{
ads_name en;
ads_point pt;
Acad::ErrorStatus es;
if (acedEntSel("\nSelect entity: ", en, pt) != RTNORM)
return;

AcDbObjectId objId; acdbGetObjectId(objId, en);

AcDbObjectPointer pEnt(objId,AcDb::kForWrite);
if ((es = pEnt.openStatus()) != Acad::eOk) {
acutPrintf("\nError open entity: %s", acadErrorStatusText(es));
return;
}
resbuf *xdata = NULL;
while ((xdata = pEnt->xData(NULL)) != NULL) {
resbuf *xdata_next = xdata->rbnext;
xdata->rbnext = NULL;
pEnt->setXData(xdata);
xdata->rbnext = xdata_next;
acutRelRb(xdata);
}
}
=========The end of the citation================
[/code]

Best Regards,
Alexander Rivilis.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Thanks!!

This resbuf struct is very hard to understand at the beginning, but it is very simple though:)
0 Likes
Message 5 of 5

Anonymous
Not applicable
Of course using lisp it's much simpler, see this thread:
http://discussion.autodesk.com/thread.jspa?threadID=12329
0 Likes