More redefine problems

Discussion in 'AutoCAD' started by Gordon Price, Jan 2, 2004.

  1. Gordon Price

    Gordon Price Guest

    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
     
    Gordon Price, Jan 2, 2004
    #1
  2. Gordon Price

    Tom Smith Guest

    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?
     
    Tom Smith, Jan 2, 2004
    #2
  3. Gordon Price

    John Uhden Guest

    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)
     
    John Uhden, Jan 2, 2004
    #3
  4. Gordon Price

    Jeff Mishler Guest

    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
     
    Jeff Mishler, Jan 2, 2004
    #4
  5. Gordon Price

    Gordon Price Guest

    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 Price, Jan 2, 2004
    #5
  6. Gordon Price

    Doug Broad Guest

    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, Jan 2, 2004
    #6
  7. Gordon Price

    Gordon Price Guest

    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...
    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
     
    Gordon Price, Jan 2, 2004
    #7
  8. Doug!
    --------
    Something's wrong!
    After Alert and making MText rectangle I get only:

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

    What will you say?
     
    Alexander V. Koshman, Jan 5, 2004
    #8
  9. Gordon Price

    John Uhden Guest

    Look back at my previous response as to how to use pause.
     
    John Uhden, Jan 5, 2004
    #9
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.