Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
this is the part of the lisp routine in question:
(repeat 5
(sssetfirst nil (ssget "X" (list )))
(c:burst)
)
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
after burst.
(while (/= oldcnt newcnt)
< loop >
)
You might use the sslength function to get the count.
Joe Burke
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
(while (ssget "X" '((0 . "INSERT")))
(sssetfirst nil (ssget "X" (list )))
(c:burst)
); end while
--
Kent Cooper
stoews1 wrote...
....is there a way to make it do a "burst" as many times as needed until there is "0 found" and then continue on with the routine.
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I think that would be an endless loop is there are either xrefs, or non-explodable
blocks, or blocks which ACAD cannot explode due to non-uniform scaling issues
involved.
Joe
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Both Explode and Burst [unlike, for instance, Refedit] *can* handle non-uniformly-scaled Blocks [at least in ACAD2004], so that shouldn't be a problem.
As for Xref's, I hadn't ever had reason to Explode or Burst one, but sure enough, they won't do it. So yes, it would probably be necessary to precede it all with something like:
(command "_.xref" "_bind" "*")
to change them all into Blocks first.
--
Kent Cooper
Joe Burke wrote...
I think that would be an endless loop is there are either xrefs, or non-explodable blocks, or blocks which ACAD cannot explode due to non-uniform scaling issues involved.
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Kent your
(while (ssget "X" '((0 . "INSERT")))
(sssetfirst nil (ssget "X" (list )))
(c:burst)
); end while
did the job perfectly. Thanks.
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
--
Kent Cooper
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi guys,
Not sure if I should bump a 4 year old thread or make a new one. Anyways, I'm trying to do a similar thing as the OP, but XREF's are giving me some problems. I don't want to bind the XREF's, but want to create a routine which will clean up drawings automatically. Is there an easy way to,
1) Unattach all of the XREF's in a current drawing
2) Run Kent's burst loop
3) Reattach the XREF's
Any help is appreciated.
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I was thinking something like,
(command "_.-xref" "_UNLOAD" "*")
(while (ssget "_A" '((0 . "INSERT")))
(sssetfirst nil (ssget "_A" (list)))
(c:burst)
)
(command "_.-xref" "_RELOAD" "*" )
But of course an unloaded XREF is still 'in' the drawing, and I don't think there's a way to select all blocks which aren't unloaded XREF's. And then if you detach the XREF you have to start keeping track of the names of the XREF's and their directories, and then that's where I don't know quite how to start.
Re: Repeat (c:burst) command in lisp routine
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
jj26 wrote:Hi guys,
Not sure if I should bump a 4 year old thread or make a new one. Anyways, I'm trying to do a similar thing as the OP, but XREF's are giving me some problems. I don't want to bind the XREF's, but want to create a routine which will clean up drawings automatically. Is there an easy way to,
1) Unattach all of the XREF's in a current drawing
2) Run Kent's burst loop
3) Reattach the XREF's
Any help is appreciated.
You don't want to "unattach" them [if by that you mean what AutoCAD calls Detaching them], but rather Unload them, so that you can Reload them and they'll come back as they were. I thought you could just do an Xref Unload *, then run the burst loop, and then Xref Reload *, but (ssget "X" '((0 . "INSERT"))) finds even Unloaded Xrefs, so the loop never stops finding things, even if it can't do anything to them, so it doesn't end.
Another possibility I thought of was to Wblock all Xrefs out to a new drawing, burst everything, and then bring that new drawing back in. But doing so [with one test Xref] converts it from an Xref to a regular Block. I didn't try Xref-ing that back in, but if you have more than one Xref to deal with, I assume you wouldn't want that.
You may need to step through each item and check whether it's an Xref, in which case you don't need to Unload them. I'm not where I can test this, but give it a try:
(defun C:YourCommandName (/ GoAgain blks blk)
(vl-load-com)
(setq GoAgain T); to begin with [make at least one pass]
(while
(and
GoAgain
; will be nil once it makes a pass without finding any non-Xref blocks
(setq blks (ssget "_X" '((0 . "INSERT")))); includes Xref's
); and
(setq GoAgain nil); "zero out" initially for this pass
(repeat (sslength blks)
(setq blk (ssname blks 0)); first [remaining] item in selection
(if (not (vlax-property-available-p (vlax-ename->vla-object blk) 'Path))
; i.e. it's not an Xref [ordinary Blocks don't have Path property]
(progn
(setq GoAgain T); it found one, so run the loop again after this pass
(sssetfirst nil blk)
(c:burst)
); progn
); if
(ssdel blk blks); remove that entity name from selection, go on to next
); repeat
); while
); defun
Might Explode do just as well as Burst under the circumstances? If so, and given that it would do them one at a time, you wouldn't need (sssetfirst), but could replace that line and the (c:burst) line with just:
(command "_.explode" blk)


