Entity Id change after save

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Entity Id change after save

Post by saibou » Wed Dec 20, 2017 12:31 pm

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 !
Attachments
screen1.PNG
screen1.PNG (68.79 KiB) Viewed 5416 times
screen2.PNG
screen2.PNG (77.07 KiB) Viewed 5416 times
screen3.PNG
screen3.PNG (67.36 KiB) Viewed 5416 times

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Entity Id change after save

Post by andrew » Wed Dec 20, 2017 4:55 pm

Object IDs are not persistent.
Object handles should be used if a persistent reference to an object is needed.

RObject::getHandle();

saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Re: Entity Id change after save

Post by saibou » Thu Dec 21, 2017 11:12 am

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 !

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Entity Id change after save

Post by andrew » Thu Dec 28, 2017 12:00 pm

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.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”