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:
- make a polyCube with a sequentially-numbered name (e.g., "box1")
- 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.
- move the polyCube to the current X position (MEL command is move -x xValue)
- 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 (
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.
9 years ago 20
- Assignment
- Acq2 Quality Work Only. Plagiarism Free
- The assignment is to write on the U.S congressional Authorization
- LAW531 U.S. Global Administrative Law Paper The U.S. possesses more extensive and expansive administrative law than any other nation analyzing the administrative bodies in Europe and Asia
- TEST ASSESSMENT ICD-10
- Literature As part of a college
- reflection
- Response paper
- I need help with this criminal justice assignment
- POL 201 American National Government (ACK1624E)