<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Recursive Explode lisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5699939#M140476</link>
    <description>&lt;P&gt;Hello all, I'm new here so please correct me If i am not following any rules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write/ manipulate some lisp code that will continue to explode blocks until no more can be exploded.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to get this to happen, but the lisp function keeps running even though the returned results are unchanging.&lt;/P&gt;&lt;P&gt;eg. This is continuously returned.&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Command: _.explode&lt;BR /&gt;Select objects: 7 found&lt;BR /&gt;Select objects:&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe I need to find a way to tell the lisp to stop once it returns two unchanged numbers of found blocks (in the case above - 7).&lt;/P&gt;&lt;P&gt;If anyone is able to help I would really appreciate it. Code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:exall(/ bSet)&lt;BR /&gt;(setvar "qaflags" 1)&lt;BR /&gt;(while (setq bSet(ssget "_X" '((0 . "INSERT"))))&lt;BR /&gt;(command "_.explode" bSet "")&lt;BR /&gt;); end while&lt;BR /&gt;(repeat 3(command "-purge" "all" "" "n"))&lt;BR /&gt;(setvar "qaflags" 0)&lt;BR /&gt;(princ)&lt;BR /&gt;); end of c:exall&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2015 15:29:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-30T15:29:29Z</dc:date>
    <item>
      <title>Recursive Explode lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5699939#M140476</link>
      <description>&lt;P&gt;Hello all, I'm new here so please correct me If i am not following any rules.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write/ manipulate some lisp code that will continue to explode blocks until no more can be exploded.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to get this to happen, but the lisp function keeps running even though the returned results are unchanging.&lt;/P&gt;&lt;P&gt;eg. This is continuously returned.&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Command: _.explode&lt;BR /&gt;Select objects: 7 found&lt;BR /&gt;Select objects:&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;BR /&gt;Cannot explode that block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe I need to find a way to tell the lisp to stop once it returns two unchanged numbers of found blocks (in the case above - 7).&lt;/P&gt;&lt;P&gt;If anyone is able to help I would really appreciate it. Code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:exall(/ bSet)&lt;BR /&gt;(setvar "qaflags" 1)&lt;BR /&gt;(while (setq bSet(ssget "_X" '((0 . "INSERT"))))&lt;BR /&gt;(command "_.explode" bSet "")&lt;BR /&gt;); end while&lt;BR /&gt;(repeat 3(command "-purge" "all" "" "n"))&lt;BR /&gt;(setvar "qaflags" 0)&lt;BR /&gt;(princ)&lt;BR /&gt;); end of c:exall&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:29:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5699939#M140476</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-30T15:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive Explode lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700122#M140477</link>
      <description>This looks like nice complex routine for your issue...&lt;BR /&gt;&lt;A href="https://sites.google.com/site/cadkits/home/explodeall" target="_blank"&gt;https://sites.google.com/site/cadkits/home/explodeall&lt;/A&gt;</description>
      <pubDate>Tue, 30 Jun 2015 16:57:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700122#M140477</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-06-30T16:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive Explode lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700134#M140478</link>
      <description>&lt;P&gt;Ha, thank you BeeKeeCZ.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I actually want to add it to a much larger routine which I can batch apply to files.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 17:01:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700134#M140478</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-30T17:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive Explode lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700171#M140479</link>
      <description>&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/routine-explode-all-blocks-except-one-block/td-p/5019464" target="_blank"&gt;http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/routine-explode-all-blocks-except-one-block/td-p/5019464&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Post 11&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 17:19:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700171#M140479</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-06-30T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive Explode lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700700#M140480</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;I'm trying to write/ manipulate some lisp code that will continue to explode blocks until no more can be exploded.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Something like this, perhaps&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)
(defun c:demo (/ explodable adoc exp_lst not_explodable ss)

  (defun explodable (ss / i lst name obj)
    (repeat (setq i (sslength ss))
      (setq obj  (vlax-ename-&amp;gt;vla-object (ssname ss (setq i (1- i))))
            name (vla-get-effectivename obj)
      )
      (if (and (not (vl-position name not_explodable))
               (vlax-write-enabled-p obj)
          )
        (setq lst (cons obj lst))
      )
    )
    lst
  )

  (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
  (vla-startundomark adoc)
  (vlax-for blk (vla-get-Blocks adoc)
    (if (or (eq (vla-get-explodable blk) :vlax-false)
            (eq (vla-get-isxref blk) :vlax-true)
        )
      (setq not_explodable (cons (vla-get-name blk) not_explodable))
    )
  )
  (while (and (setq ss (ssget "_X" '((0 . "INSERT"))))
              (setq exp_lst (explodable ss))
         )
    (foreach blk exp_lst
      (vla-explode blk)
      (vla-delete blk)
    )
  )
  (vla-endundomark adoc)
  (princ)
)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps alt-edited"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 21:37:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/recursive-explode-lisp/m-p/5700700#M140480</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-06-30T21:37:55Z</dc:date>
    </item>
  </channel>
</rss>

