Rename elements (beams,columns etc.) by X and Y direction

HELLO EVERYONE :slight_smile:

this is my 2nd post :wink: i m very exited to learn dynamo.

as you can see in this script, it can convert element id to Mark value.
so if i place first beam it will convert beam Mark value B1, 2ND BEAM name B2.etc…

but if i want to rename Mark value for horizontal beam x direction top to bottom and then vertical beam y direction bottom to top. see image below.

(sorry for my bad english, hope you understand)

have a great day :slight_smile:

1 Like

Hello, these threads could maybe help:

Hi @imran_raj1985

You need to first sort your elements by X and Y and then rename them. Below is an example.

1 Like

Looks like i and @Yna_Db reply at the same time :smile:

True, and your answer is excellent, as always. But different approaches could be useful anyway. I just wonder something here: waiting for an explanation over what has been done before on the topic and why it is not working in the issue that is submitted could possibly be interesting in such a forum, but it’s just an idea, maybe not very functional in fact… :relaxed:

Both selecting by model line and grouping/sorting by location work for this. The “best” approach likely depends on the type of work you are doing and on the user base your script will be run by.

The advantage of the select by line method are that you can quickly adjust the manor in which the selected items work. It also means that a non-rectilinear building is able to be automated to some extent. The draw back is that the workflow requires a user draw the line first, and that user has to have an understanding of not only the what the intended goal but also how the script works.

The advantage of the group and sort method is that the results will always be consistent based on the design - that is the order is only controlled by the geometric layout and it doesn’t allow for any user overrides. This might lead to odd results when buildings have off beams on 45 degree angles, or beams which span multiple bays so they show up in the opposite order you wanted. If you specialize in suburban retail box stores then that’s likely not a problem. But if you’re doing urban infill on sites that are non- rectilinear your results could be undesirable.


Therefore, I deduce from this that some explanations on the context in which the issue arises could, generally speaking, lead to shorter and more accurate answers …

1 Like


@Kulkul I have different sizes of beam in drawing. so i cant use “family type”. so i need to use “categories” and “all element of category”.
and i think its beam so i cant get “point.x or point.y” value. see below image

so i cant go ahead.

@jacob.small thank for ur reply. most of time i have only horizontal and vertical beams so renaming by direction is importent. if i face inclined beam then we can use spline option.

see below sample files.

beams.rvt (1.4 MB)
renumber_framing.dyn (9.6 KB)

waiting for your answer :slight_smile:

@imran_raj1985 One of the possible way to extract beam curves is to use OOTB “Element.GetLocation” node. You can use Curve.Endpoint or Curve.Startpoint.


The FamilyInstance.Location says that it’s producing a point, but if you watch the result you will see it is producing a line. This makes sense as beams in revit are line based not point based. As a result you are feeding a line into a node that is asking for a point. Try pulling the results of the FamilyInstance.Location node into a Curve.Startpoint and Curve.Endpoint nodes. Then feed those into your Point.X node.

These types of issues are rather common. It helps to watch your graph (either via watch nodes or by pulling down the results) as you go along to help you find these types of errors.

Good luck.

again thanks for your response.:slight_smile:

i am a learner in dynamo so its take time to understand. how to work with dynamo nodes.

@jacob.small can u tell me steps to achieve this goal. like u said.

i don’t want full script for “RENAME BEAMS BY DIRECTION”

i need some guidance to learn DYNAMO. :slight_smile:

thanks all of you for help :slight_smile:

First up, you will want to get the Point.Y for the curve start point - replace the Point.X with it.

Then pass both Point.Y nodes into an == node. This will return a true value for beams that have the same Y value for their start and end points - which happen to be beams along the X axis. These beams need to be listed before the Y axis beams.

Run the results of the original All Elements of Category node into the list input on a List.FilterByBoolMask node, and the results of the == node into the bool input. You now have two lists - one for the X value beams (in output in the bool mask nodes) and one for the Y axis (out output in the bool mask nodes).

Try that and see if you can think of a way to group the list of X value beams by pulling some of the y values as you did before, and then sort those lists by pulling some X values as you did before. You’ll then have to flatten the list so it’s only one level deep. Lacing will matter at a few points. Then you want to repeat the process for the list of Y axis beams the same way you worked out the X axis beams. Then join the lists together. Renumbering will then be simple. Remember you want to keep working with the elements as you do the sort and group efforts on the list.

This is a somewhat ambitious first script to learn… Good luck, and if you get stuck make another post. Once you get a good start on it we can discuss making it more efficient (you need to learn how to walk before you can run right?)

true @jacob.small i need to learn how to walk before i can run :slight_smile:



renumber_framing.dyn (18.7 KB)

beams.rvt (1.6 MB)

i think i am very close to achieve this.

just need little help.


Good attempt. I had to work in studio not revit attached at the moment as I’m automating some cleanup on 38,000 curtain panel families tonight, so I didn’t have the revit nodes in my graph, and I’m on version 0.9.2 so things might look a little different for you, but you should be able to get you where you want to be with this map. If you have questions ask.

Oh yeah, watch the lacing on the list management.

1 Like



@jacob.small : i can’t see your script clearly.

please take your time. no need to hurry.

Step 1: Sort the X axis beams from the Y axis beams.

Step 2: Sort the X and Y axis lists into groups based on X/Y value.

Step 3: Reverse the X axis list and sort the sublists by Y/X value.

Step 4: Reverse the Y axis list, join the lists, and flatten.

Step 5: Review by adjusting the slider.

Step 6: Set up parameter values as you had before (or simplify your nodes).

Step 7: Set parameter values as you had before (not shown).


some error, so i cant go ahead.
see image.

You’re feeding the Curve.StartPoint node a revit object when it expects a curve, so there is no end point to get.

You resolved this on the previous curve.startpoint by inserting a FamilyInstance.Location node between the elements (the Object.Identity nodes) and the Curve.StartPoint nodes. The same thing will work here.

I didn’t have to deal with this added node as I was in sandbox and pulling curves instead of revit elements as my base data. This is why I have the pink group of nodes at the start of my graph.

You’re close, keep it up!

1 Like

@imran_raj1985 This should work …
renumber_framing-20170209.dyn (25.9 KB)

1 Like

@jacob.small as per your suggestion i changed script.
see below.

result -

some error in INDEX node

and thanks @Vikram_Subbaiah for help with your script i found this. see image below.

i think i am very near but still something is missing(or i dont understand)