Undefine command in LISP

I have trouble using undefine in a lisp program.Can undefine only be used from the keyboard, where it works OK from?This is the code from the LSP file:(command "undefine" "save")(command "undefine" "qsave")(command "undefine" "saveas")I have tried with ".save" but it do not work either.It says error: Function cancelled.Svend

Comments

  • By the way I use the 5.2.0010 release PRO.

  • Try using an underscore before the command name:(command "undefine" "_save")

  • No help, the same error occours.The object is to that I want to purge the drawing automatically before the save function is used,. like this:(defun C:save ( / ) (repeat 3 (command "._purge" "b" "*" "n") ) ; repeat (setvar "filedia" 1) (setvar "cmddia" 1) (command ".save") (princ)) ; defun c:saveAny help is appreciated.

  • The undefine command can only undefine the save command once, or you will have an error (you can't undefine an undefined command). You should undefine it in icad.lsp.Try making a dummy block for each purge, so that the lisp purge command isn't interrupted if there is nothing to purge:(defun C:save ( / ) (repeat 3(command "block" "purgeme" "0,0" "")(command "._purge" "b" "a") ) ; repeat (setvar "filedia" 1) (setvar "cmddia" 1) (command ".save") (princ) ) ; defun c:save

  • I thought that the save, qsave and saveas was 3 different commands.I load my own lisp file from icad.lsp and execute it from my own lisp file. That should be OK.

  • probably the problem is not that undefine does not work, but that it is executed twice on startup. The second time returns a failure

This discussion has been closed.