Dashboard_avatar
Feb 09, 2012
Post id: 309613 Report Item

Hello,
I have this little script that finds open edges on a mesh and highlights the faces touching them...It does not fill the hole by design.  This script is only meant to help the artist locate the hole, not fill the hole.

global proc selectOpenEdges()
    {
    polyInstallAction -cs -cn polyCloseBorder;
    ConvertSelectionToFaces;
    hilite;
    polyInstallAction -uc;
    }

It works as expected but I have one issue.
If i select a mesh that does not have an open edge [hole], i get this error...
"// Error: polyCloseBorder works only on polygonal border edges."
it does not stop my workflow, but i would like to have a clean script.  I can't figure out how to check the selection for an open edge before running thru the rest of the script.
Any help is appreciated.
Thanks,
Gary

Dashboard_avatar
Feb 09, 2012
Post id: 309616 Report Item

you could use:

polySelectConstraint -m 0;
select `polyListComponentConversion -fv -ff -fuv -fvf -te`;
polySelectConstraint -w 1;
$sel = `ls -sl`;
polySelectConstraint -m 2;
select `polyListComponentConversion -fv -fe -fuv -fvf -tf`;
polySelectConstraint -m 0;

instead of your script

Dashboard_avatar
Feb 10, 2012
Post id: 309618 Report Item

Thanks for your response but it doesn't work like I need. 
My script selects only the faces touching the hole[s].  Your script selects all faces on the selected object. 
My question is basically, how can I query the object to see if it has holes, before i run the rest of my script.
Thanks,
Gary

Dashboard_avatar
Feb 11, 2012
Post id: 309621 Report Item

Yeah theres some init that maya does that don't get done in the script unless you call this once trough the poly selection constraining dialog*. Very hard thing to catch because it can work fine when developing and not when not. So if you open the poly selection constraint dialog run the code then it runs fine and does what you do. Need to investigate.

Ok i know what the problem is still trying to figure out how to reliably flush mayas state so it understands in the script im in face mode (maya updates this after my script is run, but i can't eval deferred or your code would not work)

(thats why the select is there it flushes my old version of maya but not say 2011)

>> how can I query the object to see if it has holes
 
you really can not, not in mel anyway. Without doing a lot more work then you would realistically want to do and thus slowing maya to a crawl. The option is to work with poly constraints or get the error. Lest you want to loop each edge split text and do about 6 crossproducts. On the otherhand in the api its 4 lines of code, just reflects the difference of what the tools are meant for.

Anyway you can do it with the constraints too just need to find the hack form my notes somewhere.


*polySelectConstraint -w 1; == select thngs next to open edges

Dashboard_avatar
Feb 11, 2012
Post id: 309622 Report Item

oh ok, damn I need to read the manual *"#¤, try this:












1
2
3
4


polySelectConstraint -m 0;
select -r `polyListComponentConversion -tf`;
polySelectConstraint -dis -w 1 -m 2 -t 0x0008;
polySelectConstraint -m 0;




 



Dashboard_avatar
Feb 13, 2012
Post id: 309627 Report Item

thank you for explaining things and not just posting a solution.  My brain likes to eat too :)