(defun c:findkatt (/ i tl en ed an ad ss)
(setq tl '("VAV" "M2"))
(princ "\nSearching For Tagnames: ")
(prin1 tl)
(and (setq ss (ssget "X" '((0 . "INSERT")(66 . 1))))
(while (setq en (ssname ss 0))
(setq ed (entget en)
an (entnext en)
ad (entget an)
i 0)
(while (/= "SEQEND" (cdr (assoc 0 ad)))
(if (member (strcase (cdr (assoc 1 ad))) tl)
(setq i (1+ i)))
(setq an (entnext an)
ad (entget an)))
(if (= i (length tl))
(progn
(command "_.ZOOM" "_C" (trans (cdr (assoc 10 ed)) en 1) "")
(redraw en 3)
(getstring (strcat "\n" (cdr (assoc 2 ed))
" Press Enter To Continue..."))))
(ssdel en ss)))
(princ "\nSearch Complete ")
(redraw)
(prin1)) 是的,李,这一个也有多次出现。
你几乎在那里,但VAV和M2不是静态的。这两个属性都有任何值。VAV为设备类型,M2为设备编号。VAv可以是RTU、CEF、SP等,M2可以是A1、B2、C3等。
我试过这个,但也没用
(defun c:findkatt (/ i tl en ed an ad ss unit unitno)
(setq unit (getstring "\n Enter unit type:"))
(setq unitno (getstring "\n Enter unit type:"))
(setq tl '(unit unitno))
(princ "\nSearching For Tagnames: ")
(prin1 tl)
(and (setq ss (ssget "X" '((0 . "INSERT")(66 . 1))))
(while (setq en (ssname ss 0))
(setq ed (entget en)
an (entnext en)
ad (entget an)
i 0)
(while (/= "SEQEND" (cdr (assoc 0 ad)))
(if (member (strcase (cdr (assoc 1 ad))) tl)
(setq i (1+ i)))
(setq an (entnext an)
ad (entget an)))
(if (= i (length tl))
(progn
(command "_.ZOOM" "_C" (trans (cdr (assoc 10 ed)) en 1) "")
(redraw en 3)
(getstring (strcat "\n" (cdr (assoc 2 ed))
" Press Enter To Continue..."))))
(ssdel en ss)))
(princ "\nSearch Complete ")
(redraw)
(prin1)) 看起来您在搜索属性值,而不是标记名:
(defun c:findmatv (/ fl tl en ed an ad av ss)
(setq tl '("VAV" "M2"))
(princ "\nSearching For Attrib Values: ")
(prin1 tl)
(and (setq ss (ssget "X" '((0 . "INSERT")(66 . 1))))
(while (setq en (ssname ss 0))
(setq ed (entget en)
an (entnext en)
ad (entget an)
fl nil)
(while (/= "SEQEND" (cdr (assoc 0 ad)))
(setq av (cdr (assoc 1 ad)))
(and (member av tl)
(not (member av fl))
(setq fl (cons av fl)))
(setq an (entnext an)
ad (entget an)))
(if (= (length fl) (length tl))
(progn
(command "_.ZOOM" "_C" (trans (cdr (assoc 10 ed)) en 1) "")
(redraw en 3)
(getstring (strcat "\n" (cdr (assoc 2 ed))
" Press Enter To Continue..."))))
(ssdel en ss)))
(princ "\nSearch Complete ")
(redraw)
(prin1))
-大卫 谢谢大卫和李。谢谢你的帮助。这就是我一直在找的。我学到了很多。再次感谢。。。
页:
1
[2]