-
Notifications
You must be signed in to change notification settings - Fork 188
How to: create a new DynamoRevit Node
DynamoRevit Nodes are nodes that are created to make use of powerful API on client-side like Revit. You probably have seen Revit Nodes under the library in DynamoRevit and wondering how could one create a new Revit node and make it appear in our next release. This page will demonstrate how to create a Revit node by using PerformanceAdviserRule as an example.
To make a new Revit node fully functional and a pleasant experience to use, you will need a few parts:
- Node logic (for zero touch nodes)
- Node UI definition (for UI nodes)
- Node Layout Specification (2.0)
- Node unit test
Node logic defines what kind of information the node contains or displays and what does the node do when Dynamo execute such node in graph. For example, performance adviser rule can be found here
Node UI defines how the node implements user interactions. There are nodes with only input/output ports, but nodes can have dropdown, buttons, etc. as well. For example, Performance Adviser Rules
node is a dropdown node. It list out all the performance adviser rules in the current Revit host document for you to select one. Based on that, you can hook up execute
or Name
in same sub-category so serve your own purpose. Its UI is defined here
This defines where this newly added node will live in the brand new library implementation. You can find the Layout Specification file here which is a giant json object defining the Revit Node category under default one. This category will be read and appended to the main Dynamo library root after DynamoForRevit launched. Searching for PerformanceAdviserRule, you will get a rough idea about the object hierarchy which would be the hierarchy of Revit Node category itself. Without adding your new node to LayoutSpecs.json, the new node added might end up falling into miscellaneous category in library.
From the json viewer picture, you can tell
-
PerformanceAdviserRule
is a childElement underElements
which has elementType ofgroup
. This means in the library defined by this json object,PerformanceAdviserRule
node will be found atElements
sub-category. -
PerformanceAdviserRule
itself has propertyiconUrl
which point to link of icon for it in library -
PerformanceAdviserRule
itself has propertyelementType
which means it is also a sub-category likeElements
which is capable of holding more nodes or sub-category underneath. -
PerformanceAdviserRule
itself has propertyinclude
. This array property defines nodes inlcuded. For each array item, you need to specify namespace to class name.
e.g. for zero touch nodes
namespace Revit.Elements
{
/// <summary>
/// Performance Adviser Rule
/// </summary>
public class PerformanceAdviserRule
{
So path for it becomes Revit.Elements.PerformanceAdviserRule
-
PerformanceAdviserRule
itself does not have propertychildElement
likeElements
do, which means there are no sub-categories under it.
You can define new sub-category under the Revit group or by extending existing sub-category depending on what nodes you added/modified. The categories are ordered alphabetically as you can see PerformanceAdviserRule
falls right next to Parameter
.
For example, performance adviser rule node tests can be found here