(defun lconerr (s)<BR> (if (/= s "Function cancelled") <BR> (princ (strcat "\nError: " s)) <BR> )<BR> (setq text nil) <BR> (setq *error* olderr) <BR> (princ)<BR>)
(defun getde()<BR> (setq de (car (entsel "\n请选择对齐的目标文字<所有的都向我看齐!>:")))<BR> (if (= de nil) (getde))<BR> (setq el (entget de))<BR> (setq ty (assoc 0 el))<BR> (if (/= "TEXT" (cdr ty)) (getde) )<BR>)
(defun getsel()<BR> (setq sel nil)<BR> (princ "\n请选择要对齐的文字<跟着共产党走!自动过滤>:")<BR> (setq sel (ssget))<BR>)
(defun C:wzdq (/ sel e dx dy el de num n x y ty inf olderr ab ac dc db);<BR> (setq olderr *error* <BR> *error* lconerr)<BR> (princ "\n Tolly 私人工作室,非常感谢您的支持!")<BR> (princ "\n本程序快捷键为 wzdq !\n")<BR> (command "redraw")<BR> (getde)<BR> (getsel)<BR> (initget "A X Y") <BR> (setq key (getkword "\nA只改变对齐方式/ Y垂直方向对齐 | / <X水平方向对齐 --> "))<BR> (setq e (assoc 10 el))<BR> (setq dx (nth 1 e))<BR> (setq dy (nth 2 e))<BR> (setq ac (assoc 72 el))<BR> (setq ab (assoc 73 el))
(if sel <BR> (progn <BR> (setq num 0 n (sslength sel))<BR> (while (< num n) <BR> (if (= "TEXT" (cdr (assoc 0 (setq inf (entget (ssname sel num)))))) ;if text<BR> (progn<BR> (if (or (= key "X") (= key nil) )<BR> (progn<BR> (setq x (nth 1 (assoc 10 inf) )) <BR> (setq inf (subst (list 10 x dy 0) (assoc 10 inf) inf))<BR> (entmod inf)<BR> );progn<BR> );if<BR> (if (= key "Y")<BR> (progn<BR> (setq y (nth 2 (assoc 10 inf) )) <BR> (setq inf (subst (list 10 dx y 0) (assoc 10 inf) inf))<BR> (entmod inf)<BR> );progn<BR> );if <BR> (setq inf (subst ac (assoc 72 inf) inf)) <BR> (setq inf (subst ab (assoc 73 inf) inf))<BR> (entmod inf)<BR> );progn<BR> );if<BR> (setq num (1+ num))<BR> );while <BR> );progn<BR> );if<BR> (if (= key "A") (princ "\n对齐方式已改变!"))<BR> (setq e (assoc 11 el))<BR> (setq dx (nth 1 e))<BR> (setq dy (nth 2 e))<BR> (if (and sel (/= 0.0 dx) (/= 0 dy))<BR> (progn <BR> (setq num 0 n (sslength sel))<BR> (while (< num n) <BR> (if (= "TEXT" (cdr (assoc 0 (setq inf (entget (ssname sel num)))))) ;if text<BR> (progn<BR> ;(setq inf (subst ac (assoc 72 inf) inf)) <BR> ;(setq inf (subst ab (assoc 73 inf) inf))<BR> ;(entmod inf)<BR> (if (or (= key "X") (= key nil) )<BR> (progn<BR> (setq x (nth 1 (assoc 11 inf) )) <BR> (setq inf (subst (list 11 x dy 0) (assoc 11 inf) inf))<BR> (entmod inf)<BR> );progn<BR> );if<BR> (if (= key "Y")<BR> (progn<BR> (setq y (nth 2 (assoc 11 inf) )) <BR> (setq inf (subst (list 11 dx y 0) (assoc 11 inf) inf))<BR> (entmod inf)<BR> );progn<BR> );if <BR> );progn<BR> );if
(setq num (1+ num))<BR> );while <BR> );progn<BR> );if<BR> (setq *error* olderr)<BR> (princ)<BR>)<BR>(princ "\n本程序快捷键为 wzdq !\n")
备注:以上程序我是从本论坛下载的,我用了一下可以达到X与Y两个方向的对齐功能.
|