<?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: Basic script example in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127746#M23008</link>
    <description>And the obvious question offcourse, why don't you just select all spline objects and apply a renderable spline modifier?&lt;BR /&gt;&lt;BR /&gt;;&amp;amp;#41;&lt;BR /&gt;&lt;BR /&gt;-Johan</description>
    <pubDate>Fri, 18 Dec 2009 12:53:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-12-18T12:53:14Z</dc:date>
    <item>
      <title>Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127736#M22998</link>
      <description>I'm very much a novice at scripting, in any language, so please forgive me if this is too basic a q.&lt;BR /&gt;&lt;BR /&gt;I need to write what I suspect is an absurdly simple script.  If I have a set of objects select &amp;amp;#40;it's a large set, about 1500 objects&amp;amp;#41;, that all happen to be splines, I need to make them all renderable, spline &amp;amp;#40;enable in renderer&amp;amp;#41;, regctangular, with a a specific set of dimensions &amp;amp;#40;which we're still trying to determine&amp;amp;#41;.&lt;BR /&gt;&lt;BR /&gt;I'm not asking anyone to write this for me, but it seems to me that performing the same properites change on a large number of objects is probably such a common scripting thing that someone probably has a sample sitting handy that they could offer as an example, and then I will work through it to make it do what I need &amp;amp;#40;a good exeercise for my self education anyway&amp;amp;#41;&lt;BR /&gt;&lt;BR /&gt;thanks so much.</description>
      <pubDate>Thu, 17 Dec 2009 16:31:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127736#M22998</guid>
      <dc:creator>cprettyman</dc:creator>
      <dc:date>2009-12-17T16:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127737#M22999</link>
      <description>Whenever you want to change the same thing over and over on a specific selection, you use a "for" loop. Like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;for obj in selection do&lt;BR /&gt;  &amp;amp;#40;&lt;BR /&gt;  obj.pos =  -- Move all objects to 0,0,0&lt;BR /&gt;  obj.wirecolor = red -- Change the wireframe color to red&lt;BR /&gt;  --etc.&lt;BR /&gt;  &amp;amp;#41;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I think in your case creating the shapes in the script would be more efficient than modifying an existing set of shapes...if possible.&lt;BR /&gt;&lt;BR /&gt;The MAXScript Help files have lots of example "How To" sections that should be enough to get you started. Good luck!</description>
      <pubDate>Thu, 17 Dec 2009 17:57:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127737#M22999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-17T17:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127738#M23000</link>
      <description>Ok, if you want to write it yourself...&lt;BR /&gt;&lt;BR /&gt;Things you'll need to know about.&lt;BR /&gt;For loops.&lt;BR /&gt;Collections.&lt;BR /&gt;The names of the object properties you want to change. Editable Spline objects are called "spline shapes" in Maxscript.&lt;BR /&gt;&lt;BR /&gt;Iterate over the collection, each time around the loop set the rquired properties.&lt;BR /&gt;&lt;BR /&gt;There is another way, but it's a little more cryptic &amp;amp;#40;mapped functions&amp;amp;#41;.&lt;BR /&gt;&lt;BR /&gt;Read up on all the above in the Maxscript help - if you get well and truly stuck, post back and I'll try and help you out. &lt;BR /&gt;Also, there are innumerable examples of this kind of procedure in this very forum - looking through some recent &amp;amp;#40;and not so recent&amp;amp;#41; threads should provide a fair overview, though not necessarily the specifics, of what you're trying to do.</description>
      <pubDate>Thu, 17 Dec 2009 18:08:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127738#M23000</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-12-17T18:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127739#M23001</link>
      <description>I think I got it.  Im sure there are subtleties I could add - some sort of error checking, an if statement to make sure everything in the selection set is a spline.  But, this seems to work.&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;for obj in selection do&lt;BR /&gt; &amp;amp;#40;&lt;BR /&gt; obj.render_renderable = true&lt;BR /&gt; obj.render_rectangular = true&lt;BR /&gt; obj.render_length = 0.5&lt;BR /&gt; obj.render_width = 1.0&lt;BR /&gt; &amp;amp;#41;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 17 Dec 2009 22:32:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127739#M23001</guid>
      <dc:creator>cprettyman</dc:creator>
      <dc:date>2009-12-17T22:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127740#M23002</link>
      <description>&lt;PRE&gt;&lt;BR /&gt;for obj in selection do&lt;BR /&gt;&amp;amp;#40;&lt;BR /&gt;  if &amp;amp;#40;classof obj == Editable_Spline&amp;amp;#41; then&lt;BR /&gt;   &amp;amp;#40;&lt;BR /&gt;    obj.render_renderable = true&lt;BR /&gt;    obj.render_rectangular = true&lt;BR /&gt;    obj.render_length = 0.5&lt;BR /&gt;    obj.render_width = 1.0&lt;BR /&gt;   &amp;amp;#41;-- End If&lt;BR /&gt;   else&lt;BR /&gt;   &amp;amp;#40;&lt;BR /&gt;   print "Error. This object is not of the class \"Spline\""&lt;BR /&gt;   return undefined&lt;BR /&gt;   &amp;amp;#41;-- End Else&lt;BR /&gt;&amp;amp;#41;-- End For&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I'm not at home, so you'll have to check if "Editable_Spline" is the correct class name.</description>
      <pubDate>Thu, 17 Dec 2009 22:37:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127740#M23002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-17T22:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127741#M23003</link>
      <description>That's the basis of it, yes. You could put in a test as in Dave's post below, or you could create your own collection based on the current selection and the test. However, I think you need a double test, because classof a Line is "Line" &amp;amp;#40;even if you "convert to Editable Spline"&amp;amp;#41; but any other shape like a rectangle &amp;amp;#40;converted&amp;amp;#41; is a "SplineShape".&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;mySplines = for obj in selection where &amp;amp;#40;classof obj == Line or classof obj == SplineShape&amp;amp;#41; collect obj&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Then iterate over that with&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;for obj in mySplines do ...&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; But see Anubis's post below as well</description>
      <pubDate>Thu, 17 Dec 2009 23:11:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127741#M23003</guid>
      <dc:creator>Steve_Curley</dc:creator>
      <dc:date>2009-12-17T23:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127742#M23004</link>
      <description>2 filtering tips using "where":&lt;BR /&gt;&lt;PRE&gt;for obj in selection where isShapeObject obj do &amp;amp;#40;&lt;BR /&gt; obj.render_renderable = true&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;&lt;BR /&gt;for obj in shapes where obj.isSelected do &amp;amp;#40;&lt;BR /&gt; obj.render_renderable = true&lt;BR /&gt;&amp;amp;#41;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2009 23:21:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127742#M23004</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-17T23:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127743#M23005</link>
      <description>That is indeed more concise. Is there a specialized way to add error checking for this example other than try/catch? Or are we assuming that a selection error should not be encountered with this filter?</description>
      <pubDate>Thu, 17 Dec 2009 23:26:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127743#M23005</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-17T23:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127744#M23006</link>
      <description>You guys are all awesome. &lt;BR /&gt;&lt;BR /&gt;I might note that the context of this is a model that came from Revit &amp;amp;#40;via FBX&amp;amp;#41; to Max, and what I am doing is adddressing the muntins that divide up the windows.  They were represented as lines in the revit model, and end up as splines in the Max model.  I can select them all inteh select by name window becuse they all have "muntin" in the name.  Conveniently, the Revit model was put together by a very careful, consistent team, so I can get away with less error checking.&lt;BR /&gt;&lt;BR /&gt;That said, I appreciate the thoughts, because I can see myself reworking this script for later, less well built models where error checking is badly needed.&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Fri, 18 Dec 2009 04:04:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127744#M23006</guid>
      <dc:creator>cprettyman</dc:creator>
      <dc:date>2009-12-18T04:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127745#M23007</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;That is indeed more concise. Is there a specialized way to add error checking for this example other than try/catch? Or are we assuming that a selection error should not be encountered with this filter?&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;I always avoid Try/Catch 'cause its slow. And my code above will not need additional error checking. Well, then I work on selection I check it first and this is not to debbug but just to make the code faster. Im talking about this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;sel = selection as array&lt;BR /&gt;if sel.count &amp;gt; 0 do&lt;BR /&gt;&amp;amp;#40;&lt;BR /&gt; -- the base of the speed up trick is that&lt;BR /&gt; -- Max will not read the code here if selection is empty&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Dec 2009 11:29:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127745#M23007</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-18T11:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127746#M23008</link>
      <description>And the obvious question offcourse, why don't you just select all spline objects and apply a renderable spline modifier?&lt;BR /&gt;&lt;BR /&gt;;&amp;amp;#41;&lt;BR /&gt;&lt;BR /&gt;-Johan</description>
      <pubDate>Fri, 18 Dec 2009 12:53:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127746#M23008</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-18T12:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127747#M23009</link>
      <description>The same question came to my mind at the beginning but I assumed that Charles wish to enjoy learning MaxScript :&amp;amp;#41;</description>
      <pubDate>Fri, 18 Dec 2009 15:11:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127747#M23009</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-18T15:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Basic script example</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127748#M23010</link>
      <description>Anubis has made a great blog post on the subject of optimized selection checking and processing here: &lt;A href="http://3dmyths.blogspot.com/2009/12/includeexclude-in-for-loops-via-where.html" target="_blank"&gt;http://3dmyths.blogspot.com/2009/12/includeexclude-in-for-loops-via-where.html&lt;/A&gt;</description>
      <pubDate>Fri, 18 Dec 2009 17:28:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/basic-script-example/m-p/4127748#M23010</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-18T17:28:48Z</dc:date>
    </item>
  </channel>
</rss>

