def _createGeometry(self, name, side): #create tibia self.tibia = mc.polyCube(sx=1, sy=1, sz=1, w=2, h=50, d=2, n=name + '_tibia')[0] mc.move(0, 28, -12) self.knee = mc.polyCylinder(h=5, r=2, n=name + '_knee')[0] mc.move(0, 54, -12, r=True) mc.rotate(0, 0, '90deg') self.tibia = mc.polyUnite(self.tibia, self.knee, n=name + '_tibia')[0] mc.move(0, 54, -12, self.tibia + ".scalePivot", self.tibia + ".rotatePivot") #create feamer self.femur = mc.polyCube(sx=1, sy=1, sz=1, w=3, h=50, d=3, n=name + '_feamer')[0] mc.move(0, 80, -12) self.hip = mc.polySphere(r=5, n=name + '_hip') mc.move(0, 107, -12) self.femur = mc.polyUnite(self.femur, self.hip, n=name + '_femur')[0] mc.move(0, 107, -12, self.femur + ".scalePivot", self.femur + ".rotatePivot") pass
def _createGeometry(self, name, side): #build toe self.side = side self.name = name self.toe = mc.polyCube(sx=2, sy=2, sz=2, w=5, h=2, d=3, n=name + '_toe')[0] self.ball = mc.polyCylinder(h=5, n=name + '_ball')[0] mc.move(0, 0, -2, r=True) mc.rotate(0, 0, '90deg') self.toe = mc.polyUnite(self.toe, self.ball, n=name + '_toe')[0] mc.move(0, 0, -2, self.toe + ".scalePivot", self.toe + ".rotatePivot") #build arch self.arch = mc.polyCube(w=5, d=10, n=name + '_arch')[0] mc.move(0, 0, -7, r=True) #mc.select(f[8]-f[11]) mc.select(self.arch + '.f[2]') mc.move(0, 3, 0, r=True) self.ankle = mc.polySphere(r=2.5)[0] mc.move(0, 3, -12, r=True) self.arch = mc.polyUnite(self.arch, self.ankle, n=name + '_arch')[0] mc.move(0, 3, -12, self.arch + ".scalePivot", self.arch + ".rotatePivot") #self.heal = mc.polyCube(sx=2, sy=2, sz=2,w=5, h=3, n=name+'_heal') pass
def _createGeometry(self, side): mc.select(cl=True) self.r_hand_palm = mc.polyCube(sx=4, sy=4, sz=4, w=10, h=10, d=3, n='R_palm')[0] mc.move(0, 5, -1.5) self.r_hand_heal = mc.polyCube(w=10, h=2, d=2, n='R_heal')[0] mc.move(0, 1, 1, r=True) if side == Side.right: mc.select(self.r_hand_heal + '.e[7]') elif side == Side.left: mc.select(self.r_hand_heal + '.e[6]') mc.move(0, 2, 0, r=True) self.r_hand = mc.polyUnite(self.r_hand_heal, self.r_hand_palm, n='r_hand')[0] self.r_hand_n_1 = mc.polySphere(r=1.2, n="r_hand_n_1")[0] mc.move(-3.75, 9.25, -.5) self.r_hand_n_2 = mc.polySphere(r=1.2, n="r_hand_n_2")[0] mc.move(-1.25, 9.25, -.5) self.r_hand_n_3 = mc.polySphere(r=1.2, n="r_hand_n_3")[0] mc.move(1.25, 9.25, -.5) self.r_hand_n_4 = mc.polySphere(r=1.2, n="r_hand_n_4")[0] mc.move(3.75, 9.25, -.5) self.r_hand_n_t = mc.polySphere(r=1.2, n="r_hand_n_t")[0] if side == Side.right: mc.move(4.5, 2, 1.5) elif side == Side.left: mc.move(-4.5, 2, 1.5) #self.hand = mc.polyCBoolOp(self.r_hand, self.r_hand_n_1, self.r_hand_n_2, self.r_hand_n_3, self.r_hand_n_4, self.r_hand_n_t, # op=2, n='r_hand') ### we did this becuase maya is stupid, and 2014 does not have polyCBoolOp() self.hand = mc.polyBoolOp(self.r_hand, self.r_hand_n_1, op=2, n='r_hand')[0] self.hand = mc.polyBoolOp(self.hand, self.r_hand_n_2, op=2, n='r_hand')[0] self.hand = mc.polyBoolOp(self.hand, self.r_hand_n_3, op=2, n='r_hand')[0] self.hand = mc.polyBoolOp(self.hand, self.r_hand_n_4, op=2, n='r_hand')[0] self.hand = mc.polyBoolOp(self.hand, self.r_hand_n_t, op=2, n='r_hand')[0]
def createBar(name, index): ## actual standard gold bar dimensions (inches) y = 1.75 x = 7. z = 3.63 cmds.polyCube(h=y, w=x, d=z, n=fn(name, index)) cmds.scale(.94, .9, fn(name, index) + '.f[1]', xz=True) cmds.move(y / 4 + .001, y=True, relative=True) cmds.scale(.5, .5, .5) cmds.polyBevel(fn(name, index), o=.07, sg=12)
def _createGeometry(self, name, side): #create tibia self.tibia = mc.polyCube(sx=1, sy=1, sz=1, w=2, h=50, d=2, n=name + '_tibia')[0] mc.move(0, 28, -12) self.knee = mc.polyCylinder(h=5, r=2, n=name + '_knee')[0] mc.move(0, 54, -12, r=True) mc.rotate(0, 0, '90deg') self.tibia = mc.polyUnite(self.tibia, self.knee, n=name + '_tibia')[0] self.llegArmor = mc.polyCube(w=8, h=30, d=8)[0] mc.move(0, 22, -12) mc.select(self.llegArmor + '.f[3]') mc.scale(1.5, 1, 1.5) mc.select(self.llegArmor + '.e[0]') mc.polySubdivideEdge(dv=2) mc.select(self.llegArmor + '.e[12]') mc.move(0, 2, 0, r=True) self.tibia = mc.polyUnite(self.tibia, self.llegArmor, n=name + '_tibia')[0] mc.move(0, 54, -12, self.tibia + ".scalePivot", self.tibia + ".rotatePivot") #create feamer self.femur = mc.polyCube(sx=1, sy=1, sz=1, w=3, h=50, d=3, n=name + '_feamer')[0] mc.move(0, 80, -12) self.hip = mc.polySphere(r=5, n=name + '_hip') mc.move(0, 107, -12) self.femur = mc.polyUnite(self.femur, self.hip, n=name + '_femur')[0] mc.move(0, 107, -12, self.femur + ".scalePivot", self.femur + ".rotatePivot") self._createCalfArmor(name, side) pass
def _createCalfArmor(self, name, side): p1 = mc.polySphere(r=10)[0] mc.scale(.35, 1.5, .75) mc.move(5, 0, 0) p2 = mc.polySphere(r=10)[0] mc.scale(.35, 1.5, .75) mc.move(-5, 0, 0) p3 = mc.polyCylinder(r=10, sx=40)[0] mc.rotate(0, 0, '90deg') mc.scale(1.5, 5, .75) #claf1 = mc.polyUnite(p1,p2,p3) #print calf1 #calf1 = mc.polyBoolOp(p1, p3, op=1, n='calf')[0] #calf2 = mc.polyBoolOp(calf1, p2, op=1, n='calf')[0] p4 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) p5 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) p6 = mc.polyCube(w=10, h=10, d=10)[0] mc.move(0, 10, -5) c1 = mc.polyBoolOp(p1, p4, op=2)[0] c2 = mc.polyBoolOp(p2, p5, op=2)[0] c3 = mc.polyBoolOp(p3, p6, op=2)[0] claf1 = mc.polyUnite(c1, c2, c3) mc.sets(e=True, forceElement=self.color1) mc.move(0, 45, -10) self.tibia = mc.polyUnite(self.tibia, claf1) t1 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=10, d=10, n='thigh')[0] t1r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1, 5, 1) mc.move(0, 75, -12, r=True) t3 = mc.polyCube(sx=3, sy=3, sz=3, w=10, h=15, d=10, n='thight_armor')[0] mc.sets(e=True, forceElement=self.color1) t3r = mc.polyBevel(ws=1, oaf=1, o=.5, sa=30)[0] mc.scale(1.75, 3, 1.4) mc.move(0, 90, -9, r=True) self.femur = mc.polyUnite(self.femur, t1, t3) pass
def _createGeometry(self, segmentLength, offset): mc.select(cl=True) #section 1 cunstruction self.r_hand_p_n_1 = mc.polySphere(r=.6,n="r_hand_p_n_1") mc.move(offset,2,.25) self.r_hand_p_b_1 = mc.polyCylinder(r=.25,h=.5,n="r_hand_p_b_1") mc.move(offset,2.6,.25) self.r_hand_p_p_1 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength) mc.move(offset,3.25+self.segOffset,.25) self.r_hand_p_n_2_a = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_2_a') mc.move(offset+.35,4.25+(2*self.segOffset),.25) #1.875 + .35 self.r_hand_p_n_2_b = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_2_b') mc.move(offset-.35,4.25+(2*self.segOffset),.25) #1.875 -.35 #section 1 unite self.r_hand_p_s_1 = mc.polyUnite(self.r_hand_p_n_1, self.r_hand_p_b_1, self.r_hand_p_p_1, self.r_hand_p_n_2_a, self.r_hand_p_n_2_b, n='r_hand_p_s_1')[0] mc.move(offset,2,.25, self.r_hand_p_s_1+".scalePivot", self.r_hand_p_s_1+".rotatePivot") #section 2 construction self.r_hand_p_n_2_c = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_2_c') mc.move(offset,4.25+(2*self.segOffset),.25) self.r_hand_p_p_2 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength) mc.move(offset,5.25+(3*self.segOffset),.25) self.r_hand_p_n_3_a = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_3_a') mc.move(offset+.35,6.25+(4*self.segOffset),.25) #1.875 + .35 self.r_hand_p_n_3_b = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_3_b') mc.move(offset-.35,6.25+(4*self.segOffset),.25) #1.875 -.35 #section 2 unite self.r_hand_p_s_2 = mc.polyUnite(self.r_hand_p_n_2_c, self.r_hand_p_p_2, self.r_hand_p_n_3_a, self.r_hand_p_n_3_b, n='r_hand_p_s_2')[0] mc.move(offset,4.25+(2*self.segOffset),.25, self.r_hand_p_s_2+".scalePivot", self.r_hand_p_s_2+".rotatePivot") #section 3 construction self.r_hand_p_n_3_c = mc.polyCylinder(ax=[1,0,0], sx=2, sy=2, sz=2, h=.3, r=.5,n='r_hand_p_n_3_c') mc.move(offset,6.25+(4*self.segOffset),.25) self.r_hand_p_p_3 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength) mc.move(offset,7.25+(5*self.segOffset),.25) #section 3 unite self.r_hand_p_s_3 = mc.polyUnite(self.r_hand_p_n_3_c, self.r_hand_p_p_3, n='r_hand_p_s_3')[0] mc.move(offset,6.25+(4*self.segOffset),.25, self.r_hand_p_s_3+".scalePivot", self.r_hand_p_s_3+".rotatePivot")
def __call__(self, **kwargs): name = self._name if self._name else 'calledCube' height = kwargs['height'] if 'height' in kwargs else 2 x = kwargs['x'] if 'x' in kwargs else 0 res = cmds.polyCube(name=name, height=height, width=self._width) cmds.move(x, 40, 0, res[0]) return res
def staticCube(**kwargs): """Doc...""" height = kwargs['height'] if 'height' in kwargs else 2 x = kwargs['x'] if 'x' in kwargs else 0 res = cmds.polyCube(name='staticCube', height=height) cmds.move(x, 30, 0, res[0]) return res
def _create(self, shapeData): point = None count = 0 while True: count += 1 if count > 10000: return False point = shapeData['box'].getRandomPointInside(padding=self._padding) if not cmds.elixirGeneral_PointInsideMesh(mesh=shapeData['name'], point=point): continue if self._padding > 0: cmds.setAttr(self._meshPointNode + '.inPosition', *point, type='double3') closestPoint = cmds.getAttr(self._meshPointNode + '.result.position')[0] dx = (closestPoint[0] - point[0]) dy = (closestPoint[1] - point[1]) dz = (closestPoint[2] - point[2]) dist = math.sqrt(dx*dx + dy*dy + dz*dz) if dist < self._padding: continue break cube = cmds.polyCube(width=self._size, height=self._size, depth=self._size) cmds.move(point[0], point[1], point[2], cube[0], absolute=True) return True
def classyCube(cls, **kwargs): """Doc...""" height = kwargs['height'] if 'height' in kwargs else 2 x = kwargs['x'] if 'x' in kwargs else 0 res = cmds.polyCube(name='classyCube', height=height) cmds.move(x, 20, 0, res[0]) return res
def render(self): if (self.name == "unnamed"): self.name = cmds.polyCube(n='visBox')[0] cmds.xform(sp=[self.posX, -.5, self.posZ], ro=[0, 0, self.theta]) for i in range(len(self.heights)): cmds.setKeyframe(self.name, v=self.heights[i], at='scaleY', t=i * BoxOnSphere.SPHERE_STEP) cmds.setKeyframe(self.name, v=self.positions[i][0], at='translateX', t=i * BoxOnSphere.SPHERE_STEP) cmds.setKeyframe(self.name, v=self.positions[i][1], at='translateY', t=i * BoxOnSphere.SPHERE_STEP) cmds.setKeyframe(self.name, v=self.widths[i], at='scaleX', t=i * BoxOnSphere.SPHERE_STEP) cmds.setKeyframe(self.name, v=self.widths[i], at='scaleZ', t=i * BoxOnSphere.SPHERE_STEP)
def instanceCube(self, **kwargs): """Doc...""" name = self._name if self._name else 'instanceCube' height = kwargs['height'] if 'height' in kwargs else 2 x = kwargs['x'] if 'x' in kwargs else 0 res = cmds.polyCube(name=name, height=height, width=self._width) cmds.move(x, 10, 0, res[0]) return res
def render(self): if (self.name == "unnamed"): self.name = cmds.polyCube(n='VisBox')[0] cmds.xform(t=(self.posX, self.posY, self.posZ)) for i in range(len(self.heights)): cmds.setKeyframe(self.name, v=self.heights[i], at='scaleY', t=i * Box.FRAME_STEP)
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=50,h=50,d=50,name="cube1") cmds.select(cube) response = nimble.createRemoteResponse(globals()) response.put('name', cube)
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=50, h=50, d=50, name="cube1") cmds.select(cube) response = nimble.createRemoteResponse(globals()) response.put('name', cube)
def render(self): if (self.name == "unnamed"): self.name = cmds.polyCube(n='VisBox')[0] cmds.xform(sp=[self.posX, -.5, self.posZ]) cmds.xform(t=[self.posX, self.posY, self.posZ]) for i in range(0, len(self.heights), Box.AVG_WIN): cmds.setKeyframe(self.name, v=self.avg( [x for x in self.heights[i:i + Box.AVG_WIN]]), at='scaleY', t=i)
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
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=20, h=20, d=20, name="cube1") cmds.duplicate('cube1') response = nimble.createRemoteResponse(globals()) response.put('name', cube) global created created = 'cube'
def _CreateCubeButton(self): """ This callback creates a polygonal cylinder in the Maya scene. """ cube = cmds.polyCube(w=20,h=20,d=20,name="cube1") cmds.duplicate('cube1') response = nimble.createRemoteResponse(globals()) response.put('name', cube) global created created = 'cube'
def render(self): if (self.name == "unnamed"): self.name = cmds.polyCube(n='VisDrop')[0] frameStart = max(0, self.frameHit - 3) cmds.xform(t=(self.offset, self.posY + 10, self.posZ)) cmds.setKeyframe(self.name, v=self.posY + 10, at='translateY', t=frameStart * Drop.FRAME_STEP) cmds.setKeyframe(self.name, v=self.posY, at='translateY', t=self.frameHit * Drop.FRAME_STEP)
def functionCube(**kwargs): height = kwargs['height'] if 'height' in kwargs else 2 x = kwargs['x'] if 'x' in kwargs else 0 res = cmds.polyCube(name='functionCube', height=height) cmds.move(x, 50, 0, res[0]) return res
# test_echoCommunication.py # (C)2012 t # Scott Ernst import nimble from nimble import cmds result = cmds.polyCube(height=10, depth=25) print 'polyCube result:',result cmds.select(result[0]) cmds.move(10, 10, 5, result[0]) conn = nimble.getConnection() print conn.ping().echo(True, True) print 'X:',conn.maya('getAttr', result[0] + '.translateX') print 'Y:',conn.maya('getAttr', result[0] + '.translateY') print 'Z:',conn.maya('getAttr', result[0] + '.translateZ') print 'Translate:', cmds.getAttr(result[0] + '.translate')[0] print 'Test Complete.'
def _createGeometry(self, name, side): #build toe self.side = side self.name = name self.toe = mc.polyCube(sx=2, sy=2, sz=2, w=5, h=2, d=3, n=name + '_toe')[0] self.ball = mc.polyCylinder(h=5, n=name + '_ball')[0] mc.move(0, 0, -2, r=True) mc.rotate(0, 0, '90deg') self.toe = mc.polyUnite(self.toe, self.ball, n=name + '_toe')[0] self.toeBox = mc.polyCube(w=8, h=4, d=3, n=name + '_toeBox')[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, .9, 0, r=True) #e1 mc.select(self.toeBox + '.e[1]') mc.move(0, -1, 0, r=True) self.toeBoxBase = mc.polyCube(w=8, h=4, d=3, n=name + '_toeBoxBase')[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, 1, r=True) #e1 mc.select(self.toeBoxBase + '.e[2]') mc.move(0, -2, 0, r=True) mc.select(self.toeBoxBase + '.e[1]') mc.move(0, -1, 0, r=True) mc.select(self.toeBoxBase + '.f[2]') mc.scale(1.25, 1, 1) mc.move(0, 0, -1, r=True) self.toeToeBox = mc.polyCube(w=8, h=3, d=3, n=name + '_toeToeBox')[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .4, 4, r=True) #f0 mc.select(self.toeToeBox + '.f[0]') mc.scale(.75, .75, 1) mc.move(0, 0, -2, self.toe + ".scalePivot", self.toe + ".rotatePivot") self.toe = mc.polyUnite(self.toe, self.toeBox) self.toe = mc.polyUnite(self.toe, self.toeToeBox) self.toe = mc.polyUnite(self.toe, self.toeBoxBase, n=name + '_toe') #build arch self.arch = mc.polyCube(w=5, d=10, n=name + '_arch')[0] mc.move(0, 0, -7, r=True) #mc.select(f[8]-f[11]) mc.select(self.arch + '.f[2]') mc.move(0, 3, 0, r=True) self.ankle = mc.polySphere(r=2.5)[0] mc.move(0, 3, -12, r=True) self.arch = mc.polyUnite(self.arch, self.ankle, n=name + '_arch')[0] self.archArmor = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, .9, -6, r=True) self.archArmor2 = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, 4.9, -6, r=True) mc.select(self.archArmor2 + '.e[1]') mc.move(0, -3.75, 0, r=True) mc.select(self.archArmor2 + '.e[2]') #mc.move(0,-.5,0,r=True) mc.scale(.5, 1, 1) self.archArmor3 = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color1) mc.move(0, 4.9, -8.5, r=True) mc.select(self.archArmor3 + '.e[1]') mc.move(0, 0, -4, r=True) mc.scale(.5, 1, 1) mc.select(self.archArmor3 + '.e[2]') #mc.move(0,-.5,0,r=True) mc.scale(.5, 1, 1) self.archArmorBase = mc.polyCube(w=8, h=4, d=8)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -6, r=True) mc.select(self.archArmorBase + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase + '.e[1]') mc.move(0, -2, 0, r=True) mc.select(self.archArmorBase + '.e[2]') mc.move(0, -.5, 0, r=True) self.archArmorBase2 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -12, r=True) mc.select(self.archArmorBase2 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase2 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase2 + '.e[3]') mc.move(0, 1, 1.75, r=True) mc.select(self.archArmorBase2 + '.e[1]') mc.move(0, -.5, 0, r=True) self.archArmorBase3 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 4.9, -12, r=True) mc.select(self.archArmorBase3 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase3 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase3 + '.f[1]') mc.scale(.5, 1, 1) mc.move(0, -1, 0, r=True) mc.select(self.archArmorBase3 + '.e[0]') mc.move(0, -.5, 0, r=True) mc.select(self.archArmorBase3 + '.e[1]') mc.move(0, 0, -2.5, r=True) mc.select(self.archArmorBase3 + '.e[2]') mc.move(0, 0, -1.5, r=True) self.archArmorBase4 = mc.polyCube(w=8, h=4, d=4)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, 4.9, -15.5, r=True) mc.select(self.archArmorBase4 + '.f[0]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase4 + '.f[2]') mc.scale(1.25, 1, 1) mc.select(self.archArmorBase4 + '.f[1]') mc.scale(.5, 1, 1) mc.move(0, -2, 0, r=True) mc.select(self.archArmorBase4 + '.f[3]') mc.scale(1, 1, 1.25) mc.select(self.archArmorBase4 + '.e[0]') mc.move(0, -3, .5, r=True) mc.select(self.archArmorBase4 + '.e[1]') mc.move(0, 0, -2, r=True) mc.select(self.archArmorBase4 + '.e[2]') mc.move(0, 0, 1, r=True) mc.select(self.archArmorBase4 + '.e[3]') mc.move(0, -2, -.75, r=True) mc.scale(.75, 1, 1) self.archArmorBase5 = mc.polyCube(w=8, h=4, d=5)[0] mc.sets(e=True, forceElement=self.color2) mc.move(0, .9, -15.6, r=True) mc.select(self.archArmorBase5 + '.f[1]') mc.move(0, -3, 0, r=True) mc.scale(1.25, 1, 1.25) mc.select(self.archArmorBase5 + '.f[2]') mc.scale(.75, 1, 1) #mc.select(self.archArmorBase5+'.e[3]') #mc.move(0,1,0,r=True) mc.select(self.archArmorBase5 + '.e[2]') mc.move(0, 1, 0, r=True) self.arch = mc.polyUnite(self.arch, self.archArmor) self.arch = mc.polyUnite(self.arch, self.archArmor2) self.arch = mc.polyUnite(self.arch, self.archArmor3) self.arch = mc.polyUnite(self.arch, self.archArmorBase2) self.arch = mc.polyUnite(self.arch, self.archArmorBase3) self.arch = mc.polyUnite(self.arch, self.archArmorBase4) self.arch = mc.polyUnite(self.arch, self.archArmorBase5) self.arch = mc.polyUnite(self.arch, self.archArmorBase, n=name + '_arch')[0] mc.move(0, 3, -12, self.arch + ".scalePivot", self.arch + ".rotatePivot") #self.heal = mc.polyCube(sx=2, sy=2, sz=2,w=5, h=3, n=name+'_heal') pass
# test_melCommands.py # (C)2014 # Scott Ernst """ A unit test for the Nimble bridge to test the execution of mel commands. """ from __future__ import print_function, absolute_import, unicode_literals, division import nimble from nimble import cmds from nimble.error.MayaCommandException import MayaCommandException try: cubeNode = cmds.polyCube(width=2, height=2, depth=4) print('CREATED:', cubeNode) except MayaCommandException as err: print(err.echo()) raise cubeShape = cmds.listRelatives(cubeNode[0], shapes=True) print('SHAPE:', cubeShape) cmds.select(cubeShape[0], replace=True) result = nimble.executeMelCommand('computePolysetVolume', nimbleResult=True) print(result.echo(verbose=True, pretty=True))
def _createGeometry(self, segmentLength, offset): voff = 9.25 mc.select(cl=True) #section 1 construction self.r_hand_p_n_1 = mc.polySphere(r=1.2, n="_n_1") mc.move(offset, voff + 0, -.5) self.r_hand_p_b_1 = mc.polyCylinder(r=.75, h=3, n="_b_1") mc.move(offset, voff + 2, -.5) self.r_hand_p_p_1 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2) mc.move(offset, voff + 2.25 + self.segOffset, -.5) self.r_hand_p_n_2_a = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='_n_2_a') mc.move(offset + .7, voff + 3.75 + (2 * self.segOffset), -.5) #1.875 + .35 self.r_hand_p_n_2_b = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='_n_2_b') mc.move(offset - .7, voff + 3.75 + (2 * self.segOffset), -.5) #1.875 -.35 #section 1 unite self.r_hand_p_s_1 = mc.polyUnite(self.r_hand_p_n_1, self.r_hand_p_b_1, self.r_hand_p_p_1, self.r_hand_p_n_2_a, self.r_hand_p_n_2_b, n='r_hand_p_s_1')[0] mc.move(offset, voff + 0, -.5, self.r_hand_p_s_1 + ".scalePivot", self.r_hand_p_s_1 + ".rotatePivot") #section 2 construction self.r_hand_p_n_2_c = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_2_c') mc.move(offset, voff + 3.75 + (2 * self.segOffset), -.5) self.r_hand_p_p_2 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2) mc.move(offset, voff + 5.25 + (3 * self.segOffset), -.5) self.r_hand_p_n_3_a = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_a') mc.move(offset + .7, voff + 6.75 + (4 * self.segOffset), -.5) #1.875 + .35 self.r_hand_p_n_3_b = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_b') mc.move(offset - .7, voff + 6.75 + (4 * self.segOffset), -.5) #1.875 -.35 #section 2 unite self.r_hand_p_s_2 = mc.polyUnite(self.r_hand_p_n_2_c, self.r_hand_p_p_2, self.r_hand_p_n_3_a, self.r_hand_p_n_3_b, n='r_hand_p_s_2')[0] mc.move(offset, voff + 3.75 + (2 * self.segOffset), -.5, self.r_hand_p_s_2 + ".scalePivot", self.r_hand_p_s_2 + ".rotatePivot") #section 3 construction self.r_hand_p_n_3_c = mc.polyCylinder(ax=[1, 0, 0], sx=2, sy=2, sz=2, h=.6, r=1.0, n='r_hand_p_n_3_c')[0] mc.move(offset, voff + 6.75 + (4 * self.segOffset), -.5) self.r_hand_p_p_3 = mc.polyCube(sx=2, sy=2, sz=2, h=segmentLength, w=2, d=2)[0] mc.move(offset, voff + 8.25 + (5 * self.segOffset), -.5) mc.select(self.r_hand_p_p_3 + '.f[4:7]') #f[5] on a one segment mc.scale(.8, 1, .75) #section 3 unite self.r_hand_p_s_3 = mc.polyUnite(self.r_hand_p_n_3_c, self.r_hand_p_p_3, n='r_hand_p_s_3')[0] mc.move(offset, voff + 6.75 + (4 * self.segOffset), -.5, self.r_hand_p_s_3 + ".scalePivot", self.r_hand_p_s_3 + ".rotatePivot")
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 create_bubbles(): size = rand(0.01, 0.04) cmds.scale(0.1, 0.3, 0.1) cmds.move(0, 0.4, 0) cube = cmds.polyCube(w=5, d=5, h=4) cmds.move(0, 1.5, 0) cmds.sets(renderable=True, noSurfaceShader=True, empty=True, name='ph' + 'SG') myShader = cmds.shadingNode('phongE', asShader=True, name='ph') #cmds.shadingNode('lambert', name= 'ph', asShader= True) cmds.setAttr(myShader + '.color', 0, 1, 1, type='double3') cmds.setAttr(myShader + '.transparency', 1, 0.6, 0.6, type='double3') cmds.select(cube) cmds.hyperShade(assign=myShader) #cmds.displaySurface(xRay=True) #cmds.connectAttr('ph'+'.outColor', 'ph'+'SG.surfaceShader') #cmds.sets(cube, edit=True, forceElement='ph'+'SG') #cmds.move (0, 2, 0) for i in range(20): # set playback range cmds.playbackOptions(minTime=i + rand(1, 4), maxTime='72') bubble = cmds.polySphere(name='bubble' + str(i), radius=rand(0.2, 0.4)) # create a sphere cmds.move(rand(-2, 2), rand(-2, 2), rand(-2, 2)) cmds.select('bubble' + str(i)) cmds.lattice(dv=(5, 6, 5), oc=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[0:3][0:1][2]', 'ffd' + str(i + 1) + 'Lattice.pt[4][1][2]', 'ffd' + str(i + 1) + 'Lattice.pt[0:4][2:5][2]', r=True) cmds.scale(0.33, 0.33, 0.33, relative=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[0][1][3]', 'ffd' + str(i + 1) + 'Lattice.pt[2][3][4]', r=True) cmds.move(0, 0, -0.05, relative=True) cmds.select('ffd' + str(i + 1) + 'Lattice.pt[2][3][0]') cmds.move(0, 0, 0.8, relative=True) #cmds.select('bubble'+str(i)) for time in [1, 15, 30, 45, 60, 72]: # for each frame calculate sub-steps #mc.setKeyframe( bubble, attribute='translateX', value=px, t=f ) # set keyframes cmds.setKeyframe(bubble, attribute='translateY', value=0.002 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleX', value=size + 0.001 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleY', value=size + 0.001 * time * i, t=time) cmds.setKeyframe(bubble, attribute='scaleZ', value=size + 0.001 * time * i, t=time)
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)
def createTrackNode(cls, uid, trackSetNode =None, props =None): """ A track node consists of a triangular pointer (left = red, right = green) which is selectable but only allows rotateY, translateX, and translateZ. The node has a child, a transform called inverter, which serves to counteract the scaling in x and z that is applied to the triangular node. There are two orthogonal rulers (width and length). Width and length uncertainty is represented by rectangular bars at the ends of the rulers. In Maya one can directly adjust track position (translateX and translateZ) and orientation (rotationY); other attributes are adjusted only through the UI. """ if not trackSetNode: trackSetNode = TrackSceneUtils.getTrackSetNode() if not trackSetNode: return None node = cls.getTrackNode(uid, trackSetNode=trackSetNode) if node: return node # Set up dimensional constants for the track node nodeThickness = 1.0 thetaBreadth = 0.1 thetaThickness = 0.5 barBreadth = 2.0 barThickness = 0.5 rulerBreadth = 1.0 rulerThickness = 0.25 epsilon = 1.0 # Create an isoceles triangle pointer, with base aligned with X, and # scaled by node.width. The midpoint of the base is centered on the # 'track center' and the altitude extends from that center of the track # 'anteriorly' to the perimeter of the track's profile (if present, else # estimated). The node is scaled longitudinally (in z) based on the # distance zN (the 'anterior' length of the track, in cm). The triangle # is initially 1 cm on a side. sideLength = 1.0 node = cmds.polyPrism( length=nodeThickness, sideLength=sideLength, numberOfSides=3, subdivisionsHeight=1, subdivisionsCaps=0, axis=(0, 1, 0), createUVs=0, constructionHistory=0, name='Track0')[0] # Point the triangle down the +Z axis cmds.rotate(0.0, -90.0, 0.0) # push it down below ground level so that the two rulers are just # submerged, and scale the triangle in Z to match its width (1 cm) so it # is ready to be scaled cmds.move(0, -(nodeThickness/2.0 + rulerThickness), math.sqrt(3.0)/6.0) # move the node's pivot to the 'base' of the triangle so it scales # outward from that point cmds.move( 0, 0, 0, node + ".scalePivot", node + ".rotatePivot", absolute=True) cmds.scale(2.0/math.sqrt(3.0), 1.0, 100.0) cmds.makeIdentity( apply=True, translate=True, rotate=True, scale=True, normal=False) # Set up the cadence attributes cmds.addAttr( longName='cadence_width', shortName=TrackPropEnum.WIDTH.maya, niceName='Width') cmds.addAttr( longName='cadence_widthUncertainty', shortName=TrackPropEnum.WIDTH_UNCERTAINTY.maya, niceName='Width Uncertainty') cmds.addAttr( longName='cadence_length', shortName=TrackPropEnum.LENGTH.maya, niceName='Length') cmds.addAttr( longName='cadence_lengthUncertainty', shortName=TrackPropEnum.LENGTH_UNCERTAINTY.maya, niceName='Length Uncertainty') cmds.addAttr( longName='cadence_lengthRatio', shortName=TrackPropEnum.LENGTH_RATIO.maya, niceName='Length Ratio') cmds.addAttr( longName='cadence_rotationUncertainty', shortName=TrackPropEnum.ROTATION_UNCERTAINTY.maya, niceName='Rotation Uncertainty') cmds.addAttr( longName='cadence_uniqueId', shortName=TrackPropEnum.UID.maya, dataType='string', niceName='Unique ID') # Construct a ruler representing track width, then push it down just # below ground level, and ake it non-selectable. Drive its scale by the # node's width attribute. widthRuler = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=rulerThickness, depth=rulerBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='WidthRuler')[0] # Push it down to just rest on the triangular node (which is already # submerged by the thickness of the ruler and half the node thickness. cmds.move(0.0, -rulerThickness/2.0, 0.0) cmds.setAttr(widthRuler + '.overrideEnabled', 1) cmds.setAttr(widthRuler + '.overrideDisplayType', 2) # Construct a ruler representing track length and push it down the same # as the width ruler, and make it non-selectable. Its length will be # driven by the node's length attribute. lengthRuler = cmds.polyCube( axis=(0, 1, 0), width=rulerBreadth, height=rulerThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='LengthRuler')[0] cmds.move(0.0, -rulerThickness/2.0, 0.0) cmds.setAttr(lengthRuler + '.overrideEnabled', 1) cmds.setAttr(lengthRuler + '.overrideDisplayType', 2) # Now construct 'error bars' to the North, South, West, and East of the # node, to visualize uncertainty in width (West and East bars) and # length (North and South bars), and push them just below ground level, # and make them non-selectable. barN = cmds.polyCube( axis=(0,1,0), width=barBreadth, height=barThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarN')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barN + '.overrideEnabled', 1) cmds.setAttr(barN + '.overrideDisplayType', 2) barS = cmds.polyCube( axis=(0, 1, 0), width=barBreadth, height=barThickness, depth=100.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarS')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barS + '.overrideEnabled', 1) cmds.setAttr(barS + '.overrideDisplayType', 2) barW = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=barThickness, depth=barBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarW')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barW + '.overrideEnabled', 1) cmds.setAttr(barW + '.overrideDisplayType', 2) barE = cmds.polyCube( axis=(0, 1, 0), width=100.0, height=barThickness, depth=barBreadth, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='BarE')[0] cmds.move(0, -(barThickness/2 + rulerThickness), 0) cmds.setAttr(barE + '.overrideEnabled', 1) cmds.setAttr(barE + '.overrideDisplayType', 2) # Create two diverging lines that indicate rotation uncertainty (plus # and minus), with their pivots placed so they extend from the node # center, and each is made non-selectable. First make the indicator of # maximum (counterclockwise) estimated track rotation thetaPlus = cmds.polyCube( axis=(0, 1, 0), width=thetaBreadth, height=thetaThickness, depth=1.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='ThetaPlus')[0] cmds.setAttr(thetaPlus + '.overrideEnabled', 1) cmds.setAttr(thetaPlus + '.overrideDisplayType', 2) # Next, construct the indicator of the minimum (clockwise) estimate of # track rotation thetaMinus = cmds.polyCube( axis=(0, 1, 0), width=thetaBreadth, height=thetaThickness, depth=1.0, subdivisionsX=1, subdivisionsY=1, createUVs=0, constructionHistory=0, name='ThetaMinus')[0] cmds.setAttr(thetaMinus + '.overrideEnabled', 1) cmds.setAttr(thetaMinus + '.overrideDisplayType', 2) # The two width 'error bars' will be translated outward from the node # center. First, the width attribute is converted from meters (as it # comes from the database) to centimeters; the computation is available # in the output of the node 'width'. width = cmds.createNode('multiplyDivide', name='width') cmds.setAttr(width + '.operation', 1) cmds.setAttr(width + '.input1X', 100.0) cmds.connectAttr( node + '.' + TrackPropEnum.WIDTH.maya, width + '.input2X') # Translate barW in x by width/2.0; output is in xW.outputX xW = cmds.createNode('multiplyDivide', name = 'xW') cmds.setAttr(xW + '.operation', 2) cmds.connectAttr(width + '.outputX', xW + '.input1X') cmds.setAttr(xW + '.input2X', 2.0) cmds.connectAttr(xW + '.outputX', barW + '.translateX') # Translate barE in x by -width/2.0; output is in xE.outputX xE = cmds.createNode('multiplyDivide', name = 'xE') cmds.setAttr(xE + '.operation', 2) # division operation cmds.connectAttr(width + '.outputX', xE + '.input1X') cmds.setAttr(xE + '.input2X', -2.0) cmds.connectAttr(xE + '.outputX', barE + '.translateX') # Now regarding length, first convert the node.length attribute from # meters to centimeters. This computation is available in the output of # the node 'length' length = cmds.createNode('multiplyDivide', name='length') cmds.setAttr(length + '.operation', 1) cmds.setAttr(length + '.input1X', 100.0) cmds.connectAttr( node + '.' + TrackPropEnum.LENGTH.maya, length + '.input2X') # scale thetaPlus and thetaMinus by length (since they are 1 cm, # multiply by length in cm) cmds.connectAttr(length + '.outputX', thetaPlus + '.scaleZ') cmds.connectAttr(length + '.outputX', thetaMinus + '.scaleZ') # Then barN is translated forward in z by zN = lengthRatio*length # (centimeters) zN = cmds.createNode('multiplyDivide', name='zN') cmds.setAttr(zN + '.operation', 1) cmds.connectAttr( node + '.' + TrackPropEnum.LENGTH_RATIO.maya, zN + '.input1X') cmds.connectAttr(length + '.outputX', zN + '.input2X') cmds.connectAttr(zN + '.outputX', barN + '.translateZ') # Next, translate barS backward in z by (zN - length); output is in # zS.output1D zS = cmds.createNode('plusMinusAverage', name='sZ') cmds.setAttr(zS + '.operation', 2) cmds.connectAttr(zN + '.outputX', zS + '.input1D[0]') cmds.connectAttr(length + '.outputX', zS + '.input1D[1]') cmds.connectAttr(zS + '.output1D', barS + '.translateZ') # Next, compute the half length, hl = length/2.0 (centimeters) hl = cmds.createNode('multiplyDivide', name='hl') cmds.setAttr(hl + '.operation', 2) cmds.connectAttr(length + '.outputX', hl + '.input1X') cmds.setAttr(hl + '.input2X', 2.0) # Translate lengthRuler along z by zL = (zN - hl) (centimeters) zL = cmds.createNode('plusMinusAverage', name='zL') cmds.setAttr(zL + '.operation', 2) cmds.connectAttr(zN + '.outputX', zL + '.input1D[0]') cmds.connectAttr(hl + '.outputX', zL + '.input1D[1]') cmds.connectAttr(zL + '.output1D', lengthRuler + '.translateZ') # Scale the four 'error bars' to represent the width and length # uncertainties (centimeters) cmds.connectAttr( node + "." + TrackPropEnum.WIDTH_UNCERTAINTY.maya, barW + '.scaleX') cmds.connectAttr( node + "." + TrackPropEnum.WIDTH_UNCERTAINTY.maya, barE + '.scaleX') cmds.connectAttr( node + "." + TrackPropEnum.LENGTH_UNCERTAINTY.maya, barN + '.scaleZ') cmds.connectAttr( node + "." + TrackPropEnum.LENGTH_UNCERTAINTY.maya, barS + '.scaleZ') # Create an 'inverter' transform under which all the other parts are # hung as children, which counteracts scaling applied to its parent # triangular node. inverter = cmds.createNode('transform', name='inverter') # drive the inverter's .scaleX and .scaleZ as the inverse of the parent # node's scale values sx = cmds.createNode('multiplyDivide', name='sx') cmds.setAttr(sx + '.operation', 2) cmds.setAttr(sx + '.input1X', 1.0) cmds.connectAttr(node + '.scaleX', sx + '.input2X') cmds.connectAttr(sx + '.outputX', inverter + '.scaleX') sz = cmds.createNode('multiplyDivide', name='sz') cmds.setAttr(sz + '.operation', 2) cmds.setAttr(sz + '.input1X', 1.0) cmds.connectAttr(node + '.scaleZ', sz + '.input2X') cmds.connectAttr(sz + '.outputX', inverter + '.scaleZ') # Assemble the parts as children under the scale inverter node cmds.parent(lengthRuler, inverter) cmds.parent(widthRuler, inverter) cmds.parent(barN, inverter) cmds.parent(barS, inverter) cmds.parent(barW, inverter) cmds.parent(barE, inverter) cmds.parent(thetaPlus, inverter) cmds.parent(thetaMinus, inverter) cmds.parent(inverter, node) # Rotate thetaPlus and thetaMinus about the Y axis to indicate # rotational uncertainty cmds.connectAttr( node + '.' + TrackPropEnum.ROTATION_UNCERTAINTY.maya, node + '|' + inverter + '|' + thetaPlus + '.rotateY') neg = cmds.createNode('multiplyDivide', name='negative') cmds.setAttr(neg + '.operation', 1) cmds.setAttr(neg + '.input1X', -1.0) cmds.connectAttr( node + '.' + TrackPropEnum.ROTATION_UNCERTAINTY.maya, neg + '.input2X') cmds.connectAttr( neg + '.outputX', node + '|' + inverter + '|' + thetaMinus + '.rotateY') # Disable some transforms of the node cmds.setAttr(node + '.rotateX', lock=True) cmds.setAttr(node + '.rotateZ', lock=True) cmds.setAttr(node + '.scaleY', lock=True) cmds.setAttr(node + '.translateY', lock=True) # Now, the width of the triangle will be driven by its width attribute # (driving .scaleX) cmds.connectAttr(node + '.width', node + '.scaleX') # The quantity zN is used to scale length of the triangle cmds.connectAttr(zN + '.outputX', node + '.scaleZ') # Scale the 'length' (in x) of the width ruler cmds.connectAttr( node + '.width', node + '|' + inverter + '|WidthRuler.scaleX') # Scale the length of the length ruler cmds.connectAttr( node + '.length', node + '|' + inverter + '|LengthRuler.scaleZ') # Translate the track node epsilon below ground level (to reveal the # overlaid track siteMap) cmds.move(0, -epsilon, 0, node) # Initialize all the properties from the dictionary if props: cls.setTrackProps(node, props) else: print('in createTrackNode: properties not provided') return node # Add the new nodeName to the Cadence track scene set, color it, and # we're done cmds.sets(node, add=trackSetNode) cls.colorTrackNode(node, props) return node
def _createGeometry(self, name): self.spine = mc.polyCube(w=4, d=8, h=150, n=name + '_sword_spine') self.tip1 = mc.polyCube(w=4, d=8, h=20) pass
def objCube(): cube = cmds.polyCube() return cube
def _createGeometry(self, side): mc.select(cl=True) self.n_t = mc.polySphere(r=1.2, n="n_t") mc.move(self.sideModifyer * 4.5, 2, 1.5) self.b_1 = mc.polyCylinder(r=.75, h=2) mc.move(self.sideModifyer * 6.5, 2, 1.5) mc.rotate(0, 0, 90) self.s_1 = mc.polyCube(sx=1, sy=3, sz=1, h=5, w=2, d=2)[0] mc.move(self.sideModifyer * 8.5, 3.5, 1.5) mc.select(self.s_1 + '.f[7]') mc.move(-1, 0, 0, r=True) mc.select(self.s_1 + '.e[26]') mc.move(-1, 0, 0, r=True) mc.select(self.s_1 + '.e[23]') mc.move(.123, 0, 0, r=True) mc.select(self.s_1 + '.f[3]') mc.move(0, -.5, 0, r=True) self.n_2_a = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_a') mc.move(self.sideModifyer * 8.5, 6.5, 1.5 + .7) #1.875 + .35 self.n_2_b = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_b') mc.move(self.sideModifyer * 8.5, 6.5, 1.5 - .7) #1.875 -.35 self.s_1 = mc.polyUnite(self.n_t, self.s_1, self.n_2_a, self.n_2_b, self.b_1, n='segment_1') #section 2 construction self.n_2_c = mc.polyCylinder(ax=[0, 0, 1], sx=2, sy=2, sz=2, h=.6, r=1.0, n='n_2_c')[0] mc.move(self.sideModifyer * 8.5, 6.5, 1.5) self.p_2 = mc.polyCube(sx=2, sy=2, sz=2, h=4, w=2, d=2)[0] mc.move(self.sideModifyer * 8.5, 9.5, 1.5) mc.select(self.p_2 + '.f[4:7]') #f[5] on a one segment mc.scale(.8, 1, .75) #section 2 unite self.s_2 = mc.polyUnite(self.n_2_c, self.p_2, n='p_s_2')[0] mc.move(self.sideModifyer * 8.5, 6.5, 1.5, self.s_2 + ".scalePivot", self.s_2 + ".rotatePivot")
# test_echoCommunication.py # (C)2012 t # Scott Ernst from __future__ import print_function, absolute_import, unicode_literals, division import nimble from nimble import cmds result = cmds.polyCube(height=10, depth=25) print('polyCube result:', result) cmds.select(result[0]) cmds.move(10, 10, 5, result[0]) conn = nimble.getConnection() print(conn.ping().echo(True, True)) print('X:', conn.maya('getAttr', result[0] + '.translateX')) print('Y:', conn.maya('getAttr', result[0] + '.translateY')) print('Z:', conn.maya('getAttr', result[0] + '.translateZ')) print('Translate:', cmds.getAttr(result[0] + '.translate')[0]) print('Test Complete.')
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)