And to explain again why your snippet didn't work and the
myObject==myObject always passes, consider this..
1==1
And then
x=1
x==x
Basically comparing a value to itself is always going to pass.
Justin
On Sat, Apr 8, 2017, 6:25 PM NAS18 wrote:
>
> it does work..
it does work.. thank you so much :)
On Saturday, April 8, 2017 at 6:47:54 AM UTC+1, Alok Gandhi wrote:
>
> Just to reiterate, use this, it will work and is much simpler:
>
> def delcube(self, *args):
> todelete = cmds.ls("myCube*", sl=True, dag=True, v=True, ud=False)
> for obj in
Just to reiterate, use this, it will work and is much 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
>
> 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.
Look at my last post above, it exactly
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
>
> 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
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)
>
>
> I use the bug to ignore the error warning that i received .. like this ##
> Error: ValueError: file line 14: No object matches name:
> myCube1Shape #
> not sure whether I did the right thing or misuse the handling exceptions.
It is perfectly ok to `pass` exceptions if you know what you
http://pastebin.ubuntu.com/24337966/
This is the original snippet,
It does the job but I still doubt with it..
I made a UI interface that generate sphere and cube . I wrote this snippet
so it will act only on cube and only will delete the selected cube as I
have a list of cube that start with
Hello,
May I know is it suitable to use * as variable value
http://pastebin.ubuntu.com/24337819/
The purpose function is to delete an selected object that prefix with
myobj* and delete it.
thank you so much
regards
Nurul
--
You received this message because you are subscribed to the
10 matches
Mail list logo