Search code examples
pythoncommandmaya

Maya Python polySeparate error


import maya.cmds as cmds

cmds.polyChipOff(ltz=0.1, kft=False)
cmds.polySeparate()

When running the polySeparate command, I get the error "polySeparate needs exactly 1 polygonal obkect or polygonal faces from one object" despite having a face duplicated and selected.

Total noob here, wondering why this is the case?


Solution

  • Looks like you need to pass an object to the polySeparate function.

    Since you already have a face selected you can use cmds.ls to get the selected object:

    import maya.cmds as cmds
    
    cmds.polyChipOff(ltz=0.1, kft=False)
    cmds.polySeparate(cmds.ls(sl=True, objectsOnly=True)[0])
    

    Works as expected when testing with new objects.