<?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 verify empty selection in (SSGET) in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824503#M51199</link>
    <description>&lt;P&gt;where do you get a "value" from?&lt;/P&gt;
&lt;P&gt;are you selecting texts to set "linkvalue" as their contents?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  (if (setq ss (ssget))
    
    (repeat (setq index (sslength ss))
      (setq entname (ssname ss (setq index (1- index))))
      (setq entdata (entget entname))
      (... do something ...)
      
      ) ; end of repeat
    ) ; end of if
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Dec 2021 12:02:32 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2021-12-15T12:02:32Z</dc:date>
    <item>
      <title>How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824482#M51198</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem with my routine lisp code, it gives me an error when I have no element selected and I press the enter key.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know how I can make it check if the selection is empty in (ssget) and if it is, repeat (ssget), until there is a selection or the routine is canceled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to use an if statement, but I didn't know where to put the statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(setq linkvalue (itoa value)
  ss      (ssget)
  len     (sslength ss)
  cont     0
  entdata  linkvalue
)&lt;/LI-CODE&gt;&lt;P&gt;Thank you very much for reading my message.&lt;BR /&gt;Greetings.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 11:33:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824482#M51198</guid>
      <dc:creator>arperezinf</dc:creator>
      <dc:date>2021-12-15T11:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824503#M51199</link>
      <description>&lt;P&gt;where do you get a "value" from?&lt;/P&gt;
&lt;P&gt;are you selecting texts to set "linkvalue" as their contents?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  (if (setq ss (ssget))
    
    (repeat (setq index (sslength ss))
      (setq entname (ssname ss (setq index (1- index))))
      (setq entdata (entget entname))
      (... do something ...)
      
      ) ; end of repeat
    ) ; end of if
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 12:02:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824503#M51199</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-12-15T12:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824527#M51200</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1203560"&gt;@arperezinf&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;.... I would like to know how I can make it check if the selection is empty in (ssget) and if it is, repeat (ssget), until there is a selection or the routine is canceled.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;.....&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#999999"&gt;(setq linkvalue (itoa value)&lt;/FONT&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#0000FF"&gt;(while (not (setq ss (ssget))))&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;(setq&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; &lt;FONT color="#999999"&gt;len (sslength ss) ....&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 12:10:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824527#M51200</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-12-15T12:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824593#M51201</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your comments.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I ask for the value in another line of code before this part of code that I do not publish and I am using (getint), an integer and I am selecting blocks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me analyze how I implement what they say in my code because I don't know much about visual lisp programming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for reading my message.&lt;BR /&gt;Greetings.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 12:50:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10824593#M51201</guid>
      <dc:creator>arperezinf</dc:creator>
      <dc:date>2021-12-15T12:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10825446#M51202</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much to both.&lt;span class="lia-unicode-emoji" title=":handshake:"&gt;🤝&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I already managed to do what I needed!&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":ok_hand:"&gt;👌&lt;/span&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;your code works as I need, it is the solution I was looking for.&lt;span class="lia-unicode-emoji" title=":clapping_hands:"&gt;👏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":handshake:"&gt;🤝&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for reading my message.&lt;BR /&gt;Greetings.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 19:15:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10825446#M51202</guid>
      <dc:creator>arperezinf</dc:creator>
      <dc:date>2021-12-15T19:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10826014#M51203</link>
      <description>&lt;P&gt;Like Kent's answer I often use an alert to show ssget failed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(if (=(setq ss (ssget)) nil)
(alert "There is no selection set please run again")
(repeat (setq index (sslength ss))

The other is a hard exit but have to be careful does not cause problems.
(if (=(setq ss (ssget)) nil)
  (progn
    (alert "There is no selection set please run again\nWill now exit")
    (exit)
  )
(repeat (setq index (sslength ss))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Dec 2021 00:51:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10826014#M51203</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2021-12-16T00:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to verify empty selection in (SSGET)</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10828078#M51204</link>
      <description>Thank you very much for your comment, I will keep it in mind.&lt;BR /&gt;Greetings.</description>
      <pubDate>Thu, 16 Dec 2021 22:13:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-verify-empty-selection-in-ssget/m-p/10828078#M51204</guid>
      <dc:creator>arperezinf</dc:creator>
      <dc:date>2021-12-16T22:13:42Z</dc:date>
    </item>
  </channel>
</rss>

