# Filtering edges based on highest Z Value

Hello,
I have what almost looks like a Corridor Solid and need to create TIN Surface from the top of the Solid.
I imported the Solid in Dynamo and use the Topology.Edges and Topology.Verticies nodes to get the points and curves. but I am struggling to figure out a way to filter only the top most points and/or edges (I only need the Top of the Solids!)
I have points and Edges with same XY and Different Z! how can I get the Top most elements when things are on top of each other?

Hi @marshmallow,

It kind of depends what the solid looks like, but here are some ideas.

For a solid that is built correctly, all of the surface normal vectors should point outwards, like this:

Assuming the solid is made up of planar surfaces, you could get the normal vectors for each surface using Surface.NormalAtParameter (the image shows the result with 0.5 for U and V, which would be in the middle). Then you could check the Z component of those vectors. The vector with a positive Z component would be the top, and then you could filter the original list of surfaces with List.FilterByBoolMask. However, this won’t work very well if the surfaces for the sides are slanted, or not parallel with the world Z axis. In that case, one of those side vectors would also have a positive Z component and you couldn’t distinguish from the top surface.

Something else you could try would be to get points at the center of each surface using Surface.PointAtParameter with U and V equal to 0.5. Then get the elevations of each point, and the highest value would be the top surface. Again, this would not always be true if the surfaces are slanted (e.g. cross slope). Then the point on the “uphill” side might actually be higher than the true top surface, like this:

3 Likes

Hi @marshmallow Not as detailed one as @mzjensen but this is one of they way i prefer to filter points if XY coordinates are same and filter the lower most point for same XY.

Hope this helps.

2 Likes

Thank you, I will try the group by key idea! I never really used the group nodes before, but I was thinking I have to find a way to contain the elements with same XY some how!

@mzjensen, I like the vector idea but like you mentioned it won’t work on the daylight angled areas

1 Like