<?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: Random Selection Script in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101130#M24028</link>
    <description>I noticed that with the &amp;amp;#36; code when I posted the original message... perhaps that needs reporting.&lt;BR /&gt;&lt;BR /&gt;Stokes... you're a star, this works fine... I really need to learn this MaxScript stuff and spend less time working :&amp;amp;#41;</description>
    <pubDate>Tue, 23 Jun 2009 16:07:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-06-23T16:07:11Z</dc:date>
    <item>
      <title>Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101126#M24024</link>
      <description>Hi guys,&lt;BR /&gt;&lt;BR /&gt;I wonder if anyone can help me. I have a script that someone on here put together a couple of years back.&lt;BR /&gt;&lt;BR /&gt;&lt;B&gt;clearSelection &amp;amp;#40;&amp;amp;#41;&lt;BR /&gt;for i = 11 to 5698 by 3 do&lt;BR /&gt;&amp;amp;#40;&lt;BR /&gt;obj = execute &amp;amp;#40;"&amp;amp;#36;" + "Circle_" + i as string&amp;amp;#41;&lt;BR /&gt;if obj != undefined do&lt;BR /&gt;&amp;amp;#40;selectMore obj&amp;amp;#41;&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;s=selection&lt;BR /&gt;&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;The idea of the script is to select every 3rd object within a selection &amp;amp;#40;named "circle_xx" in this example&amp;amp;#41;. I use this when I have a selection of, for example, 10000 objects which I need to split into a number of separate groups to "Align &amp;amp; Clone" another object to.&lt;BR /&gt;&lt;BR /&gt;Although this works fine for most duties I need something different this time. I need a more "random" selection. Can this script be revised to make the selection more random...?&lt;BR /&gt;&lt;BR /&gt;The attached screen dump shows an example of the selection which clearly shows distinct rows.&lt;BR /&gt;&lt;BR /&gt;Edit: Looks like the attatchement won't upload from work... I'll try from home later.&lt;BR /&gt;&lt;BR /&gt;Any help would be much appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Roly</description>
      <pubDate>Tue, 23 Jun 2009 14:44:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101126#M24024</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-23T14:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101127#M24025</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;for o in &amp;amp;#36;Circle* where &amp;amp;#40;random 1 3&amp;amp;#41; == 3 do&lt;BR /&gt;    selectMore o&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jun 2009 15:46:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101127#M24025</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-23T15:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101128#M24026</link>
      <description>&amp;amp;#36;Circle should have read &amp;amp;#40;dollar sign&amp;amp;#41;Circle. The forum software stomped it.</description>
      <pubDate>Tue, 23 Jun 2009 15:47:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101128#M24026</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-23T15:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101129#M24027</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;&amp;amp;#40;&lt;BR /&gt;clearSelection&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; &lt;BR /&gt;for i = 1 to 10 do -- we want 10 circles selected&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; local done = false&lt;BR /&gt; do &lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; n = stringstream ""&lt;BR /&gt; r = random 1 100 -- pick any of the 100 available circles&lt;BR /&gt; format "&amp;amp;#36;Circle_%" &amp;amp;#40;formattedPrint r format:"2.2d"&amp;amp;#41; to:n&lt;BR /&gt; obj = execute &amp;amp;#40;n as string&amp;amp;#41;&lt;BR /&gt; if &amp;amp;#40;obj != undefined&amp;amp;#41; then -- only continue if a valid object&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; if &amp;amp;#40;not obj.isSelected&amp;amp;#41; then -- only continue if the object is not already selected&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; selectMore obj&lt;BR /&gt; done = true -- finished this one&lt;BR /&gt; &amp;amp;#41; &lt;BR /&gt; &amp;amp;#41;&lt;BR /&gt; &amp;amp;#41; &lt;BR /&gt; while &amp;amp;#40;not done&amp;amp;#41; -- end "do" loop, repeat until one is selected&lt;BR /&gt; &amp;amp;#41; -- end "for" loop&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Change the loop counter to the number you want to select&lt;BR /&gt;Change the random value&amp;amp;#40;s&amp;amp;#41; to suit however many there are to choose from&lt;BR /&gt;If you were looping from 11 to avoid the problem of "Circle_01" etc, the above code takes care of that for you. Loop from 1 to however many you want &amp;amp;#40;easier to read...&amp;amp;#41;.&lt;P&gt;&lt;A class="migr-att-link" href="http://area.autodesk.com/userdata/forum/r/randomselection.ms.zip" target="_blank"&gt;randomselection.ms.zip&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2009 16:04:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101129#M24027</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-06-23T16:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101130#M24028</link>
      <description>I noticed that with the &amp;amp;#36; code when I posted the original message... perhaps that needs reporting.&lt;BR /&gt;&lt;BR /&gt;Stokes... you're a star, this works fine... I really need to learn this MaxScript stuff and spend less time working :&amp;amp;#41;</description>
      <pubDate>Tue, 23 Jun 2009 16:07:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101130#M24028</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-23T16:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Random Selection Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101131#M24029</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;BR /&gt;&amp;amp;#40;&lt;BR /&gt;clearSelection&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; &lt;BR /&gt;for i = 1 to 10 do -- we want 10 circles selected&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; local done = false&lt;BR /&gt; do &lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; n = stringstream ""&lt;BR /&gt; r = random 1 100 -- pick any of the 100 available circles&lt;BR /&gt; format "&amp;amp;#36;Circle_%" &amp;amp;#40;formattedPrint r format:"2.2d"&amp;amp;#41; to:n&lt;BR /&gt; obj = execute &amp;amp;#40;n as string&amp;amp;#41;&lt;BR /&gt; if &amp;amp;#40;obj != undefined&amp;amp;#41; then -- only continue if a valid object&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; if &amp;amp;#40;not obj.isSelected&amp;amp;#41; then -- only continue if the object is not already selected&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; selectMore obj&lt;BR /&gt; done = true -- finished this one&lt;BR /&gt; &amp;amp;#41; &lt;BR /&gt; &amp;amp;#41;&lt;BR /&gt; &amp;amp;#41; &lt;BR /&gt; while &amp;amp;#40;not done&amp;amp;#41; -- end "do" loop, repeat until one is selected&lt;BR /&gt; &amp;amp;#41; -- end "for" loop&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Change the loop counter to the number you want to select&lt;BR /&gt;Change the random value&amp;amp;#40;s&amp;amp;#41; to suit however many there are to choose from&lt;BR /&gt;If you were looping from 11 to avoid the problem of "Circle_01" etc, the above code takes care of that for you. Loop from 1 to however many you want &amp;amp;#40;easier to read...&amp;amp;#41;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;BR /&gt;Change the loop counter to the number you want to select&lt;BR /&gt;Change the random value&amp;amp;#40;s&amp;amp;#41; to suit however many there are to choose from&lt;BR /&gt;If you were looping from 11 to avoid the problem of "Circle_01" etc, the above code takes care of that for you. Loop from 1 to however many you want &amp;amp;#40;easier to read...&amp;amp;#41;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Steve, this looks great too. I've done what I need to do now thanks to Stokes' tip but I'm sure this will useful for future use. Thanks very much!!!</description>
      <pubDate>Tue, 23 Jun 2009 16:10:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/random-selection-script/m-p/4101131#M24029</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-23T16:10:55Z</dc:date>
    </item>
  </channel>
</rss>

