Remove textnotes that begin with {string} so they can be replaced with updated {string}

I have an open/close sheet that I update regularly to include information pertaining to the model health of the project. It includes things like “Health check last run: %DD %MM %YYYY” and a list of the worksets. I run this periodically and the text boxes that get created don’t overwrite or get replaced, they get created on top of one another.

Is there a way within dynamo to search for the textnote that begins with “Health check last run:” and delete it before running the script? I’d use a passthrough node for the wait, but I can’t find a way to seach textnotes based on their contents. Any tips? Python solutions are also welcome.

Why not just filter the textnotes in that specific view and replace them each time. No need to filter for contents at that point.

TextNote.Text will get you the string contents if you decide to filter that way.

I have multiple text notes on that page such as project notes and milestone dates. How would I know which textnote element to select?

You’d have to define that condition. You could still check the contents but if you have multiple textnotes that you’ll be repeatedly replacing then you could just add a comment to them to filter by instead.

Why not use a parameter and/or family instead? Or are these notes you are finding unique per view?

1 Like


Here’s the pic of what I’m dealing with… Those 3 text notes I’m referring to get replaced every time the script runs.

@Nick_Boyts so you’re essentially saying that I would pull all the text notes by view > read the text notes using textnote.text > filter by {string} > then delete the filtered elements. Am I following right?

@jacob.small I could create an annotation family that has assignable text parameters, but I was thinking the easy textnotes would work. I just can’t really find a way to identify them. Maybe by location? I do assign a location to them in dynamo using x, y, z coordinates.

Try build a dictionary
Parameter value, Id of the textnote.
Set the value in a query of the parameter value, get all Id’s (textnotes)

The family will perform better, scale better, and offer more parametric content (the ‘dial’ icons are easier to build as a family than producing manual content).

But yes, you could manage things via location, or a dictionary (initial string would work).

In my opinion though you’re better off putting this data in something other than the rvt - a CSV or database which is ready by power BI so you have analytics of all your models in on spot, groups by team members or project or whatever else you may desire. Then put a link in the project start page and you’re all set.

That’s one option. The other would be to assign those text notes a parameter value to filter by (like something in Comments). Then you don’t have to worry about specific text note contents.

I can’t get people to click on a link! The system sounds great, but the weak link is the user. I’d like for the info to be right in front of the user’s face when they open the project so it throws a red flag at them when things get out of hand. I also haven’t been able to get links to work within Revit for some reason. They show up as text, but not hyperlinks. I just thought that’s how it was within Revit. Now if I could have a live view of powerbi on a Revit Dashboard… chef’s kiss.

The dials are a family with parameters inside of them that get assigned via the dyn script. I did wind up rebuilding the OPEN/CLOSE View entirely. Created a generic annotation family with the 4 text outputs I wanted, loaded that family into the OPEN/CLOSE titleblock, linked all the parameters, loaded it into the project and then assigned the text outputs with the dynamo script. It looks a lot better, and it’s much more controlled & uniform. I just wasn’t sure I want to spend the 3 hours doing it. I guess it worked out in the end though!

I think I’ll eventually link this to a spreadsheet that tracks all my projects over time. It’ll be interesting to see how the model’s data changes over time as the project grows. Ideally this thing runs automatically when it’s published and updates the spreadsheet and notifies project members when things get out of hand. But that’s a project for another time.

Side bar, I don’t really know what you or @Marcel_Rijsmus are referring to when speaking about a dictionary. Is this something you could elaborate on further?

and thank you @jacob.small @Nick_Boyts and @Marcel_Rijsmus for your help with this. You guys are awesome!

You could put in a snapshot, or the relevant metrics and a link. The key bit is to keep the metrics for EVERYTHING in one spot, not bake them into just the model right off.

I’ve personally seen “frowny face” > “happy face” metrics get a lot of traction with users clicking though the link to get to the dashboard in order to review metrics to change things for the better. Gamification actually works if you are willing. Something big and bold and large enough that it can’t be ignored along the lines of this:

Model Health: :skull_and_crossbones: - failing
Model Health: :face_with_thermometer: - about to fail
Model Health: :frowning_face: - bad
Model Health: :slightly_frowning_face: - not good
Model Health: :expressionless: - indifferent
Model Health: :slightly_smiling_face: - not bad
Model Health: :smiling_face: - good
Model Health: :smiley: - great
Model Health: :partying_face: - amazing
Model Health: :face_with_spiral_eyes: - error
Model Health: :face_with_raised_eyebrow: - not calculated

1 Like

Information on dictionaries in Dynamo can be found here: https://primer.dynamobim.org/09_Dictionaries/9_Dictionaries-In-Dynamo.html

2 Likes