Beispiel #1
0
 def makePlaneButton(self, *args, **kwargs):
     '''Make a construction plane based on selected objects'''
     if self.plane and cmds.objExists(self.plane):
         cmds.delete(self.plane)
     sel = cmds.ls(sl=True)
     if not len(sel) > 2:
         raise RuntimeError("Please select three objects to make a plane")
     first, middle, last = sel[:3]
     #make dummy alignment object
     dummy = cmds.group(em=True, n='dummyPlaneObj')
     cmds.xform(dummy,
                ws=True,
                t=cmds.xform(middle, ws=True, q=True, t=True))
     cmds.delete(
         cmds.aimConstraint(first,
                            dummy,
                            offset=(0, 0, 0),
                            aimVector=(1, 0, 0),
                            upVector=(0, 1, 0),
                            worldUpType='object',
                            worldUpObject=last))
     pos = cmds.xform(dummy, ws=True, q=True, t=True)
     rot = cmds.xform(dummy, ws=True, q=True, ro=True)
     plane = cmds.plane(p=pos, s=10, r=rot)
     cmds.delete(dummy)
     self.plane = plane
     self.planeSizeSlider()
     cmds.makeLive(self.plane)
Beispiel #2
0
    def furnish(self, x, y):
        """Populates the room"""
        cmds.plane(p=(0, 0, 0),
                   l=int(y) * 2,
                   w=int(x) * 2,
                   r=('90deg', '0deg', '0deg'))

        for item in self.furnlist:
            x = 0
            while x < int(self.numlist["Type{0}".format(
                    self.furnlist.index(item))].text()):
                file_path = 'C:/Users/Alexander/Desktop/Assets/' + item
                cmds.file(file_path, i=True)

                x = x + 1

        objectList = cmds.ls(geometry=True)
        for a in objectList:
            if a.find("controller") != -1:
                cmds.transform(randint(int(x) * -1, int(x)),
                               randint(int(y) * -1, int(y)), a)
Beispiel #3
0
    def _create_drawing_plane(self, camera=None, position=None):

        camera = camera or self.camera

        self.drawing_plane = cmds.plane(
            name=self.name,
            length=self._active_view.portHeight(),
            width=self._active_view.portWidth(),
        )
        if position:
            cmds.xform(self.drawing_plane, ws=True, t=position)
        cmds.connectAttr("{}.rotate".format(camera),
                         "{}.rotate".format(self.drawing_plane))
        cmds.hide(self.drawing_plane)
        cmds.makeLive(self.drawing_plane)
        self.all_group.group_nodes(self.drawing_plane)
        return self.drawing_plane
def interactive_plane( aJnt ):
	
	try:
		bJnt = cmds.listRelatives( aJnt, children = True, type = 'joint' )[0]
	except TypeError:
		raise RuntimeError( 'You must pass a joint as the parent, %s doesn\'t seem to be a joint.' % hierarchy_parent )
		
	cJnt = cmds.listRelatives( bJnt, children = True, type = 'joint' )[0]
	
	aPos, bPos, cPos = cmds.xform( aJnt, ws = True, q = True, t = True), cmds.xform( bJnt, ws=True, q=True, t=True ), cmds.xform( cJnt, ws=True, q=True, t=True )
	aVec, bVec, cVec = om.MVector( aPos ), om.MVector( bPos ), om.MVector( cPos )
	
	polyFacet = cmds.polyCreateFacet( ch=True, tx=True, p=[aVec, bVec, cVec] )[0]
	plane = cmds.plane( s=10, p=[(aVec.x + bVec.x + cVec.x)/3, (aVec.y+bVec.y+cVec.y)/3, (aVec.z+bVec.z+cVec.z)/3] )
	cmds.delete( cmds.normalConstraint( polyFacet, plane, aimVector=[0,0,1], upVector=[0,1,0] ) )
	
	return polyFacet
Beispiel #5
0
def plane(*args, **kwargs):
    res = cmds.plane(*args, **kwargs)
    if not kwargs.get('query', kwargs.get('q', False)):
        res = _factories.maybeConvert(res, _general.PyNode)
    return res
def createPlane(): 
    for i in range(1,13):
        mx.plane(p=[0,5,0],s=4,r=[0,0,i])
EX.	mx.file(f=1,new=1)
mx.nurbsCube(n='cube1',w=6,u=6,v=6)
mx.nurbsCube(n='cube2',w=6,u=6,v=6,hr=2,ax=[0,1,0])
mx.move(6,0,0)
mx.nurbsCube(n='cube3',w=6,u=6,v=6,lr=2)
mx.move(12,0,0)


r = rotation
s = size
p = position


mx.file(f=1,new=1)
mx.plane(n='myPlane1',p=[0,5,0])
mx.plane(n='myPlane2',p=[0,5,-2],s=4)
mx.plane(n='myPlane3',p=[0,5,-4],w=4,l=2)
mx.plane(n='myPlane4',p=[0,5,-2],s=4,r=[0,45,0])
mx.plane(n='myPlane5',p=[0,5,-2],s=4,r=[0,0,45])
mx.file(f=1,new=1)
def createPlane(): 
    for i in range(1,13):
        mx.plane(p=[0,5,0],s=4,r=[0,0,10*i])
createPlane()

EX.	mx.file(f=1,new=1)
def createPlane(): 
    for i in range(1,13):
        mx.plane(p=[0,5,0],s=4,r=[0,0,i])
createPlane()