I am trying to get the hang of this mel stuff, and its been ogin pretty good, I just have one real basic question., and maybe you guys have the answer. I was trying to create a context sensitve script that did one thing if the selection was "this" and another if it was "that". More specifically, an extrude tool that would extrude edges if an edge was selected or faces if faces were selected. I am sure there is a script out there that already does this, but I'll never learn if I dont't try. Long story short... I started with this.... CODE string $selType;
if (size(filterExpand -sm 32))
$selType=2;
if (size(filterExpand -sm 34))
$selType=1;
if ($selType=1)
polyExtrudeFacet;
else {
if ($selType=2)
polyExtrudeEdge; }
well... the results were not as expected. any ideas? It does fine with the faceExtrude, but just converts the edge selection to faces on the edge selection "if statement". It seems to be reading the $selType variable coreectly though. Thanks for your thoughts.
I tried this and got simulair results. I tried reversing the second if then statement, and got the reverse. It simply converts the selection over to the first command called, and does that extrusion. any other ideas? here is my new code.
CODE $selected=ls -sl;
string $selType; string $selTypeTrans;
if (size(filterExpand -sm 32)){
$selType=2; } else
if (size(filterExpand -sm 34)){
$selType=1;
}
print $selType;
print $selTypeTrans;
if ($selTypeTrans==2){
polyExtrudeEdge; } else
if ($selTypeTrans==1){
polyExtrudeFacet;
}
this new code always extrudes the selection as an edge selection!
You are testing $selTypeTrans in your code but you never assign anything to it - that cannot be correct. Why do you need that variable anyway? You also don't need list selection if you don't use it.
I got it workin!, but now comes the finess. So far the two seperate extrusions work based on the "if then else" statements, but if history is enabled then the pivot for the extrude manip is placed at the location that it would appear the first time you run the script. I looked at the code maya builds when an extrude is done normally, it looks like you would have to get the local pivot info to place the new manip. (xform maybe??) anyways I'll take a look at your script, maybe you already answered my question.