如何清空选择集
这个代码我用来从选择集中删除给定的文本(名称)但我无法重复此操作以删除其他文本(名称1)
如何清空选择集sstest 您已经根据选择集的数量进行了重复运行,那么为什么要从选择集中删除ename呢?
您可能需要描述在没有代码的情况下您想要做什么。 维马尔,
如果我理解正确
;; 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"
);;
亨里克 或者,您可以在选择时从集合中排除相关字符串:
(ssget '((0 . "TEXT") (1 . "~Test"))) 我同意塔瓦特的观点。你的要求很不明确。你需要提供你所拥有的以及你想用你所拥有的做什么的细节。顺便说一句,在处理字符串时一定要检查大小写。当一个字符串工作而另一个不工作时,这将是我的第一个猜测。下一个将是解释所有空格。 4
先生们,很抱歉打扰你们。
我如上所述解决了任务 好吧,如果你这么说的话。很难看到几乎没有格式的代码。顺便说一句,看起来你仍然有一个流浪的'抄送'。
页:
[1]