how to check an undefined command ?

Discussion in 'AutoCAD' started by MRL, Aug 17, 2003.

  1. MRL

    MRL Guest

    Hello,

    I'm trying to undefine a command in a seperate LISP-file.
    In my routine the file is loaded twice or more.
    (That is why i get the error: "unknown command")

    (command "._UNDEFINE" "ETRANSMIT")
    (defun C:ETRANSMIT ()
    (alert "Do not use this command.")
    (prompt "\nDo not use this command.")
    (princ)
    )

    It's to complex in my whole routine to load it once, so
    how can i check if the command is already undefined?
     
    MRL, Aug 17, 2003
    #1
  2. MRL

    Kevin Nehls Guest

    From that comment right there, that's a very good clue that you need to
    do some major re-writing. You should only have to put your code in 1
    place and have it work for everything you need. There should be no need
    to have the same code in more than 1 place.

    To answer your question here is a hack:

    (defun undef_etransmit ()
    (if (not #globalUndefEtransmit)
    (progn
    (command "._UNDEFINE" "ETRANSMIT")
    (defun C:ETRANSMIT ()
    (alert "Do not use this command.")
    (prompt "\nDo not use this command.")
    (princ)
    )
    (setq #globalUndefEtransmit t)
    )
    )
    (princ)
    )

    Then just call (undef_etransmit) anytime you want to make sure it's
    undefined.

    Kevin
     
    Kevin Nehls, Aug 18, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.