功能:把杂乱的文本按照输入的间距和对齐点进行整齐排列
命令:DQW
现有方式为左对齐,按y坐标降序排列。想要其他方式的自己YY.
- ;;;程序名 :dqw.LSP
- ;;;对齐单行文本,自定义行距程序
- (defun c:dqw ()
- (setq a (ssget (list (cons 0 "text"))))
- (setq n (sslength a))
- (setq all nil)
- (setq m 0)
- (while (< m n)
- (setq all (append all (list (entget (ssname a m)))))
- (setq m (1+ m))
- )
- (setq l 0);按y坐标降序排列
- (setq m 1)
- (while (< l n)
- (setq b (nth l all))
- (while (< m n)
- (setq c (nth m all))
- (if (> (nth 2 (assoc '10 c)) (nth 2 (assoc '10 b)))
- (progn
- (setq all (subst 'aa (nth l all) all ) )
- (setq all (subst 'bb (nth m all) all ) )
- (setq all (subst c 'aa all ) )
- (setq all (subst b 'bb all ) )
- (setq b c)
- )
- )
- (setq m (1+ m))
- )
- (setq l (1+ l))
- (setq m (1+ l))
- )
- (setq val (getdist "\n行距:"))
- (setq p (getpoint "\n首行的插入点:"))
- (setq x0 (car p))
- (setq y0 (cadr p))
- (setq m 0)
- (while (< m n)
- (setq b (nth m all))
- (setq y (- y0 (* m val)))
- (setq z (nth 3 (assoc '10 b)))
- (setq xyz_new (list '10 x0 y z))
- (setq b (subst (cons '72 0) (assoc '72 b) b))
- (setq b (subst (cons '73 0) (assoc '73 b) b))
- (setq b (subst xyz_new (assoc '10 b) b ) )
- (entmod b)
- (setq m (1+ m))
- )
- )
- (princ "\n==左对齐单行文本,自定义行距程序成功加载!命令行以dqw启动!")
|