Randomize spheres in a specified area

 From:  Frenchy Pilou (PILOU)
10037.2 In reply to 10037.1 
For the Colors or other thing you have this random selection
change the % as you want

script: /* Rand selection object */ var percent = 30; var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { if ( Math.random() * 100> percent ) objs.item(i).selected = false; }

script: /* Random style existing to Face and edges selected*/ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); var edges = brep.getEdges(); for ( var j = 0; j < edges.length; ++j ) { edges.item(j).styleIndex = Math.floor(Math.random() * styles.length); } var faces = brep.getFaces(); for ( var j = 0; j < faces.length; ++j ) { faces.item(j).styleIndex = Math.floor(Math.random() * styles.length); } }



If you have SKetchUp you can use a free plugin "MS Physics" for make fall some any spheres (or any objects) in any volumes for have exactly that you want! :)
I don't believe that Moi has yet collision ?


BY Pierre Audouin with my technic in SKetchUp ;)

EDITED: 21 Nov 2020 by PILOU