再奉献一个程序 ;;;__________________________________________ ;;; 文字、数字递增加1复制 ;;;__________________________________________ (defun c:MR(/ oce ss p1 p2) (setq oce(getvar "cmdecho")) (setvar "cmdecho" 0) (setq ent (car (entsel "\n递增复制:\n选起始文字:"))) (if (null ent) (exit)) (setq p0(getpoint"\n指定基点:")) (if (null p0 )(exit)) (princ "\n指定第二点或位移:") (while t (setq p1(getpoint p0)) (if (null p1) (mosi111) (mosi112)) ) (princ) ) (defun mosi112() (command ".copy" ent "" "m" p0 p1 "") (setq juli (distance p0 p1)) (setq ent (entlast)) (DS) (setq x0 (car p0)) (setq y0 (cadr p0)) (setq p0 p1) (setq x1 (car p1)) (setq y1 (cadr p1)) (setq x (- x1 x0)) (setq y (- y1 y0)) (setq hudu(atan y x) ) (setq x1 (+ x0 x)) (setq y1 (+ y0 y)) (setq p1 (list x1 y1 0.0)) (princ (strcat "\n指定下一点或继续位移<" (rtos juli ) ">:")) ) (defun mosi111() (setq p1 (list (+ (nth 0 p0) (* juli (cos hudu))) (+ (nth 1 p0) (* juli (sin hudu))) (nth 2 p0) ) ) (command ".copy" ent "" "m" p0 p1 "") (setq ent (entlast)) (DS) (setq juli (distance p0 p1)) (setq p0 p1) (princ (strcat "\n指定下一点或继续位移<" (rtos juli ) ">:")) ) (defun DS( ) (setq txt1 (entget ent)) (setq txt1 (cdr (assoc 1 txt1))) (setq aa (atoi txt1)) (if (and (> aa 0 ) (= (itoa aa) txt1 ) ) (tj120 ) (tj110 ) ) (princ) ) (defun tj110( / mm zz pp txt2 kk txt3) (setq mm (strlen txt1)) (setq zz mm ) (while (or (> (atoi (substr txt1 zz )) 0) (= (substr txt1 zz zz ) "0" )) (setq zz (- zz 1)) ) (setq pp (substr txt1 (+ zz 1) )) (setq txt2 (substr txt1 1 zz )) (setq kk (atoi pp) ) (setq kk (+ kk 1 )) (setq txt3 (strcat txt2 (itoa kk))) (setq ent (entget ent)) (setq ent (subst (cons 1 txt3 ) (assoc 1 ent) ent) ) (entmod ent) (setq ent (cdr (assoc -1 ent))) (princ) ) (defun tj120 ( / txt2 num txt3) (setq num 0 ) (setq txt2 (atoi txt1)) (setq num (+ num 1 )) (setq txt3 ( + txt2 num) ) (setq ent (entget ent)) (setq ent (subst (cons 1 (itoa txt3) ) (assoc 1 ent) ent) ) (entmod ent) (setq ent (cdr (assoc -1 ent))) (princ) )
|