lisa-marie mueller

lisa-marie mueller

bullet pont

format selector - read and re-assign saved properties link

October 2, 2020

colored pencils writing title on paper and clock - in green Happy Friday! Today is the last post in our brief series about text in Revit. We will put together our TextPainter tool. As we did in our previous tools, we have a method that allows users to select the text boxes that they want to paint the saved formatting to, but since we have gone over selection previously, I will jump right in to the next step: reading the properties saved in our container file. You can check out the full code on my GitHub repo.

read properties

In order to know what properties we need to assign, we first need to read our container file. We can create a new method called TextFormattingContainer and get the file. We can then read the bytes and assign the container to a variable which we will return to use in our SetTextProperties method.

reassign properties

In the SetTextProperties method, we want to make sure we have the document, selected TextNote, and the formatting container as parameters. For each formatting item, we can then go through and assign it to our TextNote after getting the formatted text. Our text Type can be reassigned easily by getting the element that has the ElementId that we had saved. Then we can just assign this TextNoteType to the selected TextNote. For the all uppercase status, we want to go through and change the plain text string to all upper case like we did in the first post of the series. The bold, italic, and underline statuses can also be easily set using their respective Set methods. Finally, we need to make sure we assign the revised FormattedText back to the object.


And that wraps up our text tools. We walked through a few quick steps to learn more about text in Revit. We built a fun little tool to save text formatting from a TextNote and another to re-assign the formatting to a different TextNote in the project. You can download the compiled DLL on my GitHub repo.


If you want to learn to code and don’t know where to start check out my posts about Steps to Learn to Code [for architects and designers] Part 1 and Part 2.

Revit API Docs

bullet pont

recommended next