Lists, Sets, Strings & Trees - Grasshopper2024-03-29T07:13:48Zhttps://www.grasshopper3d.com/forum/topics/lists-sets-strings-trees?commentId=2985220%3AComment%3A623267&feed=yes&xn_auth=noHi both,
Thanks for the solu…tag:www.grasshopper3d.com,2014-12-24:2985220:Comment:11945122014-12-24T15:21:24.767ZJessica Hillamhttps://www.grasshopper3d.com/profile/JessicaHillam
<p>Hi both, </p>
<p>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. </p>
<p></p>
<p>Most appreciated, thanks!</p>
<p>Hi both, </p>
<p>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. </p>
<p></p>
<p>Most appreciated, thanks!</p> Here's a fast(er) solution:
A…tag:www.grasshopper3d.com,2014-12-20:2985220:Comment:11923122014-12-20T13:06:57.995ZArendhttps://www.grasshopper3d.com/profile/Arend
<p>Here's a fast(er) solution:</p>
<p>Assuming: Plots don't overlap, and each building resides in one plot only:</p>
<p>1a. Take the polygon center (fastest, take area if you need to because there are curves) of each building. (Works for <a href="http://en.wikipedia.org/wiki/Convex_and_concave_polygons#Convex_polygons" target="_blank">concave shapes</a>).</p>
<p>1b. Compare the distance of each block center to the distance of all building centers. Might stop working if any of the shapes used…</p>
<p>Here's a fast(er) solution:</p>
<p>Assuming: Plots don't overlap, and each building resides in one plot only:</p>
<p>1a. Take the polygon center (fastest, take area if you need to because there are curves) of each building. (Works for <a href="http://en.wikipedia.org/wiki/Convex_and_concave_polygons#Convex_polygons" target="_blank">concave shapes</a>).</p>
<p>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 <a href="http://en.wikipedia.org/wiki/Convex_and_concave_polygons#Convex_polygons" target="_blank">concave (not convex)</a>.</p>
<p>2. Use the Point in curves to deterimine which curve resides in which plot</p>
<p>3. Use the index output to set the path of each curve to the path of it's matched plot.</p>
<p>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).</p>
<p>5. If you now add the building to the grouped plot path you can easily do a planar surface.</p>
<p></p>
<p><a target="_self" href="http://storage.ning.com/topology/rest/1.0/file/get/2768938679?profile=original"><img width="721" class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2768938679?profile=RESIZE_1024x1024" width="721"/></a></p>
<p></p>
<p>I've added two solutions, I generally use two or three components in C# for this (Many-to-Many matching/grouping):</p>
<p>1. To manually set a path. (Set path: sets one path for each branch in a tree)</p>
<p>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)</p>
<p>3. To replace null branches (Similar to replace null, except you replace empty branches)</p> Couldn't figure out the fast…tag:www.grasshopper3d.com,2014-12-19:2985220:Comment:11919052014-12-19T22:21:34.477ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>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.</p>
<p></p>
<p>Attached is the slow way.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768938929?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768938929?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p>
<p>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.</p>
<p></p>
<p>Attached is the slow way.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768938929?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768938929?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p> There's two approaches that m…tag:www.grasshopper3d.com,2014-12-19:2985220:Comment:11918972014-12-19T20:50:58.426ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>There's two approaches that make sense to me:</p>
<ol>
<li>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.</li>
<li>Calculate the area for all plots, the areas for all buildings and subtract the correct ones.</li>
</ol>
<p></p>
<p>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…</p>
<p>There's two approaches that make sense to me:</p>
<ol>
<li>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.</li>
<li>Calculate the area for all plots, the areas for all buildings and subtract the correct ones.</li>
</ol>
<p></p>
<p>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.</p>
<p></p>
<p>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.</p> Hi, thanks for your help.
Th…tag:www.grasshopper3d.com,2014-12-19:2985220:Comment:11917902014-12-19T20:03:59.778ZJessica Hillamhttps://www.grasshopper3d.com/profile/JessicaHillam
<p>Hi, thanks for your help. </p>
<p>The rhino file looks like this, generally there is 1 building per plot, but sometimes there are more yes. <a href="http://storage.ning.com/topology/rest/1.0/file/get/2768939105?profile=original" target="_self"><img class="align-center" src="http://storage.ning.com/topology/rest/1.0/file/get/2768939105?profile=RESIZE_1024x1024" width="721"></img></a></p>
<p>So each plot and each building is a separate polygon/curve. I have used the area plug in GH which generates a centre point also. I was wondering whether i could match the buildings to the plots by the centre points using distance,…</p>
<p>Hi, thanks for your help. </p>
<p>The rhino file looks like this, generally there is 1 building per plot, but sometimes there are more yes. <a href="http://storage.ning.com/topology/rest/1.0/file/get/2768939105?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768939105?profile=RESIZE_1024x1024" width="721" class="align-center"/></a></p>
<p>So each plot and each building is a separate polygon/curve. I have used the area plug in GH which generates a centre point also. I was wondering whether i could match the buildings to the plots by the centre points using distance, but i'm not sure how to go with that either. </p>
<p></p>
<p>If the buildings and plots were 1 to 1 would there be an easier solution? </p>
<p></p>
<p>Thanks </p> Without seeing the Rhino file…tag:www.grasshopper3d.com,2014-12-19:2985220:Comment:11918892014-12-19T19:54:32.171ZJason Wheelerhttps://www.grasshopper3d.com/profile/JasonWheeler
<p>Without seeing the Rhino file it's a little hard to tell you how to solve your problem, but the "Sort List" component sorts the list you input numerically from the lowest to the highest I believe.</p>
<p></p>
<p>Is the relationship of the Buildings and plots 1 to 1? Meaning is there one building in every one plot? or does it vary?</p>
<p>Without seeing the Rhino file it's a little hard to tell you how to solve your problem, but the "Sort List" component sorts the list you input numerically from the lowest to the highest I believe.</p>
<p></p>
<p>Is the relationship of the Buildings and plots 1 to 1? Meaning is there one building in every one plot? or does it vary?</p> Hi,
I'm pretty new to Grassh…tag:www.grasshopper3d.com,2014-12-19:2985220:Comment:11919282014-12-19T18:09:20.853ZJessica Hillamhttps://www.grasshopper3d.com/profile/JessicaHillam
<p>Hi, </p>
<p>I'm pretty new to Grasshopper and i'm using it for a unit of my Masters. </p>
<p></p>
<p>The problem is: </p>
<p></p>
<p>I have 2 sets of curve(polygon) data. Set 1 is small building outlines. Set 2 is the plots of land which the buildings sit. There are over 2000 of these entries (Its a small village).</p>
<p></p>
<p>I am trying to figure out the way that grasshopper sorts lists using the sort list tool. I basically want to calculate the area of the buildings and the individual…</p>
<p>Hi, </p>
<p>I'm pretty new to Grasshopper and i'm using it for a unit of my Masters. </p>
<p></p>
<p>The problem is: </p>
<p></p>
<p>I have 2 sets of curve(polygon) data. Set 1 is small building outlines. Set 2 is the plots of land which the buildings sit. There are over 2000 of these entries (Its a small village).</p>
<p></p>
<p>I am trying to figure out the way that grasshopper sorts lists using the sort list tool. I basically want to calculate the area of the buildings and the individual plot sizes and then calculate the percentage of plot surrounding the building (so basically the difference but in a percentage not m2). The basic maths of this is fine, what I cant get grasshopper to do is match the correct building with the correct plot from the the list of 2000 values!! Does anyone know how to do this? </p>
<p></p>
<p>The final stage of the process is to then extrude each plot according to the percentage calculated. This part is also fine. The problem currently is that grasshopper doesn't understand which value to match from each list. </p>
<p></p>
<p>The current algorithm looks like this: </p>
<p>I have tried just sorting the lists but it doesn't seem to be sorting them in the same order! </p>
<p></p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768938871?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2768938871?profile=RESIZE_1024x1024" width="750" class="align-center"/></a></p>
<p>Any help with this would be greatly appreciated! </p>
<p></p>
<p>Thanks </p>
<p></p>
<p>J</p> I'm guessing this is directed…tag:www.grasshopper3d.com,2012-06-25:2985220:Comment:6232672012-06-25T02:02:34.311ZJason Wheelerhttps://www.grasshopper3d.com/profile/JasonWheeler
<p>I'm guessing this is directed toward David... I think it would be great to put it in FAQ's as that is where I looked first to find the answer, but I don't know how I would be able to put it there.</p>
<p>I'm guessing this is directed toward David... I think it would be great to put it in FAQ's as that is where I looked first to find the answer, but I don't know how I would be able to put it there.</p> can we copy this to the FAQ'stag:www.grasshopper3d.com,2012-06-21:2985220:Comment:6216292012-06-21T12:23:22.505ZMichael Pryorhttps://www.grasshopper3d.com/profile/MikePryor
can we copy this to the FAQ's
can we copy this to the FAQ's Danny, thanks... that helped…tag:www.grasshopper3d.com,2012-06-21:2985220:Comment:6216102012-06-21T10:26:44.557ZJason Wheelerhttps://www.grasshopper3d.com/profile/JasonWheeler
<p>Danny, thanks... that helped a bunch.</p>
<p></p>
<p>David, I also realized that I was confusing the "cull" components as being in the List pulldown menu, so that is probably where the confusion on my part was... also, thank you for the help with understanding strings... again I had a confusion here thinking "text" meant "alphabet".... been a long day, sorry</p>
<p></p>
<p>Thanks again for the help guys</p>
<p>Danny, thanks... that helped a bunch.</p>
<p></p>
<p>David, I also realized that I was confusing the "cull" components as being in the List pulldown menu, so that is probably where the confusion on my part was... also, thank you for the help with understanding strings... again I had a confusion here thinking "text" meant "alphabet".... been a long day, sorry</p>
<p></p>
<p>Thanks again for the help guys</p>