PDA

View Full Version : beginner mel question


Ironhalo
10-18-2006, 06:49 PM
im trying to write a script where a user selects an edge, and the script in turn converts it to an edge ring, converts the selection to verticies and scales the vertices by a predetermined amount.

everything is working except the scale; i end up with the script scaling the vertices to the center pivot of the transform node, not the curent center pivot of the selected vertexes.

the mel code looks like this when i use the ui: scale -r -p xcm ycm zcm 2 2 2;

where im having the problem is puling the -p value. im assuming its averaged for xyz.

any help with the code here would be greatly appreciated!

NateH
10-19-2006, 09:51 AM
You dont have to use the -p (oivot) flag, you can use -ocp or -op to get the center pivot.

Or you can just use -r and it will scale from the center of the current selection.

scale -r 2 2 2 nurbsSphere1.cv[3][0:7];

Also the flags you had: xcm ycm zcm arent listed as flags under the scale command so that isnt going to work either. If you need absolute values try the -a flag not sure how well it works though.

NateH
10-19-2006, 09:51 AM
You dont have to use the -p (pivot) flag, you can use -ocp or -op to get the center pivot.

Or you can just use -r and it will scale from the center of the current selection.

scale -r 2 2 2 nurbsSphere1.cv[3][0:7];

Also the flags you had: xcm ycm zcm arent listed as flags under the scale command so that isnt going to work either. If you need absolute values try the -a flag not sure how well it works though.

Ironhalo
10-19-2006, 04:33 PM
thanks for the response! i shoudl have been more clear about the ui mel i got. the scale -r -p xcm ycm zcm was really like this:

scale -r -p 0cm 6.319307cm 6.008102cm 0.86214 0.86214 0.86214 ;

as far as i can tell the cm values represent the position of the center pivot for the selcted components.


heres the code i used so far:

global proc ringScale(float $scale)
{

string $edge[] = `ls -sl`;
string $currentObj;

for ($currentObj in $edge)
{

SelectEdgeLoop;
polySelectEdges edgeLoop;
PolySelectConvert 3;

string $edgeCV[] = `ls -sl`;

scale -a $scale $scale $scale ;

}
}

thanks again!

Adam
10-19-2006, 09:23 PM
the only way i have found to get around this is to get all the x y and z values of each vert and then average them all. Finally use the average for the -pivot. i wrote a script kinda similar for scaling faces based on verts and i had to do that.

Adam
10-19-2006, 09:26 PM
look at the pointposition command. it might help you

CGTalk Moderation
10-19-2006, 09:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.