text aligning lisp

Discussion in 'AutoCAD' started by FELIPE, Sep 13, 2004.

  1. FELIPE

    FELIPE Guest

    Hi, I have a lisp file the I love but I want to modify it.
    Its a text aligning tool that aligns dtext to stack downward.

    I would like to make it stack upward instead.
    I think its probably easy, but I just dont see it.
    Can anyone tell me how its done?

    (defun c:STKUP ( / tmp ntht bitm bent sset bins oins oang itm num done
    ndis nhnd nent chnd cent cins cdis ht)
    (setq cmdecho (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (command "UNDO" "G")
    (setq tmp nil)
    (if (/= tmp nil)(setq vscl tmp)(setq vscl 1.35))
    (setq tmp nil)
    (if (/= tmp nil)(setq ntht tmp)(setq ntht 0))
    (setq bitm (car (entsel "\nDS> Pick Base String: ")))
    (setq bent (entget bitm))
    (if (= "TEXT" (cdr (assoc 0 bent)))
    (progn
    (redraw bitm 3)
    (princ "\nDS> Select Text to Align: ")
    (setq sset (ssget '((0 . "TEXT"))))
    (redraw bitm 4)
    (if sset
    (progn
    (if (> ntht 0)
    (progn
    (setq bent (subst (cons 40 ntht)(assoc 40 bent) bent))
    (entmod bent)
    )
    )
    (if (> (cdr (assoc 72 bent)) 0)
    (setq bins (cdr (assoc 11 bent)))
    (setq bins (cdr (assoc 10 bent)))
    )
    (setq bang (cdr (assoc 50 bent)))
    (setq tang (- bang (/ PI 2)))
    (setq nins bins)
    (ssdel bitm sset)
    (while (> (sslength sset) 0)
    (setq num (sslength sset) itm 0)
    (setq ndis 99999999.9)
    (while (< itm num)
    (setq chnd (ssname sset itm))
    (setq cent (entget chnd))
    (if (> (cdr (assoc 72 cent)) 0)
    (setq cins (cdr (assoc 11 cent)))
    (setq cins (cdr (assoc 10 cent)))
    )
    (setq cdis (distance bins cins))
    (if (< cdis ndis)
    (setq ndis cdis nhnd chnd nent cent)
    )
    (setq itm (1+ itm))
    )
    (if (> ntht 0)
    (progn
    (setq nent (subst (cons 40 ntht)(assoc 40 nent) nent))
    (setq txht ntht)
    )
    (setq txht (cdr (assoc 40 nent)))
    )
    (setq nins (polar nins tang (* txht vscl)))
    (if (> (cdr (assoc 72 nent)) 0)
    (setq nent (subst (cons 11 nins)(assoc 11 nent) nent))
    (setq nent (subst (cons 10 nins)(assoc 10 nent) nent))
    )
    (setq nent (subst (cons 50 bang)(assoc 50 nent) nent))
    (entmod nent)
    (ssdel nhnd sset)
    )
    )
    )
    )
    )
    ;
    (setq sset nil)
    (command "UNDO" "E")
    (setvar "CMDECHO" cmdecho)
    (princ)
    )
     
    FELIPE, Sep 13, 2004
    #1
  2. Just guessing -
    Change
    (setq tang (- bang (/ PI 2)))
    to
    (setq tang (- bang (/ PI -2)))
     
    Alan Henderson @ A'cad Solutions, Sep 13, 2004
    #2
  3. FELIPE

    Paul Turvill Guest

    Why use a double negative? Why not
    (setq tang (+ bang (/ pi 2)))
    ?
    ___
     
    Paul Turvill, Sep 13, 2004
    #3
  4. FELIPE

    Paul Turvill Guest

    I feel for you, Terry. It never ceases to amaze me how willing some critters
    are to bite the hand that feeds them.
    ___
     
    Paul Turvill, Sep 13, 2004
    #4
  5. FELIPE

    FELIPE Guest

    Thank you all very much.
    that did it.
     
    FELIPE, Sep 13, 2004
    #5
  6. FELIPE

    R.K. McSwain Guest


    That makes 3 in the last two weeks....
     
    R.K. McSwain, Sep 13, 2004
    #6
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.