Monday, April 3, 2017

Mel Script for Super Extruder by Ming Tang

//this script will use a poly model (mesh surface) to generate the structure beams. You have to use polygon model. select it first and run the script-------

//select faces 

proc extrudepoly()
{
float $escale = `textField -q -text escale`;
float $edist = `textField -q -text edist`;

string $myobject[] = `ls -sl`;
print ("the quary name is" + $myobject[0]);


$item = $myobject[0] + ".f[0:99999]";
select -cl; 

//poker face to add details. It is a better way than triangulate 

//polyPoke -ws 1 -tx 0 -ty 0 -tz 0 -ltx 0 -lty 0 -ltz 0 -ch 1 $myobject[0];


select -r $item; 

//extrude by scale 

//select -r $myobject[0].f[0:9999] ;
polyExtrudeFacet -ch 1 -kft 0 -lsx $escale -lsy $escale -lsz $escale;
doDelete;

//extrude again 

select -r $item ;
polyExtrudeFacet -ch 1 -kft 1 -ltz $edist;
}

//------------create UI window

global proc extrudewin ()
{
if (`window -exists extrudeWindow`) { deleteUI extrudeWindow; }
window
-widthHeight 300 300
-title "super extrude"
-sizeable true
extrudeWindow;

//add two values

columnLayout;
rowColumnLayout -numberOfColumns 2
-columnWidth 1 120
-columnSpacing 1 20 
-columnWidth 2 120 
-columnSpacing 2 20; 

text -l "extrude scale";
textField -tx 0.9 escale ;
text -l "extrude height";
textField -tx -0.1 edist ;
setParent ..;

//----break
text -l "";
separator -w 800;

text -l "Notice: only works for poly";
text -l "";

//three buttons
rowColumnLayout -numberOfColumns 1;


//---create button 1
button -label "Create Extrude"
-command "extrudepoly" extrudepoly;


setParent ..;

//break
columnLayout;
text -l "";
separator -w 800;
text -l "Ming Tang. 2007";



showWindow;
}

extrudewin;



No comments:

Post a Comment