Dynamo Users Meet-Up

If you’re living in United Kingdom and you’re interested in Dynamo, computational design and automation, I strongly recommend getting involved with UK Dynamo User group. So far I’ve attended two meetings and it was a time well spent! Each meeting consists of 3-4 longer presentations and quick round of tips & tricks from other users. When the official part is over, there’s time for casual networking and it usually involves a pub nearby. In terms of topics covered on those meetings, some of my favorite lectures were about macros, add-ins, modelling from point cloud, computational design in structural engineering and linking Revit with Power BI.

Here’s a picture from May meeting, you can even spot me there:You can find them here, there’s an event happening in Manchester, 7th September.

Watch out when the tickets are out – because they might be gone within an hour!

Painting walls using Dynamo

Hello again! As it turns out, moving all your livelihood to a different country is quite an absorbing process and I had to skip on my blogging for a bit. But now I’m back and…


…picture a massive hospital model in Revit that’s in dire need of painting. The default tool for applying paint is not the most efficient one to say the least and the deadline is approaching. What do you do? Since taking a holiday break was not an option, my second guess was to use Dynamo for that.

This script can be broken into two parts.

First part deals with sorting the walls per width and base constraint. To my surprise, the former wasn’t as straight forward I thought (It might have something to do with family structure for “Walls” category). In order to get the value of width, I used the following combination of two Python scripts:

import clr
from Autodesk.Revit.DB import *
items = UnwrapElement(IN[0])
typelist = list()
for item in items:
OUT = typelist


check = IN[0]
items = IN[1]
     if isinstance(check, (list)): OUT = items
else: OUT = items[0]

Combining those two with some basic BoolMasks leaves me with a list of walls-to-be-painted. Now to the second part – applying paint.

I must admit, my Revit API game isn’t the strongest, so to get this (simple, I know) script working I had to consult it with a colleague of mine. The final product is as follows:

import clr
from Autodesk.Revit.DB import *
import Revit
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc =  DocumentManager.Instance.CurrentDBDocument

elems = UnwrapElement(IN[0])
paintmat = UnwrapElement(IN[1])

for elem in elems:
     for geo in elem.get_Geometry(Options()):
             for face in geo.Faces:
                      doc.Paint(elem.Id, face, paintmat.Id)
OUT = elems

One interesting thing I’ve noticed is that the Python part of this Dynamo script seems to be “remembering” the values, i.e. when I’m done with painting one selections of walls and I want change the values by which I sort them – this script insists on painting the original selection. I think I’m missing something obvious here, feel free to enlighten me.


What really grinds my gears, Revit edition

I’ve been working in Revit for few years now, and I can’t imagine going back to the “old way” – daily struggles with AutoCad. Having said that, this cooperation doesn’t always go as smooth as planned. There are major problems, there are minor obstacles and there are some odd design decisions I can’t really wrap my head around.

With this lighthearted post I want to share three examples of small annoyances, in no particular order

1. 3D section box
…and more specificly – those small arrows that controls it. Why are they so small? If I got a dollar for every missed click, I’d be a rich man with shares in Autodesk!


2. Orient to View list
You can’t scroll it with your mouse wheel. there’s no scroll bar. You have to click that little arrow and wait for the right view to finally pop on your screen. That might not be a big deal for smaller buildings, but having to work on 60+ high rise, it was a daily annoyance.

3. Aligining sections
Well, you can’t do it. I mean, you can’t use the align tool to do it, there are workarounds, but the intuitive thing to do – no, Revit won’t let you. Is there something I’m missing here?


Now that I vented a bit, something positive – if you’re in Boston area, you can sign up for the tour of Autodesk Build Space. Having seen it myself – strongly recommended, especially if you’re interested in production, 3d printing and CNC.

Purging unused linestyles in Revit with Dynamo and Python

All the best in 2017!

Lately, I’ve been dealing with models with far too many (i.e. more than zero) exploded dwgs inside, and being able to clean up all those leftover linestyles was crucial to me. Once you have to deal with 500+ positions when drafting a single detail, the blow to productivity is far too severe. Purging would be a smart move, yes?

As far as I know, you can’t achieve that with default purge functionality, and to my surprise – it’s not so obvious in Dynamo either. I’ve digged through internet (This thread was very helpful), and at some point I’ve realized that using Python was inevitable. I was reluctant, because my programming skills are basic at best, but as it turns out, “basic” is good enough and I’ve managed to complete my purging script. Here’s how it works:



My goal was to do as much as possible in “vanilla” Dynamo and as little as possible with Python. What you can see here is collecting all the linestyles used in project, saving all the unique ones and cross-checking them with list of linestyles available. This is the important distinction, as the first one can be easily done with basic dynamo nodes, the latter had to be achieved with following Python script:

import clr
from Autodesk.DesignScript.Geometry import *
import Revit
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

lineStyle = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines)
lineStyleSubTypes = lineStyle.SubCategories
listNames = []
listId = []

for i in lineStyleSubTypes:
  name = i.Name
  ID = i.Id

OUT = listNames, listId

We start with the list of all available styles, then we throw away those that are used in the project and those with ID’s below zero (non-deletable system linestyles) – ending with list of unused ones. We feed that list to a second Python script that deletes elements by ID’s.

import clr
from Autodesk.DesignScript.Geometry import *

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
from System.Collections.Generic import *

x = IN[0]
Left = list()
Erased = list()

for Id in x:
OUT = Erased, Left

…and we’re done. Use with caution!

Shaft openings in phases – am I missing something?

Bug reporting is always the big point of Inside the Factory meetings with Autodesk. This year they tried to play on my competitive side, using day by day charts with number of bugs reported by us. Well, I didn’t reach the podium, but I’ll come prepared next time! There are couple of things in Revit that just doesn’t look right, and as of version 2017 – some of those bugs still exist.

I’ve spotted this one working on a partially to-be-demolished basement model, and here’s how to replicate it:

We’ll start with modelling main actors of this tragedy:
Structural slab – Phase created: existing, Phase demolished: none
Shaft opening – Phase created: new construction, Phase demolished: none
And for reference:
Structural column A – Phase Created: existing, Phase Demolished: none
Structural column B – Phase Created: new construction, Phase Demolished: none
Chunk of slab – Phase Created: existing, Phase Demolished: New Construction
In summary:

Now let’s go back to the views. Let’s start with the completed one, i.e how does in look at the end of “New Construction” phase:

Seems about right.

Now let’s go to view highlighting the amount of demolishing taking place (it’s the state “between” existing and new construction):
Lift opening should be marked in red!

So how does it look in the “Show Complete” (end of “Existing”) phase?
In my opinion – this is incorrect. The “void” part of shaft openings for some reason ignores the phase in which it was created… and to make it more confusing, detail lines are (correctly) gone. When we look deeper, we see that the model element of “Shaft Opening” category is in fact gone… but it’s effect (void in the slab) is showing preemptively.
As I mentioned before – I might be wrong, maybe I’m missing something – please let me know.
And if anyone is interested with the solution I came up with – that’s what chunk of slab is showing – we’ve started modelling separate ones to simulate the effect of creating a new opening in an existing slab. Detail lines were placed manually.

Import & export Excel spreadsheets with Dynamo

It’s November now and I’m back from vacation. I’m hoping to write a bit more as soon as I deal with accumulated work… but in the meantime: more dynamo scripts!
This one was a collaboration between me and a fellow structural engineer working on structural framing for a one particular high-rise in London. The idea goes like this – in order to automatize steel framing updates (and save countless hours), we need to establish a link between structural software and Revit model. Third-party software solutions were out of question, and long story short – we used Dynamo .xls export/import function to fill in the gap.

Export script:
Import script:

As you can see, there’s no mind blowing programming work involved, but it was customized to fit this particular task, it works and there are some neat node tricks here and there. As for the future development – I need to figure out a smart way to map beams with those from structural software, now it’s being done by finding a matching “RAM number” (project parameter used just for this task).
Hope you find this useful!

What I’m working on – Column arrangement coordination in Dynamo

…but let me start with explaining WHY I’m doing this. Imagine a high rise located somewhere in London, It will have 60-something floors, around 18000 beams, more than 2000 columns – and 2-5 people working on the structural model, just to make the tight deadlines possible. It would be hard to keep track. Now imagine a lot of design changes, structural supports moving left and right, columns disappearing and appearing again. And to top it all – very restrictive column schedule macro that doesn’t take “almost in line” as an answer. I need to be able to quickly see if all the columns are in line, are the column numbers assigned correctly and were there any last-minute design changes that I’m not aware of.

Now we get to the Dynamo part. This is what I have so far, and keep in mind this is just a very early version of this concept:


So what’s the deal here? First, we get all the columns from the model and choose the column “path” that we’re interested in (C12 here). Then it get’s trickier – as far as I know, Dynamo 1.1 (which I’ve used to write this) doesn’t have an easy way to get X,Y location of the center of the column (I know there’s a node for that in 1.2), so I’ve came up with following workaround: we get the coordinates value from Element.Solid – asking for maximum and minimum Y (thus getting the point in the middle), and we subtract this with value of the column below. If it’s zero – columns are in line. To make this work, columns should be sorted according to Z value, and to my suprise this wasn’t the default – somehow slopped columns mess up this order (that’s why the counter-intuitive sorting method)

As I said, this is still very early version, and here are my plans for further development:

  • Exporting to Excel
  • Export all the columns, not just one “line”
  • Checking X,Y values at the top and bottom, so that slopped columns won’t be seen as an “value other than zero”

Feel free to comment on this script – I’m still learning here!

First project in Revit

What’s better way to start of this journal than to write about my first BIM project! It all began almost three years ago, and my starting point was my master thesis, student exchange programme and learning about this crazy BIM-thing in Scandinavian countries (first software I’ve tried was Tekla). I’ve connected all the dots and thought to myself – “why not give myself a challange, and maybe learn something in the process?”

The idea of my master thesis was to recreate an existing housing project located in Warsaw using BIM software (in this case – Revit), provide an analitical model within the same file that could be exported to structural software (in this case – Robot Structural Analysis) and show that such an aproach could bring cost and time saving benefits.


For the modelling part I was using “paper” documentation, but because the building wasn’t very complex – it wasn’t a terrible downside. My modelling software of choice was Revit 2014, upgraded later to 2015. I’ve issued the final copy as native file (.rvt), but if I was to repeat that project, I’d definetly use .ifc standard (and I’d add another chapter to my thesis explaining why that’s the right approach to have).

I’ve tried to use the “purest” software I could – i.e I wanted to use default solutions to fully learn software capabilites. However, seeing all that Revit had to offer, for the purpose of creating shop rebar drawings I’ve used SOFiSTiK Reinforcement Detailing.


Having a working analitical model within a structural model wasn’t as simple as I thought it would be, so I’ve spent a lot of time moving columns & walls around (Robot doesn’t take misalignments very well), and If I were to do it again, I’d look for some smarter aproach (Dynamo?).


Not to make this post longer than in should, I’ll give some bullet points:

  • Structural and analitical information were matching – although I’m not sure if that could be achieved if the project would be more complex
  • Loadings and foundation were modelled in Revit – so that Robot would be used just for calculation
  • Loading combination were done in Revit, but I wouldn’t recommend such a solution
  • Rebar was modelled in Revit, wasn’t easy but It made schedulling faster than ever