(defun c:ExplodeInsideBlocks ()
(defun get-block-entities (blk / ent lst)
(if (and (setq blk (vla-get-effectivename (vlax-ename->vla-object blk)))
(setq ent (tblobjname "block" blk))
)
(while (setq ent (entnext ent)) (setq lst (cons ent lst)))
)
(reverse lst)
)
;;
(defun explodefunction (entnm / obj xx blkentlst)
(if (setq enx (entget entnm))
(progn (setq typ (strcase (cdr (assoc 0 enx))))
(if (and (eq typ "INSERT") (setq blkentlst (get-block-entities entnm)))
(progn ;;
(mapcar (function (lambda (xx)
(if (not (eq entnm xx))
(explodefunction xx)
)
)
)
blkentlst
)
)
(progn ;;
(command "_.explode" entnm)
)
)
)
)
)
(if (setq sset (ssget "_:L" (list (cons 0 "INSERT"))))
(repeat (setq n (sslength sset)) (setq ent (ssname sset (setq n (1- n)))) (explodefunction ent))
)
(princ)
)
"(command "_.explode" entnm)"
when I use "(vla-put-color (vlax-ename->vla-object entnm) 3)"
it works. I also tried "(vla-explode (vlax-ename->vla-object entnm))"
but it also does not work. When I am able to change the color of all entities within a block (without exploding the block), what is the problem in exploding those entities ?(vlax-for x def
(if (vlax-method-applicable-p x 'explode)
(if (listp (setq spawn (vl-catch-all-apply 'vlax-invoke (list x 'explode))))
(progn
(princ (strcat "\n" (vla-get-objectname x) " <" (vla-get-handle x) "> exploded."))
(vl-catch-all-apply 'vlax-invoke (list x 'delete))
)
(princ (strcat "\n" (vla-get-objectname x) " <" (vla-get-handle x) "> could not be exploded "))
)
)
)