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


Creates a new line-wrapping text note element of the given width and properties.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.484.0)
Since: 2016

Syntax

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

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.

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

width
Type: System Double
Width [ft] of the text in paper space (i.e. as it is measured when printed.) If a line of text is longer than the specified Width, the text will be automatically wrapped. If a a zero Width is supplied then this method will create an unwrapped text note element.
text
Type: System String
Text to populate the text note with.
typeId
Type: Autodesk.Revit.DB ElementId
Id of the text type to use for the new text note.

Return Value

The newly created text note.

Remarks

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 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. -or- The given width is not valid. A valid value must be within the range returned by the static methods GetMinimumAllowedWidth and GetMaximumAllowedWidth.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL

See Also