Create and set a new maya project named boxproject add the


Making Boxes by Scripting

Create and set a new Maya project named "Box_Project".

Write a MEL script that does the following:

Starting from a negative X position (e.g., -15), increment X by a small amount (e.g., 3), until X is its positive value (e.g., 15); for each X:

1. make a polyCube with a sequentially-numbered name (e.g., "box1")

2. add the name to an array of names; e.g., if the array is $boxes, then $boxes[i] = $name, where i is 0 for the first box, 1 for the second box, etc., and $name is the next sequentially-numbered box name. So, $boxes[0] is set to "box1", $boxes[1] is set to "box2", etc.

3. move the polyCube to the current X position (MEL command is move -x xValue)

4. scale the polyCube to a random height of between 1 and 5 units:

MEL function rand(m, n) generates a random float between m and n

MEL command scale -y ySize resizes selected object to the ySize on the Y axis (i.e., height)

Use a text editor like Notepad (or, even better, Notepad++) to type your script. Then, save the script as a .mel file in your project's scripts folder.

In Maya's Script Editor, use the Source Script... button () to load and run your script. Once it is working correctly, you should see a row of randomly-sized boxes along the X-axis.

Make a copy of your script file. Then, modify one of the copies so that the boxes are randomly colored:

Using the MEL function rand(1), which generates a random float between 0 and 1, get 3 random values for red ($red), green ($green) and blue ($blue) intensities. Then, randomly color the polyCube using the MEL command

polyColorPerVertex -r $red -g $green -b $blue -a 1 -cdo;

Once you are done, submit your final script (.mel) file, below.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Create and set a new maya project named boxproject add the
Reference No:- TGS01711366

Expected delivery within 24 Hours