Here are some codes I use to dig into entity data. If you want to step through layer 0, then call like
(ChaseEntData (tblobjname "layer" "0"))
(defun c:ChaseEntData (/ Sel)
(if (setq Sel (entsel))
(ChaseEntData (car Sel))
)
(princ)
)
;-----------------------------------------
(defun ChaseEntData (Ent / DiaRtn DataList)
(while
(and
Ent
(setq DiaRtn
(SingleSelectWide
(mapcar
'(lambda (x / tempType)
(if
(and
(equal (type (cdr x)) 'ENAME)
(setq tempType (cdr (assoc 0 (entget (cdr x)))))
)
(strcat
(vl-princ-to-string (car x))
"\t\t"
(vl-princ-to-string (cdr x))
" [ "
tempType
" ]"
)
(strcat
(vl-princ-to-string (car x))
"\t\t"
(vl-princ-to-string (cdr x))
)
)
)
(setq DataList (entget Ent '("*")))
)
"Select entity name to chase."
nil
)
)
)
(if (not (equal (type (setq Ent (cdr (nth (car DiaRtn) DataList)))) 'ENAME))
(setq Ent nil)
)
)
)
(defun SingleSelectWide (Listof Message Toggle / DiaLoad tmpStr tmpTog tmpList)
(setq DiaLoad (load_dialog "MyDialogs.dcl"))
(if (new_dialog "SingleSelectWide" DiaLOad)
(progn
(start_list "listbox" 3)
(mapcar 'add_list Listof)
(end_list)
(if Message
(set_tile "text1" Message)
)
(if (not Toggle)
(mode_tile "toggle1" 1)
)
(action_tile "listbox"
"(if (= $reason 4)
(progn
(setq tmpStr (get_tile \"listbox\"))
(if Toggle
(setq tmpTog (get_tile \"toggle1\"))
)
(done_dialog 1)
)
)"
)
(action_tile "accept"
"(progn
(setq tmpStr (get_tile \"listbox\"))
(if Toggle
(setq tmpTog (get_tile \"toggle1\"))
)
(done_dialog 1)
)"
)
(action_tile "cancel" "(done_dialog 0)")
(if (= (start_dialog) 1)
(progn
(setq tmpList (read (strcat "(" tmpStr ")")))
(if (= tmpTog "1")
(cons T tmpList)
tmpList
)
)
)
)
)
)