Gjorde om scriptet lite åt er.
Nu funkar det på flera object samtidigt, samt att man kan göra en random/objekt på hur många cuts man vill ha.
if ( `window -exists cutUI` == 1 )
{
deleteUI cutUI;
}
window
-maximizeButton 0
-resizeToFitChildren on
-title "cut this"
-iconName "cut this"
-menuBar false
-menuBarVisible false
cutUI;
columnLayout
-adjustableColumn 0;
text "min nr of cuts";
intFieldGrp
-numberOfFields 1
-width 50
intFieldMin;
text "max nr of cuts";
intFieldGrp
-numberOfFields 1
-width 50
intFieldMax;
text "Delete history";
checkBoxGrp
-numberOfCheckBoxes 1
chkBox;
button -label "Do It"
-width 150
-c doit;
text "random cuts min-max";
text "on all selected objects";
showWindow cutUI;
global proc doit ()
{
string $sel[] = `ls -sl`;
for ($each in $sel)
{
float $bb[] = `polyEvaluate -boundingBox ($each)`;
//minimum cuts per object.
int $min = `intFieldGrp -query -value1 intFieldMin`;
//maximum cuts per object
int $max = `intFieldGrp -query -value1 intFieldMax`;
int $ranCuts = rand($min,$max);
int $i;
for ($i = 0; $i float $px = rand(($bb[0]*0.95),($bb[1]*0.95));
float $py = rand(($bb[2]*0.95),($bb[3]*0.95));
float $pz = rand(($bb[4]*0.95),($bb[5]*0.95));
float $rx = rand(0,180); float $ry = rand(0,180);
float $rz = rand(0,180);
polyCut -pc ($px) ($py) ($pz) -ro ($rx) ($ry) ($rz) -ef 1 -eo 0 0 0 ($each);
polyCloseBorder ($each);
}
select -r ($each);
polySeparate ($each);
int $chk = `checkBoxGrp -query -value1 chkBox`;
if ($chk == 1)
{
DeleteHistory;
}
}
}