> > I still don't understand comparison between the current item from the > selection and "myObj*". Can objects actually have a literal * in their name > in Maya? When would this check actually pass?
You are right. `*` will have no effect in python. There's a bug. using: myobj = 'myCube*' and then: if myobj == myobj: # delete ... works, becuase `sel('myobj*', ....) already preselects all the object starting with 'myCube' and then myobj == myobj always evaluates to True (as you pointed the myobj = 'myCube*' is overridden by myobj in sel) thus deleting all the cubes only. My code, with todelete = 'myCube*' will NOT work but myobj = 'myCube*' will work. I think the best option would be a simpler: def delcube(self, *args): todelete = cmds.ls("myCube*", sl=True, dag=True, v=True, ud=False) for obj in todelete: try: cmds.delete(obj) except ValueError: # Shape Node already deleted pass -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMSV5KfP%2BwxbsyVVoUUgBbf5JBwxDbdbMgqqFozvCJjr9w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.