Mtext in lisp vs macro

Discussion in 'AutoCAD' started by LynnG, Feb 8, 2005.

  1. LynnG

    LynnG Guest

    I am attempting to set up toolbars buttons that will have settings of text style, size, justification, layer, etc..using multiline text.

    When I place a macro in a toolbar button it does not take all of the settings established in the macro (mainly the justification settings);
    ^C^C-textstyle standard ^C^C-layer s E-TEXT ^C^Cmtext \ J MC \\

    When I create a lisp routine it works;
    (DEFUN C:multilinetext (/) (COMMAND "textstyle" "standard")
    (initdia) (command ".mtext" PAUSE "J" "MC" "" ""))

    I have had this happen with other commands strings as well, can anyone tell me why some commands work in a macro and others only work in a lisp routine?
     
    LynnG, Feb 8, 2005
    #1
  2. LynnG

    OLD-CADaver Guest

    First, in your macro, only the first set of ^C^C are needed, and I use smei-colons instead of spaces in macros just so I can see them all.

    My guess is that after you set the current layer to E-TEXT you're hitting a cncel with a set of ^C^C before you cleanly exit the layer command. Try losing the ^C^C and add a space (semi-colon).

    What I've done is create a subroutine that sets the layer and textstyle like follows:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;; Set Current Layer to TEXT STYLE name
    (defun txstla ()(SETVAR "CMDECHO" 0)
    (setq txst (strcat "txt" (rtos (getvar "dimscale") 2 0)))
    (setq txla (tblsearch "layer" "Txt"))
    (if (/= txla nil)
    (setq txclr (abs (cdr (assoc '62 txla))))
    (setq txclr 4)
    )
    (setq ntxst (tblsearch "style" txst))
    (if (/= ntxst nil)
    (progn
    (setq txst (cdr (assoc '2 ntxst)))
    (setvar "textstyle" txst)
    )
    (progn
    (command ".style" txst "romans" (* (getvar "dimscale") 0.1) "0.7" "" "" "" "")
    )
    )
    (setq ntxla (tblsearch "layer" txst))
    (if (= ntxla nil)
    (command "_layer" "m" txst "c" txclr "txt*" "")
    (command "_layer" "t" txst "s" txst "")
    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    Then I just prefix any text command with (txstla)
     
    OLD-CADaver, Feb 8, 2005
    #2
  3. LynnG

    LynnG Guest

    Thank you for the info, as you can see I am not a programmer by any means. I will take the semicolons into the applications. The other is more like alien text to me, therefore I am unable to apply it to what I need.
     
    LynnG, Feb 9, 2005
    #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.