如何识别块实例
需要帮助!在模型空间中,有许多块实例具有一个块参照的不同属性值,如何识别每个实例?
我试图列出这一块引用的每个实例的所有属性值。
谢谢
必应 我会用这样的东西:
(defun c:getatts(/ bdef blk ss att aLst attLst)
(vl-load-com)
(setq bdef (getvar "INSNAME"))
(while (not blk)
(setq blk (getstring t (strcat "\nSpecify Block to be Searched <" bdef ">: ")))
(cond ((eq "" blk)
(setq blk bdef))
((and (snvalid blk)
(tblsearch "BLOCK" blk)))
(T (setq blknil bdef ""))))
(if (setq ss (ssget "X" (list (cons 0 "INSERT")
(cons 2 blk)
(cons 66 1)
(if (getvar "CTAB")
(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE")))))))
(progn
(foreach x(mapcar 'cadr (ssnamex ss))
(setq att (entnext x))
(while (not (eq "SEQEND" (cdadr (setq aLst (entget att)))))
(setq attLst (cons (cons (cdr (assoc 2 aLst))
(cdr (assoc 1 aLst))) attLst)
att (entnext att))))
(alert (vl-princ-to-string (reverse attLst))))
(princ "\n<!> No Blocks Found <!>"))
(princ))
将以以下格式将所有属性列为关联列表:
(.) 你好
你可以替换这个
(foreach x(mapcar 'cadr (ssnamex ss))
(setq att (entnext x))
(while (not (eq "SEQEND" (cdadr (setq aLst (entget att)))))
(setq attLst (cons (cons (cdr (assoc 2 aLst))
(cdr (assoc 1 aLst))) attLst)
att (entnext att))))
(alert (vl-princ-to-string (reverse attLst)))
+ 很好,帕特里克-谢谢 VBA可以接受吗? 我认为VBA也可以做到这一点,是的。 我尝试了几种方法,但都没有成功。 我相信这里有人很乐意提供代码,但是我对VBA知之甚少。。。
页:
[1]