You are on page 1of 54

CS123738

Dynamo Studio Model Information Analysis for


Construction Builders
Enrique Galicia
Concepto Integral S.A. de C.V.

Learning Objetives
• Learn how to use Dynamo for data extraction and analysis
• Learn how to use Dynamo for sorting and grouping elements
• Learn how to transform schedules of Revit for gathering information and renaming
• Get overview behaviors of a construction model

Description
This class will cover basic use of Dynamo software with Revit software for model information
analysis when starting from scratch. The workflow that we’ll use can help you understand in a
practical way how to analyze your model information. Revit models hold a lot of information and
a lot of ways to change it. The practice of modifying everything is also the weak point for
construction, cost, and management. Fortunately, Dynamo can help us to review the
information, check that everything is coherent with the construction needs, and have some
filters that can assure model quality. We’ll cover basic Dynamo topics, such as selection,
extraction, and lists, and we’ll link with Microsoft Excel documents, sort, group, extract and
insert parameters, and visualize them on the model. And we’ll review some Dynamo examples
of scripts used for some projects.

Your AU Expert
Enrique Galicia is a BIM Specialist and International Consultant who works on several Mexican,
and Saudi Arabian Firms, He provides real construction solutions to common problems while
implementing and using BIM, using Autodesk Revit, Autodesk Navisworks, AutoCAD Civil 3d,
and Infraworks 360. He has 10 years of experience with workflows of BIM interoperability,
participated on more than 70 projects of diverse typologies, interoperability and has
programmed more than 37 Add-ins using the Revit API, presented at Autodesk University in
2012 with Harry Mattison on a lecture called Revit API for Constructors. Revit Architecture
Certified Professional, and Professor for more than 5 Years at Tecnologico de Monterrey on
BIM Topics. Has Developed more than 24 Courses on Udemy's Platform to spread the word
using BIM true potential with more than 1250 thousand students over 83 countries.
arq.enrique.galicia@gmail.com
WhatsApp - +5215536666063

Dynamo Studio Model Information Analysis for Construction Builders


Page 1
Learn how to use Dynamo for data extraction and analysis
Dynamo is a visual programing interface that extends Autodesk Revit 2018 functionality.
As a Revit User and Revit API Programmer, Dynamo has improved workflows and functionality
because it facilitates testing and exploration of functions.

Dynamo Starting Point


Install Dynamo 1.3 or be sure that you have installed with Autodesk Revit 2018.
it would be on the Manage Tab

This will open the Dynamo Window and you can check the version on the help / About Function
on that screen

Here you can find in red letters the version you’re using.
From there you can get to the Files / New to start working around with scripts.
This script would run over the existing open project, if there’s any a red text, of not available
would appear.

Dynamo Studio Model Information Analysis for Construction Builders


Page 2
On the Left side, you’ll have the menus of functions to be used with a search bar that would be
handy for you to find functions.

On the Right side, you’ll find a grid and a space where we can place nodes.
And over the top right corner there are two icons to use to change between Background
Preview and Graph Preview.

This would help us to switch between geometry and elements, and graphs of nodes.
Tip – we can call the search function bar right clicking on the graph/background space.

Dynamo Studio Model Information Analysis for Construction Builders


Page 3
Let’s Start by the basic skills required to walk with dynamo. And work with it.

Execution
Dynamo has three different types of execution:
Automatic - Recommended for Geometry or simple elements.
Manual – For heavy transactions, experimenting, or controlled workflows that require no mayor
check up until you had finished

Nodes
Main workflow would go like this
Starting point would be a selection, pick or input value.
In the middle, you’ll have some nodes to do functions
At the end, you’ll get an output.
They are meant to be read from left to right and each node would feed upon the precedent
ones.

Inputs
We have different types of inputs and each time you want to use a node you can hover over the
left input to see what the node needs to work.
Examples of Nodes are
Number String Boolean File Path

and Code Block

Dynamo Studio Model Information Analysis for Construction Builders


Page 4
This last one would be the most used since it’s the quicker way to write generated values

And, we have all the other types of inputs that will nest their properties or will be generated by
combining nodes, Such as

Revit. Element,
Which is the standard element will need to use to understand all elements in the model
Since we are getting on Model Analysis and Management let’s review the transaction behaviors
and Lists.

Lists and Sub lists


A List would give us the ability to transform or use the multiple elements or values, since its
characteristics would depend from the element it would depend how we use them to get our
outputs

This Starting point of a List is a sequence or a range, which would hold several numbers.
We can create a sequence with commands SEQUENCE or RANGE

But to go faster we will use a code block, you can do it by double-clicking the graph space.
For a sequence you would write start..amount.step for example
0..#10..2 would give a sequence of 0,2,4,6,8,10,12,14,16,18

Dynamo Studio Model Information Analysis for Construction Builders


Page 5
Result can be checked by closely hovering the mouse over the bottom right corner and clicking
the pin so it will prevail.

At the bottom line, it has two @with L2 and L1 that means that it has one list of
information

For a Range, you can use 0. 10.. #9 so it will divide from 0 to 10 in 9 parts

Dynamo Studio Model Information Analysis for Construction Builders


Page 6
To understand sub list, we will use the Node LIST: CREATE, then click on the
plus sign and link by clicking the right box and the dragging to the left box to the
item0 and item1

Dynamo Studio Model Information Analysis for Construction Builders


Page 7
As you can see now the last lists has three levels of information, and the same process can be
downgraded by the command FLATTEN

Lacing and Functions


Elements entering and exiting functions would deliver the same number of items, with the same
hierarchy and sorting, but if we got operations of different elements we need to set the lacing
method, we got Shortest, Longest and Cross Product

A list of 6 elements multiplied by 2 elements on a shortest lacing set would give one element.

Dynamo Studio Model Information Analysis for Construction Builders


Page 8
A lacing of longest would deliver 6 elements but would multiply the non-paired results with the
last element.

Dynamo Studio Model Information Analysis for Construction Builders


Page 9
And a Cross product would create two lists of elements one for each operation.

Strings and their behaviors


Strings work as lists by themselves because all characters can be splitted up, reorder and sort
with different concatenation. By doing this we can write properties and parameters that may be
missing to elements, reducing the human error while typing.
Strings are supported by the “” Method on a Code Block

Dynamo Studio Model Information Analysis for Construction Builders


Page 10
Revit Selection Methods
To analyses model information, we need to get all model elements, and know how to filter them
two functions are important

All Elements from Category and All Elements from Family Type.

The first one would get all model elements even if they are hidden and the second one could be
use full just if we want to use a single-family type
Whatever option you choose next to that you need mix them on lists with the create. List
function and then flatten to avoid hierarchy

Dynamo Studio Model Information Analysis for Construction Builders


Page 11
Parameters GET
Our first function to analyze information is to go for Element. Parameters and
Element.GetParameterValueByName, to see which information is on the Revit elements,
remember that different categories may have different parameters so some queries may go up
Null.

Dynamo Studio Model Information Analysis for Construction Builders


Page 12
With those two set we can review existing parameters built in and shared parameters to
Call different values

We may call all values from the Level parameter.


As an exception, there are parameters which hold properties as entities, Levels and Types so
we may need to compare to the final value.

Dynamo Studio Model Information Analysis for Construction Builders


Page 13
Sample to this we might get this result.

That’s the level value and from that we can get parameter name
With Level.Name function.

Dynamo Studio Model Information Analysis for Construction Builders


Page 14
FilterByBoolMask
The FilterByBoolMask option is your first way to filter you need to get properly a comparison
value that can be a String, Bool or Double and Check it with a formula.
Sample A to get elements equal to “B2 -6.8”

Dynamo Studio Model Information Analysis for Construction Builders


Page 15
Final Result must be a bool and with that the function is FilterbyBoolMask
Where you can take the elements, you called and use the resulting == as a filter to get just the
true values.

Dynamo Studio Model Information Analysis for Construction Builders


Page 16
Parameters SET
The Parameter set function works similar the only difference it’s that it needs a value to be
written on it, it’s called Element.SetParameterByName

Review 01_Dynamo Workarounds

Parameter Creation
Because elements won’t always share the same parameters and management and analysis
would need to use on similar constraints its often better to create shared parameters for
management that can solve multiple information data analysis.
The function is called Parameter.CreateSharedParameter and what it does it creates shared
parameters in the selected file and in the model

You need to set like the sample


parameterName – “Level Location”
groupName – “Analysis”
type – Select Parameter Type - Text
group – Select Built-in Parameter Group – Text
instance – True
category List – Categories Structural Columns – Structural Framings – List Create and Set the
List.

Dynamo Studio Model Information Analysis for Construction Builders


Page 17
This function would create the shared parameters you may need for any categories you’re up to
on the next analysis issues.

Export to Excel
Functions of importing to excel are vital so that you can get information.
Just need to set up the list of values you want to get and the functions works like this,
Excel.WriteToFile

filePath – File Path- Set a File Path to Save the Information


sheetName – CodeBlock – “Analysis”
startRow – CodeBlock - 0
startCol – CodeBlock – 0
data – List Settings of 2 variables you can transpose if needed
overwrite – set to true.

Dynamo Studio Model Information Analysis for Construction Builders


Page 18
Import from Excel
Import Back would go from the Excel.ReadFromFile Function
File – Needs the Function File.FromPath and a FilePath to catch the Excel
sheetName – Needs a CodeBlock with the Name on it “Analysis”
readAsStrings – Needs a Boolean set true or false.

Insert AU caption.

Dynamo Studio Model Information Analysis for Construction Builders


Page 19
Color Overrides
Color overrides would be our first way or having information in the model we want to know
which elements are at what stage or what level they have, sample function to color framings by
their level.
First, I’m going to isolate framings category.

And using the functions get the parameter value of reference level name, because the
parameter level on framings doesn’t exist.

Dynamo Studio Model Information Analysis for Construction Builders


Page 20
And we need to set variability on the naming so we might need a function called
List.GroupByKey and set our value list to both list and keys, so we still get the keys and count
them with the list. count function. We can watch the result we got with the Watch Function.

Dynamo Studio Model Information Analysis for Construction Builders


Page 21
And now with a count we can create a sequence of numbers from start to end

Now we can find out which values we have with the index of, for that function we need to set a
flatten of the keys and compare the complete name list using a crossproduct and a ==, then use
a List. Map function to get the corresponding results and use as a function index of with a true
Value.

So, it’s showing the number they will get according to the list, we just need to set up the values
with a remap. Range function and set overrides.
The Math.RemapRange functions would let us transform the numbers in a spectrum from 0 to 1

Dynamo Studio Model Information Analysis for Construction Builders


Page 22
For the Overrides, we need to get the OverrideGraphicsSettings.ByProperties and a Color
Range that would go with the values, we can change colors and index for greater detail and we
will connect the color to the projection fill pattern
And the information it’s going to be pulled from the Math.RemapRange as list with the
getitematindex element connected with the List. Map so it would give us the order of all colors.

Dynamo Studio Model Information Analysis for Construction Builders


Page 23
Dynamo Studio Model Information Analysis for Construction Builders
Page 24
And finally, the Element.OverrideInView

The result would be something like this.

Dynamo Studio Model Information Analysis for Construction Builders


Page 25
With that you can review the properties from framings related to elevation and other settings.
Analysis Display Settings
Analysis Display on the other hand would help you to create analysis over surfaces used in
Revit for example if we want to review the distance to intersection with columns so we can
select upper face of a floor and then get points by surface. pointatparameter.

Dynamo Studio Model Information Analysis for Construction Builders


Page 26
With that information, we need to get the columns intersection with the floors
So, we are going to take the columns locations

And then project those to our surface using a zAxis

Dynamo Studio Model Information Analysis for Construction Builders


Page 27
With those we want to establish a matrix of dots with the distance they must the closest column
and from then get the minimum value

And Finally, we use all the points and its values to create an analysis display by points.

Dynamo Studio Model Information Analysis for Construction Builders


Page 28
Now when it has run we can configure the display settings to show the dots.

And configure Visibility as greater your gradient looks more complete the information will be
understood.

Dynamo Studio Model Information Analysis for Construction Builders


Page 29
Since it’s a Point Analysis definition it needs to have Markers with text.
And then on the color settings use Ranges to identify the values.

And the Result would look up like this.

Dynamo Studio Model Information Analysis for Construction Builders


Page 30
We can review the results with columns.

Dynamo Studio Model Information Analysis for Construction Builders


Page 31
Write Information by ID
The ID property may be useful just in case you are analyzing with other software and had
received that file with an ID feature, to add Information on parameters in that case you may
need to use a package called Clockwork where you will find a function called Element.ByID you
can use it to get elements ID and Match Properties with the Set or Get Function.

Filter Creation
Filter creation is a great feature that can be improved with Dynamo
Before that we need to get in some organizing features because if you get a lot of information
scripts may not be as set as you would like, what you can do is to set groups by selecting
elements

Dynamo Studio Model Information Analysis for Construction Builders


Page 32
And then in the groups select the Option Cleanup Node Layout.

On this example, it’s a filter created to several categories, you’ll need to extract those and
create a single list.

Dynamo Studio Model Information Analysis for Construction Builders


Page 33
Then we need to create a parameter setting that would give us the parameter.
byparameterName, we want for the filter.

Dynamo Studio Model Information Analysis for Construction Builders


Page 34
Then we create the rules that would drive the filter, in the sample we are using 3 rules in one
single script.

And the final output is a ParameterFilterElement.ByRules that we will need to pull to create a
ParameterFilterElement, but before we need to get our graphic overrides

In this case I used a Codeblock for each color and create three types of overrides so they can
be selected with the filters and at the end we got the filters.

Dynamo Studio Model Information Analysis for Construction Builders


Page 35
That would be the basic setting for element analysis let’s get into sorting and grouping
elements.

Learn how to use Dynamo for sorting and grouping elements


Sorting and Grouping elements would help us to get properties on elements that may be
missing information or that we want them to get identified.
The Mark property itself works for this purpose but what if we want elements to be sorted by
distance to elements, and then we want to get those string set up.
Let’s get into those settings.
Sorting Lists
We got a basic sort function that would help us do basic sorting List.Sort
We will use the framing for sort elements by its midpoint or can be the Line.PointatParameter
with a value of 0.5

Dynamo Studio Model Information Analysis for Construction Builders


Page 36
Then if we get the point. z value it would bring a lot of doubles that may be repeating we can
use the same process of group with keys and Map values with the index of extracting the value
of keys and using the sort function.

Its highly recommended to set a round function to avoid decimal differences greater than 1cm

But still we still get a lot similar values if we wanted to sort multiple we will need a different
approach

Dynamo Studio Model Information Analysis for Construction Builders


Page 37
Sorting Multiple Levels
First function to be set is from the Clockwork.Package called List.SortListOfLists, what it would
do is to receive a sequence of lists and by an index would set the sorting for all list.
Lists need to have same number of Items
So, we can create a list that has on the first list, the elements and on the second list the values
of z point rounded so when we get it to the analysis they would be set by its z value and we just
need to use the elements in that order.

If we need a deeper level of management we might need to get the package called PracticalBIM
and there we have some nodes to deeper sorting lists.
We can use the node called SortListofListsL2

Dynamo Studio Model Information Analysis for Construction Builders


Page 38
Or even use the SortListofListsL3 so it can be sorted z, y, and x values rounded.

Dynamo Studio Model Information Analysis for Construction Builders


Page 39
The result would have all elements sorted by those three criteria
We can write the element Number as Mark called F_##
For that we need to getitematindex on 0

Dynamo Studio Model Information Analysis for Construction Builders


Page 40
And Create a Count of elements same process as before

And then get the setting of the parameter on Mark

Dynamo Studio Model Information Analysis for Construction Builders


Page 41
And from there you can set whatever use you like with the model.

Dynamo Studio Model Information Analysis for Construction Builders


Page 42
Learn how to transform schedules of Revit for gathering information and
renaming
Schedules are part of the Quantity Workflow done in Revit, nevertheless they can be really
usefull for extracting data and exporting information.
Let’s see the process of creation in dynamo and the export of schedules to excel.

Extracting Schedules
Creating Schedules in dynamo needs a lot information it all will start with the Schedule View.
Create Schedule

In this case it uses the Category we want it gets a naming setting and its type from the schedule
Type
Then we need to create the fields it will hold, for that the function is called
ScheduleView.SchedulableFields and then we need to transform information to
SchedulableFIeld.Name we can use the index to extract but it would take some time instead we
can create a list with the names as written and the order we want and use the function
IndexFromMapping, this function will find the elements selected on a second list and would give
us the index number so we can extract the schedulableFields.

Dynamo Studio Model Information Analysis for Construction Builders


Page 43
Once we have that result we can add those fields to our current schedule
With the getitematindex function conbined with the scheduleView.Addfields

Dynamo Studio Model Information Analysis for Construction Builders


Page 44
We can also add Filters but you will need to get the field you want to get and the value its
looking.

The only downside of this process is that the sorting and grouping can’t be manage
Extracting Values and Exporting Schedules
For the Data extraction, we need to install the package called Bimorph Nodes in which we have
a function called Schedule.GetData that would take the information of any schedule created and
export the data in lists.

Dynamo Studio Model Information Analysis for Construction Builders


Page 45
And from there export information to the ExporttoExcel Node function we saw before.

Get overview behaviors of a construction model


Quality Routines
Quality Routines can be settled for Information analysis, Locations and Materials on Positions.

Everything on their corresponding room


We use the Settings of Level name to find that all elements are corresponding to naming but we
can also create bounding boxes to review that elements are belonging to the level they are
supposed two, this can also work when you are needing to extract information of room
boundaries or space boundaries.
Let’s review a Sample

We need the Lunchbox Package for this one, with the function Lunchbox Room Element
Collector and using a toggle of True to extract room elements

Dynamo Studio Model Information Analysis for Construction Builders


Page 46
And then with the geometry there is a function on the package Bimorph nodes that would get
the elements intersecting with solids
So, we can use a flatten to get all solids and another query of furniture elements.

This will set a result of elements intersecting with the spaces we can have visibility on dynamo
of those presents.

Dynamo Studio Model Information Analysis for Construction Builders


Page 47
And with the use of list. count using a function of leveling we can get the number of furniture
elements in each room

Dynamo Studio Model Information Analysis for Construction Builders


Page 48
We can review that information with a color using the function Display.ByGeometryColor and
using a remap range for the values like this

Dynamo Studio Model Information Analysis for Construction Builders


Page 49
But also, we can set different color to elements intersecting on rooms.
Just need to set the view as furniture elements and then create some functions.
We need to have a sequence list of elements as well that would help us to find to which list the
elements belong and then use a list. Combine to cycle the number of list the number of
elements required.

Will get both functions flatten, the elements and the values of list including them and from there
it’s just a matter of overrides.

Dynamo Studio Model Information Analysis for Construction Builders


Page 50
To get the expected result.

Dynamo Studio Model Information Analysis for Construction Builders


Page 51
With a Generic Model Direct Shape using the room geometry we can review our results.

Everything is coded for Assembly/Keynote/Cost


Let’s say you are sure that everything has its assembly code properly set, we can review with a
script that everything has a parameter value or compare with it and be shown on a 3d view.
So, we need to extract the elements and because we are asking for a parameter by type we
need to get the elementtype.

Dynamo Studio Model Information Analysis for Construction Builders


Page 52
With this value, we want to get blank elements to color them

Dynamo Studio Model Information Analysis for Construction Builders


Page 53
And then we can transform those values to 1 and 2 by a list {true, false} and use the
IndexFromMapping Node from PracticalBIM
Because values are set 0 and 1 we can override color items like before we can use the color
range straight ahead and the function Element.OverrideColorInView.

Other Uses of Dynamo as a tool for construction analysis.


Clash Detection Improvement
Other Routines showed up available on the
BIM Clash Detection with Revit Navisworks and Dynamo 2018
https://www.udemy.com/clash-detection/?couponCode=AUVEGAS2017

Simulation by every single element


Other Routines showed up available on the
BIM 4D Simulations Revit, Dynamo, Navisworks & Max 2018
https://www.udemy.com/simulate/?couponCode=AUVEGAS2017

Hope you liked this lecture and am looking forward to receive any comments and suggestions,
as well as possible topics to develop.

Dynamo Studio Model Information Analysis for Construction Builders


Page 54

You might also like