lisa-marie mueller

lisa-marie mueller

bullet pont

format selector - container to save properties link

September 25, 2020

colored pencils writing title on paper and clock - in orange Happy Friday! Now that we found all the text formatting properties that we want to save, we need to save them out to a file that we can read from whenever we want to paint our formatting. That is what we will review this week.

container to save formatting

First, we need to create a container where we can save our formatting. We can create a new class in the same namespace, and we want to explicitly state it is Serializable. Our class will be called TextFromattingContainer and will contain a member for each of the properties we want to save. We need to make sure the variable type is the same as the value we will store there: an integer for the textNoteTypeID, a Boolean for the textNoteAllCapsStatus and FormatStatus for the others. We also want to make sure we can get and set each member.

save text formatting properties in container

Then back in our FormatSelector class, we can assign the formatting statuses we gathered to the members in our TextFromattingContainer. We create a new container and assign each variable. Then we want to convert the container to bytes and write all the bytes to a new file located in the same folder that our plug-in is saved to. This means that even after closing a session of Revit, we can read from this file and whichever formatting was last saved can continue to be applied to any additional TextNotes. This can all be added to the SaveTextProperties method we wrote last week.

Here is the summary of last week's method with the updates we made:

summary

And that is how we can save the formatting data to later apply to any TextNote in Revit. Next week, we will wrap up this series and cover how to apply the formatting to a TextNote.

resources

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