Hi!
So I’ve been working in different projects to learn more GH but this one has gotten me stuck for too many days now…
What I’m trying to do is create a gradient in the plot lines based on their density of the buildings. I already deconstructed the buildings so I have the plane surface on top of the plot surfaces.
Later, I took their centroid and then using “Point In Curve” I tried to sort this points in each plot surface. The thing is this might not seem to work, because the result is all the points again.
Then, for the gradient map, I listed the plot surface with the smallest area as my minimum and the highest area as the maximum and the points in curve as the “parameter”.
But for sure I’m missing something, should I just remap the numbers from smallest to highest area? Or should I just the Division component to divide the surface buildings in the surface plot?
Thank you! Ill leave also a reference img. of the result I want to approach.
gradient.gh (3.0 MB)
Well … that’s very easy via code - a 5 minutes job (components are not my game - at all).
Notify if you want a C# that does what you want (and full explanations in case that you want to replicate the steps via components).
Oh! Thank you! Yes! I would love an explanation of this, it could be very interesting to try this in code! Looking forward to your response.
This means that you want to walk the C# walk? Excellent news, I confess : if you want to be in high demand as a pro. … there’s no other way.
BuildingsOnParcelsGradient_V1.gh (3.0 MB)
How it works (spot the 3 modes for defining what density could mean):
- It gets the footprints from your buildings (BrepFaces with Normals antiparallel to static Vector3d Z) and the OuterLoops of your BrepFaces (the parcels). This Method does that:
PS: If mode !=1 gets the areas as well.
- Then it computes the containment Tree (what thing contains what), The test is the centroid inclusion (this is not an 100% assured result - but I can obviously use far more elabotated checks). Spot the usage of the sampled bool [ ] (that saves us A LOT of Elapsed time - see info Panel for the gains). The EnsurePath is used because a parcel may not contain buildings (otherwise the color mapping could yield bananas).
- Then it computes (with 3 ways) the density and the tValues for the colors.
BIG puzzle for you: is Remap required? (the answer is no - but can you tell me the reason?).
The trad update soon: TextDots to viz various things and some other viz related stuff (Isolate parcels etc etc). On the other hand … one could use some proper Class and extract (LINQ queries) any info you can imagine: what parcel is more populated? what buillding has the most neighbors? what about OrderBy this or that? (or do some nested GroupBy collections).
But what happens if you have a real 3d terrain and buildings deployed in Z? Well … that’s easy to solve as well … but just needs some different Methods.
Found a couple of minutes to fix a VERY stupid thing (and some typos). Recycle V1 ASAP.
Added Dots, and that C# in the red group.
BuildingsOnParcelsGradient_V1C.gh (3.0 MB)