(vl-load-com)
(defun t2 (/ _kpblc-get-active-space-obj adoc space table point row col mi ma)
(defun _kpblc-get-active-space-obj (doc)
(if (and (zerop (vla-get-activespace doc)) (equal :vlax-false (vla-get-mspace doc)))
(vla-get-paperspace doc)
(vla-get-modelspace doc)
) ;_ end of if
) ;_ end of defun
(if (and (= (type (vl-catch-all-apply (function (lambda () (setq point (getpoint "\nPick the point : "))))))
'list
) ;_ end of =
point
) ;_ end of and
(progn
(setq adoc (vla-get-activedocument (vlax-get-acad-object))
space (_kpblc-get-active-space-obj adoc)
) ;_ end of setq
(vlax-for ent (if (vlax-property-available-p space 'block)
(vla-get-block space)
space
) ;_ end of if
(if (and (not table)
(= (vla-get-objectname ent) "AcDbTable")
(not (vl-catch-all-error-p
(vl-catch-all-apply
(function (lambda () (vla-getboundingbox ent 'mi 'ma)))
) ;_ end of vl-catch-all-apply
) ;_ end of vl-catch-all-error-p
) ;_ end of not
(apply (function and)
(mapcar (function <=) (vlax-safearray->list mi) point (vlax-safearray->list ma))
) ;_ end of apply
) ;_ end of and
(setq table ent)
) ;_ end of if
) ;_ end of vlax-for
(if table
(progn
(vla-hittest table (vlax-3d-point point) (vlax-3d-point (trans (getvar 'viewdir) 1 0)) 'row 'col)
(list (cons "table" table)
(cons "row" row)
(cons "col" col)
(cons "cellvalue" (vla-getcellvalue table row col))
(cons "text" (vla-gettext table row col))
) ;_ end of list
) ;_ end of progn
) ;_ end of if
) ;_ end of progn
) ;_ end of if
) ;_ end of defun