More redefine problems

Gordon Price

Usenet Archive
Joined
Jul 14, 2003
Messages
203
Reaction score
0
Can someone explain what is going on here. My wee bit of code is:

(command "undefine" "mtext")
(defun c:mtext (/)
(alert "mtext")
(SetQ LE (entlast))
(initdia 1)
(command ".mtext" pause pause)
(while (= (logand (getvar "CMDACTIVE") 1) 1)(command pause)) (If (= (entlast) LE)(alert "Function cancelled"))
);defun

Everything works right the first time I run it, but the second time it seems the old command runs (ie no alert box). Do I just have end of the year brain cramps and I am missing something obvious?

Thanks,
Gordon
 
It doesn't work for me a bit, I get an "unknown command" at the first ".mtext" call. Strangely enough, if I undefine mtext, I get an unknown command from both (command ".mtext") and by entering .mtext at the command prompt, whereas any other undefined command works fine treated this way. How odd, maybe some other variable affects this?
 
From the 2004 help:
"For ObjectARX application commands registered via acedRegCmd, you can access them by preceding the command name with a period (.), followed by the command's group name, followed by another period (.). For example, the MTEXT command can be accessed with .acad_mtext.mtext."

So, try...
(command "_.acad_mtext.mtext")
(while (> (getvar "cmdactive") 0)(command pause)
 
Maybe this will shed some light on the matter. From the help file for the
Undefine command:

For ObjectARX application commands registered via acedRegCmd, you can access them by preceding the command name with a period (.), followed by the command's group name, followed by another period (.). For example, the MTEXT command can be accessed with .acad_mtext.mtext.
HTH,

Jeff
 
John Uhden said:
From the 2004 help:
"For ObjectARX application commands registered via acedRegCmd, you can access them by preceding the command name with a period (.), followed by the command's group name, followed by another period (.). For example, the MTEXT command can be accessed with .acad_mtext.mtext."

So, try...
(command "_.acad_mtext.mtext")
(while (> (getvar "cmdactive") 0)(command pause)

Guys, I tried
(command ".acad_mtext.mtext" pause pause)
(while (= (logand (getvar "CMDACTIVE") 1) 1)(command pause)) And still only the first execution works. However, LINE works just fine. But I can't get DIMLINEAR to work at all. Argh!!! Not to mention, when I look at all the U functions I get only unload_dialog and untrace, and when I search for acedRegCmd the only reference I get is in vlax-add-cmd, not the one you both quoted. Do you guys have an updated help file that I don't have perhaps? Is there any way to verify help file version numbers? I am running ADT SP2 (but as Vanilla Acad due to ongoing office waffling on ADT!) so I would expect to have all the updates, but maybe not.

My goal here is to automatically manage layers for Mtext, dimensions and a bunch of office standard blocks, and do the non block stuff with redefined commands so that any method (command line, toolbar, toolpalette, whatever) gets the office standard version. Maybe I am just barking up the wrong tree here?

Best,
Gordon
 
Gordon,
John's suggestion works for me.

(command "undefine" "mtext")

(defun c:mtext (/ *error*)
(alert "mtext")
(SetQ LE (entlast))
(initdia 1)
(command ".acad_mtext.mtext" pause pause)
; (while (= (logand (getvar "CMDACTIVE") 1) 1)(command pause)) <--this line is pointless (alert "done")
);defun

You are probably barking up the wrong tree. A database reactor could do the layering you want. Have you looked at Eric Schnider's AutoLay? Check posts a year or two ago.
 
Doug Broad said:
Gordon,
John's suggestion works for me.

Now this getting wierd. I did a cut & paste of your code right into Acad, still no alert boxes on subsiquent executions. Maybe I have some crazy sysvar set. Maybe annoyGordon=1. Hmm...
You are probably barking up the wrong tree. A database reactor could do the layering you want. Have you looked at Eric Schnider's AutoLay? Check posts a year or
two ago.
I will have to look into that. I was hoping to do it home grown, and use it as an excuse to really learn VLisp a little better. I also have the unrealistic fantasy that I might actually understand vl-catch-all-apply and lambda before it is all over;)

Best,
Gordon
 
Doug!
Something's wrong!
After Alert and making MText rectangle I get only:

Command: ; error: invalid AutoCAD command: "\\"

What will you say?
 

Latest threads

Back
Top