Wednesday, May 20, 2015

Part 1 understanding the Script

Contents
Creating A unique Spiral Stairs With Decorations Refrence

So Initially I try to understand the script
that I used
import maya.cmds as mc
#this line is used to import the cmds
import math
# this line is use to Import the math into the script

myCubeList =[]
# this line is used to create a list

for each in range(100):
# this line is to specify the number of objects
    myCube = mc.polyCube(name="Cube")
    # this line is auto indented and than specify the object followed by creating the object
    mc.move (each , 0 , 0 , myCube[0])
    #this line  move the object around via the 2nd attribute of mycube (X axis,Y axis,Z axis, )
    mc.rotate (0, (each*10) , 0 , myCube[0], pivot =(0,0,0))
   #this line is used to rotate the object (X axis,Y axis,Z axis, ObjectName, piviot= (X,Y,Z,))
    myCubeList.append(myCube[0]) 
   #this line is used to add items to the list

so I decided to use multiple copies of the script to create the stairs

I also wanted to ajust the numbers all at once so I let maya know what is the def of the No.

import maya.cmds as mc
import math
myCubeList =[]

MyNo= 100
#used to control the numbers

myCubeList =[]
for each in range(MyNo):
    myCube = mc.polyCube(name="myCube")
    mc.move (10, (each-1) , 0 , myCube[0] )
    #the first value 10 is used to specify the Radius the distance moved in the X axis and the Each value is to allow the object to move upwards each was spcified in the line above for each in range(MyNo):so it *1unit of the object every box it creates
    mc.rotate (0, (each*10) , 0 , myCube[0], pivot =(0,0,0) )
    mc.scale (10,0.5,3, myCube[0])
    #I used the scale to create the base of the staircase
    myCubeList.append(myCube[0])



Result:

 


No comments:

Post a Comment