try destroyDialog selectRandElements catch()rollout selectRandElements "Select Random Elements" width:205(label lblPercentage "Percent of total:" across:3 offset:[0,3]spinner spnPercentage width:50 scale:1 range:[0,100,10.] offset:[0,2]button btnSelect "SELECT" height:22 offset:[12,0]fn randomizeArray arr =(local arrayLength = arr.countfor i = 1 to arrayLength do(local index = random i arrayLengthswap arr[i] arr[index]))on btnSelect pressed doif selection.count > 0 AND (isKindOf (obj = selection[1]) Editable_Poly OR isKindOf obj Editable_Mesh) do(if heapSize < 102400000 do heapSize = 102400000local faces = #{}local obj_faces = obj.faces as bitArraylocal obj_faces_arr = obj_faces as arraylocal obj_faces_count = obj_faces_arr.countlocal op = if isKindOf obj Editable_Poly then polyOp else meshOplocal getElement = op.getElementsUsingFacelocal step = 100./spnPercentage.valuelocal elements = for i in obj_faces where obj_faces[i] == true collect(local element = getElement obj iobj_faces -= elementelement)randomizeArray elementslocal elements_count = elements.countfor i = 1 to elements_count by step dofaces += elements[i]obj.selectedFaces = facesmax modify modesubObjectLevel = 4completeRedraw()))createDialog selectRandElements
USAGE: Run the script, enter desired value (in percent), select a mesh and press the SELECT button.
DISCLAIMER: All scripts and snippets are provided as is under Creative Commons Zero (public domain, no restrictions) license. The author and this blog cannot be held liable for any loss caused as a result of inaccuracy or error within these web pages. Use at your own risk.


 
 
 


This Post needs Your Comment!
Nice thank you mate
Excellent tool! Thnx a lot!
Leave a Comment