Skip to content

TextNote.Create(Document, ElementId, XYZ, String, ElementId)

Public Class

Creates a new unwrapped TextNote element with the given properties.

Namespace: Autodesk.Revit.DB

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

Syntax

public static TextNote Create(
Document document,
ElementId viewId,
XYZ position,
string text,
ElementId typeId
)

Parameters

document Document

A valid Revit document that is currently modifiable (i.e. with an open transaction).

viewId ElementId

Id of the graphic view in which the note is to be created.

position XYZ

A model position of the new note.

For a left-aligned text (default), the origin is set at the top-left corner of the note’s bounding box.

textString

Text to populate the text note with.

typeId ElementId

Id of the text type to use for the new text note.

Return Value

TextNote
The newly created text note.

Exceptions

Exception

Condition


ArgumentException

The document is a family that cannot contain text notes. -or- The viewId does not represent a valid graphic view element in the given document. -or- The typeId does not represent a valid text type in the given document. -or- A valid point must not be father then 10 miles (approx. 16 km) from the origin.


ArgumentNullException

A non-optional argument was null


Remarks

The new TextNote will consist of a single line of text unless there are carriage return (‘\r’) or vertical tab (‘\v’) characters in the given string. Once the text note is created its width gets adjusted to fit the longest (or the single one) line of text.

As a view-specific element the TextNote will be visible only in the specified view.

The new TextNote will be created using the given text type, which defines the style. The currently default style can be obtained from the Document.GetDefaultElementTypeId method.