Wall relative to below nearest level


#1

Assuming I have several levels as building story. (0, 3000, 6000)
I have a curtain wall placed at a level ‘cw_001’, cw_001 elevation 4000

I want to know what the relative height is compared to the building story height (nearest).

So in this examples the answer would be 4000 - 3000 = 1000.

Approach
V listing all the levels, bool mask which are ‘building story’: check
V getting location of element, return z-pos giving me the ‘4000’: check.

X next how to create a way to get the nearest level below. …

result = []

for i in IN[0]:
	for j in IN[1]:
		test = []
		if i > j:
			test.append(True)
		else:
			test.append(False)
		result.append(test)
OUT = result

IN[0]:
Knipsel

IN[1]
Knipsel2

Result should be
0
– true
– false
– false
– true
1
– true
– true
– false
– true
2
– true
– true
– false
– true
etc


#2

Could you post a picture of the entire section of the Dynamo and the python code? Which values are what and how does it enter your python code?


#3

@kennyb6

Thnx for your reply, the two images have a text above in[1] and in[0] referring to the python script.

I’m almost there …

result = []

for i in IN[0]:
	for j in i:
		test = []
		for k in IN[1]:
			
			if j > k:
				test.append(True)
			else:
				test.append(False)
	result.append(test)

OUT = result

#4

Next step is getting the nested firstindex of a true …


#5

So does the output display what you want? As in the lists of true and false? And to get the first index of true, something like this using the previous list (result) as the input:

firstTrue = []
for i in range(len(result)):
    for j in range(len(result[i])):
        if result[i][j] == True:
            firstTrue.append(j)
            break

Alternatively, the list.index(True) works.

firstTrue = []
for i in range(len(result)):
    firstTrue.append(result[i].index(True))