Color Gradient script?
 1-7  8-27  28-47  48-67  …  88-92

Previous
Next
 From:  amur (STEFAN)
9676.8 
Hi Michael,

i just send you some splines I am currently working on. If it is required to
use surfaces or solids I will resend the same file this afternoon or evening.

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.9 
Hi Brian,

thanks a lot! I will have to take a look, even If I am not much familar
with NodeEditor.

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
9676.10 
There was this gradient...by Michael ;)

script: /* Gradient Styles */ var red = 12, green = 15, blue = 20; for ( var i = 1; i <= 100; ++i ) { var style = moi.geometryDatabase.addStyle(); style.name = 'Gradient ' + i; style.color = (Math.abs(red%256)<<16) | (Math.abs(green%256)<<8) | Math.abs(blue%256); red += 2; green += 3; blue -= 7; }

Pas possitif= Positive Steps
Framboise = Raspberry
Vers du Bleu des mers du sud = Toward South Sea blue
La case fait 2.55 = Box width is 2.55
130 en 100 cases = 130 in 100 boxes

Il faut donc écrire dans le script = So you have to write in the script




EDITED: 9 Feb 2020 by PILOU

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.11 
Oh, cool Pilou!

But I can not get it to work ... :-(

I select all my splines and run the shortcut but the script then
writes all color styles in the browser, but does not apply the
colors to the selected splines. :-(

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
9676.12 In reply to 9676.11 
It looks like the script referenced by Pilou only creates the color styles, as stated in French it doesn't write to the geometry.

Eight !! years ago, Michael provided help in how to write color styles to objects, in one of the scripts that I was
working on. It was the Gradient script. Also used in the JacobianFunctionGraph script.

https://moi3d.com/forum/index.php?webtag=MOI&msg=5592.5

- Brian

EDITED: 9 Feb 2020 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.13 
Ah, o.k.

meanwhile I also found the second script in Pilou's old thread.

So, one has to create two shortcut keys, one for creating the
styles and one for applying all the styles, including the standard
ones.

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
9676.14 
Yes sorry i have forgotten this one!
was descripted on my Gradient page as link! :)
http://moiscript.weebly.com/make-gradient-styles.html
http://moiscript.weebly.com/assign-styles-to-solids.html

script: /* Assign styles to solids*/ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); var style_index = 0; for ( var i = 0; i < breps.length; ++i, ++style_index ) { if ( style_index == styles.length ) { style_index = 0; } var brep = breps.item(i); brep.styleIndex = style_index; }

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
9676.15 In reply to 9676.14 
There is also an "Assign styles to curves version".
Both have been in my shortcut keys for a long time...:-)
- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9676.16 In reply to 9676.13 
Hi Stefan, does the above stuff do what you need or did you need something different?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.17 
Hi Michael,

I did a quick test and I don't know how to get rid of the main MoI colors when applying the gradient.

What I had like seen, as I described, is to have in the script a way to select a starting and an end
color, while the script computes then the steps betweenthose two colors.

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
9676.18 In reply to 9676.17 
Suggestion:
Place the desired gradient colors at the end of the color styles list, and note the index of the first gradient color. If there were say 10 colors before the gradient start style, their indexes would be 0 thru 9, and the style index of the first gradient color would be 10, due to zero indexing.
Edit the script to start at style index 10. If gradient colors run out, reset index to 10.
Or a Moi script with .htm could be written...
- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9676.19 In reply to 9676.17 
Hi Stefan,

> What I had like seen, as I described, is to have in the script a way to select a starting and an end
> color, while the script computes then the steps betweenthose two colors.

It should be possible to make a script that does this.

What color space do you want to use for specifying the colors?

If using RGB colors, going from Red to Red like you mentioned above would only yield red for all the steps in between.

But something using Hue, Saturation, Value colors could probably give more of a rainbow type effect.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9676.20 In reply to 9676.17 
Hi Stefan,

re:
> I did a quick test and I don't know how to get rid of the main MoI
> colors when applying the gradient.

If this is the only problem, I think you could solve it by deleting the main MoI styles, then apply the gradient, then use "Add default styles" on the Styles menu in the Scene browser to bring back in the regular default MoI styles again.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.21 
Hi Michael,

that would be super awesome if you could do that and HSV color space would be perfect.

For the second question, thanks for the info, but I think workflow wise it is not so pratical,
like what I have suggested. For example if one has many splines or objects, select groups
of them each time, to colorize them with your script individually.

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Karsten (KMRQUS)
9676.22 In reply to 9676.21 
Hello Stefan,

would you show an example of what you want to do?

Have a nice day
Karsten
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.23 
Hi Brian,

thanks for the suggestion. I must admit, while I like to try out things It would
IMHO not the best workflow for users, whishing to apply a gradiend (rainbow)
to selected splines or objects.

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.24 
Hi Karsten,

I had years ago done many things like this with Shade3D and a Gradient plug-in,
but unfortunately I no longer have that data to show, due to a harddisc crash,
while not keeping back-ups.

To explain it again: A user should have the option via a script to select two
colors, a starting and an end color (HSV color space, like Michael suggested)
so that he/she will have later a gradient on prior selected splines or objects
as style colors applied.

This would be IMHO very appreciated (at least by me) for people doing
mathematical line drawings with MoI or when used for example on arrayed
solids or surfaces etc. Possibilities are endless with this colorizing option.

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.25 
Hi Karsten,

this free Vector Artwork (I don't remember the author etc.) would be IMHO a perfect
example to apply various gradiends on and then later presented on a black background
or rendered as glowing light paths etc.

flora2

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
9676.26 In reply to 9676.23 
Hi Stefan,

I think that a traditional Moi script, with user interaction would be relatively easy.

Outlining the steps, defining the requirements:

Have an existing styles set with good candidates for start and end colors.
Get style index for next new style color to be added to styles.
Select objects.
Select start color.
Select end color.
Code will have loop(s).
Compute HSV gradient, and save each color to end of Styles list.
Cycle through objects, and gradient styles by index, and sequentially apply the colors.
Option:Delete the new gradient styles.

-B
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  amur (STEFAN)
9676.27 
Hi Brian,

that sounds very good. I would prefer however that the styles, if I understand you corectly,
are not been added to the browser list, prior selecting the objects, and cycle through both.

My wish, if possible, would be that one (like you describe) can define his/her gradients by a start
and end color, select the desired objects or splines and then run the script to apply the gradient(s).

Anyways, whatever shows up in this regard will be much appreciated!

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-7  8-27  28-47  48-67  68-87  88-92