Tear this apart. This is used to find polygons that don't have a object data table called "Disp" so if the object is simply missing the table use this.
Code:
;;; Utility to find polygons that are missing object data.
;;; Set the table name to what it is supposed to be
(defun c:no_od (/ item tables ss sset p1 p2)
(prompt "\nSelect Objects to test by Window")
(setq p1 (getpoint "\nFirst Corner: "))
(setq p2 (getcorner p1 "\nSecond Corner: "))
(setq sset ; this is the selection set of polygons to test
(ssget
"c"
p1
p2
(list (cons 0 "LWPOLYLINE"))
)
)
(if (= sset nil) ; if nothing selected
(progn ; do this
(princ)
(alert "No polylines selected!")
(exit)
) ; end of routine to run if no polygons selected
(progn ; if polygons have been selected do this
(setq ss (ssadd)) ; make an empty selection set to put naked polygons
(setq ctr 0) ; set the counter to zero
(setq numofpolygons (sslength sset)) ; how many polygons selected
(while (and sset (> (sslength sset) 0))
(setq item (ssname sset 0)) ; extract the name of first entity in the list.
(setq tables (ade_odgettables item)) ; get the table names
(if (= (member "Disp" tables) nil)
; if particular object data is missing
(progn ;- in this case "Disp"
(ssadd item ss) ; add the item to the set to highlite
(ssdel item sset) ; delete the item from selection set being tested
)
(ssdel item sset) ; otherwise delete the item from selection set being tested
)
(setq ctr (+ ctr 1)) ; increase the counter
(princ
(strcat "\rChecked " (itoa ctr) " of " (itoa numofpolygons))
)
; checked ctr of numofpolygons
) ; get next item
) ; end of routine to run if polygons selected
) ; end of if
(setq sset nil) ; get rid of this now empty selection set
(setq nood (sslength ss)) ; how many naked polygons
(princ
(strcat "\n" (itoa nood) " polygons have no object data")
)
(sssetfirst ss ss) ; highlite and grip the ss selection set
(princ) ; clean exit
)
If the field is empty use (ade_odgetfield ename table field recnum)
Remember the first recnum is 0 not 1
If nil is returned, there is no data for that field.