;; 출 처 : http://www.lee-mac.com
;; 제 목 : Align Text
;; 버 전 : V1.2
;; 명령어 : AT
;; 사용법 :

;;--------------------=={ Align Text }==----------------------;;
;; ;;
;; Prompts user for a selection of Text and aligns each text ;;
;; item equispaced below the uppermost item, with single ;;
;; line spacing ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright ?2012 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Version 1.2 - 10-06-2012 ;;
;;------------------------------------------------------------;;
(defun c:AT ( / *error* a d e f h i l p s )
(setq f 1.5) ;; Line Spacing Factor
(defun *error* ( msg )
(if d (LM:endundo d))
(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(if (setq s (ssget "_:L" '((0 . "TEXT"))))
(progn
(repeat (setq i (sslength s))
(setq e (entget (ssname s (setq i (1- i))))
l (cons (list (LM:GetTextInsertion e) e) l)
)
)
(setq l (vl-sort l '(lambda ( a b ) (> (cadar a) (cadar b))))
p (caar l)
h (* f (cdr (assoc 40 (cadar l))))
a (* pi 1.5)
i 0
)
(LM:startundo (setq d (vla-get-activedocument (vlax-get-acad-object))))
(foreach x (cdr l)
(LM:PutTextInsertion (polar p a (* (setq i (1+ i)) h)) (cadr x))
)
(LM:endundo d)
)
)
(princ)
)
(defun LM:startundo ( doc )
(LM:endundo doc)
(vla-startundomark doc)
)
(defun LM:endundo ( doc )
(while (= 8 (logand 8 (getvar 'UNDOCTL)))
(vla-endundomark doc)
)
)
(defun LM:GetTextInsertion ( elist )
(if
(and
(zerop (cdr (assoc 72 elist)))
(zerop (cdr (assoc 73 elist)))
)
(cdr (assoc 10 elist))
(cdr (assoc 11 elist))
)
)
(defun LM:PutTextInsertion ( point elist / key )
(if
(and
(zerop (cdr (assoc 72 elist)))
(zerop (cdr (assoc 73 elist)))
)
(setq key 10)
(setq key 11)
)
(if (entmod (subst (cons key point) (assoc key elist) elist))
(entupd (cdr (assoc -1 elist)))
)
)
(vl-load-com)
(princ)
;;------------------------------------------------------------;;
;; End of File ;;
;;------------------------------------------------------------;;
댓글 없음:
댓글 쓰기
즐거운 하루되세요...^^