2.6 - Dynamo FormIt Nodes
Last updated
Last updated
FormIt comes with a library of Dynamo nodes that transfer geometry between FormIt and Dynamo. In the previous chapters we have seen how Dynamo objects can be created and dynamically adjusted within FormIt. In this chapter, we will edit a provided Dynamo graph to create a modified version of the OOTB stair graph.
For this chapter, we will be using both the Encode Campus Sample Model.axm model and the Stairs by Top Edge.dyn Dynamo script. If you have not already, you can find both of these files by downloading the FormIt Primer Part 2 Dataset..
If you are new to using Dynamo inside FormIt, we recommend completing the 1.10 - Computational Groups with Dynamo chapter in Part I of this primer. While this chapter will involve editing Dynamo graphs, we will only really cover elements of Dynamo as they relate to FormIt-specific nodes. If you are new to Dynamo, you can learn more by visiting the Dynamo Primer.
You'll need FormIt for Windows 2022.0 or newer for this section.
While FormIt comes with a library of OOTB graphs in the Dynamo Samples folder, we need a place to create and save our own custom graphs. To do this, we will first want to add a new folder to FormIt’s Dynamo Library Locations. This is similar to adding a folder to FormIt’s content library, so if you need a refresher check out the Primer Part I chapter 1.11 - Import Models with Content Library.
1 – To add a new Dynamo Library Location:
With the Encode Campus Sample Model.axm open, go to the Dynamo Palette.
Click on the Link Dynamo Directory button in the top-left corner.
The Preferences window will open, with the Dynamo tab automatically select. Click on the Add a new Dynamo library location ‘plus’ icon.
Navigate to wherever you downloaded the Encode Model Data Set, and select the Supporting Files > FormIt Primer Graphs folder.
Click on Select Folder and then OK, and you will be brought back to FormIt.
In the folder dropdown at the top of the Dynamo Palette, select the FormIt Primer Graphs folder we just added.
For any Dynamo graph to work with FormIt, it must have at least one SendToFormIt node.
1 – Let’s start by trying to use the Stair by Top Edge graph as is, from the folder we just added.
Start by going to the Section - Longitudinal scene.
2 – We're going to add the SendToFormIt node to the graph. To do this, we're going to use "Edit Source Graph" in a new FormIt model so we're not polluting the working model with our graph authoring changes.
Right-click on the FormIt icon in your taskbar, and select FormIt to launch a new empty FormIt window (or simply middle-click on the FormIt Icon).
In the Dynamo Palette, find the Stairs by Top Edge tile, and click on the small drop-down arrow on the tile’s right edge or right-click the tile.
Select Edit Source Graph. This will automatically launch Dynamo and open the graph we want to edit.
2 – Once Dynamo and the graph have opened, zoom into the area shown below, containing the right-most green and purple groups.
Note: Dynamo graphs flow from left to right, and so you will typically find the output nodes on the far right side of the graph.
3 – Now we need to add a SendToFormIt node, to send the stair geometry you see in the background into our FormIt model:
In the Add-ons (packages) area on the left, expand the FormIt dropdown, and click on SendToFormIt. A SendToFormIt node will appear in the center of your screen.
Add the new node to the purple Send Stair Geometry to FormIt group by selecting both the purple group and the new SendToFormIt node, and then right clicking on the SendToFormIt node and selecting Add To Group. Move the new node to a location similar to what is shown in the below image.
Right-click on the SendToFormIt node and make sure Is Output is checked. It should be by default, but if it is not then no geometry will be sent to FormIt.
Rename the SendToFormIt node to SendToFormIt.Stairs.
Connect the two (2) inputs of the new SendToFormIt.Stairs node as shown in the image below.
Note: Although we are only using the SetAsMesh options node, which determines whether the geometry is sent to FormIt as an object or as a mesh, there are a number of FormItGroupOptions node available. Each one controls various properties of the geometry sent to FormIt; feel free to experiment with some of the others!
4 – Let’s get back to FormIt and see if it worked:
Save and then close Dynamo. The updated graph will be automatically reloaded back into FormIt.
Switch back to the FormIt window with the Encode Campus Sample File and in the Dynamo Palette, click again on the Stair by Top Edge.
Place the stair in the model, similar so what is shown in the image below.
Select the stair, and note that its group name matches the name of the Dynamo graph.
Now, double-click to edit the group, and select the nested stair geometry group. Notice that that group’s name matches the name we gave to the node in Dynamo.
Note: Don’t worry about the stair’s exact location, we will fine tune that in the following section.
Note: In this case we only needed one SendToFormIt node, but you can create multiple. Each one will create a new group in FormIt, based on the name of the SendToFormIt node it came from.
As we have seen it previous chapters, Dynamo graphs can prompt the user to select specific geometry, which is then used by the graph. Now we will add two (2) of these nodes to our stair graph, so that the stairs orientation, width, and height can be calculated from the selected FormIt geometry inside of Dynamo.
1 – Delete the stair we just placed.
2 - Switch back to the empty FormIt window.
3 - In the Dynamo Palette, click on the dropdown for the Stairs by Top Edge tile and select Edit Source Graph, and it will open in Dynamo again.
Note: If you edit a Dynamo graph directly from its Properties Palette by clicking on the Edit Embedded Graph (instead of from the Dynamo Palette), you will be editing the embedded graph for that group only, and not the source graph saved in the folder we added to FormIt’s Dynamo Library earlier.
4 – This time, we want to add some selection nodes, which are often located near the beginning, or left, side of the graph. Zoom into the area shown below.
5 – To add the new selection nodes:
In the Add-Ons area, expand FormIt and click on SelectFromFormIt twice, which should create two (2) new nodes in the center of your screen.
Arrange them one above the other as shown in the below image, create an orange group for them, and name it Geometry Selected from FormIt. The order in which the user is prompted to select elements in FormIt is based on the vertical positioning of the selection nodes in Dynamo; the top-most node will show up first, and the bottom one will show up last.
Rename the top node to Select Top Edge, and the bottom node to Select Bottom Floor. When this graph is run in FormIt, a Dynamo Selection Wizard will appear, and will use the names of these nodes as the prompts for what geometry to select.
Right-click on each node, and ensure that Is Input is checked. It should be by default, but if it is not, these nodes will not be recognized by FormIt.
Wire up the new selection nodes as shown in the below image. They each only have one (1) connection.
Note: The new nodes may have warnings, causing them to turn yellow as seen above. You can ignore these for now. The warnings are because the nodes are expecting geometry from FormIt, but have not received any yet (because we just added them!).
6 – Now we need to make a few more changes to the graph, so that the stairs are created from the geometry from the selection nodes. First, we need to change the Floor-to-Floor Height and Stair Width inputs so that they get their values from the selected geometry instead of from input sliders:
While holding Shift, click on the output of the Floor-to-Floor Height node inside the orange Slider Inputs group, and move those wires to the output of the Calculated Floor-to-Floor Height node just above.
Using the same technique, move the output wires from the Stair Width in the orange Slider Inputs group to the output of the Calculated Floor-to-Floor Height node above.
Delete the old Floor-to-Floor Height and Stair Width nodes, as we will not need them anymore.
Note: If you want to add any Dynamo Input nodes to your graph, it is very similar to adding the SelectFromFormIt nodes. Just make sure they are marked as Is Input, rename and reorder them however you would like them to show up in FormIt, and they will appear in the FormIt Properties Palette!
7 – Lastly, zoom over to the right end for the graph, where we added the SendToFormIt.Stairs node earlier. We want to switch this output node to use the stair geometry that has been moved and rotated based on the selected Geometry in FormIt’s location. Simply switch the connection from the Stair Geometry group to the Rotated and Translated Stair Geometry group.
1 - Now that we have added both selection and bake nodes, the graph is ready. Save and close Dynamo, and then switch back to the FormIt window with the Encode Campus Sample Model.axm and try it out by:
Make sure you are still in the Section – Longitudinal scene, then draw a 6’ line along the right-edge of the first-floor stair opening. This will define the width and angle of the stair.
In the Dynamo Palette, click on the Stairs by Top Edge tile to start the graph.
A Dynamo Selection Wizard will appear, and instruct you to make the first selection using the name we gave to that selection node earlier: Select Top Edge. Once you have selected the edge we just drew, click on the forward arrow in the Dynamo Selection Wizard.
The next prompt will be the name of our other selection node, Select Bottom Floor. Select the ground floor slab of the main encode building, then click on the checkmark.
After the stair is created, notice that in the Properties Palette you now have the option to re-select geometry for either of the selection nodes. Also note that the sliders corresponding to the input nodes we deleted, Floor-to-Floor Height and Stair Width, are no longer there – they are now calculated from the selected geometry.
Note: If you change either the position of the top edge or the height of the bottom floor and re-run the graph, the stairs will update accordingly. It is usually good practice to avoid manually moving any Dynamo-generated geometry that depends on FormIt selections, as that can change its relationship to the selected geometry used to create it. Sometimes grouping the Dynamo group and the selection geometry together will help keep them connected and avoid any issues.
2 – To finish up, feel free to add your own touches. We did the following, using various tools covered in previous chapters:
Created a stair between each floor.
Slightly rotated the top edge of the bottom stair, to create a slightly-diagonal stair to the ground floor.
Slightly adjusted some input sliders for each stair to achieve our desired settings.
Used the Railing Along Path Dynamo Graph to create landings around the stair openings.
Added a central stringer for each staircase using Sweep.
Placed all the stairs, strings, and railing all on a new layer called Encode Main Building – Stairs.