<?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 Re: How to stop loop using return integer value? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11093091#M46844</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7963331"&gt;@aliff_ahtenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;...,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;if count "value" is the same for 3 or 5 times, it will stop the loop. and it will continue to do next command. coz some block cannot be explode it will not stop.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is your code what you really intended?&amp;nbsp; There's no Explode operation in it, so I don't see how it relates to the part of the Message quoted above.&amp;nbsp; And what is the point of Moving something at a Displacement of 0,0,0?&amp;nbsp; Since you say it's part of your routine, I think we need to see more of it.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 12:16:43 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2022-04-08T12:16:43Z</dc:date>
    <item>
      <title>How to stop loop using return integer value?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11092068#M46842</link>
      <description>&lt;P&gt;Hai, long time no see, i want to make a loop lisp and stop when that particular number is returning the same value for 3 to 5 time. how do i call it to end? below is part of my lisp routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun C:Test (/ sset)
  (setq brf (ssget "_X" '((0 . "INSERT"))))
  (while (/= count 0)
         (setq count (sslength brf))
         (command "move" brf "" "d" "0,0,0")
  )
(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Supposedly, during while function, i want to do if function, so it is like this,&lt;/P&gt;&lt;P&gt;if count "value" is the same for 3 or 5 times, it will stop the loop. and it will continue to do next command. coz some block cannot be explode it will not stop.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 03:18:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11092068#M46842</guid>
      <dc:creator>aliff_ahtenk</dc:creator>
      <dc:date>2022-04-08T03:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop loop using return integer value?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11092249#M46843</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7963331"&gt;@aliff_ahtenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hai, long time no see, i want to make a loop lisp and stop when that particular number is returning the same value for 3 to 5 time. how do i call it to end? below is part of my lisp routine.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need the "count" to increment at every turn.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:Test (/ count)
  (setq count 5);&amp;lt;-- say for example the number of objects selected
  (while (/= count 0)
         (print (strcat "Current count is " (itoa count)))
    	 (getstring "\nPress any key to continue")
    	(setq count (1- count));&amp;lt;-- increment the count variable by 1 less than the original value 
    )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;If the number of the intended loop is absolute , use repeat instead of while&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:Test2 (/ count)
  (setq count 5);&amp;lt;-- say for example the number of objects selected
  (setq index 1)
  (repeat count
         (print (strcat "Current number of index " (itoa index)))
    	 (setq index (1+ index));&amp;lt;-- increment the index variable by 1 more than the original value 
    )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;As for your routine, it could be as simple as this&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:Test ()
  (if (ssget "_X" '((0 . "INSERT")))
         (command "move" "P" "" "d" "0,0,0")
  )
(princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;No need for a loop or counter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7963331"&gt;@aliff_ahtenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;..coz some block cannot be &lt;STRONG&gt;explode&lt;/STRONG&gt; it will not stop.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is true, it's either you convert the block to be explodable, or flag the name in the next loop for exclusion.&lt;/P&gt;
&lt;P&gt;Let us know if you need help with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 05:55:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11092249#M46843</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2022-04-08T05:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop loop using return integer value?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11093091#M46844</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7963331"&gt;@aliff_ahtenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;...,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;if count "value" is the same for 3 or 5 times, it will stop the loop. and it will continue to do next command. coz some block cannot be explode it will not stop.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is your code what you really intended?&amp;nbsp; There's no Explode operation in it, so I don't see how it relates to the part of the Message quoted above.&amp;nbsp; And what is the point of Moving something at a Displacement of 0,0,0?&amp;nbsp; Since you say it's part of your routine, I think we need to see more of it.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 12:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11093091#M46844</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-04-08T12:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop loop using return integer value?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11097104#M46845</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;i wish to use shorter like you said but, block is literally to many, and some times got block inside block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;i hope you dont mind, coz i am using others program from autocad, but it is almost the same, in autocad, it will have command explode and burst. i use burst mostly before changing to current application to avoid the information lost. my target is only block. i found other lisp routine but it use explode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in early routine i have this code:&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun C:Test (/ sset)
  (setq brf (ssget "_X" '((0 . "INSERT"))))
  (while (/= count 0)
         (setq count (sslength brf))
         (command "move" brf "" "d" "0,0,0")
         (command "select" "p" "" "pburst" "p" "")
  )
(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;so this code function, but it do infinite bursting due to no stopping function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i work on other, like&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564264"&gt;@pbejse&lt;/a&gt;&amp;nbsp;say, use repeat but i got other issue say no function definition.&lt;/P&gt;&lt;P&gt;i make the routine goes 3 time running. if it giving the same number block remaning, it will stop, if not, it will run again. here are the code. some times, block were set to unexplodable so that make my first routine do the infinite burst.&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun C:test (/ sset)
(defun C:brfabc ()
  (setq brfa (ssget "_X" '((0 . "INSERT"))))
  (setq counta (sslength brfa))
  (command "pburst" brfa "")

  (setq brfb (ssget "_X" '((0 . "INSERT"))))
  (setq countb (sslength brfb))
  (command "pburst" brfb "")

  (setq brfc (ssget "_X" '((0 . "INSERT"))))
  (setq counta (sslength brfc))
  (command "pburst" brfc "")
(princ)
)

  (c:brfabc)
  (if (= counta countb countc)(prompt "\ndone")
        (t c:brfabc)
  )
(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;i just put done in the end for now. i wish to extend the routine in future. you can change the "pburst" to "explode" or "burst". for move function, i just to make sure that it selecting the visible block only, but it does not work. i thought if putting like that it will ignore block on the freeze and thawn layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyway what am i missing on the routine?&lt;/P&gt;&lt;P&gt;{error : no function definition &amp;lt;T&amp;gt; ; expected FUNCTION at [eval]} i got this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2022 23:41:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11097104#M46845</guid>
      <dc:creator>aliff_ahtenk</dc:creator>
      <dc:date>2022-04-10T23:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to stop loop using return integer value?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11097243#M46846</link>
      <description>&lt;P&gt;Explode command have this unusual behavior when used inside a lisp, you have to include the undocumented QAFLAGS and set it to 1&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:explodeall ()
  (setvar "qaflags" 1)
  (while (setq ss (ssget "x" (list (cons 0 "insert"))))
    (command "explode" ss "")
  )
  (setvar "qaflags" 0)
  (princ)
)
&lt;/LI-CODE&gt;
&lt;P&gt;If you need to use the Express tool burst&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:burstall ()
  (while (setq ss (ssget "x" (list (cons 0 "insert"))))
    (sssetfirst nil ss)
    (c:burst)
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;And if you are referring to &lt;A href="http://www.lee-mac.com/upgradedburst.html" target="_blank" rel="noopener"&gt;this&amp;nbsp;&lt;/A&gt;as the source for "pburst" , i would suggest use "nburst" to deal with nested blocks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7963331"&gt;@aliff_ahtenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;...block were set to unexplodable so that make my first routine do the infinite burst.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And then there's that problem. You may then include a routine to ensure all the blocks are Explodeable, something similar to this&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;  (setq BlockObjects (tblnext "BLOCK" T))
      (while BlockObjects
            (cond ((and
                  (&amp;lt; (logior 2 (cdr(assoc 70 BlockObjects))) 3)
	          (setq Ent (entget (cdr (assoc -2 BlockObjects)))
		        Ent (entget (cdr (assoc 330 Ent))))
		(entmod (subst (cons 280  1)
                               (assoc 280 Ent) Ent)))
                   )
                  )
            (setq BlockObjects (tblnext "BLOCK"))
      )
&lt;/LI-CODE&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 02:31:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-stop-loop-using-return-integer-value/m-p/11097243#M46846</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2022-04-11T02:31:38Z</dc:date>
    </item>
  </channel>
</rss>

