Grasshopper

algorithmic modeling for Rhino

# Lists, Sets, Strings & Trees

Can someone please direct or tell me the differences between these different data management systems... I understand the basic concept of the branch data, but don't really understand how to use the sets and strings... please help... Thanks

Views: 34091

### Replies to This Discussion

There's two approaches that make sense to me:

1. Create Breps for all plots minus all building outlines. This is probably quite a slow solution, as it involves making a lot of breps with region boolean operations.
2. Calculate the area for all plots, the areas for all buildings and subtract the correct ones.

I'd start with approach #2. First you calculate the areas of all buildings. This also gives you the area centroid. You figure out which plot region contains each centroid and use that relationship to modify the plot areas.

I may have time later today to make a small example, or maybe not, depends on whether my cat shows up out of its own volition or whether I have to go search for it outside.

Couldn't figure out the fast way. There must be some combination of Tree Statistics, Mass Addition, Replace Paths and List Item that does it right, but I can't figure it out.

Attached is the slow way.

Attachments:

Here's a fast(er) solution:

Assuming: Plots don't overlap, and each building resides in one plot only:

1a. Take the polygon center (fastest, take area if you need to because there are curves) of each building. (Works for concave shapes).

1b. Compare the distance of each block center to the distance of all building centers. Might stop working if any of the shapes used are concave (not convex).

2. Use the Point in curves to deterimine which curve resides in which plot

3. Use the index output to set the path of each curve to the path of it's matched plot.

4. Add back empty paths for the plots to the list that do not have a building. (So the paths of the buildings and the paths of the plots are the same. (Keep in mind that clusters can't handle empty paths, so you should replace empty paths with a bogus value).

5. If you now add the building to the grouped plot path you can easily do a planar surface.

I've added two solutions, I generally use two or three components in C# for this (Many-to-Many matching/grouping):

1. To manually set a path. (Set path: sets one path for each branch in a tree)

2. To ensure path equality. (Make sure that for every path that exists in tree A will also exist in tree B, the result may contain empty branches)

3. To replace null branches (Similar to replace null, except you replace empty branches)

Attachments:

Hi both,

Thanks for the solutions, i just need to try and understand how they work now! Pretty new to Grasshopper so i'm not familiar with all the plugs.

Most appreciated, thanks!

• View All