xuzhigangrene 发表于 2013-6-25 16:40:51

请高手相助!选择含分号的字符串,将分号“;”前后的文字互换

本帖最后由 xuzhigangrene 于 2013-6-26 17:23 编辑

如题!
如:B4f22;T3f20变成T3f20;B4f22

nzl1116 发表于 2013-6-25 16:40:52

(defun AYL-ssClist (ss / EnLst n)
(setq EnLst nil)
(repeat (setq n (sslength ss))
    (setq EnLst (cons (ssname ss (setq n (1- n))) EnLst))
)
)
(defun AYL-UMString (String Sustr / StrLst n Sustr0)
(setq StrLst nil)
(while (setq n (vl-string-search Sustr String))
    (setq Sustr0 (substr String 1 n)
          String (substr String (+ n (strlen Sustr) 1))
          StrLst (cons Sustr (cons Sustr0 StrLst))
    )
)
(apply 'strcat (cons String StrLst))
)
(defun c:tt (/ EntLst)
(if (setq ss (ssget '((0 . "*Text"))))
    (progn
      (setq EntLst (AYL-ssClist ss)
          ss           nil
      )
      (mapcar
        (function
          (lambda (x / a b)
          (setq a (entget x)
                  b (assoc 1 a)
          )
          (entmod (subst (cons 1 (AYL-UMString (cdr b) ";")) b a))
          )
        )
        EntLst
      )
    )
)
(princ)
)

xuzhigangrene 发表于 2013-6-26 10:05:33

这个插件不好弄吗?各位大神帮帮忙吧~

xuzhigangrene 发表于 2013-6-27 09:39:50

nzl1116 发表于 2013-6-26 19:20 static/image/common/back.gif


很好用,满足了我的要求

yoyoho 发表于 2013-6-27 17:23:08

nzl1116 发表于 2013-6-25 16:40 static/image/common/back.gif


感謝 nzl1116 分享程序!
页: [1]
查看完整版本: 请高手相助!选择含分号的字符串,将分号“;”前后的文字互换