NewModelText Method


Create a model text in the Autodesk Revit family document.

Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public ModelText NewModelText(
	string text,
	ModelTextType modelTextType,
	SketchPlane sketchPlane,
	XYZ position,
	HorizontalAlign horizontalAlign,
	double depth
)
Visual Basic
Public Function NewModelText ( _
	text As String, _
	modelTextType As ModelTextType, _
	sketchPlane As SketchPlane, _
	position As XYZ, _
	horizontalAlign As HorizontalAlign, _
	depth As Double _
) As ModelText
Visual C++
public:
ModelText^ NewModelText(
	String^ text, 
	ModelTextType^ modelTextType, 
	SketchPlane^ sketchPlane, 
	XYZ^ position, 
	HorizontalAlign horizontalAlign, 
	double depth
)

Parameters

text
Type: System String
The text to be displayed.
modelTextType
Type: Autodesk.Revit.DB ModelTextType
The type of model text. If this parameter is a null reference ( Nothing in Visual Basic) , the default type will be used.
sketchPlane
Type: Autodesk.Revit.DB SketchPlane
The sketch plane of the model text. The direction of model text is determined by the normal of the sketch plane. To extrude in the other direction set the depth value to negative.
position
Type: Autodesk.Revit.DB XYZ
The position of the model text. The position must lie in the sketch plane.
horizontalAlign
Type: Autodesk.Revit.DB HorizontalAlign
The horizontal alignment.
depth
Type: System Double
The depth of the model text.

Return Value

If successful, the newly created model text is returned, otherwise an exception with error information will be thrown.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when the input argument text, sketchPlane or XYZ is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Thrown when input argument text is an empty string. Thrown when input argument horizontalAlign or depth is invalid.
Autodesk.Revit.Exceptions InvalidOperationException Thrown when model text creation failed.

See Also