I need to explode everything in my drawing. The problem is that our blocks
are not that great. We have blocks inside blocks.
When my LISP routine executes the explode it explodes all the selected
items. But there are still some blocks that exist. So I doubled the
explode command, but it doesn't find the new blocks. If I type in explode
then all, it still doesn't work. I have to use the mouse and select all the
items by a window and then type explode.
How can I do this in my LISP routine?
Chad
--
________________________________
Cameron Land Surveying Ltd.
#203-6333 148 Street
Surrey, BC V3S 1C1
(o) (604) 597-3777
(f) (603) 597-3783
All E-Mail Scanned with Norton Anti-Virus
(while (setq SS (ssget "ALL"))
(command "_explode" SS "")
)
"ECCAD" <nos...@address.withheld> wrote in message
news:11463480.1090425171360.JavaMail.javamailuser@localhost...
--
Autodesk Discussion Group Facilitator
"Alan Henderson @ A'cad Solutions" <REMOV...@acadsolutions.biz> wrote in
message news:40fe9431$1_3@newsprd01...
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
;;Explode all inserts
(defun c:xpall () ;;D. C. Broad 2004
(setvar "qaflags" 1)
(while (setq ss (ssget "x" (list (cons 0 "insert"))))
(command "explode" ss ""))
(setvar "qaflags" 0)
(princ)
)
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message news:40fe8a68$1_3@newsprd01...
Makes the loop even longer...
:)
Bob
Chad
"ECCAD" <nos...@address.withheld> wrote in message
news:11463480.1090425171360.JavaMail.javamailuser@localhost...
I tried it again, and it worked. So I tried it a couple of times, and it
randomly works.
???
Chad
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message
news:40fea2bf$1_2@newsprd01...
Bob
Bob
"ECCAD" <nos...@address.withheld> wrote in message news:24014580.109043153...@jiveforum1.autodesk.com...
I tried your. It appears to do nothing. This is what is displayed on the
prompt:
C:XPALL
all blocks are still blocks.
Now what?
Chad
PS: I did try yours. How do I expand the filter list to include everything?
"Doug Broad" <nospam@address-withheld> wrote in message
news:40fe98c9$1_1@newsprd01...
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message
news:40feb74f$1_3@newsprd01...
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message news:40feb74f$1_3@newsprd01...
I have done the layer assignments already & the colours, except, that the
blocks have lines from other layers, so I have to explode the block so I can
change the layers of the lines inside the block. Not everything on the
drawing is blocks, I have text, mtext, plines, lines, etc.
If I highlight everything and type explode, it will say 10 items found 5
items could not be exploded. So I do it again, then it might say 20 items
found, 15 could not be exploded. So I do it again, and it might say 100
items found 100 items could not be exploded.
Now I know all items are exploded, and I can select everything and change it
so that the colour, linetype are 'bylayer'.
I want to be able to do this with a lisp command.
Chad
ECCAD: your way works occasionally. From what I understand, if it comes
across a line it stops the lisp routine because it cannot be exploded.
Doug: your did nothing.
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message
news:40feb74f$1_3@newsprd01...
That works perfectly.
Thanks everyone.
Chad
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message
news:40fe8a68$1_3@newsprd01...
Before using the command you should make sure
all layers are unlocked as Doug Barr explained.
If you want to include everything, you need to
delete the (list (cons 0 . "insert")) but then
it will error out because it tries to explode
unexplodable objects. To include mtext and
polyline, modify:
(list (cons 0 . "insert,mtext,LWPOLYLINE"))
If you explode polylines, you lose the width and
curve fit parameters.
"CLS" <camer...@NOTshaw.ca remove NOT> wrote in message news:40feb74f$1_3@newsprd01...
> OK Doug,
"Tom Smith" <nospam> wrote in message news:40feba0f$1_2@newsprd01...
May your next blue screen be permanent.
Chad
"Tom Smith" <nospam> wrote in message news:40feba0f$1_2@newsprd01...
Bob
Check me. I think there's a problem with xpall when the drawing contains xrefs. It
goes into an endless loop because the xrefs can't be exploded. But of course they
continue to be added to ss within the while loop based on the "insert" filter.
> ;;Explode all inserts
> (defun c:xpall () ;;D. C. Broad 2004
> (setvar "qaflags" 1)
> (while (setq ss (ssget "x" (list (cons 0 "insert"))))
> (command "explode" ss ""))
> (setvar "qaflags" 0)
> (princ)
> )
Here's something which I think avoids that problem. It probably could be tighter, and
it might not be perfect, but you get the idea. Comments welcome.
(defun c:ExplodeAllInserts ( / doc mspace )
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq mspace (vla-get-ModelSpace doc))
;return T while there are inserts which are not xrefs
(while
(vlax-for x mspace
(if
(and
(= "AcDbBlockReference" (vlax-get x 'ObjectName))
(not (vlax-property-available-p x 'Path))
)
T
)
)
(vlax-for x mspace
(if
(and
(= "AcDbBlockReference" (vlax-get x 'ObjectName))
(not (vlax-property-available-p x 'Path))
)
(progn
(vlax-invoke x 'Explode)
(vlax-invoke x 'Delete)
)
)
)
) ;while
(princ)
) ;end
Regards
Joe Burke
;;A program by Joe Burke with changes by D.C. Broad
;;Explode all inserts - skip xrefs.
(defun c:xpAll (/ doc mspace blockflag)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq mspace (vla-get-ModelSpace doc))
(setq blockflag t)
;;loop until no blocks are found.
(while blockflag
(setq blockflag nil)
(vlax-for x mspace
(cond
((and
(= "AcDbBlockReference" (vlax-get x 'ObjectName))
(not (vlax-property-available-p x 'Path))
)
;;if a block is found assume it might have a nested
;;block and loop again.
(setq blockflag t)
(vla-explode x)
(vla-delete x)
))))
(princ))
"Joe Burke" <job...@hawaii.rr.com> wrote in message news:41039f5b_1@newsprd01...
> Hi Doug,
>
> Check me. I think there's a problem with xpall when the drawing contains xrefs. It
> goes into an endless loop because the xrefs can't be exploded. But of course they
> continue to be added to ss within the while loop based on the "insert" filter.
>
<snip>
That's mo' better. :-)
I modified a bit to operate in the active space. I think that's what I would want it
to do. But maybe it should explode all in model and paper space. What do you think?
Joe Burke
;;A program by Joe Burke with changes by D.C. Broad
;;Explode all inserts in the current space - skip xrefs.
(defun c:xpAll (/ doc space blockflag)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (= 1 (vlax-get doc 'ActiveSpace))
(setq space (vla-get-ModelSpace doc))
(setq space (vla-get-PaperSpace doc))
)
(setq blockflag t)
;;loop until no blocks are found.
(while blockflag
(setq blockflag nil)
(vlax-for x space
(cond
((and
(= "AcDbBlockReference" (vlax-get x 'ObjectName))
(not (vlax-property-available-p x 'Path))
)
;;if a block is found assume it might have a nested
;;block and loop again.
(setq blockflag t)
(vla-explode x)
(vla-delete x)
))))
(princ)
) ;end
> Great points Joe. I overlooked xrefs. Oops.
> Looked at your program and made a few changes. What
> do you think?
> snip