<?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: Mel how to select same faces from current array, but on another object? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822224#M5255</link>
    <description>&lt;P&gt;Hello Malcolm,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$newComponentSel[size($newComponentSel)] = ($obj[0] + $comp);&lt;/PRE&gt;&lt;P&gt;The line above is in a forLoop as you can see so anytime the loop iterate, the variable $newComponentSel which is an array has a new value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like a trick to &lt;STRONG&gt;append&lt;/STRONG&gt; a new value ($obj[0]+$comp) at the end of the $newComponentSel array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Oct 2020 14:06:44 GMT</pubDate>
    <dc:creator>stuzzz</dc:creator>
    <dc:date>2020-10-24T14:06:44Z</dc:date>
    <item>
      <title>Mel how to select same faces from current array, but on another object?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9811716#M5254</link>
      <description>&lt;P&gt;I've often run into this problem where I've got an array of face stored in a variable, but I want to substitute a new object name. I've seen this accomplished online, but I don't understand the code because it's written in short hand. Could someone help me figure this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;//Store faces from first object
string $components[] = `ls -sl -fl`;

//Get name of second object manually select here this is just an example
string $obj[] = `ls -sl`;

//Loop through array swap names
string $newComponentSel[] = {};
for ($item in $components)
{
	string $comp = `match "\\..+" $item`;
	$newComponentSel[size($newComponentSel)] = ($obj[0] + $comp);
}
select $newComponentSel;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This code works, but I don't understand the second line $newComponenSel[size($newComponentSel)] could someone write that out for me in long hand?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 22:30:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9811716#M5254</guid>
      <dc:creator>malcolm_341</dc:creator>
      <dc:date>2020-10-19T22:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Mel how to select same faces from current array, but on another object?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822224#M5255</link>
      <description>&lt;P&gt;Hello Malcolm,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$newComponentSel[size($newComponentSel)] = ($obj[0] + $comp);&lt;/PRE&gt;&lt;P&gt;The line above is in a forLoop as you can see so anytime the loop iterate, the variable $newComponentSel which is an array has a new value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like a trick to &lt;STRONG&gt;append&lt;/STRONG&gt; a new value ($obj[0]+$comp) at the end of the $newComponentSel array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 14:06:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822224#M5255</guid>
      <dc:creator>stuzzz</dc:creator>
      <dc:date>2020-10-24T14:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Mel how to select same faces from current array, but on another object?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822379#M5256</link>
      <description>&lt;PRE&gt;$newComponentSel[size($newComponentSel)]&lt;/PRE&gt;&lt;P&gt;What do the square brackets do, I haven't worked with those before?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 18:09:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822379#M5256</guid>
      <dc:creator>malcolm_341</dc:creator>
      <dc:date>2020-10-24T18:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Mel how to select same faces from current array, but on another object?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822564#M5257</link>
      <description>&lt;P&gt;The brackets means "the value at this nth index of this variable".&lt;/P&gt;&lt;P&gt;let's say you have this array:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;string $myVar[]= {"banana", "toto", "titi"};
print $myVar[0]; // will return the first value which is "banana"
print $myVar[1]; // will return the next value which is "toto"
print $myVar[2]; // will return the last value which is "titi"
print $myVar[size($myVar)-1]; // will return the last value, same as above
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 22:53:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822564#M5257</guid>
      <dc:creator>stuzzz</dc:creator>
      <dc:date>2020-10-24T22:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Mel how to select same faces from current array, but on another object?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822631#M5258</link>
      <description>&lt;P&gt;Oh interesting, thanks for that clear explanation.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2020 00:53:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-how-to-select-same-faces-from-current-array-but-on-another/m-p/9822631#M5258</guid>
      <dc:creator>malcolm_341</dc:creator>
      <dc:date>2020-10-25T00:53:42Z</dc:date>
    </item>
  </channel>
</rss>

