A followup question regarding "PolySelectConvert"

Everything I have discovered about the PolySelectConvert command makes sense, but I guess I find it as being a little odd - maybe someone can tell me that I'm utterly wrong about some of this stuff.

Try creating a polygon object (polyCube if you will), and selecting a component->face (with the mouse). Now open the Script Editor and watch it closely. Next step - go to the Modeling pulldown subset and click on Polygons->Selection->Convert Selection To Vertices. Strange, nothing showed up in the Script Window. Okay, to alleviate this 'problem', turn 'Echo All Commands' on in the script window. Now you see something - the PolySelectConvert (3) command is echo'ed... Great! that'll work in a script wonderfully, right? wrong.

True, it works in any script just fine, -but- only if you run it from the pulldown menu -first-... Try restarting maya now and type PolySelectConvert 3 on the command line. Says it can't source the script... Now run it from the pulldown menu and then from the script line again... doink! It worked! I'm not quite sure i get it...

As far as I can tell, most anything you want to do with vertices on meshes is done with a plugin. The PolySelectConvert command is a little mysterious, as its first letter is capitalized (you will notice no other MEL commands have a capital first letter). It's not a plugin per-se, but it certainly seems to be acting as one.

So finally my question. Does anyone know of a way to get this thing to work with a script without running it from the pulldown menu first? I was going to try to script 'pulling down the menu', but 'pulling down' the Polygon menu doesn't generate any command in the Script Editor - it does for many of the menu's, but my guess is the dynamic nature of the Polygon menu makes it impossible.

Sorry for the lengthy explanation... Hopefully i am just missing something simple ... Thanks again y'all...

Andrew Gardner
University of Wisconsin, Madison

Hi,

If you search for PolySelectConvert string in the Maya MEL directory, you will find it in PolygonsMenu.mel. Meaning PolySelectConvert is a MEL procedure defined in PolygonsMenu.mel. So, I guess when you click on the pulldown menu, this MEL script is sourced, ie all the MEL procedures defined within it are now accessible. So, to bypass the pulldown menu, you could do an explicit source:

source PolygonsMenu.mel;
PolySelectConvert ...

You could even take a peep at the MEL code for the PolySelectConvert procedure. [img]http://208.179.92.68/forums/icons/smile.gif[/img]

rgds,
pipit

Thanks a bazillion! I guess I have an excuse for not looking in the MEL directory (they handily hide all of Maya out in afs for us), but it shoulda' been high on my list of directories to request from the lab. Access to these scripts has opened up a whole buncha' scripting ideas for myself, and I sincerely recommend digging through some of these if you think they implement similar functionality to a script you may be writing yourself (that was for everyone ).

Invaluable. Thanks again.

Andrew Gardner
Univertisy of Wisconsin, Madison

"doink" ??

is that a technical term andrew?

hehehe

I have only had problems with getting verticies from a selected edge. By using the mel commands and creating a small script, you can get the verts from a face. Try this:

// the below code will take a list of selected verts and convert them to adjoining edges //
string $verts[0] = ls -sl;
int $numVerts = size $verts;
string $edgeList[0] = polyListComponentConversion -fv -te -in $verts;
int $numEdges = size $edgeList;

// likewise you can easily convert from selected faces to their adjoining verticies //

Hope this helps,

Morris