如何从多类型的选择集中提取以字母开头的文字内容?
我用ssget获取了一个选择集,如上图,选择集中有两个单行文字、多段线、标注等,如何提取出 那个以字母开头的文字内容呢?
用ssget带过滤条件仅提取出以字母开头的文字选择集,我会。但是如何从多类型的选择集中提取以字母开头的文字内容呢?
(defun c:tt (/ ss ent i Text c1 newss)
(setq ss (ssget))
(setq newss (ssadd))
(setq i 0)
(while (< i (sslength ss))
(setq ent (ssname ss i))
(if (= (cdr (assoc 0 (entget ent))) "TEXT")
(progn
(setq Text (cdr (assoc 1 (entget ent))))
(setq c1 (substr Text 1 1))
(if
(or (and (> c1 "@") (< c1 "["))
(and (> c1 "`") (< c1 "{"))
)
(ssadd ent newss);;加入新的选择集
)
)
)
(setq i (1+ i))
)
(princ)
) (command "select" ss "")
(ssget "P" '((1 . "@*"))) tryhi 发表于 2020-6-30 09:47
(command "select" ss "")
(ssget "P" '((1 . "@*")))
“@*”是什么意思? gaics 发表于 2020-6-30 11:57
“@*”是什么意思?
用ssget带过滤条件仅提取出以字母开头的文字选择集,我会
你不是说你会?不用@*你用什么会? tryhi 发表于 2020-6-30 17:05
用ssget带过滤条件仅提取出以字母开头的文字选择集,我会
你不是说你会?不用@*你用什么会?
那不是我说的 gaics 发表于 2020-6-30 08:55
(defun c:tt (/ ss ent i Text c1 newss)
(setq ss (ssget))
(setq newss (ssadd))
是不是用 wcmatch 好些? gaics 发表于 2020-6-30 08:55
(defun c:tt (/ ss ent i Text c1 newss)
(setq ss (ssget))
(setq newss (ssadd))
是不是用 wcmatch 好些? 本帖最后由 小万LISP 于 2020-7-1 21:41 编辑
失礼了失礼了
失礼了
失礼了
本帖最后由 tryhi 于 2020-6-30 23:45 编辑
小万LISP 发表于 2020-6-30 22:30
版主,我觉得自己的代码写的最好,能自己拿悬赏的分吗?
你的代码最好?我怀疑你没有看懂ssget "P",所以自动忽略掉我的回复
;从选择集中提取以字母开头的文字
(defun c:tt()
(setq SS(ssget))
(command "select" ss "")
(setq ss@(ssget "P" '((1 . "@*"))))
(setq a -1)
(while
(setq en(ssname ss@(setq a(1+ a))))
(setq str(cdr(assoc 1(entget en))))
(terpri)(princ str)
)
)
(princ)
页:
[1]
2