2015 & (command) vs (command-s)

Started by Joel Roderick, April 28, 2014, 06:26:54 AM

Previous topic - Next topic

Joel Roderick

I haven't completely researched this, but wanted to get a post started to potentially save some headaches.  I have code that works in 2010-2014 but crashes in 2015.  I have isolated the issue to event functions that use (command) or (vl-cmdf).

I was able to resolve the crash by swapping (command) with (command-s).  My suspicion is that this is some sort of asynchronous/synchronous issue introduced in 2015.

So far simply replacing (command) or (vl-cmdf) with (command-s) has fixed the issue.

I think (command-s) was introduced in 2014.  The differences are documented here:
http://help.autodesk.com/cloudhelp/2015/ENU/AutoCAD-AutoLISP/files/GUID-5C9DC003-3DD2-4770-95E7-7E19A4EE19A1.htm.

Joel Roderick
Water Technology, Inc.

owenwengerd

Do the crashes occur every time you call (command), or is this in intermittent problem? I haven't done any testing with (command) in 2015, but I will take a look to see if there's anything I could do in OpenDCL to prevent the crashes.

Joel Roderick

It seems to be consistent behavior.

I have had to change each call to (command).  All is working fine now.

Joel Roderick
Water Technology, Inc.

TopoWAR

Hello, I have the following code was applied to all lisp functions, correct?

Code (autolisp) Select
(if command-s (command-s "line") (command "line"))
http://topowar.org - Programa para Topografía y Catastro para Costa Rica.

roy_043

I would use:
Code (autolisp) Select
((if command-s command-s command) "line" ...)
Or:
Code (autolisp) Select
(if (not command-s) (setq command-s command))
...
(command-s "line" ...)

TopoWAR

roy,
hello, I initially try to use this option, but I open each drawing gives me this message:

assignment to protected symbol:
COMMAND
enter break loop?

yes no


Code (autolisp) Select
(if (not command-s) (setq command-s command))
http://topowar.org - Programa para Topografía y Catastro para Costa Rica.

roy_043

I don't understand the error message. How can command-s be a protected symbol in an AutoCAD version that does not even have that Lisp function?

Mind you, I can't get either of my suggestions to work on BricsCAD V12 (the last version without command-s). :-[
The First suggestion does work on later BricsCAD versions.

Does my first suggestion work on AutoCAD?

TopoWAR

#7
the error is in autocad, I guess you can not replace command-s by command, should be a protected function and therefore the error, right message?

Code (autolisp) Select
(if (not command-s) (setq command-s command))
assignment to protected symbol:
COMMAND
enter break loop?

yes no

http://topowar.org - Programa para Topografía y Catastro para Costa Rica.

vosey

Hi...  Just wondered whether this issue is likely to be resolved, or do we need to update our code to remove instances of 'command' and 'vl-cmdf'?.  I am experiencing what appears to be a similar issue to those previously reported.  My lisp code runs fine in any Acad version up to and including Acad Release 2013, but now when using Acad Map3d 2017 I cannot seem to get past any 'command' of 'vl-cmdf' calls irrespective of whether or not an OpenDCL Dialog is 'live'.
  What's happening is that any AutoCAD 'command' or 'vl-cmdf' call (from my lisp file) will display the most recently loaded odcl dialog box (although the box has been closed earlier), and when any button is pressed on the 'unwanted' dialog, the system will pause for a few seconds, and then a 'Fatal Error' will invoke.   Changing 'command' and 'vl-cmdf' to 'command-s' seems to get over the problem, but I have tens of thousands of lines of code spread widely and the task of updating virtually all of them fills me with dread.  I have to add that I think OpenDCL is a fantastic tool, and I'm happy to update my code if that's the only way through this.