Thursday, February 6, 2014

It's just some Boolean that I used to know

Not gonna use the previous Boolean. Instead, I created a new one
Although the previous Boolean was scraped off, I still use the script that I learned to create a new outer wall. I much prefer this design though. It's difficult to execute this as I have 3 polygons. I trial and error with the scripts and managed to make it work. Wow.

Now, until to this part, my script is very messy. Time to group them up and duplicate the column !

My Script As At 6 February:

import maya.cmds as mc
import math

def createFloor():
    myFloor = mc.polyCube( name = 'floor' )
    mc.scale( 5, 1, 10, myFloor[0] )
    mc.move( 0, 0.5, 0, myFloor[0] )
    mc.polyMoveVertex( 'floor.vtx[5]', tx=-1.0 )
    mc.polyMoveVertex( 'floor.vtx[7]', tx=-1.0 )
    mc.polyMoveVertex( 'floor.vtx[4]', tx=1.0 )
    mc.polyMoveVertex( 'floor.vtx[6]', tx=1.0 )
    return myFloor


def multiFloors (exCreateFloor):
    floorList = []
    n = 0
    nA = 0.2
    for each in range(3):
        myDup = mc.duplicate(exCreateFloor)
        print myDup
        mc.move( 0, n+5, 0, myDup[0] )
        n = n+5
        mc.polyMoveFacet( 'floor.f[2]', tz= 1+nA )
        floorList.append( myDup[0] )
    mc.delete('floor')
    return floorList
 
def createWall():
    myWall = mc.polyCube( name = 'wall')
    mc.move ( 2, 10, -0.25, myWall[0] )
    mc.scale( 0.5, 20, 10.5, myWall[0] )
    mc.rotate( 0, '6deg', 0, r=True )
    mc.polyMoveVertex( 'wall.vtx[4:5]', tz=3.0 )
    return myWall
   
def mainWall():
    mc.polyCube( n = 'base', w = 5.5, h = 5 )
    mc.polyCube( n = 'cut', w = 3, h = 3 )
    mc.move( 0, -1, 0 )
    mc.polySphere( n = 'curve', sx=10, sy=15, r=2)
    mc.polyBoolOp( 'base', 'cut', op = 2, n = 'end1' )
    mc.polyBoolOp( 'end1', 'curve', op = 2, n = 'end2' )
    mc.move ( 0, 2.5, 5 , 'end2')
    return 'end2'
   
def multiwalls (exCreateWall):
    List = []
    myGrp = mc.group(exCreateWall)
    n = 0
    for each in range(3):
        myDup = mc.duplicate(myGrp)
        print myDup
        mc.move( 0, n+5, 0, myDup[0] )
        n = n+5
        List.append(myDup[0])
    return List
       
def FinalWalls():

    exCreateFloor = createFloor()
    multiFloors (exCreateFloor)
    exCreateWall = mainWall()
    multiwalls (exCreateWall)
    createWall()

No comments:

Post a Comment