TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: fathihvac on April 17, 2013, 10:28:18 AM

Title: problem with (command) in autolisp
Post by: fathihvac on April 17, 2013, 10:28:18 AM
Hello,

  When using autolisp custom commands in the following code :
(command "MyCustomCommand")  it gives "unknown command press "F1" for help" ,to your knowledge the autolisps are already loaded and my custom commands run when i launche them from my custom toolbar.Any help.

Sorry for my poor english.
Title: Re: problem with (command) in autolisp
Post by: Lee Mac on April 17, 2013, 10:58:56 AM
Call your command with:
Code: [Select]
(c:MyCustomCommand)
Title: Re: problem with (command) in autolisp
Post by: irneb on April 17, 2013, 02:00:34 PM
Yep, unfortunately acad cannot call one lisp command from another lisp using the command function. And even if you do as Lee's shown, you can't send that command any arguments (e.g. if your custom command asked to select entities).

The only alternative is to split the original command into a normal lisp defun and a c:* defun which calls it using arguments:
http://forums.augi.com/showthread.php?141343-Activating-a-command-within-another-custom-command
http://forums.augi.com/showthread.php?113909-Calling-up-LISP-routine-from-within-another-LISP
Title: Re: problem with (command) in autolisp
Post by: Lee Mac on April 17, 2013, 05:48:53 PM
Yep, unfortunately acad cannot call one lisp command from another lisp using the command function.

Unless the vlax-add-cmd function has been used  ;-)