<?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 split up an array based on number sequences within it? in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181435#M9941</link>
    <description>&lt;P&gt;Maybe this is what you're after?&lt;BR /&gt;You can access the multidimensional array like this: groupArray[1][1]&lt;/P&gt;&lt;PRE&gt;( 
	local numArray = #(1,2,3,4,5,6,15,16,17,18,19,23,24,25,26,27,28)
	local groupArray = #()
	local tempArray = #()
	
	for i=2 to numArray.count do (		
		if (i != numArray.count and numArray[i]-1 == numArray[i-1]) then (
			append tempArray numArray[i]
			continue
		)
		
		append groupArray tempArray
		tempArray = #()
	)

	print groupArray
)&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Aug 2018 05:16:43 GMT</pubDate>
    <dc:creator>blakestone</dc:creator>
    <dc:date>2018-08-07T05:16:43Z</dc:date>
    <item>
      <title>How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181112#M9938</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I start with&amp;nbsp;a large array of ascending number from 1 to 1000 sometimes more. Some of the numbers or groups of sequential numbers in that 1 to 1000 are missing creating gaps.&lt;BR /&gt;I need to collect the remaining numbers that are still in sequence to be saved out as their own new arrays.&lt;BR /&gt;Anyone have any suggestion on how to do that? I have no idea how you could identify when a gap in the sequence would appear.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 23:25:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181112#M9938</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-06T23:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181182#M9939</link>
      <description>&lt;P&gt;The below array splits the complete and incomplete sequence to their own arrays.&lt;/P&gt;&lt;P&gt;I am not sure if this is what you're after?&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;( &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;local numArray = #(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"1,2,3,4,5",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"1,4,5",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"1,5,6,8,10"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;local completeArray = #()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;local incompleteArray = #()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for n in numArray do (&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;local valid = true&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;local f = filterString n ","&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for j=1 to f.count do (&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if f[j] as integer != j then valid = false&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if not valid then exit&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if valid then append completeArray f else append incompleteArray f&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;)&lt;BR /&gt;)&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Aug 2018 00:49:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181182#M9939</guid>
      <dc:creator>blakestone</dc:creator>
      <dc:date>2018-08-07T00:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181360#M9940</link>
      <description>&lt;P&gt;I may not be explaining my question well.&lt;/P&gt;&lt;P&gt;In my array imagine a large ascending number sequence with numbers missing called myarray. There are numbers missing creating&amp;nbsp;gaps which leave groups&amp;nbsp;of ascending numbers that need to be put in their own seperate arrays. ?&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;myarray = #(1,2,3,4,5,6,15,16,17,18,19,23,24,25,26,27,28)&lt;/P&gt;&lt;P&gt;In this example I need to generate 3 arrays&amp;nbsp;that look like these&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#(1,2,3,4,5,6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#(15,16,17,18,19)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#(23,24,25,26,27,28)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only things I will know before running the script is there will be a&amp;nbsp;large ascending number sequence in the array of unknown size and that there will be missing numbers within it. The small remaining grouped sequences that remain need to be placed in new arrays.&lt;/SPAN&gt;&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>Tue, 07 Aug 2018 04:05:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181360#M9940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-07T04:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181435#M9941</link>
      <description>&lt;P&gt;Maybe this is what you're after?&lt;BR /&gt;You can access the multidimensional array like this: groupArray[1][1]&lt;/P&gt;&lt;PRE&gt;( 
	local numArray = #(1,2,3,4,5,6,15,16,17,18,19,23,24,25,26,27,28)
	local groupArray = #()
	local tempArray = #()
	
	for i=2 to numArray.count do (		
		if (i != numArray.count and numArray[i]-1 == numArray[i-1]) then (
			append tempArray numArray[i]
			continue
		)
		
		append groupArray tempArray
		tempArray = #()
	)

	print groupArray
)&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Aug 2018 05:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8181435#M9941</guid>
      <dc:creator>blakestone</dc:creator>
      <dc:date>2018-08-07T05:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183725#M9942</link>
      <description>&lt;P&gt;In the big array &amp;nbsp;&amp;nbsp;&amp;nbsp;#(1,2,3,4,5,6,15,16,17,18,19,23,24,25,26,27,28)&lt;/P&gt;&lt;P&gt;In your example code it creates&amp;nbsp;&lt;/P&gt;&lt;P&gt;#(2, 3, 4, 5, 6)&lt;BR /&gt;#(16, 17, 18, 19)&lt;BR /&gt;#(24, 25, 26, 27)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like it skips the first number of each group.&lt;/P&gt;&lt;P&gt;1 is missing from the first array&lt;/P&gt;&lt;P&gt;15 missing from the second&lt;/P&gt;&lt;P&gt;23 missing from the third&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 21:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183725#M9942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-07T21:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183845#M9943</link>
      <description>&lt;P&gt;You're right, sorry about that!&lt;BR /&gt;The below example does what you're after.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;( 
	local numArray = #(1,2,3,4,5,6,15,16,17,18,19,23,24,25,26,27,28)
	local groupArray = #()
	local tempArray = #(numArray[1])
	
	for i=2 to numArray.count do (
		if i == numArray.count then (
			append tempArray numArray[i]
		)
		else if numArray[i]-1 == numArray[i-1] then (
			append tempArray numArray[i]
			continue
		)
		
		append groupArray tempArray
		tempArray = #(numArray[i])
	)

	print groupArray
)&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Aug 2018 23:26:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183845#M9943</guid>
      <dc:creator>blakestone</dc:creator>
      <dc:date>2018-08-07T23:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I split up an array based on number sequences within it?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183900#M9944</link>
      <description>&lt;P&gt;&lt;SPAN&gt;awesome! I never would have got that! thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 00:21:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-can-i-split-up-an-array-based-on-number-sequences-within-it/m-p/8183900#M9944</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-08T00:21:21Z</dc:date>
    </item>
  </channel>
</rss>

