一共选择了个块名称含灯的块
派大上码.......... 664571221 发表于 2023-5-8 09:02
大神可以数出来了,是否可以吧文字插入cad呢
改了,再试试
(defun c:tt ()
"统计块名称含灯的块"
(if (setq ss (ssget "x" '((0 . "INSERT") (66 . 1))))
(progn
(setq lst(vl-remove-if-not'(lambda (x) (setq a (mapcar 'last (xyp-Att2list x))) (vl-some '(lambda (x) (vl-string-search "灯" x)) a))(xyp-Ss2List ss)))
(princ (strcat "\n一共选择了< " (itoa (length lst)) " >个块名称含灯的块"))
)
)
(princ)
)
(defun c:tt(/ p s)
(if (ssget ":S" '((0 . "insert")(2 . "$equip$*")))
(progn
(vlax-for e (vla-get-activeselectionset (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (vla-Get-HasAttributes e)
(foreach x
(vlax-safearray->list (vlax-variant-value (vla-GetAttributes e)))
(if (and (= "A" (vla-Get-TagString x))
(wcmatch (vla-Get-TextString x)"*灯*")
)
(setq s (cons e s))
)
)
)
)
(if (ands (setq s (mapcar '(lambda(x)(vlax-get x 'insertionpoint)) s))
(setq p (getpoint"\n大力出奇迹..."))
)
(progn
(command "text" p 350 0 (strcat "选中了"(itoa (length s))"个含灯的块"))
(foreach x s (command "line" "non" x "non" p ""))
)
)
)
)
) 664571221 发表于 2023-5-14 21:49
(defun c:tt(/ p s)
(if (ssget ":S" '((0 . "insert")(2 . "$equip$*")))
(progn
楼上是波总的代码 院长这个X用的好
页:
1
[2]