2024 Class
Changes 0
C

TextNoteOptions

Description:
Options to use when creating a new text note element.
Remarks:
Use an instance of this class as an argument in the TextNote.Create methods.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.TextNoteOptions
public class TextNoteOptions : IDisposable
#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
Name Return Type Description
C TextNoteOptions() None Default constructor; populates the options with their respective default values.
C TextNoteOptions(ElementId) None Constructs text options to create text of the given type.
Name Return Type Description
M Dispose() None Releases all resources used by the
Name Return Type Description
P HorizontalAlignment HorizontalTextAlignment Horizontal alignment of the text.
P IsValidObject bool Specifies whether the .NET object represents a valid Revit entity.
P KeepRotatedTextReadable bool Flag controling whether a rotate text is to stay oriented to be always readable.
P Rotation double Base line angle of a text note, in radians.
P TypeId ElementId Id of a text type that defines the style of a text note.
P VerticalAlignment VerticalTextAlignment Vertical alignment of the text.