This is the first article in a series of planned articles whereby I want to investigate the procedures to do simple tasks with Dynamo. I have seen plenty of designs using Dynamo from various sites and they all look awesome but complicated.
Anyway as with everything you need to start somewhere. So in this first instalment my task is to select an object like a tree and then move it about.
The idea is not to redo the tutorials on various websites but to do something else.
If you would like to learn the basics of Dynamo before continuing then you can visit the following sites: http://dynamobim.org/learn/
More advanced topics: http://therevitcomplex.blogspot.co.za/
So in preparation I downloaded and installed the latest Dynamo from the official site: http://dynamobim.org
Once installed the Dynamo icon will be in the Add-Ins tab as shown.
Once you start up the tool a dialogue box will appear. I moved this window onto a second screen connected to my laptop so I can still see my Revit session on the main screen and the Dynamo session on the other.
On this Dynamo start up window you can do the standard things like start new projects, open projects and learn about Dynamo. I clicked on the ‘New’ link to start a new Dynamo project.
An empty work area appears and this is actually the area where you will create objects inside Dynamo if required. In our case we will not create new geometry or points inside Dynamo but only read info from Revit and add items to Revit.
So the first thing we want to do is to select something in Revit. So I expanded “Revit” on the left library area and then expanded “Selection”. Clicking the “Select Model Element” from the library list on the left a node appears in your working area.
I then used the search option at the top of the Library area to search for a node that will find the XYZ position of the object I will select with the previous select node. I searched for: “Instance location.”
To link the two notes to create a workflow you would click on the right side of the Select node (The Left side of the Node is the input and the right side is the output) and then click on the input side of the Location node. This will create a workflow as follows: You would select and object in Revit and Dynamo will output the Location of the Revit object or instance.
You can test this workflow by clicking the Select button on the Select node and then in Revit select say a tree.
You will now see that the tree has been selected in the Select node.
I’ve then gone ahead and pinned both the values at the bottom of both nodes to see if something has been recorded and indeed the XYZ location of the tree has been located.
Now that I’ve successfully selected the item I want to move the object and I searched for nodes that relates to moving a Revit object or instance. I added the Translate XYZ node as shown.
You can link the Point output from the Location Node to the input of the Translate Node. I’ve also pinned the output in the Translate Node. Also not that there are three translation inputs called XY and Z.
To add infomation to these XY and Z inputs I thought sliders will be the best. So I searched for the sliders in the Node Library and added three Number sliders on for each of the XYZ inputs.
If you expand a slider by clicking on the down arrow you will see that a slider has a min, max and step value. I adjusted one of the Slider Nodes to list larger values as we work in millimeters. See below.
I then deleted the other two slider notes as I replaced them by Copying and pasting the edited Slider to create the 3 sliders once more. (Use CNTR+C for Copy and CNTR+V for paste) I then double clicked each Node and renamed each to be named X Slider, Y Slider and Z Slider. I then linked each one to the appropriate inputs on the Translate Node as shown.
Also note that as I changed the X slider I can see the value of the X-point adjust to the same value as the Slider.
Ok so now that I can adjust the XYZ position in Dynamo I need to place the object at this position in Revit. I tried to adjust the position of the original tree object but after a couple of unsuccessful googles I gave up. I reverted to adding a new object instead by doing the following. I searched for “Place Instance” in the search area and added the FamilyInstanceByPoint Node.
You can then link the Translate Node output to the Point input on the Placement Node. Note that we have a point input but no Family type input.
I now searched “get family name” in the Node Library. Reason is that I want to get the name of the original family I selected. I added the GetParameterValueByName Node.
Now link this new Get Name Node to the original Selection Node. See below. Note that we need a second input called Parameter Name.
To create this Parameter Name string I double clicked in the working area to create a Code block Node. I added “Family” in quotation marks inside the code block to define a text string called Family and linked it to the Get Name input.
Note that the Family name on this Node is the same as the original item’s name as in the Select Node.
Now link this Family name to the Create Node as shown. Note that the Family name is the same in this FamilyByPointCreation Node.
Running this process will will allow the selection of a tree for example and create a copy placed to the XYZ slider offsets. If you do use the sliders then it changes the position of the new item.
In the screenshot below I first clicked Change Button on the Selection Node inside Dynamo and then selected a tree near the bottom of the site. The program created a second tree which I can then manipulate using the sliders. I first changed the Y slider to 8000 and the tree then moves 8m in the Y direction.
And then I changed the X Slider to -7000 and the same tree moves 7m in the x direction.
If you would like us to investigate a specific task using Dynamo please let me know.