Options to use when creating a new text note element.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since:
2016
Syntax
C# |
---|
public class TextNoteOptions : IDisposable |
Visual Basic |
---|
Public Class TextNoteOptions _ Implements IDisposable |
Visual C++ |
---|
public ref class TextNoteOptions : IDisposable |
Remarks
Use an instance of this class as an argument in the TextNote.Create methods.
Examples

#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

#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 Function AddNewTextNote(uiDoc As UIDocument) As TextNote Dim doc As Document = uiDoc.Document Dim textLoc As XYZ = uiDoc.Selection.PickPoint("Pick a point for sample text.") Dim defaultTextTypeId As ElementId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType) Dim noteWidth As Double = 0.2 ' make sure note width works for the text type Dim minWidth As Double = TextNote.GetMinimumAllowedWidth(doc, defaultTextTypeId) Dim maxWidth As Double = TextNote.GetMaximumAllowedWidth(doc, defaultTextTypeId) If noteWidth < minWidth Then noteWidth = minWidth ElseIf noteWidth > maxWidth Then noteWidth = maxWidth End If Dim opts As New TextNoteOptions(defaultTextTypeId) opts.HorizontalAlignment = HorizontalTextAlignment.Left opts.Rotation = Math.PI / 4 Dim textNote__1 As TextNote = TextNote.Create(doc, doc.ActiveView.Id, textLoc, noteWidth, "New sample text", opts) Return textNote__1 End Function #End Region #End Region
Inheritance Hierarchy
System..::..Object
Autodesk.Revit.DB..::..TextNoteOptions
Autodesk.Revit.DB..::..TextNoteOptions