algorithmic modeling for Rhino
Hi All,
I was messing around a little in ghPython, selecting curves by their color or the color they got from the layer their in. I found a little discrepency in the names of the colors, if you type a string with green in a panel and convert it to color it gives you RGB: 0,128,0. But if you select the color green in select Color (for instance coloring the layer) it gives you RGB: 0,255,0. This is not the case for every color, for instance red works fine (255,0,0).
What I want to achieve is basically you enter a list of colors: red, green, blue etc. And the script selects the crvs accordingly.
I have the script running and working if you enter RGB values. But rather than entering the numeric values of a color, I would like to be able to enter the names (Like they are named in System.Drawing.Colors)
Any ideas and thanks!
Tags:
Hey Arie -
I think the names given to colors in the selection dialog do not in fact agree with the colors listed in System.Drawing.Color. System.Drawing.Color.Green is in fact 0,128,0. The color called "green" in that dialog is System.Drawing.Color.Lime.
Those colors are stored in in the Rhino Support folder. For me the location is
C:\Users\Andheum\AppData\Roaming\McNeel\Rhinoceros\5.0\Localization\en-US\Support\colors.txt
By referencing in that file to a definition, you can parse out the appropriate colors, like so:
Andrew,
Yes i found that one yesterday also, that lime in fact is green, as wel fuchsia is magenta etc.
Thanks a lot! Ill try this approach. I'm working on a script for drafting. Which basically sets the plotcolor and plotweight of a curve depending on its color (or the color that is asigned by it by the layer it is in). It is comparable with a .ctb file from autcad.
I really like your human plugin, my question is if i could send you my script if its done to maybe include it for your next release. I know a lot of people that use Rhino, but switch in the end to autcad because of the lack of a 'plotstyle'-option in Rhino. This could maybe be a first step to bridge this gap.
Let me know what you think :) and thanks for your help!
Arie
Please send it along - I'd be happy to include it as a component or example file with the next release! It would be great if it could affect objects that are colored both by layer and by object...
Andrew,
Here is the script I was working on, it is still a (very) beta version.
Select some curves as input and select the colors + lineweights you want to match and hit the activate button.
P.S. you need the ghpython plugin (here)
For now what the script does it deletes and adds the lines again to the document, which is a workaround for now. You managed for instance to change layercolors directly in your human plugin. I'm hoping you can achieve this also with lines, chaning plotcolor and weight etc. directly.
I hope this is usuefull for you and let me know your thoughts or if you need any help etc.
Cheers!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by