Hi everyone,
I’m working on a script where I need to check if a set of points lie on a level (based on the Z-coordinate), and then return the corresponding level for each point. But I wasn’t able to handle the data structure between the nodes properly.
Hi Christian, I appreciate your reply
I like your method of using dictionaries here, it saves some nodes and works perfectly in your case where the PointsZs matches exactly the Elevations, but in my case there can be a tolerance of about 0.3 to 0.5 between both. So a better description to what I want to do is to match PointZs to the nearest Elevation based on a specific tolerance, then return the equivalent level of this Elevation.
This is the result when trying the dictionaries method in my case. 
And here’s my try, but it also didn’t run as expected. The issue is related to data management I guess.

1 Like
Do you want the nearest level or do you want the nearest level only within a tolerance? If you just want a built in tolerance then you can round your values (assuming that you won’t have levels within that distance from each other) and still use a dictionary.
Yes, I want to get the nearest level to each point, and the tolerance method was a try to achieve this.
My point is that one method will always return a level and the other will only return a level if the point is within the tolerance range. If you have a surface with Z coordinate 1000 and your highest level is only 100, do you want to filter out that point or do you want it to return your top level? Are you saying that your points will always be within that tolerance? What happens if they’re not?
Your initial attempt with rounding was close. Try using list levels to get better control over how you handle lists. In this case, you need to mask each list of booleans against the original list of levels.
(In my example above, I have points outside of the allowable tolerance and therefore end up with empty lists for those points.)
2 Likes
In my case yes, the points will always be within a given tolerance. If they aren’t within the tolerance range, the output shall be empty or null then.
Yeah this exactly was my problem, I adjusted the list levels for the filter by boolean mask and I got the results I’m expecting. Below is the final output 
Thanks a lot Nick!
2 Likes