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

对齐文字的程序

[复制链接]
2443725 发表于 2004-12-31 20:08 | 显示全部楼层 |阅读模式
<b>
</b>对齐文字
(defun C:TX (/ m e1 ent en en1 yesno ptb gop next
                        temp1 temp2 temp3 ptn total count)
        (setq m:err *error* *error* *merr*)
        (setvar "cmdecho" 0)
        (command "UNDO" "G")
        (setq e1 (entsel "\n选择基准文字:"))
        (if (= e1 nil)(princ) (progn
        (setq ent (entget (car e1)))
        (setq en (cdr (assoc '0 ent )))
        (if (/= en "TEXT") (princ "\n---所选图元不是文字---")
        (progn
        (setq en1 (cdr (assoc '-1 (entget (car e1)))))
        (redraw en1 3)
        (initget 128 "X Y")
        (setq yesno (getkword "\n水平对齐(Y) / 垂直对齐(&lt;X&gt;) ? "))
        (if (or (= yesno "X") (= yesno nil))
        (setq ptb (cadr (assoc '10 ent)))
        (setq ptb (car (cddr (assoc '10 ent)))))
        (setq gop (ssget) count 0 total 0)
        (redraw en1 4)
        (repeat (sslength gop)
        (setq next (entget (ssname gop count)))
        (if (= (cdr (assoc 0 next)) "TEXT") (progn
        (setq temp1 (car (cdr (assoc 10 next)))
        temp2 (cadr (cdr (assoc 10 next)))
        temp3 (caddr (cdr (assoc 10 next))))
        (if (or (= yesno "X") (= yesno nil))
        (setq ptn (list ptb temp2 temp3))
        (setq ptn (list temp1 ptb temp3)) )
        (setq next (subst (cons 10 ptn)(assoc 10 next) next))
        (entmod next)
        (setq total (1+ total))
        ))
        (setq count (1+ count))
        )
        (princ "\n共有 ")(princ total)(princ  " 个文字串被改变")
        ))
        ))
       (command "UNDO" "E")
       (print) )
您需要登录后才可以回帖 登录 | [加入论坛]

本版积分规则

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

GMT+8, 2026-12-1 18:08

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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