Color Gradient script?
 1-12  13-32  33-52  53-72  73-92

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

Previous
Next
 From:  bemfarmer
9676.28 In reply to 9676.27 
Hi Stefan
I think that the gradient colors, MUST present in the style list?
Which brings up managing an accumulation of colors.
Maybe MoI 5 will have Tabs or libraries of styles?

 Edit: aftersaving to .3dm, gradient styles could be deleted?

I'll continue to read this thread with interest.

-Brian

EDITED: 10 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.29 
Hi Brian,

the computed gradient colors must be in the browser, but what I mean only
after selecting the desired objects and once the script is run on these objects.

Because I think this would make it easier to manage the job better, when using
multiple gradients for multiple objects(groups).

And the computed styles must be present in the .3dm file, me thinks, because
when one wants later reuse the file, say for 3D printing etc. the colored objects,
it needs these styles.

The option, you mentioned, for deleting them could be an option of course.

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.30 
So color styles can be added to MoI, and are lost upon re-opening MoI, unless the MoI screen is saved as a .3dm file to the Moi "Template file" in AppData/roaming/Moi.
The current Template file location is shown in Options/General (?)

Saving Gradient colored objects to a .3dm file, in some other place, preserves their color style in the .3dm file.
Upon re-loading to MoI, the Gradient colors are added back to MoI's style menu, but not necessarily permanently.

- 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.31 In reply to 9676.30 
Hi Brian, yes that's correct, the styles list is saved to a .3dm file and will be restored when loading the .3dm file back again. If a template file is set, the styles in it will be used for the initial styles list when MoI starts up and when you do a File > New.

If you build up a set of styles that you want to save for later use, you should save to a .3dm file which will then contain them. That's the same as if you build up set of objects that you want to work on more later on. When you create an object it does not stay around permanently, they are saved to and loaded from files.

- 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.32 In reply to 9676.1 
Hi Stefan, give the attached plug-in a try.

For v4, install it into the MoI appdata commands folder and then set up a keyboard shortcut for CreateGradientStyles to trigger it.

It depends on objects being named and applies the gradient in the alphabetic order of the object names.

- 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
 

Reply to All Reply to All

 

 
Show messages:  1-12  13-32  33-52  53-72  73-92