# Get top face of an element

Hi,

I’m trying to get the area of the top face of certain beams.
I was searching in the forum similar cases by I did’n find anything.
I think a good approach is to get every face of the element and filter the face with bigger Z coordinates. Or maybe get the file surface with an upwards orientation and bigger surface.

Does anybody tryied to do something similar?

Thank you.

try groupByKey or sort by Key

i would take a other reference than area f.e. name … Area can accidently sort something else…

KR

Andreas

Both of those are the most common solutions. You just have to know what your geometry will look like and any outliers you need to be prepared for. Give them a shot and see what you get.

2 Likes

You can also get the surface vectors and filter to the ones that are parallel to the Z axis. This will get you the top and the bottom. Then from that just get the one that has the highest z coordinate value. Normally, we give guidance and let the poster work it out and we help where needed. But it was easier to show you the approach also. I do have to clarify, that this only works if the surfaces are flat and parallel to the axis.

6 Likes

Hi @staylor,

Thank you for helping. I was trying to use the Plane.Normal node but it didn’t work.

The areas seems to be multiplied by a factor of 1.5. Do you know why?
I’m working in Universal not in Imperial.

You can also use the Surface.NormalAtParameter node to get the vector direction of the surface. However, if you need to get the plane for some other reason, then you can use this.

I don’t know why your surface areas are being increased. Sorry!

I think the problem is related to Dynamo units are in inches.
However, I don’t think 1.5 is the factor of conversiont between squared inches and squared cm.
I’m gonna create another post.

Thank you very much for you help.

1 Like

But this workaround will only work for those girders which top surfaces are parallel to the XY plane, right? I mean, flat girders with no longitudinal slope.

@JC.Moreno , I suggest taking the girder centreline and creating planes perpendicular to that centrelines. After this, the intersection between the girder faces and the vertical planes will give you a line per face. You get Curve.ParameterAtPoint(0.5) and then you get the highest Z coordinate point.

Here is another option This one tries to catch edge cases where your beam may be vertically diagonally placed.

JCMoreno_GetTopFaceOfAnElement.dyn (31.2 KB)

4 Likes

Hi, the damn special case, although in the question one can suspect the top face of the element
(mandatory double filtering to eliminate in the case of inclined beams)

cordially
christian.stan

1 Like

Hi, only if the beam is keyed to the top face in the dialog (tilted or flat)

cordially
christian.stan

@christian.stan @JMCiller That’s correct. That’s why I stated that in my post that was marked as the solution.

I do have to clarify, that this only works if the surfaces are flat and parallel to the axis.

1 Like

I had seen don’t worry , here it’s a solution provided you have (the GetLocation fixed on the top of the beam, highly dependent on the operator)
(more relevant solution from you, independent of the operator, another approach, that’s all, no competition, progress is my goal )
cordially
christian.stan

1 Like

No worries. The more options we give, the better.

1 Like

This is neat. I’ve tweaked it slightly for my use case where I want to get the top face of partitions many of which are not horizontal. So I’m just pulling the faces for the partition and filtering using those that return a +ve Z value for the Normal (using rounded values to 3dp).

1 Like

An implementation of this might be a bit easier if you’re starting with Revit objects: HostObjectUtils Methods

I wasn’t aware of these, thanks for pointing these out. Unfortunately, it doesn’t look like that will help the original poster, who is looking at beams (Structural Framing category).
Even though beams can host certain elements (openings by face, connections) it looks like HostObjectUtils is only applicable to certain categories, like walls, floors, etc.

It looks like these are mostly system families, not loaded families (Though some allow family-loadable profiles). My guess is that being a system family significantly limits the geometry vs. a loaded family, which can be almost anything…

1 Like

I’d guess that when making a wall Revit will add a property to the generated faces (as a topology though, not a surface) to indicate which of them are ‘top/bottom/side’, which is doable as the geometry of system families is generated using a known sequence of events.

System families however make that much harder. Looking at framing as an example, you can’t rely on edges of the profile as the profile:

• Might be drawn clockwise from the top for one rectangular shape but counter clockwise from the left edge for another
• Might have 5 edges on one shape, and 500 on the second
• Might have an edge which is the top, right, left and bottom, with a ‘split’ at the 45 angle that makes the family viable for Revit’s loops.
• Might be applied with a 45 degree rotation on one family and a -45 degree rotation on the next

These computationally driven properties are one of those things which makes otherwise seemingly simple updates (i.e. tapered walls) more complex than they are at first glance.

1 Like