Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
{
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 < $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;
}
}
this is the code i came up with after reading up on documentations and help from sites https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/DATA_ncurve.html
http://download.autodesk.com/global/docs/maya2012/en_us/Nodes/nearestPointOnCurve.html
Currently it works on one curve. But Its suppose to work for multiple curves. When I run it it gives me
// Error: line 9: The source attribute '.worldSpace' cannot be found. //
https://www.artstation.com/kelvintam
Solved! Go to Solution.