Monday, May 25, 2015

Part 3 Creating the DNA Structure


Contents
Creating A unique Spiral Stairs With Decorations Refrence
Part 1 Understanding the Script
Part 2 Experimenting with the Script

After experimenting with the script I wanted to start to create the DNA Structure in the middle of the steps so this what I did

DNAList =[]
for each in range(MyDnaNo):
    myDNA = mc.polyCube(name="myDNA")
    mc.move (0, ((each*2)-1) , 0 , myDNA[0] )
    mc.rotate (0, (each*15) , 0 , myDNA[0] )
    mc.scale (10,0.5,0.5, myDNA[0])
    DNAList.append(myDNA[0])
this was one of the problem faced in the script. In the above script I removed the pivot of the roatation value

DNABallA =[]
for each in range(MyDnaNo):
    myDNAOrb = mc.polySphere(name="myDNAOrb")
    mc.move (5, ((each*2)-1) , 0 , myDNAOrb[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrb[0], pivot =(0,0,0) )
    DNABallA.append( myDNAOrb[0])   
   
DNABallB =[]
for each in range(MyDnaNo):
    myDNAOrbB = mc.polySphere(name="myDNAOrbB")
    mc.move (-5, ((each*2)-1) , 0 , myDNAOrbB[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrbB[0], pivot =(0,0,0) )
    DNABallB.append( myDNAOrbB[0])

result

Part 6 Finalizing and Cleaning up the script


Creating A unique Spiral Stairs With Decorations Refrence
Part 1 Understanding the Script
Part 2 Experimenting with the Script
Part 3 Creating the DNA Structure 
Part 4 Increase the stair look
Part 5 Vortex
I noticed that my script is very messy so i decided to group them to a same list

eg:
DNAList =[]
for each in range(MyDnaNo):
    myDNA = mc.polyCube(name="myDNA")
    mc.move (0, ((each*2)-1) , 0 , myDNA[0] )
    mc.rotate (0, (each*15) , 0 , myDNA[0] )
    mc.scale (10,0.5,0.5, myDNA[0])
    DNAList.append(myDNA[0])

DNABallA =[]
for each in range(MyDnaNo):
    myDNAOrb = mc.polySphere(name="myDNAOrb")
    mc.move (5, ((each*2)-1) , 0 , myDNAOrb[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrb[0], pivot =(0,0,0) )
    DNABallA.append( myDNAOrb[0])   
   
DNABallB =[]
for each in range(MyDnaNo):
    myDNAOrbB = mc.polySphere(name="myDNAOrbB")
    mc.move (-5, ((each*2)-1) , 0 , myDNAOrbB[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrbB[0], pivot =(0,0,0) )
    DNABallB.append( myDNAOrbB[0])
to
   
#Dna Structure
DNAList =[]
for each in range(MyDnaNo):
    myDNA = mc.polyCube(name="myDNA")
    mc.move (0, ((each*2)-1) , 0 , myDNA[0] )
    mc.rotate (0, (each*15) , 0 , myDNA[0] )
    mc.scale (10,0.5,0.5, myDNA[0])
    DNAList.append(myDNA[0])
for each in range(MyDnaNo):
    myDNAOrb = mc.polySphere(name="myDNAOrb")
    mc.move (5, ((each*2)-1) , 0 , myDNAOrb[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrb[0], pivot =(0,0,0) )
    DNAList.append( myDNAOrb[0])   
for each in range(MyDnaNo):
    myDNAOrbB = mc.polySphere(name="myDNAOrbB")
    mc.move (-5, ((each*2)-1) , 0 , myDNAOrbB[0] )
    mc.rotate (0, (each*15) , 0 , myDNAOrbB[0], pivot =(0,0,0) )
    DNAList.append( myDNAOrbB[0])

And it works 

Part 7 Final Render

Part 5 Vortex

Creating A unique Spiral Stairs With Decorations Refrence
Part 1 Understanding the Script
Part 2 Experimenting with the Script
Part 3 Creating the DNA Structure 
Part 4 Increase the stair look

I was thinking of making a vortex around the stair

mySphereListC =[]
for each in range(MyNo):
    mySphereC = mc.polySphere(name="mySphereC")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereC[0] )
    mc.rotate (0, (each*2) , 0 , mySphereC[0], pivot =(0,0,0) )
    mySphereListC.append(mySphereC[0])

Result

Another problem faced which is how to make it surround the stairs so i decided to add the  value out side the each value to create the vortex according to degrees

mySphereListC =[]
for each in range(MyNo):
    mySphereC = mc.polySphere(name="mySphereC")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereC[0] )
    mc.rotate (0, (each*2) , 0 , mySphereC[0], pivot =(0,0,0) )
    mySphereListC.append(mySphereC[0])
   

mySphereListD =[]
for each in range(MyNo):
    mySphereD = mc.polySphere(name="mySphereD")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereD[0] )
    mc.rotate (0, (each*2)=135 , 0 , mySphereD[0], pivot =(0,0,0) )
    mySphereListD.append(mySphereD[0])
   
mySphereListE =[]
for each in range(MyNo):
    mySphereE = mc.polySphere(name="mySphereE")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereE[0] )
    mc.rotate (0, (each*2)+45 ,0 , mySphereE[0], pivot =(0,0,0) )
    mySphereListE.append(mySphereE[0])
   
mySphereListF =[]
for each in range(MyNo):
    mySphereF = mc.polySphere(name="mySphereF")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereF[0] )
    mc.rotate (0, (each*2)+90 ,0 , mySphereF[0], pivot =(0,0,0) )
    mySphereListF.append(mySphereF[0])

mySphereListG =[]
for each in range(MyNo):
    mySphereG = mc.polySphere(name="mySphereG")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereG[0] )
    mc.rotate (0, (each*2)+180 , 0 , mySphereG[0], pivot =(0,0,0) )
    mySphereListG.append(mySphereG[0])
   
mySphereListH =[]
for each in range(MyNo):
    mySphereH = mc.polySphere(name="mySphereH")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereH[0] )
    mc.rotate (0, (each*2)+225 , 0 , mySphereH[0], pivot =(0,0,0) )
    mySphereListH.append(mySphereH[0])
   
mySphereListI =[]
for each in range(MyNo):
    mySphereI = mc.polySphere(name="mySphereI")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereI[0] )
    mc.rotate (0, (each*2)+270 , 0 , mySphereI[0], pivot =(0,0,0) )
    mySphereListI.append(mySphereI[0])
   
mySphereListJ =[]
for each in range(MyNo):
    mySphereJ = mc.polySphere(name="mySphereJ")
    mc.move ((each)*0.3+15, (each-1) , 0 , mySphereJ[0] )
    mc.rotate (0, (each*2)+315 , 0 , mySphereJ[0], pivot =(0,0,0) )
    mySphereListJ.append(mySphereJ[0])

 Result


Part 4 Increase the stair look

Contents
Creating A unique Spiral Stairs With Decorations Refrence
Part 1 Understanding the Script
Part 2 Experimenting with the Script
Part 3 Creating the DNA Structure

 To improve the aesthetics of the stairs I created the pipes to seal the cages up

myPipeList =[]
for each in range(MyNo):
    myPipe = mc.polyPipe(name="myPipe")
    mc.move (15, (each+13) , 0 , myPipe[0] )
    mc.rotate (0, (each*10) , 0 , myPipe[0], pivot =(0,0,0) )
    mc.scale (1,2,1, myPipe[0])
    myPipeList.append(myPipe[0])

myPipeListB =[]
for each in range(MyNo):
    myPipeB = mc.polyPipe(name="myPipeB")
    mc.move (15, (each-18.5) , 0 , myPipeB[0] )
    mc.rotate (0, (each*10) , 0 , myPipeB[0], pivot =(0,0,0) )
    mc.scale (1,7,1, myPipeB[0])
    myPipeListB.append(myPipeB[0])
   
mySphereListA =[]
for each in range(MyNo):
    mySphere = mc.polySphere(name="mySphere")
    mc.move (15, (each-1) , 0 , mySphere[0] )
    mc.rotate (0, (each*10) , 0 , mySphere[0], pivot =(0,0,0) )
    mc.scale (2,2,2, mySphere[0])
    mySphereListA.append(mySphere[0])   
   
mySphereListB =[]
for each in range(MyNo):
    mySphereB = mc.polySphere(name="mySphereB")
    mc.move (5, (each-1) , 0 , mySphereB[0] )
    mc.rotate (0, (each*10) , 0 , mySphereB[0], pivot =(0,0,0) )
    mySphereListB.append(mySphereB[0])

result

Wednesday, May 20, 2015

Part 2 Experimenting with the Script

Contents
Creating A unique Spiral Stairs With Decorations Refrence
Part 1 Understanding the Script


So i started playing around with the Values of the scripts since i already understand the script now is just to calculate the distance of the objects that i am gonna create by modifying the values of the X Axis in the mc.move (10, each*10, 0, object[0])

I wanted to create a DNA Structure so i started by placing the Spheres at each end of the Stair
mySphereListA =[]
for each in range(MyNo):
    mySphere = mc.polySphere(name="mySphere")
    mc.move (15, (each-1) , 0 , mySphere[0] )
    mc.rotate (0, (each*10) , 0 , mySphere[0], pivot =(0,0,0) )
    mc.scale (2,2,2, mySphere[0])
    mySphereListA.append(mySphere[0])   
   
mySphereListB =[]
for each in range(MyNo):
    mySphereB = mc.polySphere(name="mySphereB")
    mc.move (5, (each-1) , 0 , mySphereB[0] )
    mc.rotate (0, (each*10) , 0 , mySphereB[0], pivot =(0,0,0) )
    mySphereListB.append(mySphereB[0])

Result
so I continued to add on the script
to create the cage like appearence of the Stairs
myCubeList2 =[]
for each in range(MyNo):
    mybox = mc.polyCube(name="mybox")
    mc.move (5, (each-1) , 0 , mybox[0] )
    mc.rotate (0, (each*10) , 0 , mybox[0], pivot =(0,0,0) )
    mc.scale (0.5,10,0.5, mybox[0])
    myCubeList2.append(mybox[0])

myCubeList3 =[]
for each in range(MyNo):
    mybox2 = mc.polyCube(name="mybox2")
    mc.move (15, (each-1) , 0 , mybox2[0] )
    mc.rotate (0, (each*10) , 0 , mybox2[0], pivot =(0,0,0) )
    mc.scale (0.5,30,0.5, mybox2[0])
    myCubeList3.append(mybox2[0])

Result


Part 3 Creating the DNA Structure 

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: