The tree structure is matching, so the tree branch for the wall lines corresponds to the branch for the door lengths. However, since Grasshopper does not match by branch path, but on an item by item basis, how could I find the lines to cull?
yep, stuff being output by a Data Parameter is not a Number GH type, while output coming from a Length output is Number GH type, so they won’t match by default
many times I also found myself getting number inputs from external sources, and despite passing both through a Number Parameter before the Member Index, also a trim to 2 or 3 decimals was necessary
EDIT:
and a proper approach for comparing doubles would be to use a expression with some threshold / tolerance, retrieve a true / false and then cull with a pattern.
I left the expression part in above definition, but I was not motivated to get the datatrees in the right structure to perform the logic…
# x, y inputs both floats with List access
def same_length(a, b, tol):
if abs(a-b) <= tol:
return True
return False
a = []
for test_len in x:
res = True
for bad_len in y:
if same_length(test_len, bad_len, 0.001):
res = False
break
a.append(res)
I think it would be super strong feature, if a cluster could have the same input / access as a script component. I wrote this as a wish, but did not get any answers:
Propagate Ancestors component from TreeSloth would be my main choice here. Then again, doing it natively teaches you valuable lessons about DataTrees - like how to painfully crush your toes over and over again by hitting them against DataTrees.
I would always solve stuff like this with a script … but anyhow it seamed a nice challenge…
…here is my vanilla gh solution to find a cull pattern.
instead of multiply data I use cross reference (holistic) to get the combinations for the equality-test.
flattening the final pattern and unflatten with the original tree as guide seems more readable for me…