Outline
Define Patterns in Dynamo
0:00 / 0:00
1-2 Defining Design Patterns in Dynamo – Practice Exercise
In this exercise, we will define a A – B – B – C pattern in Dynamo
Task 1: Open Revit and Dynamo
- Open Revit and create a new project file using the “imperial-architecture” template.
- In the “Manage” ribbon, click the “Dynamo” button to launch Dynamo.
- Once Dynamo opens, click the “New” button to create a new script file
Task 2: Define the pattern sequence
- Double click an empty space in the Dynamo workspace to create a node block.
- Type the letter A in quotes followed by a semicolon in the code block. Press the “Enter” key to create a new line.
- Type the letter B in quotes followed by a semicolon. Press the “Enter” key to create a new line.
- Type the letter B in quotes followed by a semicolon. Press the “Enter” key to create a new line.
- Type the letter C in quotes followed by a semicolon.
- Your code block should look like the following:
Task 3: Create a list
- In the node library, navigate to the “List” category and click the “Generate” heading.
- Click the List Create node to add it to your script.
- Click the output arrow next to the “A” in the code block and connect it to the “0” input of the List Create node.
- Click the “+” arrow and add three more inputs.
- Connect the rest of the outputs from the code block to the List Create node.
Task 4: Repeat the list
- In the node library, click the OfRepeatedItem node in the “Generate” section of the “List” category.
- Connect the output from the List Create node to the “item” input of the List.OfRepeatedItem node.
- Type “integer slider” in the node library search bar. Click to add the Integer Slider to your script.
- Connect the output of the Integer Slider to the “amount” input of the List.OfRepeatedItem node.
- Set the Integer Slider to 10.
- Type “watch” in the node library search bar and click the add a Watch node to your script.
- Connect the output of the List.OfRepeatedItem node to the watch node.
- Adjust the slider on the Integer Slider and observer the results in the Watch node.
- Reset the Integer Slider to 10.
Task 5: Flatten the list
- In the node library, navigate to the “List” category and click the “Modify” heading.
- Click the “Flatten” node to add it to your script.
- Connect the List.OfRepeatedItem output to the “list” input of the List.Flatten node.
- Leave the “amt” input empty.
- Hover over the bottom right-hand corner of the List.Flatten node to see the preview from the node. Confirm the nested lists have been removed.
Task 6: Group the Nodes
- Pick a spot in the upper left of the Dynamo workspace and click and hold the left mouse button.
- Drag the selection window to the lower right-hand corner to select all of the nodes.
- Right-click and click the “Create Group” option.
- Double click the group title and type “Define Pattern”.
- Right-click the group and select a new color
- In the menu bar, click Save to save your Dynamo script file.