sphere -r 10.0 -esw 180;//-r是半径;-esw是最终球生成在多少度位置;默认模式即创建模式即-c;
sphere -q -r nurbsSphere1;//-q 查询模式;查询小球nurbsSphere1的半径;
sphere -e -r 15 nurbsSphere1;//-e 编辑模式;编辑小球nurbsSphere1的半径为15;
//
cone -name testing;//创建模式,创建圆锥并命名"testing";
move 10 0 0 testing;//mel移动命令,xyz轴,在x轴上移动10单位;
select -cl;//取消选择;
//
string $coneNodeNames[] = `cone -name testing2`;//储存命令的返回值到字符串数组;
print($coneNodeNames[0]+"\n"+$coneNodeNames[1]+"\n");//数组里的内容分别是变换节点名称和历史节点名称;
print(size($coneNodeNames));//数组的尺寸是2;
//
string $theCommand = "";
for ($x=0;$x<5;$x++)
{
int $whichShape = rand(2.0);//rand范围内的随机数
//0和2之间的随机数;省略了0详细版为:rand(0,2.0);
//向下取整为0和1
switch($whichShape)//switch函数:根据条件判断
{
case 0:
$theCommand += " sphere;";
break;
case 1:
$theCommand += " cone;";
break;
} //这种方式方便后面可以准确打印出脚本所执行的命令字符串;
}
print ("Now we're going to execute " +$theCommand+"\n");//打印出储存在$theCommand里的所有命令;
eval($theCommand);//执行字符串"$theCommand"中的命令;返回值为最后一个创建物体的变换节点和历史节点;
//