/***************************************************************
ifShapes.mel Kelly Bechtle-Woods 12/04/2022
Generates random numbers and creates shapes depending on the result
USAGE: ifShapes
****************************************************************/
global proc ifShapes()
{
int $randNum = rand(10.9999);
print ($randNum+"\n");
if ($randNum < 2) // True if 0 or 1
{
polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;
}
else if ($randNum == 2) // True if 2
{
polyTorus -r 1 -sr 0.5 -tw 0 -sx 20 -sy 20 -ax 0 1 0 -cuv 1 -ch 1;
}
else if ($randNum > 8) // True if 9 or 10
{
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
}
else if (($randNum > 2) && ($randNum < 9)) // True if 3, 4, 5, 6, 7, 8
{
polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1;
}
else
{
print "nothing.";
}
print "DONE!";
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter