Revit/Dynamo/Python Tutorial – Auto join concrete elements

As many of you will appreciate, the joining of in-situ concrete elements is critical when modelling structures. This ensures that the volume of concrete is correct and makes the construction drawings legible. It is worth understanding how Revit reacts in a default situation when working with in-situ concrete members.

When working with in-situ concrete elements, Revit will automatically join the following elements as shown in the table below. This can be very useful and greatly increases efficiency when modelling.

The order in which elements join is also predetermined by the software. You will find that walls and floors are the primary elements, and these will take priority when joined to other structural elements.

The auto joining property is useful in some situations but can cause issues. For example, you may want the columns to take priority and have floors ‘cut’ around the column’s perimeter. Another situation may be that walls should be continuous and not broken by floors. In these situations, you can use switch join order.

Automating Joins with Dynamo

In the last few releases of Revit, Dynamo has some additional nodes which can help us when working with in-situ concrete. The nodes shown below are all found within Revit – Elements – Element menu.

As you can see, these are simple to use and just requires a selection list of the two element sets. Of course, the selection can be made automatically by collecting all elements of a certain category with a specific material type. In the example below, all structural foundations are selected, the structural material instance parameter is collected and filtered if it contains the string ‘In-Situ’.

However, there is no provision in Dynamo to switch the join order of elements. This is where we can use the power of the Revit API and Python to plug this gap.

The first step is to perform a search on revitapidocs.com. Everything you can automate within Revit is listed on this webpage if it’s not here you cannot achieve the automation! You can then search for the method ‘switch join order’, the method is the code that performs this operation.

Before the Python node can interact with Revit you will need to copy and paste some boilerplate code. This can be located here:

https://dynamopythonprimer.gitbook.io/dynamo-python-primer/getting-started/boilerplate-setup-code

These lines of code setup the various resources you will need to interact with Revit.

The below image shows the Python node. The lines of code shown with the blue border is the specific code that executes the switch join order method.

If the operation is changing elements within Revit, then you must perform a transaction. This is the first and last line within the blue box. The next two lines of code are getting lists of elements at IN[0] and IN[1]. Notice that the list is also unwrapped. Basically, this makes the actual Revit elements useable within Python.

The code then iterates through the nested list and finally executes the switch join order operation for each item in the list. You will notice that this line of code is from RevitAPIDocs.

Notice that as you start typing ‘Autodesk.Revit.DB.JoinGeometryUtils’, the relevant classes and methods are listed.

If you would like to see a step-by-step example of this, then feel free to watch my YouTube Tutorial. Be aware that you will need 25mins to watch this tutorial.

Advertisement