SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
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:

Weitere ähnliche Inhalte

Was ist angesagt?

BIM Execution Plan
BIM Execution PlanBIM Execution Plan
BIM Execution Plan
Russell and Dawson
 
BuildingSmart COBie presentation March 2014
BuildingSmart COBie presentation March 2014BuildingSmart COBie presentation March 2014
BuildingSmart COBie presentation March 2014
Graham H Stewart
 

Was ist angesagt? (20)

Intro to BIM and Revit Structure
Intro to BIM and Revit StructureIntro to BIM and Revit Structure
Intro to BIM and Revit Structure
 
BIM - Building Information Modelling
BIM - Building Information ModellingBIM - Building Information Modelling
BIM - Building Information Modelling
 
Bim implementation
  Bim implementation   Bim implementation
Bim implementation
 
Revizto RevUP2023 - Codifying Coordination with Clash Automation
Revizto RevUP2023 - Codifying Coordination with Clash AutomationRevizto RevUP2023 - Codifying Coordination with Clash Automation
Revizto RevUP2023 - Codifying Coordination with Clash Automation
 
02- Coordination (Clash Detection).pptx
02- Coordination (Clash Detection).pptx02- Coordination (Clash Detection).pptx
02- Coordination (Clash Detection).pptx
 
BIM - Building Information Modelling
BIM - Building Information ModellingBIM - Building Information Modelling
BIM - Building Information Modelling
 
BIM 360 Overview by Jessica Denman- august 2017
BIM 360 Overview by Jessica Denman- august 2017BIM 360 Overview by Jessica Denman- august 2017
BIM 360 Overview by Jessica Denman- august 2017
 
Plannerly and Dalux for construction system engineering
Plannerly and Dalux for construction system engineeringPlannerly and Dalux for construction system engineering
Plannerly and Dalux for construction system engineering
 
Bim and project management
Bim and project managementBim and project management
Bim and project management
 
BIM Execution Plan
BIM Execution PlanBIM Execution Plan
BIM Execution Plan
 
BIM in Project Management: Keynote Speech by Mr. Kevin POOLE
BIM in Project Management: Keynote Speech by Mr. Kevin POOLEBIM in Project Management: Keynote Speech by Mr. Kevin POOLE
BIM in Project Management: Keynote Speech by Mr. Kevin POOLE
 
The Role of CIC on BIM Development
The Role of CIC on BIM DevelopmentThe Role of CIC on BIM Development
The Role of CIC on BIM Development
 
BIM Execution Plan - Bim Process Model Rview and Procedure
BIM Execution Plan - Bim Process Model Rview and ProcedureBIM Execution Plan - Bim Process Model Rview and Procedure
BIM Execution Plan - Bim Process Model Rview and Procedure
 
COBie
COBieCOBie
COBie
 
Building Information Modeling (BIM)
Building Information Modeling (BIM)Building Information Modeling (BIM)
Building Information Modeling (BIM)
 
Use of BIM in planning and construction and implementation in real project
Use of BIM in planning and construction and implementation in real projectUse of BIM in planning and construction and implementation in real project
Use of BIM in planning and construction and implementation in real project
 
bim+ Presentation BIM Manager
bim+ Presentation BIM Managerbim+ Presentation BIM Manager
bim+ Presentation BIM Manager
 
BuildingSmart COBie presentation March 2014
BuildingSmart COBie presentation March 2014BuildingSmart COBie presentation March 2014
BuildingSmart COBie presentation March 2014
 
Introduction to BIM and business case of BIM
Introduction to BIM and business case of BIMIntroduction to BIM and business case of BIM
Introduction to BIM and business case of BIM
 
what is BIM
what is BIMwhat is BIM
what is BIM
 

Ähnlich wie Donut chart in Revit with Dynamo

Duarte ms template_download
Duarte ms template_downloadDuarte ms template_download
Duarte ms template_download
artecxt
 
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
Skills Matter
 

Ähnlich wie Donut chart in Revit with Dynamo (20)

Create finished floors by room outlines
Create finished floors by room outlinesCreate finished floors by room outlines
Create finished floors by room outlines
 
Old code doesn't stink - Detroit
Old code doesn't stink - DetroitOld code doesn't stink - Detroit
Old code doesn't stink - Detroit
 
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
 

Mehr von 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
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Kürzlich hochgeladen (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

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: