<?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)getting curve cv parameter? in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504260#M6061</link>
    <description>&lt;P&gt;i found the issue. d'ohhh its the shapes[size($shapes)] thats causing issues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with this it will work regardless even without .worldSpace[0]&lt;/P&gt;&lt;LI-CODE lang="general"&gt;connectAttr -force ($shapes[0] + ".worldSpace") ($nearestInfo +".inputCurve");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 May 2020 21:10:40 GMT</pubDate>
    <dc:creator>absoluteKelvin</dc:creator>
    <dc:date>2020-05-09T21:10:40Z</dc:date>
    <item>
      <title>(MEL)getting curve cv parameter?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504122#M6058</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;{
 string $selected[] = `ls -sl`;
 string $shapes[];
 float $uParam[] ;
 for ($curve in $selected){
    int $CVs =`getAttr ($curve + ".spans")`;
    $shapes = `listRelatives -shapes $curve`;
    string $nearestInfo = `createNode nearestPointOnCurve`;
    connectAttr ($shapes[size($shapes)] + ".worldSpace") ($nearestInfo +".inputCurve");
    for ($x = 0; $x &amp;lt; $CVs; $x++)
    {
        vector $location = `pointPosition ($curve + ".cv[" + $x + "]")`;
        setAttr ($nearestInfo + ".inPositionX") ($location.x);
        setAttr ($nearestInfo + ".inPositionY") ($location.y) ;
        setAttr ($nearestInfo + ".inPositionZ") ($location.z) ;
        $uParam[$x] = `getAttr ($nearestInfo + ".parameter")`;  //format getAttr nearestPointOnCurve1.parameter;
        string $Parameter = $uParam[$x];
        print ($Parameter + "\n");
    }
    delete $nearestInfo;
 }    
} 
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code i came up with after reading up on documentations and help from sites &lt;A href="https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/DATA_ncurve.html" target="_blank"&gt;https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/DATA_ncurve.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://download.autodesk.com/global/docs/maya2012/en_us/Nodes/nearestPointOnCurve.html" target="_blank"&gt;http://download.autodesk.com/global/docs/maya2012/en_us/Nodes/nearestPointOnCurve.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently it works on one curve. But Its suppose to work for multiple curves.&amp;nbsp; When I run it it gives me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Error: line 9: The source attribute '.worldSpace' cannot be found. //&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>Sat, 09 May 2020 18:28:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504122#M6058</guid>
      <dc:creator>absoluteKelvin</dc:creator>
      <dc:date>2020-05-09T18:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: (MEL)getting curve cv parameter?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504202#M6059</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stuzzz_0-1589053642312.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/767902i971911FE5158312E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stuzzz_0-1589053642312.png" alt="stuzzz_0-1589053642312.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;looking at Nurbs shape output attributes in maya2018, &lt;EM&gt;worldSpace&lt;/EM&gt; attribute is an array.&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;so you may explicitly specify an index to worldspace ( ie. worldspace[0] )&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;connectAttr ($shapes[size($shapes)] + ".worldSpace[0]") ($nearestInfo +".inputCurve");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2020 19:51:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504202#M6059</guid>
      <dc:creator>stuzzz</dc:creator>
      <dc:date>2020-05-09T19:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: (MEL)getting curve cv parameter?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504253#M6060</link>
      <description>&lt;P&gt;i edited the code with your suggestion, but this occurs when i have 2 curves selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Error: line 9: The source attribute '.worldSpace[0]' cannot be found. //&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2020 21:02:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504253#M6060</guid>
      <dc:creator>absoluteKelvin</dc:creator>
      <dc:date>2020-05-09T21:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: (MEL)getting curve cv parameter?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504260#M6061</link>
      <description>&lt;P&gt;i found the issue. d'ohhh its the shapes[size($shapes)] thats causing issues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with this it will work regardless even without .worldSpace[0]&lt;/P&gt;&lt;LI-CODE lang="general"&gt;connectAttr -force ($shapes[0] + ".worldSpace") ($nearestInfo +".inputCurve");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2020 21:10:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504260#M6061</guid>
      <dc:creator>absoluteKelvin</dc:creator>
      <dc:date>2020-05-09T21:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: (MEL)getting curve cv parameter?</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504275#M6062</link>
      <description>&lt;P&gt;great!&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2020 21:23:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-getting-curve-cv-parameter/m-p/9504275#M6062</guid>
      <dc:creator>stuzzz</dc:creator>
      <dc:date>2020-05-09T21:23:48Z</dc:date>
    </item>
  </channel>
</rss>

