-2

trying to make this work

import maya.cmds as mc


def firstFace():
    FaceToSel = 'first' def allFace():
    FaceToSel = 'all'


def execute():
        if FaceToSel == 'first':
            print Yes
        elif FaceToSel == 'all':
            print No


def ui():
    if mc.window('face_Select', exists = True):
        mc.deleteUI('face_Select')
    FaceWin = mc.window('face_Select', mxb = False)
    mc.columnLayout( adjustableColumn = True )

    mc.intFieldGrp( 'numberOfFaces', label = 'Number Of Facess', value1 = 10 )

    ButtonOne = mc.radioButtonGrp( label='Type', labelArray3=['TopFaces', 'Allfaces'], numberOfRadioButtons = 2, onCommand1 = 'firstFace()', onCommand2 = 'lastFace()')
    mc.button( label = 'Select faces', command = 'execute()',  align = 'center', aop = True)

    mc.showWindow('face_Select')
     ui()
Simply Ged
  • 8,250
  • 11
  • 32
  • 40
HFD
  • 9
  • 1
  • 1
    I see code but I don't see an actual question or what issue you're having. First fix all the indent errors as they are all over the place. Also replace `labelArray3` to `labelArray2` for your `ButtonOne`. Finally, `FaceToSel` in your `execute` function wasn't previously defined and will error immediately. You could either make that a global variable or stick this all in a class and use instance variables. Read up on Python variables and local scope to understand more. – Green Cell May 09 '19 at 02:02

1 Answers1

0

First ask a question. Then provide a code with indentation, put Yes and No with comma, check that your functions has a def that exists, command flags that has correct datas and it will be more easy to make you an answer.....

So here is a working code, if you want more explanation, check question about ui I've answered

How to use a slider value in calculations?

import maya.cmds as mc
from functools import partial


def execute(FaceToSel, *args):
    option = mc.radioButtonGrp(FaceToSel, q=True, select=True)
    if option == 1:
        print True
    elif option == 2:
        print False

def ui():
    if mc.window('face_Select', exists = True):
        mc.deleteUI('face_Select')
    FaceWin = mc.window('face_Select', mxb = False)
    mc.columnLayout( adjustableColumn = True )

    mc.intFieldGrp( 'numberOfFaces', label = 'Number Of Facess', value1 = 10 )

    ButtonOne = mc.radioButtonGrp( label='Type', labelArray2=['TopFaces', 'Allfaces'], numberOfRadioButtons = 2, select=1)
    mc.button( label = 'Select faces', command = partial(execute, ButtonOne),  align = 'center', aop = True)

    mc.showWindow('face_Select')
ui()
DrWeeny
  • 2,487
  • 1
  • 14
  • 17
  • Your questio was "make this work", in the link Ive given, you can see how to store data with global, dictionary or class. There is also lots of example of using partial to pass data. I think you have enough to at least try to update your code. – DrWeeny May 11 '19 at 02:42