Grasshopper

algorithmic modeling for Rhino



I'm a beginner with grasshopper, but had a somewhat specific question in regards to something I'm currently working on...I have a field of circles, with varying radii, all of which are resultant from a rectangular grid of points.  I want to apply colors to the model which would set a range for the radius and assign an appropriate color.  For example, any circles with a radius from value x to value y yields a certain color.  Any advice would be greatly appreciated.

 

Adam 

Views: 2020

Replies to This Discussion

Hi Adam,

 

it would be fairly easy to achieve if you had a smooth gradient (i.e. radius x yields red, radius y yields blue, radius in between yields purplish). Before I go off an throw an incredibly complicated example together, is there anything logical about the colour threshold values x and y? Like are they always multiples of 3.6 or something?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

 

Intervals between the radii and colors should be the same.  So for example, if the radius grows at a multiple of 3, it produces a new color.  Gradients between the two radii aren't significant at the moment. 

 

Thank you,

Adam

Ok, see attached. It uses an expression to convert a floating point number (the radius in this case) into an integer which can then be used to index a colour out of a hand-crafted list. the expression is:

 

Floor(x / mul)

 

Where Floor() is a function that returns the first integer smaller than or equal to whatever is inside the brackets. x is the variable you're working on (i.e. the radius) and mul is the multiple of N value.

 

 

You may want to make this expression more complex by adding constants to it or if you feel that your expression might result in invalid indices, you'll have to add limits to the result using Min() and Max() functions.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Hi Adam,

 

Have a look at Giulio Piacentino's Bake Attributes component to bake these colors ...

http://www.giuliopiacentino.com/grasshopper-tools/

 

 

Thanks Nick,

 

It seems to have worked! The only issue I'm having right now is that the default curve layer is being baked in addition to the colors I was looking for.

Adam

I just wanted to update with some of the progress I made by combining some of the code I had received in relation to my original post..The actual grasshopper file will follow once I get back to my other computer. 

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service