thanks for the answers guys.
I tried to use this snippet but it does not work..It does not give any
error but it does not pass the functionality to the button .but if I use
myobj==myobj like old one .it works.even though it is working but still not
satisfied. i'm curious.
On Saturday, April 8, 2017 at 4:32:08 AM UTC+1, Alok Gandhi wrote:
>
> Ah and I forgot to mention, you should not use `myobj` for both the
> pattern matching and object in selection. It makes the code less clear.
> Better to use some other name. Here's what I suggest:
>
> def delcube(self, *args):
> sel = cmds.ls("myCube*", sl=True, dag=True, v=True, ud=False)
> todelete = "myCube*"
> for myobj in sel:
> if myobj == todelete:
> try:
> cmds.delete(myobj)
> except ValueError:
> # Shape Node already deleted
> pass
>
> also notice that the try, except should be inside the loop otherwise the
> for loop will run only once.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f2ce7d0c-0936-47e6-a491-f074b5742e78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.