August 14, 2016

Dynamo - Element Parameters

If you are relatively new to Dynamo and not intimately familiar with the Revit API, like me, you may find this relatively simple graph of use.
The Select Model Element node at the upper left allows you to select an element in your Revit model and will report back, through the two Watch nodes at the right, the available instance parameters and their current values. These are the parameters that work with the Element.GetParameterValueByName and Element.SetParameterValueByName nodes. This can be helpful in identifying the parameter you need to access for a particular task.

The Element.Parameters node generates a list of these parameters, the Element.Name node takes that list and turns it into a list of the parameter names, as strings, and the List.Sort node sorts that list alphbetically. The left Watch node displays this sorted list; the list is also fed into the Element.GetParameterValueByName node, which generates a list the values for those parameters, for the selected element, and displays them in the right Watch node. My experience has been that the Element.Parameters node will list the parameters found in what seems like a random order that makes it hard (for me, anyway) to track them from element to element. The description of the Object.Identity node states that it passes out what is passed into it, doing nothing, which, I suppose, it true, but I included it here because by locking the Data Preview of the node in the open position, it shows the element category as well as the element ID number, whereas the Select Model Element node only shows the element ID number. Seeing the element category helps me be sure that I selected the desired element correctly.

Here are two screen shots of this graph in action, one with a Wall selected, and the other with a Dimension selected.
As always, you can select any of the images to see it full size.


david939 said...

And what if I would like to change Shared Parameter Value which is a Project Parameter? I have few parameters and they're available as sheets parameters. Is there a way to change them through Dynamo? I've used Element.Name to find the parameter but when I wanted to use Element.SetParameterByName I have to input "parameterName" - so I've used Element.Parameters but there are only: Category, Design option: -1, Family Name, Type Name - no Value or somethnig like that.. Could you help me out?

David Koch said...

@david939: For the Element.SetParameterByName node, the parameterName input takes a String value. You can use a String node into which you type the name of the Parameter whose value you want to set, and then wire that into the parameterName input.

If you hover your cursor over the parameterName input, you will get a tool tip that provides a short explanation of the input, along with the expected data type.