< >(defun c:Td ()</P>
<P> (princ "\n请选择需要排列的文字:")
(setq TxtSS (ssget '((0 . "TEXT"))))
(setq L_TxtSS (sslength TxtSS)
ct 0
MY_ALL nil
) ;_ end of setq</P>
<P> (while (< ct L_TxtSS)</P>
<P> (setq txt (entget (ssname TxtSS ct)))
(setq FY (cadr (trans (cdr (assoc 10 txt)) 0 1)))
(setq TH (cdr (assoc 40 txt)))</P>
<P> (setq MY (+ FY (/ Th 2)))
(setq MY_ALL (append MY_ALL (list MY)))</P>
<P> (setq ct (1+ ct))
) ;_ end of while</P>
<P> (setq index (vl-sort-i MY_ALL '<))
(setq Y_min (nth (nth 0 index) MY_ALL))
(setq Y_max (nth (nth (1- L_TxtSS) index) MY_ALL))
(setq deta_y (/ (- Y_max Y_min) (1- L_TxtSS)))</P>
<P> (setq ct 1)
(while (< ct (1- L_TxtSS))
(setq num (nth ct index))
(setq txtEnt (ssname TxtSS num))
(setq txt (entget txtEnt))
(setq gc72 (cdr (assoc 72 txt))
gc73 (cdr (assoc 73 txt))
) ;_ end of setq
(setq Y_Y (- (nth num MY_ALL)
(+ y_min (* ct deta_y))
) ;_ end of -
) ;_ end of setq</P>
<P> (if (and (= 0 gc72) (= 0 gc73))
(progn
(setq U_O (trans (cdr (assoc 10 txt)) 0 1))
(setq U_FX (car U_O)
U_FY (- (cadr U_O) Y_Y)
U_FZ (caddr U_O)
) ;_ end of setq
(setq W_O (trans (list U_FX U_FY U_FZ) 1 0))
(setq NewFP (list 10
(car W_O)
(cadr W_O)
(cadr W_O)
) ;_ end of list
) ;_ end of setq
(setq txt (subst NewFP (assoc 10 txt) txt))
(entmod txt)
(entupd txtent)
) ;_ end of progn
(progn
(setq U_O (trans (cdr (assoc 11 txt)) 0 1)) ;_ end of setq</P>
<P> (setq U_FX (car U_O)
U_FY (- (cadr U_O) Y_Y)
U_FZ (caddr U_O)
) ;_ end of setq
(setq W_O (trans (list U_FX U_FY U_FZ) 1 0))
(setq NewFP (list 11
(car W_O)
(cadr W_O)
(cadr W_O)
) ;_ end of list
) ;_ end of setq
(setq txt (subst NewFP (assoc 11 txt) txt))
(entmod txt)
(entupd txtent)
) ;_ end of progn</P>
<P> ) ;_ end of if</P>
<P> (setq ct (1+ ct))
) ;_ end of while
(princ)
) ;_ end of defun</P>
|