A twist on the MTEXT Line Spacing

Discussion in 'AutoCAD' started by Kent Cooper, AIA, Apr 21, 2004.

  1. Well, there's a bizarre twist on my earlier question about the line spacing
    in MTEXT, supposedly controlled by the TSPACETYPE System Variable. Be
    warned if this matters to you!

    Since the place to pick the text style for MTEXT (if you don't want to use
    the current style) is after you've given it the first corner of the box,
    I've had Tablet & Pull-Down Menu picks that did this:

    ^C^C-LAYER S <your-notes-layer> MTEXT \S <your-note-style>
    (And you take it from there, with the prompt for the other corner of the
    box.)

    I set TSPACETYPE to 2 for the "Exactly" spacing. (The AutoCAD starting
    default is 1 for "At Least".) When I then call up the MTEXT command by any
    means other than the menu pick, AND go with the current text style, it works
    fine, that is, it comes up with "Exactly" line spacing. (In 2000, that's
    discernible from the dialog box header's Line Spacing tab, but in 2004 for
    some reason there's only a text properties header, and no other tabs, and
    you apparently can't tell what the line spacing is until you're done, and
    check the properties of the Mtext entity. Strangely, it seems you can't
    change the line spacing from within the command any more, either.)

    Here's the rub: When I invoke the note menu item, OR when I call up MTEXT
    some other way and choose to set the text Style (by entering S after I've
    given it the first box corner), somehow the Line Spacing gets CHANGED to "At
    Least" instead! If I cancel the MTEXT command, and check TSPACETYPE, it's
    still set to 2, but if I actually put some text in and finish the command,
    lo & behold, TSPACETYPE is now changed to 1!

    It seems that if you set the text Style, with any text-type command, even if
    you then cancel without entering any text content, then the style you set
    becomes current, and then you can use MTEXT without changing the Style
    within the command, and then it behaves. So I've changed my Menu items to
    set the Style I want (with regular TEXT and a Cancel), then force TSPACETYPE
    to 2 (just in case) before calling up MTEXT, like this:

    ^C^C-LAYER S <your-notes-layer> TEXT S <your-note-style> ^CTSPACETYPE 2
    MTEXT

    It seems to work, but it shouldn't be necessary. And of course, I'll have
    to keep in mind that in those rare cases where I might want the line spacing
    to be "At Least" instead, I'll have to do it (including Layer setting, etc.)
    "manually", or change it in the MTEXT dialog box in 2000, or in PROPERTIES
    after I'm done in 2004.

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Apr 21, 2004
    #1
  2. Kent Cooper, AIA

    David Kozina Guest

    Kent,

    I don't know how you initialize your out-of-the-box sysvars, but what I to
    do is load a small .lsp file upon opening a drawing that just sets 'em how I
    want 'em and gets it over with.

    I particularly loathe OSMODE being set to some idjit value when I open a
    drawing....

    (I haven't looked at this for awhile, so be kind...)

    I figure that if I want to do something fancy with any of them, like set
    TSPACETYPE to something else, I'll just fix it after the fact, since 99.9%
    of the time, I'll be wanting it "exactly".

    ;|
    Initialize SYSVARS
    |;
    (princ "\nInitializing System Variables...")

    (setvar "ATTDIA" 0)
    (setvar "AUPREC" 6)
    (setvar "DIMASSOC" 2)
    (setvar "DWGCHECK" 1)
    (setvar "EDGEMODE" 1)
    ; (setvar "HPASSOC" 1) ; ??
    ; (setvar "INDEXCTL" 3) ; ??
    (setvar "ISAVEBAK" 1)
    (setvar "ISAVEPERCENT" 1)
    (setvar "LUPREC" 8)
    (setvar "OSMODE" 0)
    (setvar "PICKSTYLE" 1)
    (setvar "PSTYLEPOLICY" 0)
    (setvar "PSLTSCALE" 0)
    (setvar "REGENMODE" 1)
    (setvar "TEXTFILL" 1)
    (setvar "TSPACETYPE" 2)
    (setvar "UCSICON" 3)

    hth,
    David Kozina
     
    David Kozina, Apr 21, 2004
    #2
  3. Kent Cooper, AIA

    CAB2k Guest

    Here is mine..

    Code:
    ;;; variable setting mechanism
    ;;; called from 'AlansAutoLoad.lsp'
    ;;;
    ;;;  Note, vars that need point data are not entered as dotted pairs
    ;;;    Example  ("snapbase" 0 0)
    ;;;
    ;;;
    ;;; After setting the global variable, call the function, (vl-propagate
    ;;; 'globalVariable) where globalVariable is the symbol name of your global
    ;;; variable.  This will copy the value of globalVariable into all open document
    ;;; namespaces and set its value in any subsequent drawings opened during the
    ;;; current AutoCAD session.
    
    (defun ACADset_vars (/ var)
    
    (setq var '(
    ( "angbase"   . 0 )  ;
    ( "angdir"    . 0 )  ; CCW
    ( "apbox"     . 0 )  ; Aperture box off 0
    ( "aperture"  . 10 ) ; zone of detection
    ( "aunits"    . 0 )  ; 0 = degrees 4 = survey
    ( "auprec"    . 4 )  ; no  od decimal places
    ( "autosnap"  . 7 )  ;
    
    ( "blipmode"  . 0 )  ; o = blips off
    
    ( "chammode"  .  0 )  ; require 2 distances
    ( "cmddia"    .  1 )
    ( "cmdecho"   .  1 )
    ( "coords"    .  1 )
    ( "cursorsize" . 5 )  ; size of cross
    
    ( "dimaso"    .  1 )  ;
    ( "dimsho"    .  1 )
    ( "dragmode"  .  2 )  ; display outline
    ( "dragp1"    .  10 )
    ( "dragp2"    .  25 )
    
    ( "edgemode"  .  1 )  ; trim to extension
    ( "expert"    .  4 )
    
    ( "facetres"  .  2 )
    ( "filedia"   .  1 )
    ( "filletrad" .  0 )
    ( "fillmode"  .  1 )  ;
    
    ( "gridmode"  .  0 )  ; grid off
    ( "grips"     .  1 )  ;
    ( "gripsize"  .  3 )  ; grip box size
    
    ( "highlight" .  1 )
    
    ( "insbase"  0 0 0)  ;
    ( "isolines"  .  4 )
    
    ( "limcheck"  .  0 )  ; 0= allow create obj outside limites
    ( "lunits"    .  4 )  ; 4=Arch  2=decimal
    ( "luprec"    .  5 )  ; decimal places displayed for linear
    
    ( "maxactvp"  .  50 ) ; max viewport to be regenerated
    ( "maxsort"   .  500) ; max num of layers to sort in layer manager
    ( "mbuttonpan" . 1)  ;
    ( "measurement" . 0)  ; English
    ( "measureinit" . 0)  ; English
    ( "mirrtext"  .  0 )  ; 1=mirror text 0=backwards test
    
    ( "offsetgaptype" . 0 )  ;
    ( "osmode"    .  175 )
    
    ( "pickadd"   .  1 )
    ( "pickauto"  .  1 )
    ( "pickbox"   .  3 )  ; the pick box size
    ( "pickdrag"  .  0 )
    ( "pickfirst" .  1 )
    ( "pickstyle" .  1 )  ;
    ( "plinegen"  .  0 )  ;
    ( "plinetype" .  2 )  ;
    ( "plinewid"  .  0 )  ; pline width
    ( "plotrotmode" . 2)  ; needs to be 2 to show shadow in PS display
    ( "polarmode"  . 1 )  ;
    ( "projmode"  .  1 )  ;
    ( "proxygraphics" . 1)  ;
    ( "proxynotice" .  1)  ;
    ( "proxyshow"   .  1)  ;
    
    ( "qtextmode"  . 0 )  ; 1=display box ILO text
    
    ( "regenmode"  . 1 )
    
    ( "savetime"   . 30 ) ; minutes between auto save 0=no auto save
    ( "sdi"        .  0 )
    ( "snapang"    . 0 )
    ( "snapbase"  0 0) ; hatch base point
    ( "snapisopair" . 0 )
    ( "snapmode"   . 0 )
    ( "snapstyl"   . 0 )
    ( "snaptype"   . 0 )
    ( "snapunit"   1 1)  ;
    ( "sortents"   . 96)
    ( "splframe"   . 0 )
    
    ( "textfill"   . 1 )  ; plot with text filled
    ( "textqlty"   . 50 ) ; text resolution of TT font while plotting
    ( "textsize"   . 5 )  ; default text size
    ( "tooltips"   . 1 )
    ( "trimmode"   . 1 )
    ( "tstackalign" . 1 )
    ( "tstacksize"  . 70 )
    
    ( "unitmode"   . 0 )
    ( "ucsfollow"  . 0 )
    ( "ucsicon"    . 0 )  ; 0=no display 3=display icon at origin
    
    ( "worldview"  . 1 )
    
    ( "visretain"  . 1 )  ; retain layer state
    
    ( "zoomfactor" . 10 )
    )
    ); setq
    
    (mapcar '(lambda (x)
    (setvar(car x) (cdr x))
    )
    var)
    (prompt "\nACADSet_Variables has set system variables to your preset values.")
    (princ)
    
    ) ;; EOF
    ;;  remove the comment from the next line to run as soon as it is loaded
    ;(ACADset_vars)
     
    CAB2k, Apr 21, 2004
    #3
  4. Kent Cooper, AIA

    John Guest

    I feel your pain. I was just working through this myself last week. When
    you changed the mtext text style it seems to reset the line spacing values.


    We also tried to figure out a way to adjust the line spacing of leader
    mtext. But each time you issue the qleader command it resets the variables.
    Finally had to do an entlast and update it after the fact.

    John
    Well, there's a bizarre twist on my earlier question about the line spacing
    in MTEXT, supposedly controlled by the TSPACETYPE System Variable. Be
    warned if this matters to you!

    Since the place to pick the text style for MTEXT (if you don't want to use
    the current style) is after you've given it the first corner of the box,
    I've had Tablet & Pull-Down Menu picks that did this:

    ^C^C-LAYER S <your-notes-layer> MTEXT \S <your-note-style>
    (And you take it from there, with the prompt for the other corner of the
    box.)

    I set TSPACETYPE to 2 for the "Exactly" spacing. (The AutoCAD starting
    default is 1 for "At Least".) When I then call up the MTEXT command by any
    means other than the menu pick, AND go with the current text style, it
    works
    fine, that is, it comes up with "Exactly" line spacing. (In 2000, that's
    discernible from the dialog box header's Line Spacing tab, but in 2004 for
    some reason there's only a text properties header, and no other tabs, and
    you apparently can't tell what the line spacing is until you're done, and
    check the properties of the Mtext entity. Strangely, it seems you can't
    change the line spacing from within the command any more, either.)

    Here's the rub: When I invoke the note menu item, OR when I call up MTEXT
    some other way and choose to set the text Style (by entering S after I've
    given it the first box corner), somehow the Line Spacing gets CHANGED to
    "At
    Least" instead! If I cancel the MTEXT command, and check TSPACETYPE, it's
    still set to 2, but if I actually put some text in and finish the command,
    lo & behold, TSPACETYPE is now changed to 1!

    It seems that if you set the text Style, with any text-type command, even
    if
    you then cancel without entering any text content, then the style you set
    becomes current, and then you can use MTEXT without changing the Style
    within the command, and then it behaves. So I've changed my Menu items to
    set the Style I want (with regular TEXT and a Cancel), then force
    TSPACETYPE
    to 2 (just in case) before calling up MTEXT, like this:

    ^C^C-LAYER S <your-notes-layer> TEXT S <your-note-style> ^CTSPACETYPE 2
    MTEXT

    It seems to work, but it shouldn't be necessary. And of course, I'll have
    to keep in mind that in those rare cases where I might want the line
    spacing
    to be "At Least" instead, I'll have to do it (including Layer setting,
    etc.)
    "manually", or change it in the MTEXT dialog box in 2000, or in PROPERTIES
    after I'm done in 2004.

    Kent Cooper, AIA
     
    John, Apr 21, 2004
    #4
  5. Both David Kozina & CAB2k had good suggestions for setting System Variables
    (of which there are many possibilities -- pre-loaded lisps, scripts, macros,
    menu picks, using Drawing Templates, etc.), but even with either/both
    approaches, we'd still have the problem that TSPACETYPE, though set to 2 by
    whatever means, gets reset to 1 by selecting a text style within MTEXT. Not
    that I'm I expect any solution from this group (it's a bug, not a
    customization issue), but I thought people ought to know.

    Kent Cooper, AIA
     
    Kent Cooper, AIA, Apr 21, 2004
    #5
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.