Dynamo tutorial: Working with Parameters

Dynamo tutorial: Working with Parameters

We created a simple Dynamo script in our tutorial series. We learned how to place an element using Dynamo. Another popular usage of Dynamo is to modify the parameter’s value. In this tutorial, we learn how to adjust all Views’ name to all caps.

Open a sample Revit file or your Revit project. A sample project has a mixed case of view names. We are going to change all view names to all caps.

With the Revit project file opens, open Dynamo. Create a new file.

Getting the Parameter’s Name

What we need to do first is to select all views. In Dynamo library, under Revit category, Selection sub category, click All Elements of Category.

The node requires category as the input. Place your mouse pointer on the empty area in your workspace, click your right mouse button. Type categories on the search field.

Select the Categories node from the search result. Connect the nodes. In the Categories node, select Views for input. Notice that our Dynamo script selects the views.

We selected the views, now we need to get the view names. Revit saves the view names in a parameter. The parameter name is View Name. Let’s grab this value.

Right click in an empty space to search a node. Type getparameter in the search field.

Select GetParameterValueByName from the search result. Use the elements output for the input.

Add a string node and type View Name for the Parameter Name input. Remember, View Name is the the parameter name that we want to take. The parameter name is case sensitive. Type the name exactly as it is.

Now we have all the view names. The node color is now orange, it means there is a warning. We can ignore this warning now. The warning shows because some views don’t have a view name.

Change the Values to Upper Case

Now add ToUpper node. This node converts the values to all caps.

We grab the views name, we convert it to all caps, now what we need to do is to set the new values to the views.

Put Back the Modifed Names To Revit Views

Add node SetParameterByName. We use Get to get the value and Set to change the value.

Most of the inputs for this node is the same as inputs that we use for GetParameterValueByName node. Except for the values.

  1. The element that we are going to change is the views.
  2. The parameter name is View Name.
  3. For value, we use the value after we process it with ToUpper node.

Revit shows this warning when you complete the script. Unless you checked the Do not show me this message again before. Click Yes.

Check the Revit Project Browser. All the view names now are all caps!

This is another simple script that you can do in less than 5 minutes but very useful. Dynamo doesn’t have to be complicated. It can be very simple, but gives significant result.

Be the first to comment

Leave a Reply

Your email address will not be published.


*