Grasshopper

algorithmic modeling for Rhino

hey, I'm pretty new to grasshopper and I'm working on a project using the image sampler. I'm creating a surface out of extruded rectangles based off the values out of the image sampler. I need to be able to control the heights of the extrusions by rounding up to the nearest number provided by a domain of heights that I would establish. Does this sounds possible? If so I also want to be able to control the amount of height variations.

Thanks

Views: 1926

Attachments:

Replies to This Discussion

Hi Arash,

 

if you want to round a number to a specific accuracy, you can use an expression to achieve that. Something like this:

 

1.6 * CInt(x / 1.6)

 

the above will round a number to the nearest entry in the sequences of multiples of 1.6 (0.0, 1.6, 3.2, 4.8, ..., 17.6, 19.6, andsoonadinfinitum).

 

If you want to round a number to the nearest value in a non-logical sequence, you can use the [Find Similar Member] component in the Sets panel. 

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks so much for the quick reply, I tried using the Find Similar Member component but my version of grasshopper only had one called similarity. I tried using it but I can't really control the outcome. I want to be able to give it the panels a range let say between 1-3 and then give it a specific number of variations allowed, like only 80 different heights can be generated and the rest of the panels would be rounded up or down to match with one of the 80 heights. would that be possible? 

Thanks

Attachments:

I think [Find Similar Member] is exactly what you need. If you can't find that component (Similarity does something completely different) then you should upgrade to a newer Grasshopper. 

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hey David,

Finally got the new grasshopper to work on my system, and i found the component you had mentioned. thanks again for you help, I'm going to try and figure out  how to use it now and see what i come up with

 

If quantization or [Find Similar Member] component doesn’t fit you —I encourage you to upgrade, too—, classifying your items by any property in order to set according to class whatever property you need to be set, maybe could help you. Group tagged Classify is the relevant part. More information is available here.

Classify items (say points from a grid, or circles, or rectangles to be extruded) by any parameter of your choice (say distance from attractor, or radius, or height of extrusion) allows you to set any property by class: radius, colour, or whatever, even height of extrusion.

 

 

An illustrative example:

 

                    1  Heights in [1, 17]

 

                    2  Subintervals: {[1, 2], [2, 2.03], [2.03, 4], [4, 9.1], [9.1, 16.99], [16.99, 17]}

 

                    New values:  {  0.3,      2.9,         5.5,       13.2,      15.0025,         17      }

 

                    Examples: 9.23 becomes 15.0025 and 1.7 becomes 0.3

 

Every height belonging to first subinterval —[1, 2]— becomes 0.3, every height in [2, 2.03] becomes 2.9, and so forth. Actually, every rectangle with its —old— height of extrusion belonging to a specific subinterval gets corresponding value according to 3 for its —new— height of extrusion.

 

In order to perform a true partition —classes— covering 1, boundaries should be a monotonically increasing succession, and subintervals should be half-open as far as boundaries (2, 2.03, 4, 9.1 and 16.99) can’t belong to more than one subinterval/class —classes are defined to be mutually exclusive and collectively exhaustive—, but this isn’t technically necessary; overlapping subintervals are allowed by creating duplicates: same rectangle is extruded twice (or more times) but different heights, also according 3, are used for each extrusion.

 

Notice that 3 could be even more exotic:

 

                   {0.01, 0.1, 0.02, -0.3, -0.05, -0.8}

 

                   {-5, 0, 3, 0, -1, 0}

 

                   {-11/2, -9/2, π, 5/2, -3/2, -1/2}

 

                   {O, T, R, F, V, S}

 

You’ll have to recycle classify by distance, but I think for sure it will help you. If you need further assistance, or you have any feedback, let me know.

 

Beltran,

I am having difficulty opening the ghx file from your previous post that you referenced above. I am not sure how to work around the error when opening... I am using Rhino 4 Sr9 along with Grasshopper 8.0013.  Your post and example are very helpful and I am hoping to work through it step by step. Thanks for explaining your approach... it is very helpful!

 

 

Attachments:

I've been trying to use the Find similar member component but i'm having no luck in making it do what I want, can anyone upload a simple demo ghx file?

thanks! 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

niice, thanks a lot! One question tho, what component is that (.1) I know its the equation you defined for me earlier but how do I type that into grasshopper? thanks again

The object with the 0.1 inside the black hexagon is the Number parameter. Its job is to convert the text I typed in the panel "1.5", "8.0" and so on into actual numbers.

 

The [Find Similar Member] component won't be able to find any common ground between the number 8.0 and the text "8.0".

 

All parameters in Grasshopper have icons that feature black hexagons and they can all be found in the Params tab.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Got it thank you sooo much! it works PERFECTLY now!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service