Our director Thomas Mahon recently hosted a lab at the BILT EUR 2018 conference in Ljubljana, Slovenia teaching the basics of Dynamo Zero Touch node development using C# in Visual Studio…in 75 minutes! The lab attracted a high turnout on both days it ran, highlighting an increasing trend within the construction industry to acquire programming skills now digital technology forms a vital part of our everyday procedures.
Joining Thomas was Alex Faur, Software Architect and Director at Fabrit Global who collaborate on a number of projects with us here at Bimorph. Alex did a fantastic job supporting delegates as they were introduced to Visual Studio, the concepts of C#, programming, and Zero Touch node development.
For those who did not attend the BILT conference this year but are interested in unlocking their hidden coder, we have released the full dataset from our BILT lab, including the 60-page handout. The exercises explored in the handout will enable you to get familiar with Visual Studio IDE, C# syntax, and basic programming, so you can start building custom nodes for Dynamo with minimal effort.
The lab contents is ideal for those looking to acquire coding skills but do not know where to start, or for experienced Dynamo users reaching the limits of visual programming. For Dynamo users familiar with IronPython but wary of strong-typed languages such as C#, this is a great opportunity to overcome any barriers and develop skills using an elegant language with a powerful IDE.
Why Develop Nodes in C#?
There are numerous reasons to create Zero Touch nodes using C#, including:
- Fully integrated in an IDE (Visual Studio), providing IntelliSense and debugging which make coding easier than any other option (and yes, that includes IronPython)
- Speed – Zero Touch nodes execute rapidly making them ideal for complex problems on large projects
- Full access to the Revit API, Dynamo API and ability to communicate with external applications
- Code is more secure and easier to protect if IP is a concern
Lab Contents
The lab – or rather, the handout and exercises – are delivered through practical exercises covering:
- Visual Studio and Zero Touch environment configuration
- Key C# and Zero Touch Concepts
- Creating namespaces, classes, methods and properties
- Creating compiled assemblies and Zero Touch import
- Navigating the Revit API and making API calls in your nodes
Before starting, ensure the following software is installed:
- Revit 2018.3
- Dynamo 2.0
- Visual Studio Community 2017 – Use the Visual Studio Installer and select/install the .NET Desktop Development Workload
- Revit Lookup
Handout
To accompany the lab, the illustrated handout with almost 60 pages is available for download on the link below. The handout covers the exercises in the lab, with tips and useful links throughout the document. We recommend undertaking the handout exercises while referencing the presentation slides as this will aid your understanding of the concepts.
Presentation
Tips and Tricks
GitHub Repo – Get the Source Code
You can compile the lab project exercises from source by downloading it from the Bimorph GitHub repository to your local machine on the link below. If you get stuck, or find things just aren’t working as you undertake the exercises, then you may find it useful to compare your progress against this repo and ‘reverse-engineer’ it to improve your understanding.
The GitHub repo is located here: BILT EUR 2018 Dynamo ZeroTouch Source Code
To download the repo, we recommend using the GitHub desktop app. Download it from github.com. Once installed, launch the app and click on File > Clone Repository. In the dialog box that opens, click on the URL tab and copy/paste the repo URL into the Repository input box and select a location on your local machine to save the files. Click the Clone button to complete this step:
To open the project, simply browse to the location where you saved the project and open the ZeroTouchNodes.sln file and Visual Studio will launch (make sure it is already installed!). To build the solution, click Project > Build and if it is successful, you will see the ZeroTouchNodes library appear in Dynamo.
Do Want to Learn More?
If you are looking to further your understanding of C#, the Revit API, custom node development and hone your programming skills then you can book yourself into one of our 2-day Zero Touch C# workshops, and learn first-hand from industry leading experts.
You will gain expert knowledge and pro-tips on a wide range of topics including Dynamo’s Revit wrapper class, element binding, wrapping and unwrapping, inheritance, garbage collection, interoperability techniques, data management, custom package creation, the Dynamo ProtoGeometry library, RevitNodes and geometry conversion libraries, in-depth C# syntax skills, XML documentation and more.
To find out more and make a booking, visit our workshop page.
Stay Updated
If you want to receive the latest content ranging from custom C# node development in Dynamo to the latest release of BimorphNodes, then subscribe to our newsletter using the form below at the bottom of this page.
Hello there!
Revit API in V2020 and v2021 does not have anymore DocumentManager class.
This is now not [possible anymore:
Document doc = DocumentManager.Instance.CurrentDBDocument;
Can you please send me a code for Revit 2020 so I ca do access Active document and commit transaction?
If you have a sample code that shows’ references needed and “using” statements including the necessary code snippet!
stsar06@yahoo.ca
stsar06@yahoo.ca
Hi Stan
You need to reference the RevitServices.dll from the new location introduced with Dynamo’s integration with Revit since 2020: C:\Program Files\Autodesk\Revit 2021\AddIns\DynamoForRevit\Revit.