Page 1 of 1

Entity Id change after save

Posted: Wed Dec 20, 2017 12:31 pm
by saibou
Hello,

My question is about persistence of Entity Id :
I have a Transaction listener that is installed at qcad start-up, for showing entity line Id when it's affected.
And I do this scenario :
I draw a Line base on tool Line2P, and I see through the listener, that the line entity have 47 as Id (screen1).
Whatever change I make on the line after that I keep seeing the same Id 47 (screen2).
I save the document with name myTestObjId, I close qcad.
And I open this my document myTestObjId, now I see onother Id for my line : 48 !! (screen3)
If Entity Id, isn't persistent after save, what information is persistent after save ?
(I join screenshots that shows the scenario described with the results)

Thanks in advance !

Re: Entity Id change after save

Posted: Wed Dec 20, 2017 4:55 pm
by andrew
Object IDs are not persistent.
Object handles should be used if a persistent reference to an object is needed.

RObject::getHandle();

Re: Entity Id change after save

Posted: Thu Dec 21, 2017 11:12 am
by saibou
Thanks for responding, but still I have the same issue using handles :
Before I save the document my object handle is 47.
And after I save the document and I reopen it, handle of object changed to 89.
I need to have something persistent after save and reopening.

Thanks again !

Re: Entity Id change after save

Posted: Thu Dec 28, 2017 12:00 pm
by andrew
I just saw that you are using dxflib to write the file.
I should have mentioned that handles are only persistent using the QCAD Professional Teigha based filters for exporting / importing DXF/DWG.