本帖最后由 llsheng_73 于 2013-11-28 16:13 编辑
偏爱云~小吴 发表于 2013-11-28 15:02
我只要字母的,比如A之后是B,B之后是C,如此而已。一般编号不超过26个的
- (defun c:zm1 (/ mycopy mymove SstoEs sign ss p1 p2)
- (defun SstoEs(ss / a en lst)
- (if ss(progn(setq a -1)(while(setq en(ssname ss(setq a(1+ a))))(setq lst (cons en lst)))))
- lst)
- (defun sign (nn) (if (< nn 0) -1 (if (> nn 0) 1 0)))
- (defun mycopy(ss p p1 / ty q q1 s1 s2);;参照by-xyp1964的xyp-ScaleEntity
- (setq ty(type ss)i -1
- s2(ssadd)
- q1(vlax-3D-point(trans p1 0 0))
- q(vlax-3D-point(trans p 0 0)))
- (cond((= ty 'ENAME)(vla-move(vla-copy(vlax-ename->vla-object ss))q q1)(setq s2(ssadd(entlast)s2)))
- ((= ty 'PICKSET)
- (setq i -1)
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (mycopy s1 p p1)(setq s2(ssadd(entlast)s2))))
- ((= ty 'LIST)(foreach x ss(mycopy x p p1)(setq s2(ssadd(entlast)s2))))
- )s2)
- (defun mymove(ss p p1 / ty q q1 s1);;参照by-xyp1964的xyp-ScaleEntity
- (setq ty(type ss)i -1
- q1(vlax-3D-point(trans p1 0 0))
- q(vlax-3D-point(trans p 0 0)))
- (cond((= ty 'ENAME)(vla-move(vlax-ename->vla-object ss)q q1))
- ((= ty 'PICKSET)
- (setq i -1)
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (mymove s1 p p1)))
- ((= ty 'LIST)(foreach x ss(mymove x p p1))))
- )
- (setq ind (getint "\n输入增减量<1> :")
- ind (sign ind))
- (prompt"\n选择要进行递增复制的文字、属性")
- (setq ss(SstoEs(ssget'((0 . "*TEXT,ATTDEF")))))
- (setq p1(getpoint"复制基点"))
- (setq p2(getpoint p1"复制到"))
- (mycopy (setq ss(vl-remove'nil(mapcar'(lambda(x)(setq e(entget x))
- (if(assoc 1 e)
- (progn(setq tx(vl-string->list (cdr(assoc 1 e))))
- (if(OR(<(IF(> ind 0)65 66)(last tx)(IF(> ind 0)89 90))
- (<(IF(> ind 0)97 98)(last tx)(IF(> ind 0)121 122)))x))))ss)))p1 p1)
- (mymove ss p1 p2)
- (mapcar'(lambda(x)(entmod(setq e(entget x)
- tx(vl-string->list (cdr(assoc 1 e)))
- e(subst(cons 1 (vl-list->string(reverse(cons((IF(> ind 0)1+ 1-)(last tx))(cdr(reverse tx))))))(assoc 1 e)e)))
- nil)ss)
- (princ)
- )
没来得及处理最后是数字的 |