- ;;;前后分别加"(" ")"
- (defun C:test1 (/ ss)
- (defun LM:ss->vla (ss)
- ;;->Lee Mac 2010
- (if ss
- ((lambda (i / e l)
- (while (setq e (ssname ss (setq i (1+ i))))
- (setq l (cons (vlax-ename->vla-object e) l))
- )
- l
- )
- -1
- )
- )
- )
- (setq ss (ssget '((0 . "TEXT"))))
- (setq ss (LM:ss->vla ss))
- (mapcar
- '(lambda (x / str)
- (setq str (vl-string-right-trim " " (vla-get-TextString x)))
- (setq str (vl-string-left-trim " " str))
- (vla-put-TextString x (strcat "(" str ")"))
- )
- ss
- )
- (princ)
- )
- ;;;前后分别删"(" ")"
- (defun C:test2 (/ ss)
- (defun LM:ss->vla (ss)
- ;;->Lee Mac 2010
- (if ss
- ((lambda (i / e l)
- (while (setq e (ssname ss (setq i (1+ i))))
- (setq l (cons (vlax-ename->vla-object e) l))
- )
- l
- )
- -1
- )
- )
- )
- (setq ss (ssget '((0 . "TEXT"))))
- (setq ss (LM:ss->vla ss))
- (mapcar
- '(lambda (x / str)
- (setq str (vl-string-right-trim " " (vla-get-TextString x)))
- (setq str (vl-string-left-trim " " str))
- (if (= (substr str 1 1) "(")
- (setq str (substr str 2 (1- (strlen str))))
- )
- (if (= (substr str (strlen str) 1) ")")
- (setq str (substr str 1 (1- (strlen str))))
- )
- (vla-put-TextString x str)
- )
- ss
- )
- (princ)
- )
- ;;;删除所有"(" ")"
- (defun C:test3 (/ ss)
- (defun LM:ss->vla (ss)
- ;;->Lee Mac 2010
- (if ss
- ((lambda (i / e l)
- (while (setq e (ssname ss (setq i (1+ i))))
- (setq l (cons (vlax-ename->vla-object e) l))
- )
- l
- )
- -1
- )
- )
- )
- (setq ss (ssget '((0 . "TEXT"))))
- (setq ss (LM:ss->vla ss))
- (mapcar
- '(lambda (x / str)
- (setq str (vl-string->list (vla-get-TextString x)))
- (setq str (vl-remove-if '(lambda(x) (or (= x 40)(= 41 x))) str))
- (setq str (vl-list->string str))
- (vla-put-TextString x str)
- )
- ss
- )
- (princ)
- )
|