Match data from two different trees


_test00.3dm (71.3 KB)
_test00.gh (9.2 KB)

Hi Guys , first of all thanks for your time reading this post !

I feel that I’m still quite new to GH, and I’m still trying to figure it out how to deal with complex data.

In this case:

  • 1st: I tried to see which horizontal surface collides with wich vertical line;
  • 2nd: I want to raise the horizontal surface to the highest point of the vertical line.

I’m wondering if I can use the Collision Index output but don’t know how can I match with the Moved Geometry output.

I thank you in advance for your precious help !

Cheers

Hello, and welcome to the forum !

There are several things to correct in your file, I’ve made some annotations directly on the components, I hope this will be clear enough.

The main thing regarding data trees is :

  • 99% of the time, you want all inputs of a component to recieve trees with the same structure (same branches numbers), or lists that have the same length. If those mismatch, Grasshopper will repeat the last item/branch, and that is usually bad news. This happens in your file when you are creating the lines, you have 6 points but only 4 vectors.
  • Or, on the very specific case you want to associate objects and create repetitions, you’ll combine different structures. In your example, you want to intersect each Brep with all the curves, this means the breps must be Grafted and the lines Flattened. I also used this to solve your problem, either using Brep | Line, or Brep Closest Point, the latter being my prefered way to associate geometrical objects.

_test00.gh (19.0 KB)

2 Likes

Slightly Deviating from @magicteddy Solution.
_test00_tay.0.gh (9.9 KB)

I tried to keep the same toolset you provided with your definition, and trying to break down your problem into the below:

1- Collide Surfaces / Lines.
2- Generate Pairs (Line is paired with It’s Corresponding Surfaces)
3- Work in a parallel way.

Your problem is less complex since it is still considered a list problem than a Data Tree. when it comes to managing data trees in Grasshopper, Simplicity is everything.

1- do not graft unless you have to.
2- Do not simplify unless you have to.

2 Likes

@magicteddy
@tay.othman

Thank you both for your prompt reply!

This was actually me trying to figure out a particular solution that is part of a more extensive exercise.

If you allow me, I’ll share " the full picture" to know your insights regarding it.

0: So I got this big site, where it was provided a topographic mesh (a bad one );

1: I also got the contour of each plot, so to get the height of each corner I projected the points to the mesh;

2: Afterwards I want to fill the plot whenever possible to the highest level of the highest corner, without exceeding 0.60m from the lowest point of the plot.

3: The last step is to match, whenever possible the height from your adjacent side neighbor, without exceeding 0.60m from the lowest point of the plot.

4: My idea is to repeat step 3, till there is no more availability for changes due to the 0.60m restrain.

Looking forward for your opinion,

I know the file is a bit messy :sweat_smile:

Setup Plot SSL.gh (406.5 KB)

Total Plot Eval.3dm (13.9 MB)

Hi,

This is indeed a more complicated exercise.

First, there are open curves in your definition, you can close them in Rhino using CloseCrv.
Q1. You did the correct thing to project the points to the mesh, although you could have used Explode instead of Control Points which is more suitable for NURBS curves. Then to analyze the Z difference, you could sort the Z coordinates of the 4 vertices.

Q2. Now the problems begin. What happens if the distance between the top and bottom points is larger than 0.6 m ? You have to provide some kind of rule, because there are 674 cases where this occurs.

Q3. And now the problems double. What you are trying to do requires some sort of looping, which will very likely require some code. Also, there are some rules to establish.
Imagine the following case :

3 adjacent contours have their bottom level at 0, 0.1, 0.2, and their top level at 0.5, 0.6, 0.7.
You could say that the first contour can rise up to the second contour, going to 0.6 respects criteria. Then you analyze the second contour and you find out it could go up to 0.7, to match the third contour level. But then you are back to the first contour which no longer matches the second one, and can’t get up there because 0.7 is too high. So should you leave it to 0.6, or get back to 0.5 ???

You need some very clear rules so that you can tackle this recursive problem in a correct fashion.
And then, there is the case of contours that have several adjacent contours on the same edge, like this :

Anyway my idea would be to work with Breps and use the connectivity tree to know which contour is adjacent to which one. Then, starting from the highest contour and going by decreasing Ztop, look at all adjacent contours that are currently lower, and raise their level, if possible.

Find attached a GH file that works on a small portion, to avoid huge calculation times.

Setup Plot SSL.gh (17.5 KB)

1 Like

Many Thanks once again @magicteddy !!

The clean way you patch the nodes together is just way way above my level, it took me a while to " reverse engineer it " and in order to understand it.

Q1. Nothing to add, seems a perfectly valid suggestion.

Q2. When the distance is larger than 0.6m it means that there is no availability to increase the height of that plot. So those should stick with the data unchanged. Meaning that the Base Top level and Base bot level will remain the same, with the Diff between them marked as it is.

Q3. In that case, the plots should raise to the highest level possible, meaning that the middle one should raise to 0.7 level to match the one from the side. The one on the left should remain intact.

However if by instance there are 4 plots instead of three, the case being their bottom level at 0, 0, 0.1, 0.2, and their top-level at 0.5, 0.5, 0.6, 0.7. They should be leveled at 0.6, 0.6, 0.6, and 0.7. The purpose of this is to achieve max plots leveled at the same height, without exceeding the 0.6m top-bottom difference.

Q4*. This matching should take into concern only the side neighbors, please refer to the " grouped" by color plots shown on the image.

I’ve rounded up the values to the decimal case, which might make this process easier.

Sorry for the delayed answers, but as mentioned before, I need some time to “fully” understand your insights!

Much appreciated if you can follow this !


Setup Plot SSL(2).gh (23.0 KB)

Following up the discussion before going back to Grasshopper…

Q2. If such a plot is unchanged, it means the Z coordinate of all 4 corners is probably different, and you don’t get something flat. It is perfectly possible to isolate those plots and only work on the remaining plots (using Dispatch). However, let’s imagine that case with three adjacent plots :

  • Plot with DeltaZ>0.6 : remains unchanged
  • Plot with DeltaZ<0.6 : will be processed
  • Plot with DeltaZ<0.6 : will be processed

What happens to the second plot, should it somehow take into account the Z level of the corners it’s attached to, or should it only look for the level of the third plot ?

Q4. This could be working, however unless some mesh gurus on the forum have some ideas*, I think the easiest way to set up the data correctly is to reference all your curves group by group, and then create a data tree using Entwine. Each group of plots will be in a separate branch, so they don’t interact with each other later on.

Q3. The case with 4 plots you are describing, though easy to write as a sentence, is not so easy to turn into a logical and systematic procedure to apply, and looping through all possible combinations doesn’t seem reasonable. Right now my component would give 0.5, 0.5, 0.7, 0.7 as an output.

No worries for the time needed, it’s much better to think and anticipate the problems rather that throwing a thousand components on a canvas !

*By the time I wrote this, an idea came, and with that, horrible news regarding the quality of the file.
I’ve made a script that attempts at merging the boundaries by rows/columns automatically, and I encountered a LOT of problems such as :

  • curves that have overlapping segments, I solved that in GH
  • curves that have their seam (clsing point) not on a corner, also solved in GH
  • curves that overlap, not very solvable in GH
  • curves that have corners that should be 90 degrees, but are not, same thing

The problem is that the Brep Join operation, which everything is built upon, fails for a good third of the groups, especially in the middle. Every group where there is no color has a problem. I saw a lot of layers indicating this was imported from a PDF, I’m not really surprised then. Do you have a way to review all these base curves, and maybe redraw them more accurately ? Else, another method for finding adjacent plots has to be imagined.

Attached the file with this attempt, you’ll need to download Elefront.

Setup Plot SSL(2).gh (85.2 KB)

2 Likes