• Return to module overview

Set Family Types by Number

0:00 / 0:00

Set Family Types by Number – Practice Exercise

In this exercise, we will assign family types to the random numbers in Dynamo.

Task 1: Add Switch node and define cases

  1. Navigate to Clockwork in the node library then click the “Script” category.
  2. In the “Script” category, click “Control Flow” then click the Switch node to add it to your script.
  3. To setup the Switch node, you need to provide a list of cases, a list of values, and a default value.
  4. Double-click on an empty part of screen to add a code block. Enter the following in the code block: 1 . . 5 followed by a semicolon as show below. This will create a list of numbers from 1 to 5.



  5. Hover over the lower right-hand corner of the Code Block to see the preview from the node.
  6. Connect the output from the code block to the “Cases” input of the Switch node.

Task 3: Create a list of family types

  1. Next, click the List category in the node library. Click the “Generate” heading and click the List Create node to add it to your script.
  2. Click the “+” button four times to add four additional inputs.
  3. In the node library, click the Revit category then click the “Selection” heading. Click the “Family Types” node five times to add three instances of the node to your script.
  4. Select a different System Panel type in each of the Family Types node. The sample file contains System Panel Types from “Type 1” through “Type 5”. These will be the families define the curtain panel in Revit.
  5. Connect the outputs from the Family Type nodes to the List Create inputs. The first node will correspond to number 1 in the random number list. The second to number 2 in the list and so on.



  6. Connect the output of the List Create node to the “Values” input of the Switch node.

Task 4: Finishing up

  1. Connect the output from the first Family Types node to the “Default” input of the Switch node. This is the value that will be used if a value does not match 1, 2, 3, 4 or 5.
  2. Connect the output from the RandomList.AsIntegers node to the “Check” input of the Switch node.
  3. Type “watch” in the node library search bar and click to add a Watch node to the script.
  4. Connect the Watch node to the output of the Switch node.
  5. Verify that the family types match the number pattern.
  6. Your script should look like this:

Task 5: Group the Nodes

  1. Pick a spot in the upper left of the Dynamo workspace and click and hold the left mouse button.
  2. Drag the selection window to the lower right-hand corner to select all the nodes.
  3. Right-click and click the “Create Group” option.
  4. Double click the group title and type “Set Families”.
  5. Right-click the group and select a new color.
  6. In the menu bar, click Save to save your Dynamo script file.
  • Return to module overview