Author Topic: problem with (command) in autolisp  (Read 2713 times)

0 Members and 1 Guest are viewing this topic.

fathihvac

  • Guest
problem with (command) in autolisp
« 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.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: problem with (command) in autolisp
« Reply #1 on: April 17, 2013, 10:58:56 AM »
Call your command with:
Code: [Select]
(c:MyCustomCommand)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: problem with (command) in autolisp
« Reply #2 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
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: problem with (command) in autolisp
« Reply #3 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  ;-)