(command) will not cancel
- Hi,
- if I try to cancel via ... (while(/= 0(getvar 'CMDACTIVE))(command)(getstring "foo")) ... a runnig eg. Line Command ... (command) will not cancel?
- try ...
- command: _line [ENTER]
- ... paste in the expression ...
-
(while(/= 0(getvar 'CMDACTIVE))(command)(getstring "foo"))[ENTER]
... than (getstring "foo") should NOT appear!
... (getstring "foo") is neccessary because without you can not ESC while ... and BC crashes!
In AC cancel the running Line-command with ... (while(/= 0(getvar 'CMDACTIVE))(command)) ... works normaly ... canceling Line.
Can you confirm this?
Thanks in Advance ...
Peter
Comments
-
Yes this seems to be different than in Acad. I tried V15 and V16 also. All the same.
0 -
@martin ...
If I use an if-statement it will cancel ... just while do not work.
Thanks for the check ... !
peter0 -
Hi Peter :-)
indeed, looks a bit strange, from first impression ...
so I verified with AutoCAD 2014 + 2017, and it is exactly the same.The "(while ...)" statement should return the last-evaluated value :
(while (/= 0 (getvar 'CMDACTIVE))(command)(getstring "foo"))and that last-evaluated expression is just (getstring "foo"), after (command) - the (command) to cancel is effectively cancelled yet,
then (getstring "foo") follows - that is what you see :-)In opposite, the (if ...) statement only evaluates (command) ...
so I guess the mystery should be clear now ?many greetings !
0 -
@Torsten Moses
Hi Torsten ... große Freude von Dir zu hören !!!No Torsten, the mystery is NOT CLEAR NOW!
I found this lisp line in Owen's OpenDCL-Demo in the error function.
First it looks "like usual" ... but than I tried this line in BricsCAD.If you try the exression ... as input through a normal _Line command ...
(while (/= 0 (getvar 'CMDACTIVE))(command))
... consider: without (gestring "foo") ... BricsCAD crashes ... in an endless while hour-glass-cursor.
(getstring "foo") is just for the reason there, that you can prohibit the crash in BricsCAD by hitting ESC.Thanks in advance ...
Peter0 -
Dear Peter,
it is clearly the wrong Lisp code :-)
the "while" statement processes any statement inside the loop - but "if" statement only 1 of the 2 statements ...
the crash is, as the while loop never ends, without the extra (getstring) ... it runs endless, because the LINE command is still active;
this means, the (command) statement is not properly processed here ... in opposite to the variant with "if" statement.I verified :
(while (/= 0 (getvar 'CMDACTIVE))(command))
and indeed, endless loop (till stack overflow & crash)I will check this problem, to get it fixed.
Best, send us a SupportRequest as well, so we have this problem in our database, for later references - thanks in advance !So as workarounf the "(if ...)" code version can be used, it is safe + proper.
many greetings ! :-)0 -
@torsten ...
exactly ... thanks for your attention ...
peter0 -
Dear Peter,
the endless loop is now fixed ... happens only in that particular code scenario ...
does not happen when used in "normal" Lisp file ...I marked our fix to be included in V17.2 ... so you might check then, once published :-)
many greetings !0