AUTOMATIC 1/8" TEXT SIZING FOR PAPERSPACE LAYOUTS

Discussion in 'AutoCAD' started by Mark Sulzbach, Nov 1, 2004.

  1. PLEASE HELP!!!!!!!!!!

    IN AUTOCAD LAYOUT BUT IN MODELSPACE YOU TYPE
    1. DTEXT
    2. (PICK START POINT)
    3. 'SPACETRANS
    4. 1/8

    THIS WILL ALWAYS SET YOUR TEXT SIZE TO 1/8" NO MATTER WHAT SCALE THE
    VIEWPORT IS.

    I WOULD LIKE TO COME UP WITH A LISP ROUTINE TO DO THIS WITH ONLY TYPING 2
    LETTERS:

    (DEFUN C:pT()
    ;START
    (COMMAND "LAYER" "M" "M-TEXT" "") ;SET
    LAYER
    (COMMAND "COLOR" "BYLAYER") ;SET
    COLOR
    (COMMAND "DTEXT" PAUSE "'SPACETRANS" "1/8" )) ;SET TEXT HEIGHT

    HOWEVER THIS DOES NOT WORK!

    FROM WHAT I KNOW ABOUT LISP (WHICH ISN'T TOO MUCH) PUTTING COMMANDS LIKE
    "'SPACETRANS" IN QUOTES " " SHOULD TYPE THEM EXACTLY ON THE COMMAND
    LINE, BUT IT JUST CRASHES.

    ANYONE HAVE ANY IDEAS????

    Mark Sulzbach
    Designer

    --

    Mark Sulzbach
    Designer

    ATSI, Inc.
    415 Commerce Dr.
    Amherst, NY 14228
    Phone: 716-691-9200 ext 266
    FAX: 716-691-7221
    email:

    Website: www.atsiinc.com
     
    Mark Sulzbach, Nov 1, 2004
    #1
  2. Mark Sulzbach

    ECCAD Guest

    (DEFUN C:pT()
    ;START
    (COMMAND "LAYER" "M" "M-TEXT" "") ;SET LAYER
    (COMMAND "COLOR" "BYLAYER") ;SET COLOR
    (COMMAND "DTEXT" PAUSE "0.125" "0" "'SPACETRANS" "");SET TEXT HEIGHT
    )

    Bob
     
    ECCAD, Nov 1, 2004
    #2
  3. THANKS FOR YOUR RESPONSE BUT IT DOESN'T WORK EITHER

    MARK
     
    Mark Sulzbach, Nov 1, 2004
    #3
  4. Mark Sulzbach

    3ABTPA Guest

    lowercase please, I can't hear you...
     
    3ABTPA, Nov 1, 2004
    #4
  5. Mark Sulzbach

    ECCAD Guest

    C:pT

    Command: pt

    Enter text: AAAAA
    Enter text: nil

    Command: LIST

    Select objects: 1 found

    Select objects:
    TEXT Layer: "M-TEXT"
    Space: Paper space
    Layout: Layout1
    Color: BYLAYER Linetype: "CONTINUOUS"
    Handle = 97
    Style = "STANDARD"
    Font file = txt
    start point, X= 2.6905 Y= 3.3890 Z= 0.0000
    height 0.1250
    text AAAAA
    rotation angle 0
    width scale factor 1.0000
    obliquing angle 0
    generation normal
    ?????
    Bob
     
    ECCAD, Nov 1, 2004
    #5
  6. Mark Sulzbach

    CJ Follmer Guest

    no it's not working

    try (command "dtext" pause "'spacetrans" "0.125") it bombs. Spacetrans
    should feed the text height to the command. You're feeding a constant
    height of 1/8" no matter what. If you're at 96xp for the viewport scale the
    text height should be 12.0. Spacetrans doesn't appear to work in lisp.

    you could try using this

    ;;by tony tanzillo
    (defun xpfact () (/ 1 (caddr (trans '(0 0 1) 2 3))) )

    (command "dtext" pause (* (xpfact) 0.125))

    returns the xp scale factor, multiple that by the text height and you've got
    the needed height. You'll need a check though to make sure you're in model
    space through viewport.


    cj
     
    CJ Follmer, Nov 1, 2004
    #6
  7. Mark Sulzbach

    Dave Drahn Guest

    I'm not exactly sure why, but this seems to work. Pretty clunky and you
    have to have MSPACE active for it to calc right. Maybe others can help
    clean it up:

    (DEFUN C:pT()
    (COMMAND "LAYER" "M" "M-TEXT" "")
    (setq STRANS (getreal "\nEnter desired text height: "))
    (setq STRANSHT
    (/ STRANS
    (- (car (trans '(1 0 0) 2 3))
    (car (trans '(0 0 0) 2 3))
    )
    )
    )
    (COMMAND "COLOR" "BYLAYER")
    (setq TPT (getpoint "\nSelect point to place text:"))
    (COMMAND "DTEXT" TPT STRANSHT "")
    (PRINC)
    )
     
    Dave Drahn, Nov 2, 2004
    #7
  8. Mark Sulzbach

    viliam Guest

    Why don't you setup the variable "textsize" prior to running the text?
    as in (setvar "textsize" value) where value can be calculated
    accordingly 1/8" in paper space, ( 1/8 * scalefactor) in viewport and
    last used or type new on model space. similar to what I use for dimscale
    setting.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun scaling ()
    (if (eq (getvar "tilemode") 1)
    (progn
    (setq Dim-scale (if (eq (getvar "dimscale") 0) 1 (getvar "dimscale")))

    (setq Scale-key (strcat "\n Scale Factor <" (rtos Dim-scale)
    ">:"))
    (setq Scale (cond ((getreal Scale-key))(t Dim-scale)))
    );progn
    (progn (if (eq (getvar "CVPORT") 1) (setq Scale 1) (setq Scale (/ 1
    (xpfact))))
    )
    )
    (setvar "DIMSCALE" Scale)
    (princ)
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    (defun xpfact () ;by Tony Tanzillo
    (- (car (trans '(1 0 0) 2 3))
    (car (trans '(0 0 0) 2 3))
    )
    ;(princ)
    ); end of xpfact
     
    viliam, Nov 2, 2004
    #8
  9. Thanks CJ!!!!!

    You solved a 2 year old problem for me, I revised it like this:

    (DEFUN C:T()
    (COMMAND "LAYER" "M" "M-TEXT" "")
    (COMMAND "COLOR" "BYLAYER")
    (defun xpfact () (/ 1 (caddr (trans '(0 0 1) 2 3))) )
    (SETVAR "TEXTSIZE" (* 0.125 (xpfact)) )
    (command "dtext") )

    works like a charm

    Forever in your debt

    Mark
     
    Mark Sulzbach, Nov 3, 2004
    #9
  10. Mark Sulzbach

    CJ Follmer Guest

    Just passing on what I've learned from this NG.

    cj
     
    CJ Follmer, Nov 3, 2004
    #10
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.