A couple questions about the Explode method.
First, I find when used on a block or pline, the source vla object itself is not exploded. Rather it's like making a copy, and exploding the copy. I guess that's just how it works. But it seems strange there's no reference to this in help on the Explode method. It says, "refer to the Explode command topic..." hmm.
Second question is somewhat related to the first. It seems the new objects created by the Explode method are not immediately accessible. The following Test function demonstrates. With the line (command "point" 0,0) commented out, (if ss... test returns "... out-to-lunch". With (command "point" 0,0) included, (if ss... test returns the correct entity list, i.e., what you'd expect. It *seems* the database has to be altered in some way before the exploded vla objects are recognized.
(defun c:Test ( / ent ename pt vobj vlst ss )
(setq ent (entsel "\nSelect block or pline: "))
(setq ename (car ent))
(setq pt (cadr ent))
(setq vobj (vlax-ename->vla-object ename))
(setq vlst (vlax-invoke vobj 'Explode)) ;list of exploded vla objects (vla-delete vobj) ;delete source object ;(foreach x vlst (vlax-release-object x)) ;error: unable to get ObjectID (print (mapcar 'vlax-write-enabled-p vlst)) ;(T T) no hint, seems right (command "point" 0,0) ;** compare with this line commented out ** (setq ss (ssget pt)) ;selection set at point pt (if ss (print (entget (ssname ss 0))) ;if something, what is it? (print "Object is out-to-lunch") ;else - command "point" is commented out ) (princ)
) ;end
I'd appreciate any thoughts on this. Just want to understand what's going on.
Thanks
Joe Burke
First, I find when used on a block or pline, the source vla object itself is not exploded. Rather it's like making a copy, and exploding the copy. I guess that's just how it works. But it seems strange there's no reference to this in help on the Explode method. It says, "refer to the Explode command topic..." hmm.
Second question is somewhat related to the first. It seems the new objects created by the Explode method are not immediately accessible. The following Test function demonstrates. With the line (command "point" 0,0) commented out, (if ss... test returns "... out-to-lunch". With (command "point" 0,0) included, (if ss... test returns the correct entity list, i.e., what you'd expect. It *seems* the database has to be altered in some way before the exploded vla objects are recognized.
(defun c:Test ( / ent ename pt vobj vlst ss )
(setq ent (entsel "\nSelect block or pline: "))
(setq ename (car ent))
(setq pt (cadr ent))
(setq vobj (vlax-ename->vla-object ename))
(setq vlst (vlax-invoke vobj 'Explode)) ;list of exploded vla objects (vla-delete vobj) ;delete source object ;(foreach x vlst (vlax-release-object x)) ;error: unable to get ObjectID (print (mapcar 'vlax-write-enabled-p vlst)) ;(T T) no hint, seems right (command "point" 0,0) ;** compare with this line commented out ** (setq ss (ssget pt)) ;selection set at point pt (if ss (print (entget (ssname ss 0))) ;if something, what is it? (print "Object is out-to-lunch") ;else - command "point" is commented out ) (princ)
) ;end
I'd appreciate any thoughts on this. Just want to understand what's going on.
Thanks
Joe Burke