OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Joel Roderick on April 28, 2014, 06:26:54 AM

Title: 2015 & (command) vs (command-s)
Post by: Joel Roderick on April 28, 2014, 06:26:54 AM
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 (http://help.autodesk.com/cloudhelp/2015/ENU/AutoCAD-AutoLISP/files/GUID-5C9DC003-3DD2-4770-95E7-7E19A4EE19A1.htm).

Title: Re: 2015 & (command) vs (command-s)
Post by: owenwengerd on April 28, 2014, 07:21:50 AM
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.
Title: Re: 2015 & (command) vs (command-s)
Post by: Joel Roderick on April 28, 2014, 07:28:42 AM
It seems to be consistent behavior.

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

Title: Re: 2015 & (command) vs (command-s)
Post by: TopoWAR on October 12, 2016, 07:14:45 AM
Hello, I have the following code was applied to all lisp functions, correct?

Code (autolisp) Select
(if command-s (command-s "line") (command "line"))
Title: Re: 2015 & (command) vs (command-s)
Post by: roy_043 on October 12, 2016, 07:38:41 AM
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" ...)
Title: Re: 2015 & (command) vs (command-s)
Post by: TopoWAR on October 20, 2016, 09:50:45 AM
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))
Title: Re: 2015 & (command) vs (command-s)
Post by: roy_043 on October 20, 2016, 10:41:28 AM
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?
Title: Re: 2015 & (command) vs (command-s)
Post by: TopoWAR on October 20, 2016, 10:45:59 AM
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

Title: Re: 2015 & (command) vs (command-s)
Post by: vosey on February 03, 2017, 01:18:16 AM
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.