Using Dynamo to Concatenate Strings in Revit
There are times when you may need to take several Revit text type parameter values and combine them into one parameter for use in maybe a schedule or a tag. At this point in time, this cannot be accomplished using formulas to drive the combined parameter's value directly in Revit. Instead, one way that we can accomplish this is through Dynamo.
For instance, let's say you have plate families in your project that already have instance parameters on them that give their name (CONTROL_MARK), a description (IDENTITY_DESCRIPTION), and their location within the precast concrete piece (LOCATION_IN_FORM), and you want to combine all of that information into one parameter for each plate. For this example, I will refer to the combined parameter as DESCRIPTION_LONG. We will review how to build a Dynamo script to combine these parameter values and assign the combined value back to the DESCRIPTION_LONG parameter on each plate family in your project.
First, we need to tell Dynamo which elements it should be looking for. We will start with the "Categories" block to filter our list down to just the category that our plates belong to. For this example, the plates belong to the Specialty Equipment category. Then we will use the "All Elements of Category" block to collect all elements in the project belonging to that category.
Then we will place three "Element.GetParameterValueByName" blocks (one for each parameter) so that we can pull the relevant parameter values from the elements that we collected in the previous step. The names of the parameters that you intend to pull values from should be specified in a separate "Code Block". Next, we will use addition blocks to combine all of these parameter values together. Don't forget to add spaces, dashes, etc. as necessary between the parameter values when adding them together.
Now that we have added all of the parameter values together and formatted them as we see fit, we will write it to our DESCRIPTION_LONG parameter that exists on the plates in the project. This will be accomplished using the "Element.SetParameterByName" block along with a "Code Block" telling it which parameter to write to.
Now our Dynamo script is complete and should look similar to the one below. When run it will fill in the DESCRIPTION_LONG parameter for all elements in the project belonging to the Specialty Equipment category.
The image below shows the DESCRIPTION_LONG parameter for an element that was processed by the aforementioned Dynamo script.