I have text notes in Revit that follow a pattern like Z2_L0_69, Z2_L0_70, etc.
I need to automatically change or renumber the numbers after the prefix (Z2_L0_).
I want to know if there is a Dynamo script or automation method to:
find all text notes with this prefix
extract the number
change or renumber it automatically
I have text notes in Revit that follow a pattern like Z2_L0_69, Z2_L0_70, etc.
I need to automatically change or renumber the numbers after the prefix (Z2_L0_).
I want to know if there is a Dynamo script or automation method to:
You’re right — it might be a bit of an uncommon scenario.
Regarding keynotes: I initially thought of using them, but in my project, the text notes are being used for specific labeling that can’t easily be replaced with keynotes. Still, I’ll consider keynotes for future projects or if the script approach doesn’t work.
Would you have any recommendations on how to approach this in Dynamo, or any sample scripts for renumbering elements or text in a batch process?
I appreciate the advice and the welcome. So far, I’ve tried collecting the text notes using the All Elements of Category node, and I’ve used the TextNote.Text node to extract the text content. However, I’m having trouble incrementing or renumbering the numbers after the prefix (e.g., Z2_L0_69 → Z2_L0_70).
Do you have any suggestions on how to easily implement the logic for incrementing the numbers? I understand string nodes can help, but I’m unsure of the best way to split and manipulate the numbers.
Additionally, if you know of any example scripts that would help me get started with this task, I’d really appreciate it!
Some nodes which will help you out @tobiyey908 (in a somewhat sequential order from after your TextNote.Text
String.StartsWith to identify an text which starts with your prefix.
List.FilterByBoolMask to remove any text notes you don’t want to change. Be sure to use your text notes (from All Elements of Category), not the text itself (from TextNote.Text) as your list.
TextNote.Text to get the text from the notes after filtering.
String.Split to break each note into two parts at the “_” character.
List.LastItem to get the ‘numbers’ which you’ll need to increment. Watch your lacing and list levels (you likely want @L2).
String.ToNumber to convert the text "60" to 60 (colors change from orange to blue).
+ to add one to the value.
+ again with an empty string to convert the numbers back to text.
List.ReplaceItemAtIndex to swap the last item in each sublist from the String.Split node with your incremented text.
TextNote.SetText (or something similar - as I can’t remember the exact name, but if you find ‘text note’ in your library you’ll be able to identify it quickly).
Hi
For the TextNote positioning, I used the Coord property of the TextNote class from the API (packages almost certainly exist for this aspect).
Starting with a bounding box, if you have two numbers, you have a variation on X for the TextNote ordering.
"I tried running this script, but I’m getting several warnings. Could you please advise if anything needs to be modified or if there’s another approach I should try? I’ve attached the image and the .dyn file for your reference.
If there are any additional steps I need to follow, or if I should use a different node setup, kindly let me know. Your guidance will really help me move forward. Thank you in advance!"