Deleted Entity still exists

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
RR88
Full Member
Posts: 51
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Deleted Entity still exists

Post by RR88 » Sat Oct 02, 2021 6:32 pm

I have another question.

I want to test, whether an entity has been deleted or not.

Here is the code:

Code: Select all

var ent = doc.queryEntity(id);
var op = new RMixedOperation();
op.deleteObject(ent);
di.applyOperation(op);

var _ent = doc.queryEntity(id);
qDebug(_ent);
// RPolylineEntityPointer(0x54bb100)
Why is _ent not REntityPointer(0x0)?

I think, the reason is, that the entity still exists in history. Also isDeleted(_ent) is not true.
Arch Linux, QCad 3.22.0 Prof.

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

Re: Deleted Entity still exists

Post by andrew » Sat Oct 02, 2021 7:50 pm

Yes, deleted entities still exist for the sake of transaction handling (the undo / redo mechanism of QCAD).

You can check the status of an entity with entity.isUndone().

RR88
Full Member
Posts: 51
Joined: Sun Apr 29, 2018 7:04 am
Location: Leinefelde

Re: Deleted Entity still exists

Post by RR88 » Sat Oct 02, 2021 8:01 pm

Thanks Andreas.
Arch Linux, QCad 3.22.0 Prof.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”