Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Check if a command is undefined

120 views
Skip to first unread message

Alan Henderson @ A'cad Solutions

unread,
Jun 9, 2004, 12:54:26 PM6/9/04
to
I've written a startup ACADDOC.lsp that undefines MTEXT.
When I start AutoCAD 2002 I get an error "Unknown command name." when (command "UNDEFINE" "MTEXT") runs in the startup routine.
I checked to make sure that is the offending line in the file.
I am also undefining the TEXT and DTEXT command and I am not having a problem with undefining these commands.
 
If I create a new drawing or open an existing drawing after the first error, I get the same error.
If I then use (command "UNDEFINE" "MTEXT") or issue the Undefine command from command prompt, for any new or existing drawing in the current session, the startup program works properly.
 
I'm wondering if I should check to make sure the command is all ready undefined.
 
Is there a method using Lisp or VLA functions to see if a command is undefined?
Or has anyone else run into this problem.

Jeff Mishler

unread,
Jun 9, 2004, 3:05:00 PM6/9/04
to
I believe that Mtext is NOT an internal Acad command, but rather an
externally loaded ARX application and is not loaded until it is needed,
which why it can't be undefined.

Jeff

"Alan Henderson @ A'cad Solutions" <REMOV...@acadsolutions.biz> wrote in
message news:40c740e9$1_1@newsprd01...

Paul Turvill

unread,
Jun 9, 2004, 8:41:25 PM6/9/04
to
Huh?

Command: MTEXT
Current text style: DIMS. Text height: 4 1/2"
Specify first corner: *Cancel*

Command: UNDEFINE Command name: *Cancel*

Command: MTEXT
Current text style: DIMS. Text height: 4 1/2"
Specify first corner: *Cancel*

Command: UNDEFINE
Command name: MTEXT

Command: MTEXT
Unknown command "MTEXT". Press F1 for help.
___

Enter Insert key to select menu item.
"Jeff Mishler" <mi...@USESsonic.net> wrote in message
news:40c75f5d_1@newsprd01...

Paul Turvill

unread,
Jun 9, 2004, 8:44:00 PM6/9/04
to
Oops ... posted more than I intended:

Command: MTEXT
Current text style: DIMS. Text height: 4 1/2"
Specify first corner: *Cancel*

Command: UNDEFINE
Command name: MTEXT

Command: MTEXT
Unknown command "MTEXT". Press F1 for help.


At any rate, the MTEXT command *can* be undefined.


Jeff Mishler

unread,
Jun 9, 2004, 8:51:37 PM6/9/04
to
Starting a new drawing....

Regenerating model.

Initializing....
.Done.
Initializing VBA System...
Loading VBA startup file...
AutoCAD Express Tools Copyright © 2000 Autodesk, Inc.
undefine Enter command name: plot
AutoCAD menu utilities loaded.
Command: undefine
Enter command name: mtext

Unknown command name.

Command:

OK Do something that uses the mtext editor....

Command: mtext ;;;;;;;;HERE IT TAKES A MOMENT TO LOAD
Current text style: "Standard" Text height: 0.2000
Specify first corner:
Specify opposite corner or [Height/Justify/Line
spacing/Rotation/Style/Width]:

Command: undefine
Enter command name: mtext

Command: mtext


Unknown command "MTEXT". Press F1 for help.

My point was, the arx is not loaded until the command is used. Once used the
command interpreter knows it is a command so THEN it can be
undefined....whew! Since the acad.lsp is loaded prior to a call to the mtext
command, trying to undefine it there fails.

Jeff

"Paul Turvill" <nos...@turvill.com> wrote in message
news:40c7ae38_3@newsprd01...
> Huh?
>


Alan Henderson @ A'cad Solutions

unread,
Jun 9, 2004, 9:12:56 PM6/9/04
to
Thanks Jeff!!! That solves my problem. I just need to use mtext then I can
undefine it.

FYI, that is curious, that mtext is not a member of AutoCAD base commands.
Maybe it's not a "finished" command???


Doug Broad

unread,
Jun 9, 2004, 10:59:20 PM6/9/04
to
Alan,
You could also do this
(arxload "acmted")
(command "undefine" "mtext")


"Alan Henderson @ A'cad Solutions" <REMOV...@acadsolutions.biz> wrote in message news:40c7b5c0$1_3@newsprd01...

Tony Tanzillo

unread,
Jun 9, 2004, 10:30:46 PM6/9/04
to
MTEXT is an externally defined command. Its implementation
is demand loaded, so at the start of the editing session,
it will not be recognized as a command until the first time
it is issued.

For externally defined commands, you don't have to UNDEFINE
them to replace them with LISP, if the command hasn't been
invoked yet.

The following is the general pattern for replacing either
a built-in or externally defined, demand-loaded command:

(if (getcname "MTEXT")
(command "._UNDEFINE" "MTEXT")
)

(defun C:MTEXT ()
(princ "\nHere is the replacement command for MTEXT")
(princ)
)

If you run the above at startup, you'll see that the
replacement command is used when you issue MTEXT at
the command line, even if the MTEXT command was not
undefined.


--
http://www.caddzone.com

AutoCAD based Security Planning Solutions:
http://www.caddzone.com/securityplanning

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com


"Paul Turvill" <nos...@turvill.com> wrote in message news:40c7ae38_3@newsprd01...

0 new messages