Grasshopper

algorithmic modeling for Rhino

Hey guys,

I'm am trying to randomize three different objects (square, circle, and cylinder) on a point grid. I am having trouble assigning different values to the geometry so from the base reference point it can either run the square, circle, or cylinder.

I think using some sort of boolean list command might be most successful? I have separated my randomly generated list of values but perhaps somehow need to assign value, or set a condition in order to reference the different geometries? Help would be greatly appreciated! 

Thank you

Views: 2416

Attachments:

Replies to This Discussion

I'm not sure if this is what you want, or if it's the best way...

  1. I created a list of geometries (the "Geo" component) that contains your Sphere, Box and Cone.
  2. I generated a list of random numbers between 0 and 1 with 'N' supplied by the length of your list of start points.
  3. I multiplied each of the random numbers by the length of the "Geo" list (3) and used 'Round' to get the 'Floor (F)' of the result (0 to 2).
  4. I used those values as the 'Index (i)' for 'List Item', passing the results to the 'Geometry (G)' input to 'Orient', along with the list of end points.

Attachments:

Awesome that's exactly what I had in mind, if you don't mind could you explain why you multiplied the random values and the geometry list and also what the difference of plugging in the nearest, floor, or ceiling list does to the list generated? They seem to generate different list values, are they just three different random options?

Thank you for the response!

I'm a newbie :)

Multiplying the 0..1 random values by the length of the "Geo" list (3) is intended to generate random values of 0, 1 or 2, corresponding to the Sphere, Box and Cone.

The three outputs of the 'Round' component - 'N (Nearest)', 'F (Floor)' and 'C (Ceiling)' - are standard math terms for obtaining an integer from a floating point value: Floor and ceiling functions

Actually, I probably did that wrong...  It should be (length-1) and 'N (Nearest)'.

By the way, you don't need to use Rhino geometry for your grid of points; they can be generated in GH, or you could use the "Internalize data" feature of your first 'Point' component to save the data in the GH file and disconnect it from Rhino.

Attachments:

Hello Will.

In order to get random integers corresponding to your geometry, you can :

- generate random numbers betweem 0 and 1, multiply them by the number of optional geometries (in your case 3) to get numbers between 0 and 3, round these values to get an integer (if you have 1.8665865548 Floor value will be 1, Ceiling value will be 2, and Nearest will be 2) and use the result for the List Item component. That is what Joseph did here.

- or you can also use the range input of the random component with the geometry list lenght and the integer option of the random component (with right click) like shown below.

In both case, you get the same result !

Good luck !

Yeah, as I was drifting off to sleep last night, I realized I could probably have configured the 'Random' component to generate integers in a range but didn't think it was important enough to get out of bed.  :)  Then when I looked this morning, I didn't notice the "Integer Numbers" option on the 'Random' component - thanks for mentioning it.  Revised code attached.

P.S.  Your code is generating values from 0..3 instead of 0..2 - there are only three geometries to choose from: Sphere, Box and Cone.  As I noted earlier, it should be (length-1) to get 0..2 as the index value for 'List Item'.

Attachments:

Hey Joseph and FRiou,

Thank you for the assistance learning lots and super fun. I played a bit more, adding random sizing and double stacking to the objects. I have a problem stacking the objects so there isn't a gap between them. Before randomizing the geometry size it was fine for me to multiply the referenced radius multiply it by 2 and move the geometries. Now that sizes are randomize this approach doesn't seem to work. Also is there a way to reorganize the geometries into their separate shapes so I can bake them and organize them as squares, cylinders, and circles?

Help would be greatly appreciated!

Thank you

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service