我会用这样的东西:
- (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 blk nil 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))
将以以下格式将所有属性列为关联列表:
( . ) |