Script for selecting edges?

Script for selecting edges?

Anonymous
Not applicable
997 Views
4 Replies
Message 1 of 5

Script for selecting edges?

Anonymous
Not applicable
Hello Maya users 🙂

I'm looking into Maya MEL documentation and also in script editor for few days, trying to write my own scipt without success. I thought it will be a lot of easier, because script will make only selecting and deleting. Here is my vision:

I select one edge on my object
and script will make following steps:

1. selected edge convert to EDGE RING
2. then convert selected edge ring into FACES
3. delete selected faces
4. separate object

thats all.

I'm using this procedure a lot of in my workflow with right click menu etc. ,but the script would make my worklflow a lot of easier.

Please if anyone can help me with this, or how should I start writing this imho simple script, it would be perfect.
Thank you.


best,
Tom
0 Likes
998 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
This will do it. You can enable the "DeleteHistory" command at the end by removing the // from in front of it.

string $sel[] = `ls -sl`;
string $edgeName = $sel;
int $selSize = `size($sel)`;
string $shapeNameAr[] = `listRelatives -parent $sel`;
string $shapeName = $shapeNameAr;
string $dagNameAr[] = `listRelatives -parent $shapeNameAr`;
string $dagName = $dagNameAr;
string $matchOne = `match "\\+" $matchOne`;
int $edgeIDInt = (int)$edgeIDString;

polySelect -edgeRing $edgeIDInt $dagName;

string $newSel[] = `polyListComponentConversion -toFace`;

select -replace $newSel;

delete;

maintainActiveChangeSelectMode $dagName;

select -r $dagName;

polySeparate -ch 1 $shapeName;

//DeleteHistory;
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thank you milion times Valen 🙂
Its working perfectly, thanks again.
0 Likes
Message 4 of 5

lee.dunham
Collaborator
Collaborator
this is just a quick simplify of the previous code.

string $mySel[] = `ls -sl -flatten`;
pickWalk -type "edgeRing" ;
delete `polyListComponentConversion -fe -tf` ;
polySeparate -ch 1 (`listRelatives -p $mySel`);
//DeleteHistory;
0 Likes
Message 5 of 5

Anonymous
Not applicable
Very nice!
0 Likes