Hello, I’m a researcher in Architecture. Recently I was making a Building Arrangement Algorithm. The Problem is when I try to arrange my buildings to the terrain by using the “move” component toward Z direction, something goes wrong and the result is not accurate. For example, a random building has to move for “H(as an assumption)”. And Let’s say H = H1+H2. From now on, my building only moves H1, Not H1+H2, and I can’t find the reason.
My first guess was something happened in the Data Tree Control section… so I flattened my data and reconstructed the algorithm, and it works.
But I have to maintain the Graftness(?) of my data for my next algorithm…
If you can solve this problem… please give me some advice. BuildingArrangement.gh (2.1 MB)
Guessing isn’t enough for data trees, one must know! Unfortunately, you have used a plugin for two methods that are easily done with standard GH components:
I could work around them but noticed that ‘BuildingCrv’ has more items (1894) than ‘BuildingLevel’ (1584) when they should be the same? Looking at ‘BuildingCrv’ with a text panel shows some branches have more that one surface, up to a maximum of 18 in one branch How do you handle that?
P.S. I tried joining the surfaces but it doesn’t help. Further examination shows these 18 separate surfaces on branch {0;0;197}, all with the same Z value of zero. So this looks like a data problem.
P.P.S. I tried using the largest surface in each branch but there is still a problem. ‘BuildingCrv’ has 1583 branches while ‘BuildingLevel’ has 1584 branches.
I think this is the only component from a plugin in the canvas, but it’s not a white box in my screen so it’s easy to bypass because I know what it does
the original data that I got already had that kind of data condition. But the data has the same branch length(I’m not sure it’s the right word, It’s pretty sure that I’m very poor at gh… especially for data tree design), so I thought It can be handle like the image above by my algorithm… And It’s not?
Building Curve data tree is missing branch 658, it goes from 657 to 659, while Building Level does have branch 658
I didn’t know that kind of error could happen, and thanks for finding that structure error!
The problem is… Future data that I can get also may have sort of problems(data mismatch problems), and if that, what should I do for make the connection and array them right?
data pairing in GH works by repeating the last item of the shorter list, until reaching the very same length of the longest list
so in a situation like:
curve list: {xxx} has 10 curves
height list: {xxx} has 1 height
then I guess things are ok for your purpose, because it just means that all the curves in the very same branch represent buildings with the very same height, so the height -even if it’s just one value- will be repeated 10 times: one for each of the 10 curves
I can indeed imagine you have several buildings with the very same height, but I can’t imagine having one single curve of a single building with more than one height… so you might also check that, for each corresponding path, the number of items in the height list is either “one single item” or the very same number of items in the curve list
a different scenario is for paths: paths addresses like {xxx} are more of a helper for us -humans- to know in numbers which branch we are talking about
if list A has 7 branches, and list B has 7 branches, regardless of the numerical value represented on their path, GH will pair them 1 to 1
see this very stupid but clear example, where you can see the above sentence in action (warning: it’s not good practice to do that, it just proves a point)
because of that, you have to be sure to use only paths contained in both lists, and avoid the ones which are not common to both
the red part in this definition does exactly that: takes all the paths of the first list, all the paths of the second list, intersects them to find only paths that are present in both, and uses just those to continue the process you had created
[edit] to implement also the check for number of heights in relation to number of curves in a given path, I guess you might use something like this: