维马尔,
如果我理解正确
- ;; Providing a selection set and a text string
- ;; will remove from the given ss all entities
- ;; with that text string
- (defun texthtfilter3 (ssx name / i text)
- (repeat (setq i (sslength ssx));count no of texts absorbs
- (setq text (cdr (assoc 1 (entget (ssname ssx (setq i (1- i)))))))
- (if (= text name); remove first texts
- (ssdel (ssname ssx i) ssx)
- ); if
- );repeat
- ssx
- ); end text filer3
- ;;i.e.:
- (if (setq ss1 (ssget '((0 . "TEXT"))))
- (texthtfilter3 ss1 "Test");; will remove from the selection set ss1 all entities with a text string "Test"
- );;
或者如果需要删除多个texto字符串
- ;; Providing a selection set and a list of text strings
- ;; will remove from the given ss all entities with the
- ;; provided text strings
- (defun texthtfilter4 (ssx names / i text)
- (foreach n names
- (repeat (setq i (sslength ssx));count no of texts absorbs
- (setq text (cdr (assoc 1 (entget (ssname ssx (setq i (1- i)))))))
- (if (= text n); remove first texts
- (ssdel (ssname ssx i) ssx)
- ); if
- ); repeat
- ); foreach
- ssx
- ); end text filer4
- ;; i.e.
- (if (setq ss (ssget '((0 . "TEXT"))))
- (texthtfilter4 ss '("Test" "Test1"));; will remove from the given ss all entities with a text string "Test" and "Test1"
- );;
亨里克 |