PDA

View Full Version : Squeeze a Text String



Colby
04-05-2006, 08:33 AM
The following Lisp routine will change the width factor on a Text string

I take no credit for this code nor do I remeber where I found it but it works good for me!!!!! :lol:


;SQUTXT.LSP
;to use it, have this file in the ACAD library search path and key in
;(load "squtxt") at the "command:" prompt. use the command SQUTXT, point to a
;text extity, then use the keypad "+" or "-" keys to adjust width 5% at a time.
;press enter when done. does not work on fit or aligned text.

(defun aval ( a l / ) (cdr (assoc a l)))

(defun c:squtxt ( / hilite el done inp )
(setq hilite (getvar "highlight"))
(setvar "highlight" 0)
(setq el (entget (car (entsel "Select text by pointing: "))))
(if el
(progn (write-line "Use '+' or '-' keys, or RETURN when done")
(setq done nil)
(while (not done)
(princ (strcat ""
(rtos (aval 41 el) 2 2) " "))
(while (/= (car (setq inp (grread))) 2))
(cond ((= (cadr inp) 43)
(entmod (setq el
(subst (cons 41 (+ 0.05 (aval 41 el)))
(assoc 41 el) el))))
((= (cadr inp) 45)
(entmod (setq el
(subst (cons 41 (- (aval 41 el) 0.05))
(assoc 41 el) el))))
((= (cadr inp) 13) (setq done t))
(t))))
(prompt "Not found.."))
(setvar "highlight" hilite))