ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

change the xdata of an Entity

1 REPLY 1
Reply
Message 1 of 2
Anonymous
215 Views, 1 Reply

change the xdata of an Entity

Hello,

I created a Blockreference that contains xdata. After this I want to change
the values of the of xdata without erasing the whole Blockreference. I did
not find a methode like RemoveXdata (in the opposite to setXData). If I use
setXData serveral times for the same Entity did it automatically overwrites
the old xdata ? The follwing sample code works, but Im not sure if it is a
legal way to exchange the Xdata ?

(code without any errorchecking)
...
acdbRegApp(szAppname);
xdata=acutBuildList(...........) // My First Data
acdbOpenObject(pObj,eId,AcDb::kForWrite);
pObj->setXData(xdata);
pObj->close();
acutRelRb(xdata);
....

...
acdbRegApp(szAppname);
xdata=acutBuildList(...........) // My Changed Data
acdbOpenObject(pObj,eId,AcDb::kForWrite);
pObj->setXData(xdata);
pObj->close();
acutRelRb(xdata);
....

Thank you
Jörg


PS: Thanks Art Cooney for ansering my last question
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

setXData() will replace any xdata with the same RegApp name as that in the
data being passed into it. So, what you are doing is fine (and is the only
way to do it). If you pass in a RegApp name with no data after it, then
that RegApp name and any data associated with it will be removed from the
object.

"Jörg Kühne" wrote in message
news:1303D6282BB2B6BE459C8908412E7AF4@in.WebX.maYIadrTaRb...
> Hello,
>
> I created a Blockreference that contains xdata. After this I want to
change
> the values of the of xdata without erasing the whole Blockreference. I did
> not find a methode like RemoveXdata (in the opposite to setXData). If I
use
> setXData serveral times for the same Entity did it automatically
overwrites
> the old xdata ? The follwing sample code works, but Im not sure if it is a
> legal way to exchange the Xdata ?
>
> (code without any errorchecking)
> ...
> acdbRegApp(szAppname);
> xdata=acutBuildList(...........) // My First Data
> acdbOpenObject(pObj,eId,AcDb::kForWrite);
> pObj->setXData(xdata);
> pObj->close();
> acutRelRb(xdata);
> ....
>
> ...
> acdbRegApp(szAppname);
> xdata=acutBuildList(...........) // My Changed Data
> acdbOpenObject(pObj,eId,AcDb::kForWrite);
> pObj->setXData(xdata);
> pObj->close();
> acutRelRb(xdata);
> ....
>
> Thank you
> Jörg
>
>
> PS: Thanks Art Cooney for ansering my last question
>
>
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost