Boost Your BIM – making Revit even better

February 20, 2013

Finding Text Size as a Built-In Parameter

Filed under: Parameters — harrymattison @ 8:42 am

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());
About these ads

2 Comments »

  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,

    Comment by David Raynor — February 20, 2013 @ 12:11 pm


RSS feed for comments on this post. TrackBack URI

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 )

Connecting to %s

Theme: WordPress Classic. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 369 other followers