找回密码
 [加入论坛]
查看: 1219|回复: 0

[转帖]将几行文字均匀排列的程序

[复制链接]
2443725 发表于 2004-8-1 15:01 | 显示全部楼层 |阅读模式
<>(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 (&lt; 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 '&lt;))
  (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 (&lt; 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>
您需要登录后才可以回帖 登录 | [加入论坛]

本版积分规则

手机版|化工技术网- 赠人玫瑰 手有余香 ( 苏ICP备14035884号 )

GMT+8, 2026-12-1 15:59

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表