Grasshopper

algorithmic modeling for Rhino

I try here to answer from a question on discourse

https://discourse.mcneel.com/t/fill-an-rectangular-area-with-predef...

Fill an rectangular area with predefined elements

https://discourse.mcneel.com/t/subdivide-given-area-into-randomly-s...

I add some difficulties to resist and to do it with Grasshopper and Anemone. I know it is surely more simple in C# or other program. Peter Fotiadis will be sad, but I did it in GH, it is quite long but it seems to work. The idea is to generate a grid of point, to take a random point on it, to generate a rectangle with a random incremental size (1, 2, 3, 4 in width and the same in height in my example) so look if this rectangle contains all the points of the grid, if yes put this rectangle on memory, destroy the points on contact and redo it until grid is empty. 

Views: 23002

Attachments:

Replies to This Discussion

I add a stop and some coloring of lines and cells. Anemone plugin Mandatory. Human not mandatory.

Attachments:


A vers

Attachments:

OK, it works great thing !

I know I have no right to ask for anything, this is already pretty cool, but could this also work with a number of predefined blocks? 

I really feel stupid because I cannot do it myself, is there maybe something else I could do for you? At least I can send you a bottle of wine?

best

Andreas

Yes you have right to ask. There are many passionate on this forum.

 It is surely possible and seems "quite" simple, but not before tonight or tomorrow night. GH is just for my free time.

The idea is make a heap (2 lists/tree) with big rectangle first, then the medium, then the littles ...

so do a list/tree like that

{4 4

4 4

...

1 1 }

try to place the first => if OK delete first item of list if NOK retry with first ... it must work but it also surely could be blocked in some cases.

Ok it is done, you will have to fill 3 gene pool with same number of line. Each for one shape, one for the width (in number of cells), the other the height (in number of cells) and the last the number of shapes types. Begin by the shapes with bigger surfaces. I suppress "physical" size of cell, not very useful, you just need to make a scale. I will try to update the script to count for try and if too many try suppress the shape. 

Attachments:


I added some tests, the algorithm search n times to put a rectangle, after the number of try it delete its shapes and goes to the other. Take care not to put too many "big" rectangles it will try each ones. 

Attachments:

Hello Laurent,

I am playing with it for an hour now... it is great!,

maybe I am too stupid to understand, or I was not making myself clear enough, but Is it possible to modify it in a way that the algorithm would produce rhino blocks ( which then could be modified / replaced later on in rhino) instead of surfaces ?

Again, please excuse me asking without beeing able to contribute in this case...

best

Andreas

 

I don't work with blocks but I understand that you want to modify a type of block and then everything's with the same size will be replaced. It is surely more simple to use the surfaces to sort them by family with sets components and transform them in blocks.

I was able to transform surface in blocks. You will need Panda plugin because I didn't find other block components. 

Here, I assume that the block base point is on the middle. All the blocks are moved on {0,0,0}

To classify the surface in sets I transformed a surface in an integer that will be the same for one type of surface. I used here (Width+10*Height) of each surface. If width is less than 10 it will be OK. With this integer I get an index for each set. 

I have 6 types of surfaces and so 6 blocks. The genepool is used to make a relation between one block and one type of surface.

Hope it is clear !

Attachments:

I am downloading your new version ...will post feedback ASAP

thanks!

Andreas

hi Laurent,

I was wondering if you can apply the same logic into a given area..see attached. I am working on your definition a while but i did not managed to have any result. Can you assist please????

Best

Theo


I just saw your mrssage. Can you post on discourse?

Yes it is possible on whatever shape. On my phone at the moment.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service