PDA

View Full Version : need help with a simple mel script


ManuelM
03-30-2003, 07:07 PM
a friend of mine asked me, to help him with a problem, regarding nurbs geometry. what he wants is a script, that queries the u and v divisions of a surface and doubles the values
e.g.:

udivisions:4, vdivisions: 6, script rebuilds surface with 8 divisions in u and 12 in v direction

i`m not a mel programmer, so i`m asking you for you mel-gods for help. i tried something like this:

setAttr nurbsPlaneShape7.uDivisionsFactor = (`getAttr nurbsPlaneShape7.uDivisionsFactor`)*2;


doesn`t work
:shrug:

Hugh
03-31-2003, 12:55 AM
The following will do what you want:


int $spansU = `rebuildSurface -query -spansU myPlane`;
int $spansV = `rebuildSurface -query -spansV myPlane`;
$spansU *= 2;
$spansV *= 2;
rebuildSurface -edit -spansU $spansU -spansV $spansV myPlane;

Deimos
03-31-2003, 01:22 AM
hi

I ve done an alternate mel.
It double all the UV spans for the selected nurbs.

string $srfList[] = `filterExpand -sm 10`;
int $U,$V,$i;
int $len=size($srfList);

for($i=0; $i<$len; $i++) {
pickWalk -d down;
$U=eval("getAttr "+$srfList[$i]+".spansUV.spansU")*2;
$V=eval("getAttr "+$srfList[$i]+".spansUV.spansV")*2;
rebuildSurface -rt 0 -su $U -sv $V $srfList[$i];
}

hope this

CGTalk Moderation
01-14-2006, 07:00 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.