Exemple #1
0
def createMiddleCrv( curves=[], parameter=0.5 ):
    '''
    update : 2015-04-24
    '''
    if curves:
        curves = pm.select(curves)
    curves = pm.selected()
    if not curves:
        raise    

    surface, loft = pm.loft( 
        curves, 
        ch           = True, 
        uniform      = True, 
        close        = False, 
        autoReverse  = True, 
        degree       = 3, 
        sectionSpans = 1, 
        range        = False, 
        polygon=0,  # 0: nurbs surface 
                    # 1: polygon (use nurbsToPolygonsPref to set the parameters for the conversion) 
                    # 2: subdivision surface (use nurbsToSubdivPref to set the parameters for the conversion) 
                    # 3: Bezier surface 
                    # 4: subdivision surface solid (use nurbsToSubdivPref to set the parameters for the conversion) 
        reverseSurfaceNormals = True )

    dupCrv, crvFromSurf = pm.duplicateCurve( surface.getShape().v[ parameter ], ch=True, range=False, local=False )
    pm.delete( surface, loft, crvFromSurf )

    dupCrv = pm.PyNode( dupCrv )
    dupCrv.rename('middleCrv#')   

    return dupCrv
Exemple #2
0
    def createIk(self):
        # create the curve for the ik
        self.ikCrv = pm.duplicateCurve(self.rbnSrf + ".v[0.5]", ch=1, rn=0, local=0, name=self.name + '_ik_crv')[0]

        # create the ik
        self.ikHandle = \
        pm.ikHandle(sj=self.ikJntList[0], ee=self.ikJntList[-1], c=self.ikCrv, ccv=False, sol='ikSplineSolver',
                    name=self.name + '_ikspline')[0]
        pm.select(cl=1)
        pm.parent(self.ikHandle, self.mainGrp)
        pm.parent(self.ikCrv, self.mainGrp)
        pm.select(cl=1)
Exemple #3
0
def duplicateAttachEdges(pEdges):
    """ Duplicates Curves from Edges and attach returns single curve """
    dupSurfCurves = []
    for aEdge in pEdges:
        x = pm.duplicateCurve(aEdge, ch=1, rn=0, l=0)
        dupSurfCurves.append(x[0])
    pm.attachCurve(dupSurfCurves, ch=0, rpo=1, kmk=0, m=1, bb=0, bki=0, p=0.5)
    pm.select(dupSurfCurves[0])
    pm.runtime.DeleteHistory()
    pm.language.mel.eval("CenterPivot;")
    pm.delete(dupSurfCurves[1::])
    return pm.PyNode(dupSurfCurves[0])