Places a tag on an element or subelement.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:  2019

Syntax

C#
public static IndependentTag Create(
	Document document,
	ElementId symId,
	ElementId ownerDBViewId,
	Reference referenceToTag,
	bool addLeader,
	TagOrientation tagOrientation,
	XYZ pnt
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	symId As ElementId, _
	ownerDBViewId As ElementId, _
	referenceToTag As Reference, _
	addLeader As Boolean, _
	tagOrientation As TagOrientation, _
	pnt As XYZ _
) As IndependentTag
Visual C++
public:
static IndependentTag^ Create(
	Document^ document, 
	ElementId^ symId, 
	ElementId^ ownerDBViewId, 
	Reference^ referenceToTag, 
	bool addLeader, 
	TagOrientation tagOrientation, 
	XYZ^ pnt
)

Parameters

document
Type: Autodesk.Revit.DB..::..Document
The document to which the tag will be added.
symId
Type: Autodesk.Revit.DB..::..ElementId
The id for the FamilySymbol which determines the tag's type.
ownerDBViewId
Type: Autodesk.Revit.DB..::..ElementId
The view in which the tag will be visible.
referenceToTag
Type: Autodesk.Revit.DB..::..Reference
The host reference of the tag. The reference can be to an element or subelement in a local or linked document.
addLeader
Type: System..::..Boolean
When true, the tag will be created with a straight leader with an attached end.
tagOrientation
Type: Autodesk.Revit.DB..::..TagOrientation
The orientation of the tag's head.
pnt
Type: Autodesk.Revit.DB..::..XYZ
For tags without leaders, this point is the position of the tag head. For tags with leaders, this point is the end point of the leader, and a leader of default length will be created from this point to the tag head.

Return Value

If successful the new tag is returned.

Exceptions

ExceptionCondition
Autodesk.Revit.Exceptions..::..ArgumentException The ElementId ownerDBViewId does not correspond to a View. -or- The ElementId ownerDBViewId is a view template. -or- The ElementId ownerDBViewId is a perspective view. -or- The 3D view ownerDBViewId is not locked. -or- The ElementId symId does not correspond to a FamilySymbol. -or- The reference can not be tagged.
Autodesk.Revit.Exceptions..::..ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions..::..ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
Autodesk.Revit.Exceptions..::..InternalException Tag creation failed.
Autodesk.Revit.Exceptions..::..ModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.Exceptions..::..ModificationOutsideTransactionException The document has no open transaction.

See Also