05-31-2019
09:26 AM
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
05-31-2019
09:26 AM
@dylanwagner1996 hi,
here is a lisp command to condense an attribute by setting it to fit justify.
wrap this in a lisp file than load it and run CSA command.
Command: CSA
Pick an Attribute: <do that>
Max characters <3>: <Specify max characters width>
it runs in a loop and remembers your last Max value.
enjoy
moshe
; condense attribute
(defun c:csa (/ getMaxChar pick ename elist n dbTextBox attang atthgt lowerLeft
upperRight diagonal midJustify cenJustify dbSample charWidth p10 p11)
(defun getMaxChar (msg def / ask)
(if (setq ask (getint (strcat "\n" msg " <" (itoa def) ">: ")))
(setq def ask)
(setq ask def)
)
); getMaxChar
; here start command
(if (= (getvar "useri1") 0)
(setvar "useri1" 3)
)
(while (and
(setq pick (nentsel "\nPick an Attribute: "))
(setq ename (car pick))
(setq elist (entget ename))
(eq (cdr (assoc '0 elist)) "ATTRIB")
(setvar "useri1" (setq n (getMaxChar "Max characters" (getvar "useri1"))))
)
(setq dbTextBox (textbox elist))
(setq attang (cdr (assoc '50 elist)))
(setq atthgt (cdr (assoc '40 elist)))
(setq lowerLeft (cdr (assoc '10 elist)))
(setq upperRight (list (+ (car lowerLeft) (caadr dbTextBox)) (+ (cadr lowerLeft) (cadadr dbTextBox))))
(setq diagonal (distance lowerLeft upperRight) ang (angle lowerLeft upperRight))
(setq midJustify (polar lowerLeft (+ attang ang) (/ diagonal 2)))
(setq cenJustify (polar midJustify (- attang (/ pi 2)) (/ atthgt 2)))
(setq dbSample (textbox (list (assoc '0 elist) (assoc '7 elist) (assoc '40 elist) '(1 . "8"))))
(setq charWidth (car (cadr dbSample)))
(setq p10 (polar cenJustify (+ attang pi) (* charWidth n 0.5)))
(setq p11 (polar cenJustify attang (* charWidth n 0.5)))
; replace start point
(setq elist (subst (cons '10 p10) (assoc '10 elist) elist))
; set fitted alignment
(if (assoc '72 elist)
(setq elist (subst '(72 . 5) (assoc '72 elist) elist))
(setq elist (append elist (list '(72 . 5))))
)
; replace alignment point
(if (assoc '11 elist)
(setq elist (subst (cons '11 p11) (assoc '11 elist) elist))
(setq elist (append elist (list (cons '11 p11))))
)
(entmod elist) ; update datbase
); while
(princ)
); c:csa