텍스트 정렬 리습입니다.
가로정렬(TAH)에서는 텍스트들을 선택하고 기준점을 선택시
텍스트의 자리맞추기가 중간중심으로 변경되도록 하고 싶습니다.
세로정렬(TAV)의 경우 현재 <Left> 가 기준으로 되어있고
리습실행하면 <Left> / Middle / Right 중에 정렬하고싶은 자리맞추기로 선택하여 정렬하는데
주로 미들을 이용하는데 한번 미들 선택해서 실행하여도 다음 리습명령 실행시 왼쪽으로 되고있습니다
이부분도 미들을 기본으로 하고 리습실행시 한번 다른 방향으로 지정하였으면
지속적으로 그 방향이 되도록 변경하고 싶어서 문의드립니다.
세로정렬도 자리맞추기는 중간왼쪽, 중간중심, 중간오른쪽으로 정렬되도록 한번 봐주시면 감사하겠습니다
;********************************
; Program : TAH
; Text Arrange Holizontal
; By Suk-Jong Yi
; 1995/5/29
;********************************
; Text 가로 정렬
(defun C:TAH(/
ents nent ypnt count ent
old10 old11 old72 new10 new11
)
(defun SETERR(s)
(if (/= s “Function cancelled”)
(princ (strcat “nError: ” s))
); of If
(setq *error* oer seterr nil)
(princ)
); of SETERR
(setq oer *error* *error* seterr)
(setq ents (ssget))
(setq nent (sslength ents))
(setq ypnt (getpoint “nPick Point: “))
(setq count 0)
(repeat nent
(setq ent (entget (ssname ents count)))
(if (= “TEXT” (cdr (assoc 0 ent)))
(progn
(setq old10 (assoc 10 ent)) ;
(setq old11 (assoc 11 ent)) ;
(setq old72 (assoc 72 ent)) ;
(setq old73 (assoc 73 ent)) ;
(setq new10 (cons 10 (list (car (cdr old10)) (cadr ypnt))))
(setq new11 (cons 11 (list (car (cdr old11)) (cadr ypnt))))
(if (and (= (cdr old72) 0) (= (cdr old73) 0))
(setq ent (subst new10 old10 ent))
(progn
(setq ent (subst new11 old11 ent))
(setq ent (subst (cons 73 0) old73 ent))
) ;of progn
) ;of if
(entmod ent)
) ;of progn
) ;of if
(setq count (+ count 1))
);of repeat
(setq *error* oer seterr nil)
(princ)
) ;of defun
;********************************
; Program : TAV
; Text Arrange Vertical
; By Suk-Jong Yi
; 1995/5/27
;********************************
; Text 세로 정렬
(defun C:TAV(/
ents nent ans w72 xpnt count ent
old10 old11 old72 new10 new11 new72
)
(defun SETERR(s)
(if (/= s “Function cancelled”)
(princ (strcat “nError: ” s))
); of If
(setq *error* oer seterr nil)
(princ)
); of SETERR
(setq oer *error* *error* seterr)
(setq ents (ssget))
(setq nent (sslength ents))
(initget “Left Middle Right”) ;
(setq ans (getkword “n<Left>/Middle/Right: “))
(if (= ans nil) (setq ans “Left”))
(cond
((= ans “Left”) (setq w72 0))
((= ans “Middle”) (setq w72 1))
((= ans “Right”) (setq w72 2))
) ;of cond
(setq xpnt (getpoint “nPick Point: “))
(setq count 0)
(repeat nent
(setq ent (entget (ssname ents count)))
(if (= “TEXT” (cdr (assoc 0 ent)))
(progn
(setq old10 (assoc 10 ent)) ;
(setq old11 (assoc 11 ent)) ;
(setq old72 (assoc 72 ent)) ;
(setq new10 (cons 10 (list (car xpnt) (cadr (cdr old10)))))
(setq new11 (cons 11 (list (car xpnt) (cadr (cdr old11)))))
(setq new72 (cons 72 w72))
(if (= (cdr old72) 0)
(progn ; left
(if (= w72 0)
(setq ent (subst new10 old10 ent))
(progn
(setq new11 (cons 11 (list (car xpnt) (cadr (cdr old10)))))
(setq ent (subst new11 old11 ent))
);of progn
) ;of if
(setq ent (subst new72 old72 ent))
) ;of progn
(progn ; left
(if (= w72 0)
(setq ent (subst new10 old10 ent))
(setq ent (subst new11 old11 ent))
) ;of if
(setq ent (subst new72 old72 ent))
) ;of progn
) ;of if
(entmod ent)
) ;of progn
) ;of if
(setq count (+ count 1))
);of repeat
(setq *error* oer seterr nil)
(princ)
) ;of defun