逐步遍历集合和各种“子实体”的示例
- (defun c:attribext (/ ss i bEnt aEnt aEntlist attlist)
- (vl-load-com)
- (if (setq ss (ssget "X"
- (list (cons 0 "INSERT")
- (cons 66 1)
- (if (getvar "CTAB")
- (cons 410 (getvar "CTAB"))
- (cons 67 (- 1 (getvar "TILEMODE")))
- )
- )
- )
- )
- (progn
- (setq i (sslength ss))
- (while (not (minusp (setq i (1- i))))
- (setq bEnt (ssname ss i)
- aEnt (entnext bEnt)
- )
- (while (/= "SEQEND" (cdr (assoc 0 (entget aEnt))))
- (setq aEntlist (entget aEnt)
- attlist (cons (cons (cdr (assoc 2 aEntlist)) (cdr (assoc 1 aEntlist))) attlist)
- )
- (setq aEnt (entnext aEnt))
- )
- )
- )
- (princ "\n<!> No Attributed Blocks Found <!>")
- )
- (alert (vl-princ-to-string attlist))
- (princ)
- )
|