Notifications
Clear all

[Closed] Random Extrude script

An old script i used a long time ago to randomly extrude faces with min max value and a dialog box. Wont work with 3dsmax 2009 – i get the following error:

“– sytax error at ), expected <factor>
– In line: global proc tsdRandomExtrude(float $min, f”

If anyone can help me, much appreciated. Would save me a crapload of time

global proc tsdRandomExtrude(float $min, float $max)
{
//Get the currently selected object
string $temp[] = ls -selection;
if(size($temp) < 1) error “Nothing is selected”;

        //get a list of all the faces in the object
    select ($temp[0] + ".f

[li]”);[/li]> string $faces[] = filterExpand -selectionMask 34;

        //loob through the list of faces, extruding them
    for($i = 0;$i &lt; size($faces);$i++)
    {
        float $distance = `rand $min $max`;
        polyExtrudeFacet -localTranslateZ $distance $faces[$i];
    }
        
        //select the object again and delete it's history
    select $temp[0];
    DeleteHistory;
}
8 Replies
1 Reply
(@bobo)
Joined: 2 years ago

Posts: 0

I hope you realize that MEL has never worked in 3ds Max, no matter what version :shrug:

what about something like this?


convertTo $ polymeshobject --the selected object
minE = 10  
maxE = 20  
for f in $.faces do polyop.extrudefaces $ f (random minE maxE)

How would i make it so only selected polygon faces get extruded?

What is MEL?

1 Reply
(@bobo)
Joined: 2 years ago

Posts: 0

“Maya Embedded Language”, the scripting language of Autodesk Maya, the language the piece of code was written in? :wavey:

Apologies, its the wrong code, the one i had used before is probably lost somewhere in my HD. It serverd as a basic random extrude for polyfaces. I need to organize my back up drives.

The code haavard provided (thank you btw) extrudes every face in the object, how would you be able to target only selected polyfaces?

1 Reply
(@bobo)
Joined: 2 years ago

Posts: 0

Assuming the object is already collapsed to Editable Poly and the selection is made, you can change his code to

minE = 10.0  
maxE = 20.0
for f in polyOp.getFaceSelection $ do polyop.extrudefaces $ f (random minE maxE)

Worked perfectly! Thank you Bobo