Simple extrude (edge/face/vertex)?

I posted a thread in cgtalk... but nobody seems to care :confused:
ok so I try here again and put my latest experiences to it:

Is there a way to determine the current component mode, no matter how you toggled it (RMB/F8/F9-F12)??

I set up two shortcuts: "u" for face extrude and "U" for edges. But as I have to extrude hundreds of edges now "shift-u" really sucks a hundred times.
Now I just wanted to create a short mel that figures out which polygon mode is active and chooses the right extrude mode (edge/face/vertex).

So here is what i have so far:

if (selectType -q -fc) {
performPolyChipOff 0 2;
} else if (selectType -q -eg) {
performPolyChipOff 0 4;
} else if (selectType -q -v) {
performPolyExtrudeVertex 0;
} else {
warning "Nothing to extrude!";
};

problem is: It just works sometimes. It seems that the RMB left/up/down-thingy doesn't change the selectType correctly. Or better not allway. I swear I've seen it working!! But much more often it doesn't.

This thread reveals something about a difference between changing component mode via RMB or F9-12. Why is that so? Can I avoid that?

Hey ewerybody....

I copied your script, and I'm trying it. It works fine if you're already in the mode you want (and edge, face, or vert selected)... But I'm trying to understand what you want to accomplish. You said you are trying to extrude hundreds of edges? At once? Like in a loop, based on selected edges?

Thanks!

Shawn

hello, how about this code:

global proc nn_extrudeVEF()
{
int $nTokens,$size;
string $buff[];
string $selObj[] = ls -sl -fl;

$size = `size($selObj)`;
$nTokens = `tokenize $selObj[0] "." $buff`;
$nTokens = `tokenize $buff[1] "[" $buff`;

if (!$size)
{  error ("Nothing selected.n");  }

if ($buff[0] == "vtx")
{
	performPolyExtrudeVertex 0;
}

else if ($buff[0] == "e")
{
	for ($edg in $selObj)
	{  polyExtrudeEdge -kft true -ltz 2 -ls .5 .5 0 $edg;  } // Change value		
}
else if ($buff[0] == "f")
{
	for ($face in $selObj)
	{  polyExtrudeFacet -kft true -ltz 2 -ls .5 .5 0 $face;  } // Change value
}
else 
{
	warning ("Make sure you've selected a vertex, edge, or face.n");
}

}

nn_extrudeVEF();

this code is really basic, if you want you can modify it more so.

thanks
Kat

@Shawn. No no. Not at once.
Actually I have to do rivers for a game now. And at last its only that workflow-thing that I had the idea about.
You know? Why 3 extrudes? When you can have just one!??

@Kat:
Greeeeeeeaeaaaattt!!!!

Thats it! I had the Idea about checking the strings from ls -slbut I didn't know, how to do that.
"Wieder wat jelernt!" I'd say here in Berlin.
I just had no time to figure out how to disassemble strings in mel. Now I know.

ok, as you said: I modified it some more.
I took out polyExtrudeEdge/Face because they do [censored] like pulling other components away with the selection... And polyChipOff is shorter for the script ;]
And then I use to model without history sometime, but polyChipOff always hides the tool so I catched it.

global proc smartExtrudeVEF()
{
int $nTokens,$size;
string $whichCtx = currentCtx;
string $buff[];
string $selObj[] = ls -sl -fl;

$size = `size($selObj)`; 
$nTokens = `tokenize $selObj[0] "." $buff`; 
$nTokens = `tokenize $buff[1] "[" $buff`; 

if (!$size) {
	error ("Nothing selected.n");
};
if ($buff[0] == "vtx") { 
	performPolyExtrudeVertex 0; 
} else if ($buff[0] == "e") {
	performPolyChipOff 0 4;
} else if ($buff[0] == "f") {
	performPolyChipOff 0 2;
} else {
	warning ("Make sure you've selected a vertex, edge, or face.n");
};
if (!`constructionHistory -q -tgl`) {
setToolTo $whichCtx; };

};

A lil while ago I noticed a bug: With history on I seletet a few edges of a cube and extruded them,
but when I wanted to extrude them once more there was a polySelectionThing.f[blabla] on to of the $selObj string.
But I couln't reproduce with another cube... hmm..
yea whatever!

Its not idiotproof so far, but it does what it should for my needs. Thanks a lot!!!

Anyone more suggestions?!?!