Append string to parameter

Hi all,

If anyone can give me a pointer on the below it would be much appreciated.

I’m trying to make a simple script to append a string to some existing parameters.

To be specific, adding a word to the end of 48 drawing titles which is a sheet parameter ‘Sheet name’.

I have got to the end of the script and all seems to be working fine, the string has joined correctly in the preview.

However when I run it on the Revit model it gives the error:

Name cannot contain any of the following characters:
\ : { } [ ] | ; < > ? ` ~
or any of the non-printable characters.

It then replaces the first sheet name with FOUNDATIONS rather than appending

image

I’ve got a feeling it might be a levels issue but I have tried changing the levels with no success.

Please see below image and attached dyn.

This is using Revit 2025

Append string to sheet title.dyn (31.3 KB)

Hi,

First of all, it’s a bit odd that you’re setting the parameter values to title block(?) instances rather then to sheets itself.

Second, you went pretty complicated way to achieve appended sheet numbers.

It’s much easier, if you’ll get all sheets, then get it’s names, create a code block and type a+”FOUNDATIONS”
connect sheet names to a input, and you’ll get a result.
Then just use Set parameterByName, connect sheets and new appended sheet names

Many thanks for these observations, I will give this a go and report back.

The suggestions have simplified the script a lot but unfortunately it doesn’t work, for some reason the string isn’t appearing in the preview of SetParameterByName?

Is there some extra step to set these parameter values that I’m missing?

Append string to sheet title.dyn (11.6 KB)

Just in case this will help someone else in future;

I swapped the get parameter by name node with Sheet.Sheetname, I think resolving the problem which was related to the parameter name being included in the string being replaced which had a colon “Sheet Name: “.

Thanks @Andriy for your help.

I’ve simplified further with set sheet name node and also added an input so it can be easily used with Dynamo player to append a string of text to all sheets in a project.

Append string to sheet title.dyn (10.4 KB)

1 Like

This gets the parameter element - you generally want to get the parameter value so the node to use is Element.GetParameterValue... not Element.GetParameter...

1 Like

I’m with you, many thanks Jacob.

1 Like