(defun c:zddq ( / i n txsize ent ent1 o1 o2 o3 o4 a aa oldsiaze newsize
index bb cc p0 p1 p pp ent0 b ss a1 a2 a3 a4 a5 a6)
(setq i 1)
(princ "\n")(princ "选择对齐方式如下:")(princ)
(setq a (getstring "\n L左/R右/C中心/M中点 < L >: "))
(if (= a "")(setq a "L"))
(setq a (strcase a))
(cond ((= a "L")(setq a1 0 a2 11 a4 10 a5 10))
((= a "M")(setq a1 1 a2 10 a4 11 a5 11))
((= a "R")(setq a1 2 a2 10 a4 11 a5 11))
((= a "C")(setq a1 4 a2 10 a4 11 a5 11))
)
(setq b (getint "\n1.横向对齐(使Y座标一样) 2. 纵向对齐(使X座标一样) <2>: "))
(setq txsize (getpoint "\n点取对齐点<点取参照实体>: "))
(princ "\n")(princ "选取文字(自动滤去非文字实体):")(princ)
(while (< i 10000)
(setq ss (ssget))
(setq n (sslength ss))
(setq index 0)
(repeat n
(setq ent0 (entget (ssname ss index)))
(if (= (cdr (assoc 72 ent0)) 0)
(progn
(setq a4 10)
(if (/ = a1 0)(setq a5 11)(setq a5 10))
)
)
(setq index (+ 1 index))
(setq type (assoc 0 ent0))
(if (= "TEXT" (cdr type))
(progn
(setq p0 (assoc 72 ent0))
(setq p (cons (car p0) a1))
(setq pp (subst p p0 ent0))
(setq old (assoc 11 pp))
(if (= a "L")
(setq a3 (list 0 0))
(setq a3 (cdr (assoc 11 pp)))
)
(setq new (cons (car old) a3))
(setq ent (subst new old pp))
(setq o1 (cadr (cdr (assoc a4 ent0))))
(setq o2 (car (cdr (assoc a4 ent0))))
(if (= txsize nil)
(p rogn
(setq a6 (entget (ssname ss 0)))
(setq a6 (cdr (assoc a4 a6)))
(setq o3 (car a6) o4 (cadr a6))
)
(setq o3 (car txsize) o4 (cadr txsize))
)
(setq oldsize (assoc a5 ent0))
(if (and (/= b nil)(/= b 2))
(setq aa o2 bb o4 cc (car oldize))
(setq aa o3 bb o1 cc (cdr oldsize))
)
(setq newsize (cons (car oldsize) (list aa bb)))
(setq ent1 (subst newsize oldsize ent))
(entmod ent1)
)
)
)
)
(prin1)
)
;--------------------
2.多文字的间距调整
edit date: 1995.6.1
(defun c:zd jt ( / new old ent ent1 index s ss s1 s2 cj sj n x xs y ys wb wg wc wg0 wg1 zb type fs i j bbb bj1 bj2 aj1 aj2 cj1 cj2 $a $c $b ss1 ss2 dj1 dj2 zx ej1 ej2 fj1 fj2 zk jd)
(setvar "cmdecho" 0)
; (princ "\n1. order: from top to button. from left to right")