talk.bindpose.com has been shut down on the 6th of March 2021. You can read a bit more about it here.

You are currently reading an archived copy of the latest content, with all the usernames deleted.

Maya python - getting positive vertices

by user76 posted 29-11-2017 | 4 comments

obj = pm.ls (selection=True) verts=pm.polyEvaluate(v=1) pm.select(obj[0]+'.vtx[0:'+str(verts)+']') posit=pm.filterExpand(sm=31,ex=1,smp=1) print posit

obj is a simple cube (ref to image - https://drive.google.com/open?id=1HIICJ3DaPnmAiv9plZUqXBp6lCueEM2t) I read that in order to get smp to work, i need to get symmetry on. Done! But when i print posit, its returning me vertices in negative world space or the negative axis i am trying to find WHERE i am trying to get positive vertices only. Is there something i am doing wrong? Hoping some saint would kindly explain the concept to me haha

beers!

P.S I am trying to write in python to calculate a selected mesh to check whether its vertices are symmetry or not.

 

by user3 posted 30-11-2017

heya! Can you please format the code using the Markdown syntax as it's a bit tricky to read it now?

Basically, you need to surround your code with three backtick (`) characters on each side. Additionally, after the opening three ticks, you can type python without any spaces, to get python highlighting.

I've done it for the existing code here.

obj = pm.ls(selection=True) 
verts=pm.polyEvaluate(v=1) 
pm.select(obj[0]+'.vtx[0:'+str(verts)+']') 
posit=pm.filterExpand(sm=31,ex=1,smp=1) 
print posit

As for your actual question, I just tried doing the same thing (using maya.cmds though) and it seems like I do get the verts only on one side, but they are reversed. So, instead of using smp, I tried smn and it did the job. Does it work for you as well?

 

by user76 posted 06-12-2017

Sorry for the late reply haha. Yea i got everything to work out thankfully! XD just wondering, as this is part of a auto rig script i am writing, is this actually practical to be a useful script to be in a reel/interview or should i actually spend time researching on more practical tools?

 

by user3 posted 06-12-2017

To be honest I don't have much experience on either side of the interview, but I can definitely say that I have never needed to write a tool that does this.

If you can picture a practical scenario where you would use this in production and it will either save time or enhance performance, then most certainly add it to the reel as you have a justification for it.

Otherwise, I'd invest my time in something that could earn more benefits.

 

by user76 posted 07-12-2017

Thank you for the kind explanation. I thought so myself too. Perhaps I should indulge it as a personal project and learning experience on python while spend majority of the other time on more useful tools. Many thanks! :)