Color Gradient script?
 1-16  …  37-56  57-76  77-92

Previous
Next
 From:  Frenchy Pilou (PILOU)
9676.77 In reply to 9676.76 
The hidden function is "ExplodeMove" native you must Press Tab and write it (with any capitals (so EXplodeMOVe is valid) but without Spaces! ;)
You can also make a shortCut
And it's present also if you have installted the List Scripts/Commands helper...for me the more speedy trick! ;)

EDITED: 15 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:  bemfarmer
9676.78 
ExplodeMove is in Max's CustomUI, at the top of his Scripts menu.
- 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:  Mindset (IGNITER)
9676.79 
Is there some way that a version of the Color Gradient script could apply its effect to the vertices of a obj export (file)?
  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.80 In reply to 9676.79 
Hi Mindset,

re:
> Is there some way that a version of the Color Gradient script could apply its effect
> to the vertices of a obj export (file)?

Sorry no there isn't any way to set them individually, faces in .obj export will inherit the color of the surfaces they were generated from.

To manipulate individual mesh vertices you would need to do that in a polygon mesh editing program.

- 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:  GonzoRus
9676.81 
Hi.

Please tell me how to assign hotkeys for the following actions:

1. Assign a fixed color to selected curves?

2. Assign a fixed color to all curves?

The color will be assigned in advance in the script:
"var red = XX, green = XX, blue = XX"

For version 3.0

All gradient scripts are very cool, but sometimes I need to quickly assign a color with hotkeys to individual curves or all curves.

I understand that the script will be like this:

"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;} "

only for a single color and only for curves.

tried to edit this script, but I lack knowledge of syntax)
  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.82 In reply to 9676.81 
Michael provided code for changing styles, used in the script for Jacobian function graph script, a few years ago. Do not know if you already have all of the code.

-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:  Frenchy Pilou (PILOU)
9676.83 
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; }





---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Message 9676.84 deleted 19 Dec 2020 by BEMFARMER

Previous
Next
 From:  GonzoRus
9676.85 
I probably explain it wrong)

I need a simple script.

Just a fixed color. Color predefined in the script.

I understand color definition like this: red = XX, green = XX, blue = XX


1. all curves is assigned a color red = XX, green = XX, blue = XX (one fixed color)

2. the selected curves are assigned a color red = XX, green = XX, blue = XX (one fixed color)




only in MOI v.3 language for MOI to understand :)
Attachments:

  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.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

  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:  GonzoRus
9676.87 
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; }

This script does not work quite correctly. It makes ALL curves the same specified color (color 0, 1, 2, 3, etc.) existing in the Style Menu. BUT. "Undo" and "Redo" stop working for styles.



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; }

This script does not work correctly, it assigns different colors to the curves)
  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.88 In reply to 9676.87 
Hi GonzoRus,

I concur with you. The same failure to "save" to history occurs in both MoI3 and MoI4beta.
Pushing enable history seemed to make no difference.

A test with multiple color changes, MoI3 or MoI4beta:
Create a few Black curves, and save .3dm.
Change the color of the curves to Green, using Style menu.
Change the color of the curves to Purple, using Style menu.
Change the color of the curves to Magenta, using Style menu.
Change the color of the curves to Red, with the RED script, OR to multi-colors, with the "multi-color" script.
Change the color of the curves to white, using Style menu.
Undo History is not saving the RED colored curves, but History is saving all of the other colored curves, as per multiple pressing of undo.
Similar for Redo History.

- Brian

The same applies to the script which applies "rainbow" colors to solids.

I would call it normal behavior, but not the desired behavior?
Is there some way to enable history for these color scripts?

EDITED: 19 Dec 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:  Michael Gibson
9676.89 In reply to 9676.87 
Hi GonzoRus,

re:
> This script does not work quite correctly. It makes ALL curves the same specified color
> (color 0, 1, 2, 3, etc.) existing in the Style Menu. BUT. "Undo" and "Redo" stop working
> for styles.

Please give these versions a try:

/* Assign selected curves to style = Red */ var starting_selection = moi.geometryDatabase.getSelectedObjects(); var curves = starting_selection.getCurves(); moi.geometryDatabase.deselectAll(); curves.setProperty( 'selected', true ); var style = moi.geometryDatabase.findStyle( 'Red', false /*Create if not found*/ ); if ( style ) { moi.ui.propertiesPanel.editStyleIndex( style.index ); } moi.geometryDatabase.deselectAll(); starting_selection.setProperty( 'selected', true );

/* Assign all curves to style = Red */ var starting_selection = moi.geometryDatabase.getSelectedObjects(); var curves = moi.geometryDatabase.getObjects().getCurves(); moi.geometryDatabase.deselectAll(); curves.setProperty( 'selected', true ); var style = moi.geometryDatabase.findStyle( 'Red', false /*Create if not found*/ ); if ( style ) { moi.ui.propertiesPanel.editStyleIndex( style.index ); } moi.geometryDatabase.deselectAll(); starting_selection.setProperty( 'selected', true );

These use the properties panel mechanism for applying the style index, it's what is used when you assign a style by clicking on the style name in the properties panel and it does the extra work to set up an undo unit to make it work with undo. The properties panel only modifies the current selection so for the version that does all curves it modifies the selection first and then restores it afterwards.

- 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:  GonzoRus
9676.90 
Thanks Michael!

Everything works great with your scripts.

Undo and Redo work great. Thank you!)
  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.91 In reply to 9676.89 
Both shortcuts work!

A minor observation:

For customUI shortcuts "gearpair" icon menu, add the ! i.e. /*!

Also, the second comment /*Create if not found*/ causes the customUI gearpair icon to display all of the code up to the last */, which is a long line of text in the menu.
so I removed the second comment /*Create if not found*/, in the installed shortcut.

- 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
 From:  GonzoRus
9676.92 
Script for assigning "Magenta" color to selected faces.

code:
/* Assign selected faces to style = Magenta */ var starting_selection = moi.geometryDatabase.getSelectedObjects(); var faces = starting_selection.getFaces(); moi.geometryDatabase.deselectAll(); faces.setProperty( 'selected', true ); var style = moi.geometryDatabase.findStyle( 'Magenta', false /*Create if not found*/ ); if ( style ) { moi.ui.propertiesPanel.editStyleIndex( style.index ); } moi.geometryDatabase.deselectAll(); starting_selection.setProperty( 'selected', true );


"Magenta" can be changed to any color from the existing styles.
  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-16  17-36  37-56  57-76  77-92