See the reason is advised a alternate approach is that I was hoping you'd take a hint. The alternate approach is simpler, less code and faster and gives you a construction history, because thats how you use MEL. Now i have to explain for the millionth of time how maya does NOT work the way you think it does. If you want to approach this problem with this approach use the maya API its there for this purpose.
You can not use xform -rotateAxis the way you think becasue maya nodes are auxiliaries to specific nodes. xform is the auxilliary to the transformation node it does not have much of a purpose outside manipulation of transforms. Granted maya abstracts selections as temporary transforms but these transforms don't have ALL properties to transforms.
The bottom line is your solution needs to end up with a node of somekind, the less you sue time to manually manipulate things the better your nodes behave. Besides you get graphical user interfaces, build tools and user configuration for free when you use nodes.
Heres a very quick and dirty example i could do it much cleaner and make all transforms disappear into history but i have other things to do. Likewise i could eliminate twist problems on 3d curves but frankly so should you, again recurse as many times as you like.
{
$selection=`ls -sl`;
for ($item in $selection){
$rebuld = `rebuildCurve -ch 1 -rpo 0 -rt 0 -end 1 -kr 2
-kcp 0 -kep 1 -kt 0 -s 50 -d 3
$item`;
hide;
$twistSurf=`circle -c 0 0 0 -nr 0 1 0
-sw 360 -r 1 -d 3
-ut 0 -s 8 -ch 1`;
hide;
$ext= `extrude -ch true -rn false -po 0 -et 2 -ucp 1 -fpt 1
-upn 1 -rotation 0 -scale 1 -rsp 1 $twistSurf[0] $rebuld[0]`;
hide;
$shape=`listRelatives -shapes $ext[0]`;
$maxV = `getAttr ($shape[0]+".sv")`;
print $maxV;
curveOnSurface -d 1 -uv 0 0
-uv (12*8) ($maxV) -k 0 -k 1 $ext[0];
duplicateCurve;
}
};
pm me if you want that script to peek at.
Not really. If you want community support then you do it in the open. That is the proce of asking on a forum.