Create Method (Document, ElementId, XYZ, String, TextNoteOptions)


Creates a new unwrapped text note element with the given properties.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2016

Syntax

C#
public static TextNote Create(
	Document document,
	ElementId viewId,
	XYZ position,
	string text,
	TextNoteOptions options
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	viewId As ElementId, _
	position As XYZ, _
	text As String, _
	options As TextNoteOptions _
) As TextNote
Visual C++
public:
static TextNote^ Create(
	Document^ document, 
	ElementId^ viewId, 
	XYZ^ position, 
	String^ text, 
	TextNoteOptions^ options
)

Parameters

document
Type: Autodesk.Revit.DB Document
A valid Revit document that is currently modifiable (i.e. with an open transaction).
viewId
Type: Autodesk.Revit.DB ElementId
Id of the graphic view in which the note is to be created.
position
Type: Autodesk.Revit.DB XYZ
A model position of the new note.

Note that the position's relation to the text's bounding box depends on the requested text alignment (set via the Options argument). It will be the box' top-left corner for a left-aligned text, the top-right corner for a right-aligned text, and middle-top point if the text is to be centered.

text
Type: System String
Text to populate the text note with.
options
Type: Autodesk.Revit.DB TextNoteOptions
Options to control behavior and appearance of the text note.

Return Value

The newly created text note.

Remarks

The new text note will consist of a single line of text unless there are line-break characters (CR) 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 text note will be visible only in the specified view.

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

Exceptions

Exception Condition
Autodesk.Revit.Exceptions 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 options structure does not contain a valid text type to use for a new text note in the given document. -or- A valid point must not be father then 10 miles (approx. 16 km) from the origin.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null

See Also