Finding Text Size as a Built-In Parameter

The TextNoteType class is where a property to find the size of a Text type would ideally be found. But it is not.

TextNoteType

However, all hope is not lost.

It is important to remember (and sometimes easy to forget), that there is also a huge set of parameters in the Revit API known as Built In Parameters. Many of these parameters work in the internal Revit code and not in the API, but many (such as TEXT_SIZE) are also perfectly usable in the API.

BuiltInParam

Usage:

TextNote textNote = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element).ElementId) as TextNote;
TextNoteType textNoteType = doc.GetElement(textNote.GetTypeId()) as TextNoteType;
Parameter textSizeParam = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE);
TaskDialog.Show("Text Size", textSizeParam.AsDouble().ToString());
Advertisements

2 thoughts on “Finding Text Size as a Built-In Parameter

  1. How about text that is bold? I don’t mean the parameter for text type for bold, but when text has been made bold in the text editor. Is there a way in the API to switch between bold and unbold?

    Thanks,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s