Color Gradient script?

 From:  bemfarmer
9676.86 In reply to 9676.85 
Hi GonzoRus,

I think that the desired colors need to exist in the Styles menu???

An existing script is:
code:
script: /*!Assign styles to curves */ var styles = moi.geometryDatabase.getObjectStyles(); var curves = moi.geometryDatabase.getObjects().getCurves(); var style_index = 0; for ( var i = 0; i < curves.length; ++i, ++style_index ) { if ( style_index == styles.length ) { style_index = 0; } var curve = curves.item(i); curve.styleIndex = style_index; }


By a minor edit to this existing script, try out the following experimental script.
(I changed color from Black to Red, and deleted incrementing ++style index.)

TRY
code:

script: /*!Assign RED style to ALL curves */ var styles = moi.geometryDatabase.getObjectStyles(); var curves = moi.geometryDatabase.getObjects().getCurves(); var style_index = 1; for ( var i = 0; i < curves.length; ++i ) { var curve = curves.item(i); curve.styleIndex = style_index; }



- Brian
I'll leave any more up to the experts.

EDITED: 19 Dec 2020 by BEMFARMER