Skip to content

TextNoteOptions

Public Class

Options to use when creating a new text note element.

Inheritance Hierarchy

System.Object
Autodesk.Revit.DB.TextNoteOptions

Namespace: Autodesk.Revit.DB

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public class TextNoteOptions : IDisposable

The TextNoteOptions type exposes the following members.

Constructors

Name

Description


Public Method
TextNoteOptions.

Default constructor; populates the options with their respective default values.


Public Method
TextNoteOptions(ElementId)

Constructs text options to create text of the given type.


Properties

Name

Description


Public Property
HorizontalAlignment

Horizontal alignment of the text.


Public Property
IsValidObject

Specifies whether the .NET object represents a valid Revit entity.


Public Property
KeepRotatedTextReadable

Flag controling whether a rotate text is to stay oriented to be always readable.


Public Property
Rotation

Base line angle of a text note, in radians.


Public Property
TypeId

Id of a text type that defines the style of a text note.


Public Property
VerticalAlignment

Vertical alignment of the text.


Methods

Name

Description


Public Method

Releases all resources used by the TextNoteOptions


Public Method

Equals

Determines whether the specified object is equal to the current object.
(Inherited from Object)


Public Method

GetHashCode

Serves as the default hash function.
(Inherited from Object)


Public Method

GetType

Gets the Type of the current instance.
(Inherited from Object)


Public Method

ToString

Returns a string that represents the current object.
(Inherited from Object)


Remarks

Use an instance of this class as an argument in the TextNote.Create methods.

Example

#region Autodesk.Revit.DB.TextNote.Create(Autodesk.Revit.DB.Document, Autodesk.Revit.DB.ElementId, Autodesk.Revit.DB.XYZ, double, System.String, Autodesk.Revit.DB.TextNoteOptions)
#region Autodesk.Revit.DB.TextElement.GetMinimumAllowedWidth(Autodesk.Revit.DB.Document, Autodesk.Revit.DB.ElementId)
public TextNote AddNewTextNote(UIDocument uiDoc)
{
Document doc = uiDoc.Document;
XYZ textLoc = uiDoc.Selection.PickPoint("Pick a point for sample text.");
ElementId defaultTextTypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType);
double noteWidth = .2;
// make sure note width works for the text type
double minWidth = TextNote.GetMinimumAllowedWidth(doc, defaultTextTypeId);
double maxWidth = TextNote.GetMaximumAllowedWidth(doc, defaultTextTypeId);
if (noteWidth < minWidth)
{
noteWidth = minWidth;
}
else if (noteWidth > maxWidth)
{
noteWidth = maxWidth;
}
TextNoteOptions opts = new TextNoteOptions(defaultTextTypeId);
opts.HorizontalAlignment = HorizontalTextAlignment.Left;
opts.Rotation = Math.PI / 4;
TextNote textNote = TextNote.Create(doc, doc.ActiveView.Id, textLoc, noteWidth, "New sample text", opts);
return textNote;
}
#endregion
#endregion