(vl-load-com)
(defun explode-table (ent erase / adoc def ent_lst res_lst ins)
;; (setq ent (car (entsel)))
(if (and (setq ent (cond ((= (type ent) 'ename) ent)
((= (type ent) 'vla-object) (vlax-vla-object->ename ent))
) ;_ end of cond
) ;_ end of setq
(setq def (vla-item (vla-get-blocks (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(cdr (assoc 2 (entget ent)))
) ;_ end of vla-item
) ;_ end of setq
) ;_ end of and
(progn (vlax-for ent def (setq ent_lst (cons ent ent_lst)))
(setq ins (vla-get-insertionpoint (vlax-ename->vla-object ent))
res_lst (vla-copyobjects adoc
(vlax-make-variant
(vlax-safearray-fill (vlax-make-safearray vlax-vbobject (cons 0 (1- (length ent_lst)))) ent_lst)
) ;_ end of vlax-make-variant
(vla-get-modelspace adoc)
) ;_ end of vla-copyobjects
) ;_ end of setq
(foreach ent (vlax-safearray->list (vlax-variant-value res_lst))
(vla-move ent (vlax-3d-point '(0. 0. 0.)) ins)
) ;_ end of foreach
(if erase
(entdel ent)
) ;_ end of if
) ;_ end of progn
) ;_ end of if
) ;_ end of defun