No random color

 From:  Frenchy Pilou (PILOU)
4517.10 
And how apply these new gradients styles to the selection of Objects ? :)

I know for apply them as random mode but with these new gradients in normal mode?
(by Michael)
script: /* Assign random styles to solids */ 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 style_index = Math.floor(Math.random() * styles.length); brep.styleIndex = style_index; }

Surely trivial but...
works only if number of objects <= numbers of styles
how make if numbers of object are bigger than the gradients and wanted cyclic result?
(of course i can reselect the no color objects and relaunch the script but... :)

something like this ? modification of the script above :)
script: /* Assign styles to solids */ 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 style_index = i; brep.styleIndex = style_index; }

here nice result for the gradients'style!

EDITED: 18 Sep 2011 by PILOU