Script to assign colour to objects
All  1-7  8-11

Previous
Next
 From:  Michael Gibson
11193.8 In reply to 11193.7 
Hi shayne, I'm glad that was what you needed. For MoI version 4 or v5 the returns should be removed automatically when you paste it in.

- 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:  shayno
11193.9 In reply to 11193.8 
Thanks Michael
I am tempted to upgrade to ver4 but my ver3 is so custom now and full of scripts I feel it would be time consuming to change it .
I have previously reconfigured the sidepane to only have the commands I use and only 2 panels so not split for construct/ transform etc
I have colours I use for everything and a single key press I find is very fast to access them.
would it be difficult to script to hide a specific colour say r 207 g 194 b 37 ?
kind regards
shayne
  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
11193.10 In reply to 11193.9 
Hi shayne,


re:
> would it be difficult to script to hide a specific colour say r 207 g 194 b 37 ?

Try this:

code:
script: var r = 207, g = 194, b = 37;
var rgbcolor = (r << 16) | (g << 8) | b;
var style_index = -1;
var styles = moi.geometryDatabase.getObjectStyles();
for ( var i = 0; i < styles.length; ++i )
{
    var style = styles.item(i);
    if ( style.color == rgbcolor )
    {
         style_index = i;
         break;
    }
}

if ( style_index != -1 )
{
     var objs = moi.geometryDatabase.getObjects();
    for ( var i = 0; i < objs.length; ++i )
    {
        var obj = objs.item(i);
        if ( obj.styleIndex == style_index )
        {
            obj.hidden = true;
        }
    }
}


- 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
 From:  shayno
11193.11 In reply to 11193.10 
Hi Michael
Do you have a donation box so I can give you some money ?
cheers
shayne
  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: All  1-7  8-11