SlideShare a Scribd company logo
By WOJCIECH KLEPACKI wklepa@gmail.com
Imagine yourself, the ideal world where Revit can do the fancy charts based on the data like
a real spreadsheet. Well, it’s not only the song of the future, actually, this is happening now in the
backyard. There is Mandrill, a nice and very effective package for the Dynamo to visualise the data in
a way most spreadsheets can do. This package is a brilliant piece of code and I highly recommend any
data-hungry individual to make himself familiar with it. Data mining and analysing take a huge part in
our daily activities these days. I have some good experience with Mandrill and I price it very high.
The only issue I had with Mandrill was, that it didn’t produce vector output. You can export
the outcome to bitmap and then nest it in a Revit. The only objection to this process is, that the chart
is not easy to manipulate and change inside Revit. My ambition was to create a Dynamo workflow,
which is less sophisticated than Mandrill but still good enough, will produce a vector chart inside Revit
environment.
I developed a script and complementary detail families to effectively achieve the working
solution. It’s less flexible than Mandrill package and has some limitations but suits my needs perfectly.
This a snippet of a working, real-world application (I’ve only changed the inputs to be more
general):
Inside this same topology, we can achieve pie charts as well. Redeveloping script a bit and
building more detail families it’s easy to successfully show data in a different manner. Bar charts or
plots are equally possible. Now, data-driven Revit charts are within a reach of hands. Think about
potentially endless options how to enrich your raw and sometimes dull schedules.
This particular script takes the manually entered data as an input but what I normally do is to
feed it with data from real project environment like rooms or glazed walls areas.
By WOJCIECH KLEPACKI wklepa@gmail.com
This is how the whole script looks. I decided to use the Code Blocks and I assure you there is
a good reason for this. Honestly speaking, there is more than only one. At first, it keeps the whole
script much more compact. Secondly, because it has a modular structure it subjects to changes
seamlessly and adopts new modules easily. The last but not least feature is that when you have some
skills it’s more clear and effortless to follow.
Let me give you a good example. This is a bit of code based on the traditional Dynamo nodes:
The one below is done in Code Block technique. Like I mentioned, it’s easier to follow and it’s
more compact. You can add own comments inside to make it more understandable. And what is
important and comes in a package, it’s more elegant and sophisticated. Mastering this technique is
very good exercise to start coding in Python for instance. Keeping every chunk of code in modules
creates the good habits for the future as well.
By WOJCIECH KLEPACKI wklepa@gmail.com
Let’s go deeper and allow me to explain the background of the whole process. The workflow
utilizes detail families developed exclusively for the purpose of this process. The first one is the
“donut” and the last one is the “table”. I decided to base the workflow on the families rather than the
lines drawn by the script only because it’s a good compromise between the outcome and keeping the
script reasonably easy to change. Please consider the fact that almost every specialised script is
designed to solve specific not the generic problem.
This is how the “donut” family looks and works:
By WOJCIECH KLEPACKI wklepa@gmail.com
Please notice that all parameters that are to be changed by the Dynamo script are “instance”. This is
important to keep them this way otherwise it will be not possible to access these parameters and
change them per individual family instance. Please pay attention, that the chunk of “donut” is driven
by angle, inner and outer parameters.
Same principals apply to the “table” family:
And family parameters:
There is a trick, however. The table header is a part of the “table” family and it’s controlled by the
visibility parameter. This trick keeps the whole workflow easier to manage inside the Dynamo.
Now let’s jump in Dynamo and analyse the code. The first part of the script is responsible for
the formatting the input data. Because I use string input nodes and not all the data are a string type,
I want to convert some of them to integers. Subsequently, I want to change them into lists, splitting
by the “,” separator. This is exactly what the block below does:
By WOJCIECH KLEPACKI wklepa@gmail.com
Please pay attention, that I plug the watch nodes in some critical places of the code to analyse
what information is coming out from them. This is not only the matter of a good practice. This step is
necessary to understand if everything runs according to the specification.
The chunk of code below checks if the input lists are equal in the count. It gives a combined
list of input names and element counts. As an additional precaution, it gives a warning in case of error
or confirmation if everything is up and running.
The top part of the code calculates the percentage share and rounds the numbers.
Subsequently, it converts the numbers to strings and adds “%” sign and “SQM” for percentages and
By WOJCIECH KLEPACKI wklepa@gmail.com
square meters respectively. Because values for both are float type, it requires a few additional lines
of code to convert and round them properly.
indDot=String.IndexOf(numStr,".",true);
strRem=String.Remove(numStr,(indDot+digToLeft+1),(numLen-indDot-digToLeft-1));
To make the life complicated, it may happen that some numbers are integers and others are a float.
Two lines of code above take care that both of the types will be converted to strings with the desired
precision. I want 100 to be precisely formatted as “100”, not “100.00”. But in contrary, I want 175.378
to be formatted exactly as “175.38”.
Now comes the time when we definitely want to play with some colours. This portion of code
defines “top left”, “middle” and “bottom right” colours. These three members will define the limits
of the matrix of colours. Subsequently, I want to shuffle the colours, but I will use them only if the
Boolean node is true, otherwise, I use the list of colours straight from the mixer.
Here comes the interesting part and time the for a little disclaimer. The code will place
“donuts” and “tables” in any plan, ceiling or section view. In my opinion, the best place to locate
them is newly created drafting view. This view must be an active view! For some reason, I suggest
setting the drawing scale to 1:100. The script will work fine on any scale, but some additional tweaking
of code might be required to make it look nice and neat. The portion of the code below prepares data
for rotation and placement the pieces of “donut”. The script utilizes the node
FamilyInstance.ByPointInView from LunchBox package to place the family in a proper location.
Afterwards, the script assigns the values for the parameters responsible for the rotation, inner and
outer radiuses of the “donuts”. Before running the script, make sure that the right fill pattern is chosen
in a Fill Patterns node. Also, pay attention that the outer radius has to be greater than the inner radius.
It’s the question of common sense to keep them this way but it’s a matter of a good practice to
doublecheck.
By WOJCIECH KLEPACKI wklepa@gmail.com
The portion of the script below does roughly same operations as the part from the above. The
differences occur because it was designed to place the “table” detail family. But the concept is the
same. Find the location points, place multiple family instances, resize and assign values to the
parameters.
Last part of the script will override the colours of the placed family instances in a view. Please
pay attention than the script utilizes only a few inputs of the OverrideGraphicSettings.ByProperties
node.
By WOJCIECH KLEPACKI wklepa@gmail.com
The benefit of keeping the chart as a native Revit geometry is an ability to perform
modifications locally without running the script again. Please remember that if you want to modify
the script dramatically, change the input numbers, amount of inputs or colours, it’s compulsory to run
the script again. Also in new Revit session, it’s necessary to delete existing “donuts” and “tables” in
an active view. As a bottom line let me visualise the example of a local change you can make. This
change is impossible when the chart is nor vector type:

More Related Content

Similar to Donut chart in Revit with Dynamo

Handout 17317 es17317-sgambelluri-au2016
Handout 17317 es17317-sgambelluri-au2016Handout 17317 es17317-sgambelluri-au2016
Handout 17317 es17317-sgambelluri-au2016
CutiePie33
 
Old code doesn't stink
Old code doesn't stinkOld code doesn't stink
Old code doesn't stink
Martin Gutenbrunner
 
Bridging the gap between designers and developers at theguardian.com
Bridging the gap between designers and developers at theguardian.comBridging the gap between designers and developers at theguardian.com
Bridging the gap between designers and developers at theguardian.com
Kaelig Deloumeau-Prigent
 
Dynamics gp insights to manufacturing
Dynamics gp insights to manufacturingDynamics gp insights to manufacturing
Dynamics gp insights to manufacturing
Steve Chapman
 
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
Oleg Shilovitsky
 
SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2
dan_mcweeney
 
Hipster FP code harder to maintain because it actively removes domain knowledge
Hipster FP code harder to maintain because it actively removes domain knowledge Hipster FP code harder to maintain because it actively removes domain knowledge
Hipster FP code harder to maintain because it actively removes domain knowledge
Philip Schwarz
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AI
Vijayananda Mohire
 
Differences in macros between catia v5 and catia v6 or 3dexperience
Differences in macros between catia v5 and catia v6 or 3dexperienceDifferences in macros between catia v5 and catia v6 or 3dexperience
Differences in macros between catia v5 and catia v6 or 3dexperience
Fernando Petre
 
introduction-to-programming-in-visual-basic-6-01.pdf
introduction-to-programming-in-visual-basic-6-01.pdfintroduction-to-programming-in-visual-basic-6-01.pdf
introduction-to-programming-in-visual-basic-6-01.pdf
Juan Perez
 
Blender for ArchViz.pdf
Blender for ArchViz.pdfBlender for ArchViz.pdf
Blender for ArchViz.pdf
shan_1900
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
Mike Wilcox
 
InforMeDesign
InforMeDesignInforMeDesign
InforMeDesign
Ceilidh Higgins
 
Duarte ms template_download
Duarte ms template_downloadDuarte ms template_download
Duarte ms template_downloadartecxt
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
PVS-Studio
 
London F-Sharp User Group : Don Syme on F# - 09/09/2010
London F-Sharp User Group : Don Syme on F# - 09/09/2010London F-Sharp User Group : Don Syme on F# - 09/09/2010
London F-Sharp User Group : Don Syme on F# - 09/09/2010Skills Matter
 
10 things you're doing wrong in Talend
10 things you're doing wrong in Talend10 things you're doing wrong in Talend
10 things you're doing wrong in Talend
Datalytyx
 
10 things you're doing wrong in Talend
10 things you're doing wrong in Talend10 things you're doing wrong in Talend
10 things you're doing wrong in Talend
Matthew Schroeder
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
Andrey Karpov
 

Similar to Donut chart in Revit with Dynamo (20)

Ibm redbook
Ibm redbookIbm redbook
Ibm redbook
 
Handout 17317 es17317-sgambelluri-au2016
Handout 17317 es17317-sgambelluri-au2016Handout 17317 es17317-sgambelluri-au2016
Handout 17317 es17317-sgambelluri-au2016
 
Old code doesn't stink
Old code doesn't stinkOld code doesn't stink
Old code doesn't stink
 
Bridging the gap between designers and developers at theguardian.com
Bridging the gap between designers and developers at theguardian.comBridging the gap between designers and developers at theguardian.com
Bridging the gap between designers and developers at theguardian.com
 
Dynamics gp insights to manufacturing
Dynamics gp insights to manufacturingDynamics gp insights to manufacturing
Dynamics gp insights to manufacturing
 
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
BOM Management Webinar: Part Numbers - Intelligent or Just Numbers?
 
SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2
 
Hipster FP code harder to maintain because it actively removes domain knowledge
Hipster FP code harder to maintain because it actively removes domain knowledge Hipster FP code harder to maintain because it actively removes domain knowledge
Hipster FP code harder to maintain because it actively removes domain knowledge
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AI
 
Differences in macros between catia v5 and catia v6 or 3dexperience
Differences in macros between catia v5 and catia v6 or 3dexperienceDifferences in macros between catia v5 and catia v6 or 3dexperience
Differences in macros between catia v5 and catia v6 or 3dexperience
 
introduction-to-programming-in-visual-basic-6-01.pdf
introduction-to-programming-in-visual-basic-6-01.pdfintroduction-to-programming-in-visual-basic-6-01.pdf
introduction-to-programming-in-visual-basic-6-01.pdf
 
Blender for ArchViz.pdf
Blender for ArchViz.pdfBlender for ArchViz.pdf
Blender for ArchViz.pdf
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
 
InforMeDesign
InforMeDesignInforMeDesign
InforMeDesign
 
Duarte ms template_download
Duarte ms template_downloadDuarte ms template_download
Duarte ms template_download
 
The First C# Project Analyzed
The First C# Project AnalyzedThe First C# Project Analyzed
The First C# Project Analyzed
 
London F-Sharp User Group : Don Syme on F# - 09/09/2010
London F-Sharp User Group : Don Syme on F# - 09/09/2010London F-Sharp User Group : Don Syme on F# - 09/09/2010
London F-Sharp User Group : Don Syme on F# - 09/09/2010
 
10 things you're doing wrong in Talend
10 things you're doing wrong in Talend10 things you're doing wrong in Talend
10 things you're doing wrong in Talend
 
10 things you're doing wrong in Talend
10 things you're doing wrong in Talend10 things you're doing wrong in Talend
10 things you're doing wrong in Talend
 
The Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and EverythingThe Ultimate Question of Programming, Refactoring, and Everything
The Ultimate Question of Programming, Refactoring, and Everything
 

More from Wojciech Klepacki

Create a camera view by room
Create a camera view by roomCreate a camera view by room
Create a camera view by room
Wojciech Klepacki
 
Create room separations lines for the structure columns
Create room separations lines for the structure columnsCreate room separations lines for the structure columns
Create room separations lines for the structure columns
Wojciech Klepacki
 
Format any sequence of numbers
Format any sequence of numbersFormat any sequence of numbers
Format any sequence of numbers
Wojciech Klepacki
 
Controlling the visibility in a Revit family
Controlling the visibility in a Revit familyControlling the visibility in a Revit family
Controlling the visibility in a Revit family
Wojciech Klepacki
 

More from Wojciech Klepacki (11)

Create a camera view by room
Create a camera view by roomCreate a camera view by room
Create a camera view by room
 
Create room separations lines for the structure columns
Create room separations lines for the structure columnsCreate room separations lines for the structure columns
Create room separations lines for the structure columns
 
Format any sequence of numbers
Format any sequence of numbersFormat any sequence of numbers
Format any sequence of numbers
 
Controlling the visibility in a Revit family
Controlling the visibility in a Revit familyControlling the visibility in a Revit family
Controlling the visibility in a Revit family
 
Bialystok
BialystokBialystok
Bialystok
 
Sopot
SopotSopot
Sopot
 
Detal rynny
Detal rynnyDetal rynny
Detal rynny
 
BRAWO_portfolio
BRAWO_portfolioBRAWO_portfolio
BRAWO_portfolio
 
ZDZ_portfolio
ZDZ_portfolioZDZ_portfolio
ZDZ_portfolio
 
MROZA_portfolio
MROZA_portfolioMROZA_portfolio
MROZA_portfolio
 
DAMIR_portfolio
DAMIR_portfolioDAMIR_portfolio
DAMIR_portfolio
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 

Donut chart in Revit with Dynamo

  • 1. By WOJCIECH KLEPACKI wklepa@gmail.com Imagine yourself, the ideal world where Revit can do the fancy charts based on the data like a real spreadsheet. Well, it’s not only the song of the future, actually, this is happening now in the backyard. There is Mandrill, a nice and very effective package for the Dynamo to visualise the data in a way most spreadsheets can do. This package is a brilliant piece of code and I highly recommend any data-hungry individual to make himself familiar with it. Data mining and analysing take a huge part in our daily activities these days. I have some good experience with Mandrill and I price it very high. The only issue I had with Mandrill was, that it didn’t produce vector output. You can export the outcome to bitmap and then nest it in a Revit. The only objection to this process is, that the chart is not easy to manipulate and change inside Revit. My ambition was to create a Dynamo workflow, which is less sophisticated than Mandrill but still good enough, will produce a vector chart inside Revit environment. I developed a script and complementary detail families to effectively achieve the working solution. It’s less flexible than Mandrill package and has some limitations but suits my needs perfectly. This a snippet of a working, real-world application (I’ve only changed the inputs to be more general): Inside this same topology, we can achieve pie charts as well. Redeveloping script a bit and building more detail families it’s easy to successfully show data in a different manner. Bar charts or plots are equally possible. Now, data-driven Revit charts are within a reach of hands. Think about potentially endless options how to enrich your raw and sometimes dull schedules. This particular script takes the manually entered data as an input but what I normally do is to feed it with data from real project environment like rooms or glazed walls areas.
  • 2. By WOJCIECH KLEPACKI wklepa@gmail.com This is how the whole script looks. I decided to use the Code Blocks and I assure you there is a good reason for this. Honestly speaking, there is more than only one. At first, it keeps the whole script much more compact. Secondly, because it has a modular structure it subjects to changes seamlessly and adopts new modules easily. The last but not least feature is that when you have some skills it’s more clear and effortless to follow. Let me give you a good example. This is a bit of code based on the traditional Dynamo nodes: The one below is done in Code Block technique. Like I mentioned, it’s easier to follow and it’s more compact. You can add own comments inside to make it more understandable. And what is important and comes in a package, it’s more elegant and sophisticated. Mastering this technique is very good exercise to start coding in Python for instance. Keeping every chunk of code in modules creates the good habits for the future as well.
  • 3. By WOJCIECH KLEPACKI wklepa@gmail.com Let’s go deeper and allow me to explain the background of the whole process. The workflow utilizes detail families developed exclusively for the purpose of this process. The first one is the “donut” and the last one is the “table”. I decided to base the workflow on the families rather than the lines drawn by the script only because it’s a good compromise between the outcome and keeping the script reasonably easy to change. Please consider the fact that almost every specialised script is designed to solve specific not the generic problem. This is how the “donut” family looks and works:
  • 4. By WOJCIECH KLEPACKI wklepa@gmail.com Please notice that all parameters that are to be changed by the Dynamo script are “instance”. This is important to keep them this way otherwise it will be not possible to access these parameters and change them per individual family instance. Please pay attention, that the chunk of “donut” is driven by angle, inner and outer parameters. Same principals apply to the “table” family: And family parameters: There is a trick, however. The table header is a part of the “table” family and it’s controlled by the visibility parameter. This trick keeps the whole workflow easier to manage inside the Dynamo. Now let’s jump in Dynamo and analyse the code. The first part of the script is responsible for the formatting the input data. Because I use string input nodes and not all the data are a string type, I want to convert some of them to integers. Subsequently, I want to change them into lists, splitting by the “,” separator. This is exactly what the block below does:
  • 5. By WOJCIECH KLEPACKI wklepa@gmail.com Please pay attention, that I plug the watch nodes in some critical places of the code to analyse what information is coming out from them. This is not only the matter of a good practice. This step is necessary to understand if everything runs according to the specification. The chunk of code below checks if the input lists are equal in the count. It gives a combined list of input names and element counts. As an additional precaution, it gives a warning in case of error or confirmation if everything is up and running. The top part of the code calculates the percentage share and rounds the numbers. Subsequently, it converts the numbers to strings and adds “%” sign and “SQM” for percentages and
  • 6. By WOJCIECH KLEPACKI wklepa@gmail.com square meters respectively. Because values for both are float type, it requires a few additional lines of code to convert and round them properly. indDot=String.IndexOf(numStr,".",true); strRem=String.Remove(numStr,(indDot+digToLeft+1),(numLen-indDot-digToLeft-1)); To make the life complicated, it may happen that some numbers are integers and others are a float. Two lines of code above take care that both of the types will be converted to strings with the desired precision. I want 100 to be precisely formatted as “100”, not “100.00”. But in contrary, I want 175.378 to be formatted exactly as “175.38”. Now comes the time when we definitely want to play with some colours. This portion of code defines “top left”, “middle” and “bottom right” colours. These three members will define the limits of the matrix of colours. Subsequently, I want to shuffle the colours, but I will use them only if the Boolean node is true, otherwise, I use the list of colours straight from the mixer. Here comes the interesting part and time the for a little disclaimer. The code will place “donuts” and “tables” in any plan, ceiling or section view. In my opinion, the best place to locate them is newly created drafting view. This view must be an active view! For some reason, I suggest setting the drawing scale to 1:100. The script will work fine on any scale, but some additional tweaking of code might be required to make it look nice and neat. The portion of the code below prepares data for rotation and placement the pieces of “donut”. The script utilizes the node FamilyInstance.ByPointInView from LunchBox package to place the family in a proper location. Afterwards, the script assigns the values for the parameters responsible for the rotation, inner and outer radiuses of the “donuts”. Before running the script, make sure that the right fill pattern is chosen in a Fill Patterns node. Also, pay attention that the outer radius has to be greater than the inner radius. It’s the question of common sense to keep them this way but it’s a matter of a good practice to doublecheck.
  • 7. By WOJCIECH KLEPACKI wklepa@gmail.com The portion of the script below does roughly same operations as the part from the above. The differences occur because it was designed to place the “table” detail family. But the concept is the same. Find the location points, place multiple family instances, resize and assign values to the parameters. Last part of the script will override the colours of the placed family instances in a view. Please pay attention than the script utilizes only a few inputs of the OverrideGraphicSettings.ByProperties node.
  • 8. By WOJCIECH KLEPACKI wklepa@gmail.com The benefit of keeping the chart as a native Revit geometry is an ability to perform modifications locally without running the script again. Please remember that if you want to modify the script dramatically, change the input numbers, amount of inputs or colours, it’s compulsory to run the script again. Also in new Revit session, it’s necessary to delete existing “donuts” and “tables” in an active view. As a bottom line let me visualise the example of a local change you can make. This change is impossible when the chart is nor vector type: