<?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 can I assign position controllers for knots  to spline in spline using 4 in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8181442#M9965</link>
    <description>&lt;P&gt;No problem, well done for finding the solution yourself!&lt;/P&gt;</description>
    <pubDate>Tue, 07 Aug 2018 05:27:37 GMT</pubDate>
    <dc:creator>blakestone</dc:creator>
    <dc:date>2018-08-07T05:27:37Z</dc:date>
    <item>
      <title>How can I assign position controllers for knots  to spline in spline using 4 loo</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8175274#M9962</link>
      <description>&lt;P&gt;--Hello,&lt;BR /&gt;--I was wondering if someone could give me some advice on how to simplify the last section of this script.&lt;BR /&gt;--the script creates a spline with all the knots positioned at the first array value. Later they will be animated by moving the point helpers.&lt;BR /&gt;--The challenge is setting up the controllers for the knots. This example works but I need to simplify the last part to handle possibilty of greater than 4 values in the array.&lt;BR /&gt;--Does anyone have suggestions? The way I have it now uses $ScanTail_Helper_?? and is done knot by knot. I was hoping to do that part in a loop. Ideas? You can select my whole post and try it if you want. You move the pointer to move the spline. problem is optimizing to handle large number of items that could end up in the array. Thanks&lt;BR /&gt;--&lt;BR /&gt;resetMaxFile #noPrompt&lt;/P&gt;&lt;P&gt;myarray = #([0,0,20],[20,0,20],[40,0,20],[60,0,20]) --total number of items in array varies. I use 4 items for testing&lt;/P&gt;&lt;P&gt;----------------------------------------------------Create what I call a Scan Box which outlines the VMC FOV intecept on the planets Mars Surface surface.&lt;BR /&gt;ScanTail = splineShape name:"ScanTail_Spline"&lt;BR /&gt;addnewSpline ScanTail&lt;BR /&gt;------------------------------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;m = 0&lt;BR /&gt;for m in 1 to myarray.count do&lt;BR /&gt;(&lt;BR /&gt;addknot ScanTail 1 #smooth #curve myarray[1] ---creates a bunch of knots on spline based on the total number of values in array and place all of them at the 1st value in the array&lt;BR /&gt;)&lt;BR /&gt;updateShape ScanTail&lt;BR /&gt;animateVertex ScanTail #all&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;u = (myarray.count * 3) --total number of values in the array * 3 gives you the total number of X,Y Z point controllers you need to make in this loop&lt;BR /&gt;for m = 2 to u by 3 do&lt;BR /&gt;(&lt;BR /&gt;ScanTail[#Object__Editable_Spline][#Master][m].controller = Point3_XYZ()&lt;BR /&gt;)&lt;BR /&gt;-----------------------------------------------------------------------------------------------SECTION BELOW NEED TO SIMPLIFY&lt;BR /&gt;-----------Create Point Helpers for all knots on the spline&lt;BR /&gt;for s in 1 to myarray.count do&lt;BR /&gt;(&lt;BR /&gt;nm = "ScanTail_Helper_" + s as string&lt;BR /&gt;PointHelperObj name:nm pos:[0,0,0] size:258 centermarker:true axistripod:false cross:false box:false drawnontop:true axisLength:4000 constantscreensize:false&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;--------------------------------This section works but is limited to 4 helpers. I need to simplify it&lt;BR /&gt;(&lt;BR /&gt;for i = 1 to 3 by 1 do (ScanTail[#Object__Editable_Spline][#Master][2].controller[i].controller = $ScanTail_Helper_1.position.controller[i].controller)&lt;BR /&gt;--------------------------------------------------------------------------------------&lt;BR /&gt;for i = 1 to 3 by 1 do (ScanTail[#Object__Editable_Spline][#Master][5].controller[i].controller = $ScanTail_Helper_2.position.controller[i].controller)&lt;BR /&gt;--------------------------------------------------------------------------------------&lt;BR /&gt;for i = 1 to 3 by 1 do (ScanTail[#Object__Editable_Spline][#Master][8].controller[i].controller = $ScanTail_Helper_3.position.controller[i].controller)&lt;BR /&gt;-------------------------------------------------------------------------------------&lt;BR /&gt;for i = 1 to 3 by 1 do (ScanTail[#Object__Editable_Spline][#Master][11].controller[i].controller = $ScanTail_Helper_4.position.controller[i].controller)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;-------------------------------------------------------------------------------------------THIS ATTEMPT AT SIMPLIFYING FAILS I need something where the ????? is but dont know what.&lt;BR /&gt;-- for j = 2 to u by 3 do&lt;BR /&gt;-- (&lt;BR /&gt;--&lt;BR /&gt;-- for w = 1 to 3 by 1 do (ScanTail[#Object__Editable_Spline][#Master][j].controller[w].controller = ?????.position.controller[w].controller)&lt;BR /&gt;-- )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 07:28:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8175274#M9962</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-03T07:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I assign position controllers for knots  to spline in spline using 4</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8178878#M9963</link>
      <description>&lt;P&gt;Is something like this what you're after?&lt;/P&gt;&lt;PRE&gt;(
	resetMaxFile #noPrompt
	
	local myarray = #([0,0,20],[20,0,20],[40,0,20],[60,0,20])
	local inc = for i=2 to (myarray.count * 3) by 3 collect i
	
-- Spline
	local ScanTail = splineShape name:(uniqueName "ScanTail_Spline")
	
	addNewSpline ScanTail
	
	for i in myarray do addknot ScanTail 1 #smooth #curve i
		
	updateShape ScanTail
	animateVertex ScanTail #all

-- Controller Helpers
	local nm = for i in myarray collect PointHelperObj name:(uniqueName "ScanTail_Helper_") pos:i size:258 centermarker:true axistripod:false cross:false box:false drawnontop:true axisLength:4000 constantscreensize:false
	
	for n=1 to nm.count do (
		ScanTail[#Object__Editable_Spline][#Master][inc[n]].controller = Point3_XYZ()
		for i=1 to 3 do ScanTail[#Object__Editable_Spline][#Master][inc[n]].controller[i].controller = nm[n].position.controller[i].controller
	)
	
	forceCompleteRedraw()
)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/531313i5BFABE3F97EC8424/image-size/large?v=v2&amp;amp;px=999" role="button" title="example.jpg" alt="example.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 03:14:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8178878#M9963</guid>
      <dc:creator>blakestone</dc:creator>
      <dc:date>2018-08-06T03:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can I assign position controllers for knots  to spline in spline using 4</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8181401#M9964</link>
      <description>&lt;P&gt;Thank you. I found a way to do it on my own that is very similar to yours and your works to so thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 04:41:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8181401#M9964</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-07T04:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I assign position controllers for knots  to spline in spline using 4</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8181442#M9965</link>
      <description>&lt;P&gt;No problem, well done for finding the solution yourself!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 05:27:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-assign-position-controllers-for-knots-to-spline-in/m-p/8181442#M9965</guid>
      <dc:creator>blakestone</dc:creator>
      <dc:date>2018-08-07T05:27:37Z</dc:date>
    </item>
  </channel>
</rss>

