Revit and Dynamo Tutorial – Placing family instances at world coordinates

During my years of training Revit, many clients ask if there is a tool to place a Revit family at a world coordinate, perhaps issued by a contractor or a surveyor. In AutoCAD, due to everything being modelled from the World Coordinate System or WCS, this is an easy task. You simply type in the easting and northing. However, Revit’s coordinate system for placing families uses the internal origin which will not be the real-world coordinate. We also must consider the possible rotation of the site in relation to the project north.

A simple solution is to use Dynamo to transform the coordinate system and place a selected family at the coordinates. I have wanted to create a tutorial for some time now and I have finally got around to it! The most efficient method for placing the families is to use Dynamo Player, however, if a number of families are required from a list, then we can read a text file, comma separated file or Microsoft Excel.

Above I have included an image of the complete Dynamo Script but will step you through each of the groups. If you want to see a detailed, step by step guide then I have created a YouTube video here:

The first step is to get the project base point built in parameters which get the East/West, North/South and Angle to True North. Although there is a node that retrieves this information directly, the node will not update or refresh so this is a better method.

Next, we create to inputs for the Easting and Northing, these values are subtracted from the Project Base Point and a coordinate system is created.

We can now create another coordinate system at the internal origin of Revit and then rotate this system to take into account the project north rotation. The family instance is then placed at the coordinate system. The Dynamo script should ideally be executed within Dynamo player to allow for multiple coordinates and families to be placed simultaneously.

If several families are to be inserted at world coordinates then you can create a dynamo script that reads a series of coordinates that are stored in Microsoft Excel or a simple comma separated file.

Anyway, feel free to watch the YouTube video where I create and explain the script step by step!

LawrenceH

Advertisement

Automating steel modelling with Revit & Dynamo

When modelling structures such as portal frames there is currently no built-in macros to aid with this very typical structural frame. If you are using tools such as Robot or Advance Steel, then this can be automated with the frame generator. In the image below you can see the frame generator integrated with Robot 2022.

However, if you want to stick with Revit for the modelling of these types of structures then you can use Dynamo to generate the portal frame system. Of course, the geometry for the portal frame can be generated using the standard out of the box nodes but to make the process even more efficient you can make use of the free Structural Design package for Dynamo.

The below image shows a simple dynamo script to create all the geometry for a portal frame structure. The nice thing about using Dynamo is the fact that everything is Dynamic and can be changed very quickly.

Take a look at the tutorial below to get a better understanding of the Dynamo workflow and the speed of modelling!

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.

Revit Tutorial – Naming PDF and DWG exports to match ISO19650

Many of you working with large Revit projects are probably utilising the BIM naming conventions outlined in ISO19650. Just for your reference, the naming system may look similar to the sheet below.

Revit ISO19650 Sheet

Below is a screen capture of the properties of the sheet, you can clearly see the use of shared parameters to hold the values such as the Originator, Volume,Level and so on.

Revit ISO19650 Properties Palette

The problem starts when you are required to generate PDFs or DWGs from the Revit project to issue or upload to a Common Data Environment (CDE). The naming convention, of course, needs to comply with ISO19650 but Revit will give you something like the output below:

Revit PDF naming and Output

Fortunately, we can employ Dynamo to rename the documents for us to match with the correct ISO19650 naming convention. The basic process is to collect the ISO19650 shared parameters from the sheet and concatenate these together using hyphens to generate the correct document name. The name is then concatenated with the file path and this forms the new name.

We then get the contents of the directory that the PDFs were published to and just get the PDFs that match the drawing number. For example, the drawing number could be 1070 and this can be used to get the original PDF name that contains this number. It is essentially a wildcard match (*- 1070 -*)

A python script is then employed to do the actual renaming in the operating system.

Python - Rename docs

You may want to watch the YouTube Tutorial which shows the dynamo script in operation and steps through the graph and explains whats happening.

Here is a high res image of the Dynamo script if you want to recreate it for your own use.

DynamoISO19650HiRes