QCAD.org Forum

Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Hello,I'm encountering a problem when I try to get an entity from the document.I wrote this code to debug the problem, but QCAD-Pro crashes when I execute the queryEntity.I have checked step by step with the debugger and I have seen that document is not null.this.theEntityId is the id of a line obtained with getId() method.Please, anybody can suggest me where I'm wrong?

I create a new document and I draw some lines.I select one ( in this way my script get the id of the selected entity).When I push the "test" button my function is executed.If the application crashes, it crashes also the debugger window.Any idea ?

The reason is that the debugger is consulted regularly. The debugger then processes all queued events. This interferes with the order in which commands are intended to be executed.

Long story short, if your application 'randomly' crashes, disable the debugger which should solve the problem. Only enable the debugger to do actual debugging (step through) and keep in mind that the debugger has an impact on the order in which events are processed.

Andrew, thank you for the hint, it's good to know.Concerning this specific case I've written a test script and I have found that if I set my document in the beginEvent method everything works.I'm pretty new with Javascript, so I post here my code, maybe I'm wrong somewhere.