Problem with DTEXT and MTEXT

Discussion in 'AutoCAD' started by Sunburned Surveyor, Nov 12, 2004.

  1. OK Guys....I'm having a problem using MTEXT and DTEXT in AutoLISP. I might need to modify a environment variable, but I'm not sure which one.

    When I use:

    (defun C:TEST ()
    (alert "This is a test.")
    (initdia)
    (command "_MTEXT")
    )

    ......everything works fine and I can input my text. However when I try and place a command after the text command, like this:

    (defun C:TEST ()
    (alert "This is a test.")
    (initdia)
    (command "_MTEXT")
    (command "_LINE")
    )

    .....I get an invalid point error and the routine exits. It doesn't matter what command I try to use after the text command. Any idea on what I need to change?

    Thanks,

    The Sunburned Surveyor
     
    Sunburned Surveyor, Nov 12, 2004
    #1
  2. Sunburned Surveyor

    ECCAD Guest

    Sunburned,
    I think the following change will do it.

    Your existing little program is not waiting for the MTEXT
    command to complete, it starts the command, and immediately
    sends input - the next line (command "_LINE").. feeds the
    string "_LINE" into the Mtext command..instead of waiting
    for you to Pick the points.


    (defun C:TEST ()
    (alert "This is a test.")
    (initdia)
    (command "_MTEXT")
    ;; add next 2 lines
    (while (= (logand (getvar "cmdactive") 1) 1)
    (command pause))
    (command "_LINE")
    )

    Give it a whirl.

    Bob
     
    ECCAD, Nov 12, 2004
    #2
  3. Thanks BOB,

    That did the trick!

    The Sunburned Surveyor
     
    Sunburned Surveyor, Nov 12, 2004
    #3
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.