algorithmic modeling for Rhino
I started with this idea:
I wanted to add new data fields to a list of geometry, based a existing value associated with the geometry.
My solution is below as image, and .gh
My question is how can it be done in a sexy way or more elegantly with python code. It seems like a lot of components for a simple task.
Tags:
i am not really sure if you want the output to be a color value (R,G,B) or a in text as you did in the def. above (sml,lrg,med,....)
if you want the color value, you can use this one:
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghcomhueList = [ rs.CurveArea(crv)[0]/50000 for crv in crvList ]
a = [ ghcom.ColourHSL(1,h*0.75) for h in hueList ]
but you should tweak the 50000 as the max value (you can also let python to determine the max value by using max() function) you should also tweak 0.75 as the range of colors you want to use starting from red (you can try adding a value to start from another color, e.g: 0.5+h)
i wrote another script if you want to specify the size (sml,lrg,med,....), you can find both in the attachments
I like what you have written, however there are two short comings, and perhaps I should have explained more in the initial post.
First, with your scripts, each bin is determined within the code, or colors are simply mapped onto a gradient.
second, the goal is: given a list of information, how to associate with new fields, or information.
I just wrote this script and I think it functions well. It takes the list, its keys, and their associated new key. and returns a list of the new keys assigned.
the script simply maps the list of curves to a gradient of colors through Hue value based on their areas that range from 0-->50000, e.g: if my gradient is from red to blue, then the closer the number to 50000 it will have more blue and less red, and vice versa...
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by