def _makeCyl(self):
     r = 50
     a = 2.0*r
     y = (0, 1, 0)
     c = cmds.polyCylinder(
         r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0]
     cmds.select(c)
     response = nimble.createRemoteResponse(globals())
     response.put('name', c)
    def _handleExampleButton(self):
        """
        This callback creates a polygonal cylinder in the Maya scene.

        """
        r = 50
        a = 2.0*r
        y = (0, 1, 0)
        c = cmds.polyCylinder(
            r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0]
        cmds.select(c)
        response = nimble.createRemoteResponse(globals())
        response.put('name', c)
Exemple #3
0
    def createToken(cls, uid, props, trackSetNode =None):
        """ A token is created, provided with some additional Maya attributes,
            and placed in the scene. Tokens are functtionally similar to
            TrackNodes, but with different shapes and attributes. """

        cylinderHeight = 5.0
        coneHeight     = 10.0

        if not trackSetNode:
            trackSetNode = TrackSceneUtils.getTrackSetNode()

        if not trackSetNode:
            return None

        node = cls.getTrackNode(uid, trackSetNode=trackSetNode)

        if node:
            return node

        # determine whether left or right, and manus or pes, from name
        name = props['name'] if props else None
        if not name:
            print('createToken:  No properties specified')
            return
        # remove '_proxy' or '_token' if present (as in S6_LP3_proxy)
        nameFields = cls.decomposeName(name.split('_')[0])
        isLeft     = nameFields['left']
        isPes      = nameFields['pes']

        # make a cone for the token of an proxy else a cylinder
        if uid.endswith('_proxy'):
            node = cmds.polyCone(
                radius=0.5,
                height=coneHeight,
                subdivisionsX=10,
                subdivisionsY=1,
                subdivisionsZ=1,
                axis=(0, 1, 0),
                createUVs=0,
                constructionHistory=0,
                name='Token_0')[0]
            cmds.move(0, 0.5 * coneHeight, 0)
        else:
            node = cmds.polyCylinder(
                radius=0.5,
                height=cylinderHeight,
                subdivisionsX=10,
                subdivisionsY=1,
                subdivisionsZ=1,
                subdivisionsCaps=0,
                axis=(0, 1, 0),
                createUVs=0,
                constructionHistory=0,
                name='Token_0')[0]
            cmds.move(0, 0.5 * cylinderHeight, 0)

        # Set up the basic cadence attributes
        cmds.addAttr(longName='cadence_dx', shortName='dx', niceName='DX')
        cmds.addAttr(longName='cadence_dy', shortName='dy', niceName='DY')

        cmds.addAttr(
             longName='cadence_uniqueId',
             shortName='track_uid',
             dataType='string',
             niceName='UID')

        cmds.addAttr(
             longName='cadence_name',
             shortName='token_name',
             dataType='string',
             niceName='Name')

        # Disable some transform attributes
        cmds.setAttr(node + '.rotateX',    lock=True)
        cmds.setAttr(node + '.rotateZ',    lock=True)
        cmds.setAttr(node + '.scaleY',     lock=True)
        cmds.setAttr(node + '.translateY', lock=True)

        # Scale the cylinder/cone in x and z to represent 'dy' and 'dx' in
        # centimeters. There is a change of coordinates between Maya (X, Z) and
        # the simulator (X, Y) space. For example, for the right manus:
        #    x = int(100*float(entry['rm_y']))
        #    z = int(100*float(entry['rm_x']))
        # and likewise for dx and dy.

        # the DX and DY attributes affect scaleZ and scaleX in the node
        cmds.connectAttr(node + '.dx', node + '.scaleZ')
        cmds.connectAttr(node + '.dy', node + '.scaleX')

        # add a short annotation based on the name
        annotation = cmds.annotate(node, text=cls.shortName(props['name']))
        cmds.select(annotation)
        aTransform = cmds.pickWalk(direction='up')[0]

        # control it's position by that of the node, so that it stays 15 cm
        # above the pes and 10 cm above the manus
        if isPes:
            cmds.move(0.0, 15.0, 0.0, aTransform)
        else:
            cmds.move(0.0, 10.0, 0.0, aTransform)

        cmds.connectAttr(node + '.translateX', aTransform + '.translateX')
        cmds.connectAttr(node + '.translateZ', aTransform + '.translateZ')

        # and make it non-selectable
        cmds.setAttr(aTransform + '.overrideEnabled', 1)
        cmds.setAttr(aTransform + '.overrideDisplayType', 2)
        cmds.rename(aTransform, "TokenAnnotation_0")

        if isPes:
            if isLeft:
                color = TrackwayShaderConfig.LEFT_PES_TOKEN_COLOR
            else:
                color = TrackwayShaderConfig.RIGHT_PES_TOKEN_COLOR
        else:
            if isLeft:
                color = TrackwayShaderConfig.LEFT_MANUS_TOKEN_COLOR
            else:
                color = TrackwayShaderConfig.RIGHT_MANUS_TOKEN_COLOR
        ShadingUtils.applyShader(color, node)

        cmds.select(node)
        # add the new node to the Cadence track set
        cmds.sets(node, add=trackSetNode)

        # finally, initialize all the properties from the dictionary props
        cls.setTokenProps(node, props)

        return node
Exemple #4
0
    def buildScene(self):
        """Doc..."""

        groupItems = []
        hinds      = []
        fores      = []

        for c in self._data.getChannelsByKind(ChannelsEnum.POSITION):
            isHind = c.target in [TargetsEnum.LEFT_HIND, TargetsEnum.RIGHT_HIND]
            radius = 20 if isHind else 15
            res    = cmds.polySphere(radius=radius, name=c.target)
            groupItems.append(res[0])
            if isHind:
                hinds.append(res[0])
            else:
                fores.append(res[0])

            if c.target == TargetsEnum.LEFT_HIND:
                self._leftHind = res[0]
            elif c.target == TargetsEnum.RIGHT_HIND:
                self._rightHind = res[0]
            elif c.target == TargetsEnum.RIGHT_FORE:
                self._rightFore = res[0]
            elif c.target == TargetsEnum.LEFT_FORE:
                self._leftFore = res[0]

            for k in c.keys:
                frames = [
                    ['translateX', k.value.x, k.inTangentMaya[0], k.outTangentMaya[0]],
                    ['translateY', k.value.y, k.inTangentMaya[1], k.outTangentMaya[1]],
                    ['translateZ', k.value.z, k.inTangentMaya[2], k.outTangentMaya[2]]
                ]
                for f in frames:
                    cmds.setKeyframe(
                        res[0],
                        attribute=f[0],
                        time=k.time,
                        value=f[1],
                        inTangentType=f[2],
                        outTangentType=f[3]
                    )

                if k.event == 'land':
                    printResult = cmds.polyCylinder(
                        name=c.target + '_print1',
                        radius=radius,
                        height=(1.0 if isHind else 5.0)
                    )
                    cmds.move(k.value.x, k.value.y, k.value.z, printResult[0])
                    groupItems.append(printResult[0])

        cfg = self._data.configs
        name = 'cyc' + str(int(cfg.get(GaitConfigEnum.CYCLES))) + \
               '_ph' + str(int(cfg.get(GaitConfigEnum.PHASE))) + \
               '_gad' + str(int(cfg.get(SkeletonConfigEnum.FORE_OFFSET).z)) + \
               '_step' + str(int(cfg.get(SkeletonConfigEnum.STRIDE_LENGTH)))

        cube        = cmds.polyCube(name='pelvic_reference', width=20, height=20, depth=20)
        self._hips  = cube[0]
        groupItems.append(cube[0])
        cmds.move(0, 100, 0, cube[0])

        backLength = self._data.configs.get(SkeletonConfigEnum.FORE_OFFSET).z - \
                     self._data.configs.get(SkeletonConfigEnum.HIND_OFFSET).z

        cube2 = cmds.polyCube(name='pectoral_comparator', width=15, height=15, depth=15)
        cmds.move(0, 115, backLength, cube2[0])
        cmds.parent(cube2[0], cube[0], absolute=True)

        cmds.expression(
            string="%s.translateZ = 0.5*abs(%s.translateZ - %s.translateZ) + min(%s.translateZ, %s.translateZ)" %
            (cube[0], hinds[0], hinds[1], hinds[0], hinds[1])
        )

        cube = cmds.polyCube(name='pectoral_reference', width=15, height=15, depth=15)
        self._pecs = cube[0]
        groupItems.append(cube[0])
        cmds.move(0, 100, 0, cube[0])
        cmds.expression(
            string="%s.translateZ = 0.5*abs(%s.translateZ - %s.translateZ) + min(%s.translateZ, %s.translateZ)" %
            (cube[0], fores[0], fores[1], fores[0], fores[1])
        )

        self._group = cmds.group(*groupItems, world=True, name=name)

        cfg = self._data.configs
        info = 'Gait Phase: ' + \
                str(cfg.get(GaitConfigEnum.PHASE)) + \
                '\nGleno-Acetabular Distance (GAD): ' + \
                str(cfg.get(SkeletonConfigEnum.FORE_OFFSET).z) + \
                '\nStep Length: ' + \
                str(cfg.get(SkeletonConfigEnum.STRIDE_LENGTH)) + \
                '\nHind Duty Factor: ' + \
                str(cfg.get(GaitConfigEnum.DUTY_FACTOR_HIND)) + \
                '\nFore Duty Factor: ' + \
                str(cfg.get(GaitConfigEnum.DUTY_FACTOR_FORE)) + \
                '\nCycles: ' + \
                str(cfg.get(GaitConfigEnum.CYCLES))

        cmds.select(self._group)
        if not cmds.attributeQuery('notes', node=self._group, exists=True):
            cmds.addAttr(longName='notes', dataType='string')
            cmds.setAttr(self._group + '.notes', info, type='string')

        self.createShaders()
        self.createRenderEnvironment()

        minTime = min(0, int(cmds.playbackOptions(query=True, minTime=True)))

        deltaTime = cfg.get(GeneralConfigEnum.STOP_TIME) - cfg.get(GeneralConfigEnum.START_TIME)
        maxTime = max(
            int(float(cfg.get(GaitConfigEnum.CYCLES))*float(deltaTime)),
            int(cmds.playbackOptions(query=True, maxTime=True))
        )

        cmds.playbackOptions(
            minTime=minTime, animationStartTime=minTime, maxTime= maxTime, animationEndTime=maxTime
        )

        cmds.currentTime(0, update=True)

        cmds.select(self._group)
Exemple #5
0
def setUpMolecule():
    #Adjust time slider
    cmds.playbackOptions( minTime='1', maxTime='300', mps=1)

    # Create the oxygen part of the larger bond (cylinder)
    cmds.polyCylinder(n='oxyCylinder', r=1, h=2, sx=20, sy=1, sz=1, ax=(1, 0, 0), rcp=0, cuv=3, ch=1)

    #Set scale for oxyCylinder
    cmds.setAttr("oxyCylinder.translateX", 6)
    cmds.setAttr("oxyCylinder.scaleZ", 2)
    cmds.setAttr("oxyCylinder.scaleX", 2)
    cmds.setAttr("oxyCylinder.scaleY", 2)

    #-------Set up shader and shade cylinder----------
    redShader = cmds.shadingNode('blinn', asShader=True, n='redBlinn')
    cmds.setAttr("redBlinn.color", 0.772, 0, 0, type="double3")

    cmds.select('oxyCylinder')

    cmds.hyperShade(assign=redShader)

    #--------------White Cylinder-------------

    # Create the oxygen part of the larger bond (cylinder)
    cmds.polyCylinder(n='hydroCylinder', r=1, h=2, sx=20, sy=1, sz=1, ax=(1, 0, 0), rcp=0, cuv=3, ch=1)

    #Set scale for oxyCylinder
    cmds.setAttr("hydroCylinder.translateX", 10)
    cmds.setAttr("hydroCylinder.scaleZ", 2)
    cmds.setAttr("hydroCylinder.scaleX", 2)
    cmds.setAttr("hydroCylinder.scaleY", 2)

    #-------Set up shader and shade cylinder----------
    whiteShader = cmds.shadingNode('blinn', asShader=True, n='whiteBlinn')
    cmds.setAttr("whiteBlinn.color", 1, 1, 1, type="double3")

    #Select the cylinder to color
    cmds.select('hydroCylinder')
    # Assign shader
    cmds.hyperShade(assign=whiteShader)

    #----------------------------------------------------------
    #-----------Group two cylinders together as "cylinder"-----
    #----------------------------------------------------------
    cmds.group(em=True, n='cylinder')
    cmds.parent('oxyCylinder', 'cylinder')
    cmds.parent('hydroCylinder', 'cylinder')

    #------------Oxygen-------------

    # Create the Oxygen sphere
    cmds.polySphere(n='oxygen', r=1, sx=20, sy=20, ax=(0, 1, 0), cuv=2, ch=1)

    #Set scale for oxygen
    cmds.setAttr("oxygen.scaleZ", 5)
    cmds.setAttr("oxygen.scaleX", 5)
    cmds.setAttr("oxygen.scaleY", 5)

    #-------Assign shader--------
    cmds.select('oxygen')

    cmds.hyperShade(assign=redShader)

    #------------Hydrogen-------------

    # Create the Hydrogen sphere
    cmds.polySphere(n='hydrogen', r=1, sx=20, sy=20, ax=(0, 1, 0), cuv=2, ch=1)

    #Set scale for oxygen
    cmds.setAttr("hydrogen.translateX", 14)
    cmds.setAttr("hydrogen.scaleZ", 4)
    cmds.setAttr("hydrogen.scaleX", 4)
    cmds.setAttr("hydrogen.scaleY", 4)

    #-------Assign shader--------
    cmds.select('hydrogen')

    cmds.hyperShade(assign=whiteShader)

    #----------------------------------------------------------
    #-----------Group 'cylinder' and hydrogen together as "hydroAssembly"-----
    #----------------------------------------------------------
    cmds.group(em=True, n='hydroAssembly1')
    cmds.parent('cylinder', 'hydroAssembly1')
    cmds.parent('hydrogen', 'hydroAssembly1')

    #----------------------------------------------------------
    #-----------Group into realign group
    #----------------------------------------------------------
    cmds.group(em=True, n='realignGroup1')
    cmds.parent('hydroAssembly1', 'realignGroup1')

    #-------------------------------------------------------------
    #------------Duplicate the assembly--------------------------
    #-------------------------------------------------------------
    cmds.duplicate('realignGroup1', n='realignGroup2')
    cmds.setAttr('realignGroup2.rotateZ', 180)
    cmds.rename('realignGroup2|hydroAssembly1','hydroAssembly2')

    #----------------------------------------------------------
    #-----------Make entire thing a group "molecule"-----
    #----------------------------------------------------------
    cmds.group(em=True, n='molecule')
    cmds.parent('oxygen', 'molecule')
    cmds.parent('realignGroup1', 'molecule')
    cmds.parent('realignGroup2', 'molecule')

    #-------Move entire molecule up-------
    cmds.setAttr("molecule.translateY", 10)
Exemple #6
0
    def _createGeometry(self, name, side):

        #create radius
        self.radius = mc.polyCube(sx=1,
                                  sy=1,
                                  sz=1,
                                  w=2,
                                  h=40,
                                  d=2,
                                  n=name + '_radius')[0]
        mc.move(0, 20, 0)

        self.elbow = mc.polyCylinder(h=5, r=2, n=name + '_elbow')[0]
        mc.move(0, 41, 0, r=True)
        mc.rotate(0, 0, '90deg')
        self.radius = mc.polyUnite(self.radius, self.elbow,
                                   n=name + '_radius')[0]
        mc.move(0, 41, 0, self.radius + ".scalePivot",
                self.radius + ".rotatePivot")

        #create humerus
        self.humerus = mc.polyCube(sx=1,
                                   sy=1,
                                   sz=1,
                                   w=3,
                                   h=40,
                                   d=3,
                                   n=name + '_humerus')[0]
        mc.move(0, 62, 0)
        self.shoulder = mc.polySphere(r=5, n=name + '_shoulder')
        mc.move(0, 84, 0)
        self.humerus = mc.polyUnite(self.humerus,
                                    self.shoulder,
                                    n=name + '_humerus')[0]
        mc.move(0, 84, 0, self.humerus + ".scalePivot",
                self.humerus + ".rotatePivot")
        pass

        ######### shoulders ############
        t1 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='l_shoulder')[0]
        mc.sets(e=True, forceElement=self.color4)
        t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        #mc.scale(1,5,1)
        mc.move(self.sideMult * 5, 90, 0, r=True)

        t2 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color4)
        t2r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        mc.scale(1, 2.5, 1)
        mc.move(0, 63, 0, r=True)

        t3 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color1)
        t3r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        mc.scale(1.2, 2.25, 1)

        mc.move(0, 63, -1, r=True)

        t4 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color4)
        t4r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        mc.scale(1, 2.5, 1)
        mc.move(0, 20, 0, r=True)

        t5 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color1)
        t5r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        mc.scale(1.2, 2.25, 1.0)
        mc.move(0, 20, -1, r=True)

        self.elbowArmor = mc.polyCube(sx=3,
                                      sy=3,
                                      sz=3,
                                      w=8,
                                      h=15,
                                      d=9,
                                      n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color1)
        t5r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        mc.move(0, 41, -1, r=True)

        self.humerus = mc.polyUnite(self.humerus, t1, t2, t3)

        self.radius = mc.polyUnite(self.radius, t4, t5)
def objCylinder():
    cylinder = cmds.polyCylinder(r=1)
    return cylinder
Exemple #8
0
    def _handleExampleButton(self):
        """
        This callback creates a polygonal container and fills it with bubbles.
        """

        sx = 0.1  # original scale size x
        sy = 0.1  # original scale size y
        sz = 0.1  # original scale size z
        so = 0.1  # scale original for exp growth form

        maxY = 10  # highest bound
        maxX = 5  # max horizon bound
        maxZ = 5  # max horzon bound

        # Create container material
        containerShader = mayaShader('container_mat', (0.6, 0.6, 0.6),
                                     (0.9, 0.9, 0.9), (0.8, 0.8, 0.8), 'blinn')
        containerShader.create()

        # Create Container
        cHeight = 12
        c = cmds.polyCylinder(r=11,
                              h=cHeight,
                              sx=40,
                              sy=10,
                              sz=0,
                              ax=(0, 1, 0),
                              rcp=0,
                              cuv=3,
                              ch=1,
                              n='container1')[0]
        cmds.select(c)
        cmds.setAttr("container1.translateY", cHeight / 2 - 0.5)

        # create another mesh smaller
        cHeight = 12
        c = cmds.polyCylinder(r=10.5,
                              h=cHeight,
                              sx=40,
                              sy=10,
                              sz=0,
                              ax=(0, 1, 0),
                              rcp=0,
                              cuv=3,
                              ch=1,
                              n='container2')[0]
        cmds.select(c)
        cmds.setAttr("container2.translateY", cHeight / 2)

        # Boolean difference for making container
        cmds.polyCBoolOp('container1', 'container2', op=2, n='container')

        # Assign container_mat
        cmds.hyperShade(a="container_mat")

        keyStep = 3  #  3 * 10 = 30 fps
        totalTime = 10  # number of seconds of animation

        maxKey = totalTime * keyStep * 10  # max num of keys for the time
        minHdev = -2.0  # max movement between horizon space
        maxHdev = 2.0  # max movement beteen horiz space

        numBubbles = 50  # make 20 bubbles

        scaleRate = 0.2  # for growth of bubble exponentially as a decimal

        bubbleToTop = 1  # seconds for life of bubble

        # Create Material
        # Start bubble_mat
        bubbleShader = mayaShader('bubble_mat', (0.0, 0.8, 1.0),
                                  (0.9, 0.9, 0.9), (0.8, 0.8, 0.8), 'blinn')
        bubbleShader.create()
        #end bubble_mat

        for i in xrange(0, numBubbles):
            x = 0
            y = 0
            z = 0

            time = 0  # amount of time since bubble creation

            # Create Spehere nurb, the [0] selects first node of object
            randX = uniform(-maxX, maxX)
            randZ = uniform(-maxZ, maxZ)
            r = 1
            yUp = (0, 1, 0)  # start creation at y-up
            p = (randX, 0, randZ)  # object pivot point
            d = 3  # degree
            bNum = 1  # bNum is the bubble number

            c = cmds.sphere(p=p,
                            ax=yUp,
                            ssw=0,
                            esw=360,
                            r=r,
                            d=d,
                            ut=0,
                            tol=0.01,
                            s=8,
                            nsp=4,
                            ch=1,
                            n='bubble' + str(bNum))[0]
            cmds.select(c)

            # Assign bubble_mat
            cmds.hyperShade(a="bubble_mat")

            randFrameStart = randint(1, maxKey)  # Start randomly in time

            for j in xrange(randFrameStart, maxKey, keyStep):
                cmds.currentTime(j)
                cmds.setKeyframe(v=y, at='translateY')
                cmds.setKeyframe(v=x, at='translateX')
                cmds.setKeyframe(v=z, at='translateZ')

                x = x + uniform(minHdev, maxHdev)
                z = z + uniform(minHdev, maxHdev)
                y = y + (keyStep / bubbleToTop)
                print(y)
                if x >= maxX:
                    x = maxX

                if z >= maxZ:
                    z = maxZ

                sx = so * ((1 + scaleRate)**time)
                sz = so * ((1 + scaleRate)**time)
                sy = so * ((1 + scaleRate)**time)

                cmds.setKeyframe(v=sy, at='scaleY')
                cmds.setKeyframe(v=sx, at='scaleX')
                cmds.setKeyframe(v=sz, at='scaleZ')

                time = time + 1

                if y > maxY:
                    break  # terminate movement which can explode bubble later

        response = nimble.createRemoteResponse(globals())
        response.put('name', c)
Exemple #9
0
import math

import nimble
from nimble import cmds

#cmds.doSomethingHere
r = 50
a = 2.0*r
y = (0, 1, 0)
c = cmds.polyCylinder(
            r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0]
cmds.select(c)
response = nimble.createRemoteResponse(globals())
response.put('name', c)
Exemple #10
0
    def _createGeometry(self, name):

        #self.spine = mc.polyCylinder(h=75,r=2,n=name+'_spine')[0]
        #mc.move(0,30,0)
        self.pelvic = mc.polyCylinder(h=40, r=2, n=name + '_pelvic')[0]
        mc.rotate(0, 0, '90deg')
        self.clavical = mc.polyCylinder(h=56, r=2, n=name + '_clavical')[0]
        mc.rotate(0, 0, '90deg')
        mc.move(0, 67, 0)

        #self.hip = mc.polySphere(r=5,n=name+'_hip')
        self.hipPlate = mc.polyCube(w=50, d=10, h=5)
        mc.move(0, 15, 0)

        self.hipPlate2 = mc.polyCube(w=8, d=5, h=35)[0]
        mc.move(12, 0, 15)
        mc.select(self.hipPlate2 + '.e[10]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate2 + '.e[0]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate2 + '.e[6]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate2 + '.e[1]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate2 + '.e[4]')
        mc.move(3, 0, 0, r=True)
        mc.select(self.hipPlate2)
        mc.rotate(-10, 0, 0)

        self.hipPlate3 = mc.polyCube(w=15, d=5, h=35)[0]
        mc.move(23.5, 0, 15)
        mc.select(self.hipPlate3 + '.e[11]')
        mc.move(0, 10, 0, r=True)
        mc.select(self.hipPlate3 + '.e[0]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate3 + '.e[7]')
        mc.move(-6, -3, 0, r=True)
        mc.select(self.hipPlate3 + '.e[1]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate3 + '.e[5]')
        mc.move(-3, 0, 0, r=True)
        mc.select(self.hipPlate3)
        mc.rotate(-10, 0, 0)

        self.hipPlate4 = mc.polyCube(w=8, d=5, h=35)[0]
        mc.move(-12, 0, 15)
        mc.select(self.hipPlate4 + '.e[11]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate4 + '.e[0]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate4 + '.e[7]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate4 + '.e[1]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate4 + '.e[5]')
        mc.move(-3, 0, 0, r=True)
        mc.select(self.hipPlate4)
        mc.rotate(-10, 0, 0)

        self.hipPlate5 = mc.polyCube(w=15, d=5, h=35)[0]
        mc.move(-23.5, 0, 15)
        mc.select(self.hipPlate5 + '.e[10]')
        mc.move(0, 10, 0, r=True)
        mc.select(self.hipPlate5 + '.e[0]')
        mc.move(0, 3, 0, r=True)
        mc.select(self.hipPlate5 + '.e[6]')
        mc.move(6, -3, 0, r=True)
        mc.select(self.hipPlate5 + '.e[1]')
        mc.move(0, -3, 0, r=True)
        mc.select(self.hipPlate5 + '.e[4]')
        mc.move(3, 0, 0, r=True)
        mc.select(self.hipPlate5)
        mc.rotate(-10, 0, 0)

        self.hipPlate = mc.polyUnite(self.hipPlate, self.hipPlate2,
                                     self.hipPlate3, self.hipPlate4,
                                     self.hipPlate5)

        self.crotchPlate1 = mc.polyCube(w=10, d=20, h=20)[0]
        mc.select(self.crotchPlate1 + '.e[3]')
        mc.move(0, 2, 0, r=True)
        mc.scale(.75, 1, 1)
        self.crotchPlate2 = mc.polyCube(w=10, d=10, h=20)[0]
        mc.move(0, 0, 15)
        mc.select(self.crotchPlate2 + '.e[0]')
        mc.move(0, 2, -5, r=True)
        mc.scale(.75, 1, 1)

        mc.select(self.crotchPlate2)
        self.crotchPlate1_1 = mc.duplicate(rr=True)
        mc.sets(e=True, forceElement=self.color1)
        mc.move(0, 2, -3, r=True)
        mc.scale(1.5, 1, 1)

        self.crotchPlate3 = mc.polyCube(w=10, d=20, h=10)[0]
        mc.move(0, 15, 10)
        mc.select(self.crotchPlate3 + '.e[1]')
        mc.move(0, 0, -6, r=True)
        mc.scale(.75, 1, 1)

        mc.select(self.crotchPlate3)
        self.crotchPlate3_1 = mc.duplicate(rr=True)
        mc.sets(e=True, forceElement=self.color1)
        mc.move(0, 2, -3, r=True)
        mc.scale(1.5, 1, 1)

        mc.select(self.crotchPlate3)
        self.crotchPlate3_2 = mc.duplicate(rr=True)
        mc.sets(e=True, forceElement=self.color3)
        mc.move(0, 0, 1, r=True)
        mc.scale(.75, .75, 1)

        #self.crotchPlate4 = mc.polyCube(w=10,d=20,h=10)[0]
        #mc.move(0,-15,0)
        self.pelvic = mc.polyUnite(self.pelvic, self.crotchPlate2,
                                   self.crotchPlate3, self.crotchPlate1_1,
                                   self.crotchPlate3_1, self.crotchPlate3_2)
        self.pelvic = mc.polyUnite(self.pelvic, self.crotchPlate1)
        self.pelvic = mc.polyUnite(self.pelvic, self.hipPlate)[0]

        #self.torso = mc.polyUnite(self.spine,self.pelvic,n=name)[0]
        self.torso = self.pelvic

        ######### Cockpit ##############

        self.cockpit = mc.polyCube(w=10, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(0, 25, 8, r=True)
        mc.select(self.cockpit + '.e[1]')
        mc.move(0, 5, 5, r=True)

        self.cockpit2 = mc.polyCube(w=10, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(0, 35, 10, r=True)
        mc.select(self.cockpit2 + '.e[1]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.cockpit2 + '.e[2]')
        mc.move(0, 2, 10, r=True)
        self.cockpit = mc.polyUnite(self.cockpit, self.cockpit2)

        self.cockpitWall1 = mc.polyCube(w=2, h=30, d=10)[0]
        mc.move(0, 25, 0, r=True)
        mc.select(self.cockpitWall1 + '.e[1]')
        mc.move(0, 0, 15, r=True)

        self.cockpitWall2 = mc.polyCube(w=2, h=20, d=20)[0]
        mc.move(6.5, 32, 0, r=True)
        mc.select(self.cockpitWall2 + '.e[1]')
        mc.move(0, 0, 15, r=True)

        self.cockpitWall3 = mc.polyCube(w=2, h=20, d=20)[0]
        mc.move(-6.5, 32, 0, r=True)
        mc.select(self.cockpitWall3 + '.e[1]')
        mc.move(0, 0, 15, r=True)

        self.cockpitWall4 = mc.polyCube(w=2, h=20, d=20)[0]
        mc.move(6.5, 52, 0, r=True)
        mc.select(self.cockpitWall4 + '.e[0]')
        mc.move(0, 0, 15, r=True)

        self.cockpitWall5 = mc.polyCube(w=2, h=20, d=20)[0]
        mc.move(-6.5, 52, 0, r=True)
        mc.select(self.cockpitWall5 + '.e[0]')
        mc.move(0, 0, 15, r=True)

        self.cockpitWall6 = mc.polyCube(w=15, h=20, d=2)
        mc.move(0, 32, -10, r=True)
        self.cockpitWall7 = mc.polyCube(w=15, h=20, d=2)
        mc.move(0, 52, -10, r=True)

        self.cockpit = mc.polyUnite(self.cockpit, self.cockpitWall1,
                                    self.cockpitWall2, self.cockpitWall3,
                                    self.cockpitWall4, self.cockpitWall5,
                                    self.cockpitWall6, self.cockpitWall7)

        self.lRibs1 = mc.polyCube(w=10, d=20, h=5)[0]
        mc.sets(e=True, forceElement=self.color1)
        mc.move(12, 25, 0, r=True)
        mc.select(self.lRibs1 + '.e[1]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.lRibs1 + '.e[2]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.lRibs1 + '.e[7]')
        mc.move(-2, 1, 0, r=True)
        mc.polyBevel()

        self.lRibs2 = mc.polyCube(w=5, d=15, h=5)[0]
        mc.sets(e=True, forceElement=self.color1)
        mc.move(12, 30, 0, r=True)
        mc.select(self.lRibs2 + '.e[1]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.lRibs2 + '.e[2]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.lRibs2 + '.e[7]')
        mc.move(-2, 1, 0, r=True)
        mc.polyBevel()

        self.lRibs3 = mc.polyCube(w=2, d=20, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(8, 30, 0, r=True)
        mc.select(self.lRibs3 + '.e[1]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.lRibs3 + '.e[2]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.lRibs3 + '.e[7]')
        mc.move(2, 1, 0, r=True)
        mc.polyBevel()

        self.lRibs4 = mc.polyCube(w=8, d=30, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(8, 40, 0, r=True)
        mc.select(self.lRibs4 + '.e[1]')
        mc.move(0, 0, 5, r=True)
        mc.select(self.lRibs4 + '.e[2]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.lRibs4 + '.e[7]')
        mc.move(5, 1, 0, r=True)
        mc.polyBevel()

        self.lRibs = mc.polyUnite(self.lRibs1, self.lRibs2, self.lRibs3,
                                  self.lRibs4)

        self.rRibs1 = mc.polyCube(w=10, d=20, h=5)[0]
        mc.sets(e=True, forceElement=self.color1)
        mc.move(-12, 25, 0, r=True)
        mc.select(self.rRibs1 + '.e[1]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.rRibs1 + '.e[2]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.rRibs1 + '.e[6]')
        mc.move(2, 1, 0, r=True)
        mc.polyBevel()

        self.rRibs2 = mc.polyCube(w=5, d=15, h=5)[0]
        mc.sets(e=True, forceElement=self.color1)
        mc.move(-12, 30, 0, r=True)
        mc.select(self.rRibs2 + '.e[1]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.rRibs2 + '.e[2]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.rRibs2 + '.e[6]')
        mc.move(2, 1, 0, r=True)
        mc.polyBevel()

        self.rRibs3 = mc.polyCube(w=2, d=20, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(-8, 30, 0, r=True)
        mc.select(self.rRibs3 + '.e[1]')
        mc.move(0, 0, 2, r=True)
        mc.select(self.rRibs3 + '.e[2]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.rRibs3 + '.e[6]')
        mc.move(-2, 1, 0, r=True)
        mc.polyBevel()

        self.rRibs4 = mc.polyCube(w=8, d=30, h=10)[0]
        mc.sets(e=True, forceElement=self.color2)
        mc.move(-8, 40, 0, r=True)
        mc.select(self.rRibs4 + '.e[1]')
        mc.move(0, 0, 5, r=True)
        mc.select(self.rRibs4 + '.e[2]')
        mc.move(0, 0, -2, r=True)
        mc.select(self.rRibs4 + '.e[6]')
        mc.move(-5, 1, 0, r=True)
        mc.polyBevel()

        self.rRibs = mc.polyUnite(self.rRibs1, self.rRibs2, self.rRibs3,
                                  self.rRibs4)

        self.cockpit = mc.polyUnite(self.cockpit, self.lRibs, self.rRibs)
        ########## CHEST #############

        self.chest1 = mc.polyCube(w=10, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(0, 47, 23, r=True)
        mc.select(self.chest1 + '.e[1]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest1 + '.e[3]')
        mc.move(0, 2, 0, r=True)
        mc.select(self.chest1 + '.e[2]')
        mc.move(0, 0, -20, r=True)

        self.chest2 = mc.polyCube(w=10, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(0, 57, 23, r=True)
        mc.select(self.chest2 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest2 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest2 + '.e[2]')
        mc.move(0, 0, -20, r=True)

        self.chest3 = mc.polyCube(w=20, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(15, 57, 23, r=True)
        mc.select(self.chest3 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest3 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest3 + '.e[2]')
        mc.move(0, 0, -20, r=True)
        mc.select(self.chest3 + '.e[5]')
        mc.move(0, 0, -5, r=True)

        self.chest4 = mc.polyCube(w=20, d=2, h=10)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(-15, 57, 23, r=True)
        mc.select(self.chest4 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest4 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest4 + '.e[2]')
        mc.move(0, 0, -20, r=True)
        mc.select(self.chest4 + '.e[4]')
        mc.move(0, 0, -5, r=True)

        self.chest5 = mc.polyCube(w=10, d=2, h=5)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(0, 67, 13, r=True)
        mc.select(self.chest5 + '.e[0]')
        mc.move(0, -2.5, 10, r=True)
        mc.select(self.chest5 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest5 + '.e[2]')
        mc.move(0, 0, -20, r=True)
        mc.select(self.chest5 + '.f[1]')
        #mc.move(0,0,-20,r=True)
        mc.scale(.5, 1, .5)

        self.chest6 = mc.polyCube(w=20, d=2, h=5)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(15, 64.5, 13, r=True)
        mc.select(self.chest6 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest6 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest6 + '.e[2]')
        mc.move(0, 0, -20, r=True)
        mc.select(self.chest6 + '.e[5]')
        mc.move(0, 0, -5, r=True)
        mc.select(self.chest6 + '.e[1]')
        mc.move(0, 0, -10, r=True)

        self.chest7 = mc.polyCube(w=20, d=2, h=5)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(-15, 64.5, 13, r=True)
        mc.select(self.chest7 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest7 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest7 + '.e[2]')
        mc.move(0, 0, -20, r=True)
        mc.select(self.chest7 + '.e[4]')
        mc.move(0, 0, -5, r=True)
        mc.select(self.chest7 + '.e[1]')
        mc.move(0, 0, -10, r=True)

        self.chest8 = mc.polyCube(w=10, d=2, h=5)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(10, 67.5, 3, r=True)
        mc.select(self.chest8 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest8 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest8 + '.e[2]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest8 + '.e[5]')
        mc.move(0, 0, -5, r=True)
        mc.select(self.chest8 + '.e[1]')
        mc.move(0, 0, -1, r=True)

        self.chest9 = mc.polyCube(w=10, d=2, h=5)[0]
        mc.sets(e=True, forceElement=self.color3)
        mc.move(-10, 67.5, 3, r=True)
        mc.select(self.chest9 + '.e[0]')
        mc.move(0, 0, 10, r=True)
        mc.select(self.chest9 + '.e[3]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest9 + '.e[2]')
        mc.move(0, 0, -10, r=True)
        mc.select(self.chest9 + '.e[4]')
        mc.move(0, 0, -5, r=True)
        mc.select(self.chest9 + '.e[1]')
        mc.move(0, 0, -1, r=True)

        self.chest = mc.polyUnite(self.chest1, self.chest2, self.chest3,
                                  self.chest4, self.chest5, self.chest6,
                                  self.chest7, self.chest8, self.chest9)

        ######### shoulders ############
        t1 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='l_shoulder')[0]
        mc.sets(e=True, forceElement=self.color4)
        t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        #mc.scale(1,5,1)
        mc.move(25, 67, 0, r=True)

        t2 = mc.polyCube(sx=3, sy=3, sz=3, w=15, h=15, d=15, n='r_shoulder')[0]
        mc.sets(e=True, forceElement=self.color4)
        t2r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0]
        #mc.scale(1,5,1)
        mc.move(-25, 67, 0, r=True)

        self.clavical = mc.polyUnite(self.clavical, t1, t2)