Hi Pilou, so here's an updated script for assigning random colors:
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; }
This script also assigns the style to the parent object instead of only to sub-object edges and faces like the previous one that I sent you by PM - if you use this script instead of the previous one to assign the colors then it won't have the tricky behavior with the invert selection.
- Michael
|