Post mtext lisp

Discussion in 'AutoCAD' started by rmcclane, Mar 21, 2005.

  1. rmcclane

    rmcclane Guest

    Hello,
    I have a lisp routine that we use to create mtext with and it is not working exactly as I want.
    What I want the routine to do is set the layer back to the current layer after the mtext command is finished. What I get now is the mtext ends up on the current layer. Any ideas?

    (defun c:t ()
    (setq lay (getvar "clayer"))
    (setq scale (getvar "dimscale"))
    (setq txtsz (* 0.09375 scale))
    (setvar "textsize" txtsz)
    (command "layer" "m" "Text-medm" "c" "7" "" "")
    (setvar "celtype" "Bylayer")
    (command "style" "TEXTM" "romans.shx" "0" "1" "0" "n" "n" "n")
    (initdia) (command ".mtext")
    (setvar "clayer" lay)
    )

    Thanks
    Ron
     
    rmcclane, Mar 21, 2005
    #1
  2. rmcclane

    Matt W Guest

    Try this....

    Code:
    (defun c:t ( / lay scale txtsz) ; changed the variables to local instead of
    global
    (setq lay (getvar "clayer"))
    (setq scale (getvar "dimscale"))
    (setq txtsz (* 0.09375 scale))
    (setvar "textsize" txtsz)
    (command "layer" "m" "Text-medm" "c" "7" "" "")
    (setvar "celtype" "Bylayer")
    (command "style" "TEXTM" "romans.shx" "0" "1" "0" "n" "n" "n")
    (initdia) (command ".mtext")
    ;  added the following line
    (while (> (getvar "cmdactive") 0) (command pause))
    (setvar "clayer" lay)
    )
    
     
    Matt W, Mar 21, 2005
    #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.