Grasshopper

algorithmic modeling for Rhino

hi guys,

how can I array 2D objects "squares" in a 2D region "rectangular"

I could only choose the total number of objects and the cell but not the region!

I tried to use populate 2D but it gave me random positions which I don't know.

my aim is to spread squares like a grid in a big rectangle, by choosing the percentage between the total areas of all squares and the area of the big rectangle. for examples I want the squares to cover 80% of the rectangle.

the closest thing I could get is by arraying 1X1 small square to cover the whole rectangle, then i scale the small square by 0.8. but the final area was less than 80% so that didn't work well but it is the best I could do.

any idea of a better way to do that?

Cheers,

Ahmad

Views: 1450

Attachments:

Replies to This Discussion

Hello Ahmad,

My 1st comment is that scale doesn't "work" on areas but on dimensions. So you would need the square root of the scaling factor for areas. See this discussion for more details: http://www.grasshopper3d.com/forum/topics/whats-wrong-with-the-scal...

Secondly, I should notice that it is not guaranteed that you can fill a rectangle with squares. It depends on the rectangle's dimensions. So you should decide what is more important for you: to have a square grid that does not fill the rectangle exactly, or to have a rectangular grid that fills it.

If it is the second you can either get the rectangle's dimensions and divide them by the number of grid cells to get the cell's dimensions, or you can treat the rectangle as a surface and use [DivideSurface] component to get the grid.

edit

I just saw that you don't mention anything about the number of squares of your grid. In case this is not a constrain, then you CAN actually fill the rectangle with squares, by calculating the greatest common divisor and using this as square size...(that is option number 3)

Thank you very much, that was so helpful,

I added a sq.root to scale the area instead of dimensions. and it worked exactly as I want. 

to answer your questions:

the rectangle is 62 X 125 so a grid of 1x1 squares will spread fine and scaling each squares will also work fine. 

here is a copy if what I've done in case some one faced the same problem. I used 0.8 scale and the ratio of areas is 0.8.

cheers 

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