<?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 do I add each group of selected edges to a separate array? in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802145#M4673</link>
    <description>&lt;P&gt;Found a solution&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9D9CB9CD-5F2C-4AF6-8A55-54D933A8457A" target="_blank"&gt;https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9D9CB9CD-5F2C-4AF6-8A55-54D933A8457A&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Dec 2021 16:59:51 GMT</pubDate>
    <dc:creator>ivanchin.ivan</dc:creator>
    <dc:date>2021-12-05T16:59:51Z</dc:date>
    <item>
      <title>How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802127#M4672</link>
      <description>&lt;P&gt;There are selected edges, as in the picture. When the code below is executed, it outputs everything in one array.&lt;/P&gt;&lt;P&gt;output:&lt;BR /&gt;# {151, 181, 185, 3985, 3987, 3991}&lt;/P&gt;&lt;P&gt;how to implement a loop to put each group of edges into an array?&lt;/P&gt;&lt;P&gt;output:&lt;BR /&gt;# {151, 181, 185}&lt;BR /&gt;# {3985, 3987, 3991}&lt;/P&gt;&lt;P&gt;I can't figure it out.&lt;BR /&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot_2.png" style="width: 866px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/997430i23556C10B5B10A8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_2.png" alt="Screenshot_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;from pymxs import runtime as mxs

mxs.clearListener()

obj = mxs.getCurrentSelection()[0]
edges_data = mxs.polyop.getEdgeSelection(obj)

print(edges_data)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 16:52:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802127#M4672</guid>
      <dc:creator>ivanchin.ivan</dc:creator>
      <dc:date>2021-12-05T16:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802145#M4673</link>
      <description>&lt;P&gt;Found a solution&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9D9CB9CD-5F2C-4AF6-8A55-54D933A8457A" target="_blank"&gt;https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9D9CB9CD-5F2C-4AF6-8A55-54D933A8457A&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 16:59:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802145#M4673</guid>
      <dc:creator>ivanchin.ivan</dc:creator>
      <dc:date>2021-12-05T16:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802296#M4674</link>
      <description>&lt;P&gt;The MXS Help developers sometimes surprise me with some impractical or unprofessional solutions and examples, as showed above .. see for yourself:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;delete objects

s = plane widthsegs:200 lengthsegs:200
converttopoly s
ee = #{}
for k=1 to s.edges.count do ee[k] = (random 0 1) == 1

polyop.setedgeselection s ee

(
	t0 = timestamp()
	h0 = heapfree

	getEPolyUnconnectedEdgesSelections s

	format "time:% heap:%\n" (timestamp() - t0) (h0 - heapfree)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but you can do the same hundreds of times faster if you know how MAXScript works&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 19:45:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802296#M4674</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-12-05T19:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802820#M4675</link>
      <description>&lt;P&gt;hastily, rewrote in python, then I'll revise the solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pymxs import runtime as mxs

mxs.clearListener()
mxs.execute("fn b2a bitarray = (return bitarray as Array)")
obj = mxs.getCurrentSelection()[0]


def get_data_edges():

    edges_data = mxs.b2a(mxs.polyop.getEdgeSelection(obj))
    edges_loop = mxs.Array()
    current_sel_count = 0
    
    while edges_data.count &amp;gt; 0:
    
        mxs.append(edges_loop, mxs.Array())
    
        if edges_loop.count == 1:
            current_sel_count = 0
        else:
            current_sel_count += 1
    
        mxs.append(edges_loop[current_sel_count], edges_data[0])
        mxs.deleteItem(edges_data, 1)
    
        cnt = 0
    
        while cnt &amp;lt; edges_loop[current_sel_count].count:
    
            current_edge_verts = mxs.b2a(mxs.polyOp.GetVertsUsingEdge(obj, edges_loop[current_sel_count][cnt]))
            neigbor_edges = mxs.Array()
            cnt += 1
    
            for vert in current_edge_verts:
                mxs.join(neigbor_edges, mxs.b2a(mxs.polyOp.GetEdgesUsingVert(obj, vert)))
    
            for edge in neigbor_edges:
                check_in_selection = mxs.findItem(edges_data, edge)
                if check_in_selection &amp;gt; 0:
                    mxs.deleteItem(edges_data, check_in_selection)
                    mxs.append(edges_loop[current_sel_count], edge)
    
    return edges_loop


print(get_data_edges())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 05:26:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10802820#M4675</guid>
      <dc:creator>ivanchin.ivan</dc:creator>
      <dc:date>2021-12-06T05:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10804338#M4676</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11485601"&gt;@ivanchin.ivan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;hastily, rewrote in python, then I'll revise the solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;what's the difference? it is the same algorithm, the same very slow for high resolution objects.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 18:21:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10804338#M4676</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-12-06T18:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10805275#M4677</link>
      <description>&lt;P&gt;I agree with you, this is still temporary&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 03:58:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10805275#M4677</guid>
      <dc:creator>ivanchin.ivan</dc:creator>
      <dc:date>2021-12-07T03:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10805951#M4678</link>
      <description>&lt;P&gt;even if you rewrite this algorithm in c++, nothing will change anyway. everything will remain very slow with a huge memory leaking...&lt;STRONG&gt; this algorithm works for "teapots" only&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 11:37:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10805951#M4678</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2021-12-07T11:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add each group of selected edges to a separate array?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10806080#M4679</link>
      <description>I'm not trying to argue with you, I repeat - this is a temporary solution, for my tasks, so far enough.</description>
      <pubDate>Tue, 07 Dec 2021 12:43:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-do-i-add-each-group-of-selected-edges-to-a-separate-array/m-p/10806080#M4679</guid>
      <dc:creator>ivanchin.ivan</dc:creator>
      <dc:date>2021-12-07T12:43:37Z</dc:date>
    </item>
  </channel>
</rss>

