# Finding Elements According to Topology or Proximity

In the course of running different scripts I have realized that I need a way to find and query elements in the following way:

1. Here is element A, find all elements above, below, left, right, near within a certain distance, etc.

2. Here is some 3d geometry. Return all the horizontal or vertical faces, or return the bottom or top surface.

I have looked at the topology nodes but have not figured out how they work. Does anyone know how this is done is Dynamo?

Hi Rafael,

For 1) I’d try the awesome “Tool.GetSurroundingElements” from SteamNodes. Note that if you’re using it after 0.8, you might need to convert your units to feet manually.

For 2), have you considered evaluating the surface normal?

Right on, Dimitar - you beat me to it!

Small addition to 2): To find the top/bottom surface you can also pull the face vertices and evaluate their Z coordinates.

Dimitar / Andreas

I will look into your suggestions. Did not know about “Tool.GetSurroundingElements.” That looks like what I need. I actually did use the normals trick, but it sucks to do when you have lots of panels.

This came up in a façade mullion exercise for exterior curtainwall. We have an irregular facetted design where every panel is at a different angle, and I have to place the mullion that goes in between each panel, whose angle is the bisector if the two panels to either side. As there are about 8,000 panels on two towers, I needed to find a way to do this with a script.

I tried reading the wall locations, but they were created “by face” from a Rhino import, since the design is produced with Grasshopper. This places all the walls on a single level with top and bottom offsets. I would solve the problem in a small test file, but when implementing it on the real thing the fact that all walls were hosted on a single level created real problems with list structure and nesting.

I eventually solved it by taking the curve location of the walls, and intersecting them as a surface extrusion with a cuboid around the bounding box of each curtainwall. This gave me clean rectangular boxes that where for the most part going in the same direction, and whose faces extracted in a predictable manner. Before this I was trying to get the geometry from the panels themselves, which was a mess because some panels’ normals were flipped (Grasshopper created them that way), others did not clean up at intersections, and any non rectangular ones would report their edges in odd orders when extracted.

Here is what it looks like:

Rafael, that looks like a pretty hard thing to tackle - good job on solving the issue.

Curtain walls still belong to the wall category and that means that you can use Andreas’ extremely useful “Wall.Orientation” node to extract their individual “direction”. The node manages that by tapping the API and thus the output is pretty fast, providing a potential speed boost for your work flow.