Creates a new IndependentTag Element.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Syntax
Return Value
If successful, an IndependentTag object is returned.
Remarks
Examples
CopyC#
private IndependentTag CreateIndependentTag(Autodesk.Revit.DB.Document document, Wall wall)
{
Autodesk.Revit.DB.View view = document.ActiveView;
TagMode tagMode = TagMode.TM_ADDBY_CATEGORY;
TagOrientation tagorn = TagOrientation.Horizontal;
LocationCurve wallLoc = wall.Location as LocationCurve;
XYZ wallStart = wallLoc.Curve.GetEndPoint(0);
XYZ wallEnd = wallLoc.Curve.GetEndPoint(1);
XYZ wallMid = wallLoc.Curve.Evaluate(0.5, true);
IndependentTag newTag = document.Create.NewTag(view, wall, true, tagMode, tagorn, wallMid);
if (null == newTag)
{
throw new Exception("Create IndependentTag Failed.");
}
WallType type = wall.WallType;
Parameter foundParameter = type.LookupParameter("Type Mark");
bool result = foundParameter.Set("Hello");
newTag.LeaderEndCondition = LeaderEndCondition.Free;
XYZ elbowPnt = wallMid + new XYZ(5.0, 5.0, 0.0);
newTag.LeaderElbow = elbowPnt;
XYZ headerPnt = wallMid + new XYZ(10.0, 10.0, 0.0);
newTag.TagHeadPosition = headerPnt;
return newTag;
}
CopyVB.NET
Private Function CreateIndependentTag(document As Autodesk.Revit.DB.Document, wall As Wall) As IndependentTag
Dim view As Autodesk.Revit.DB.View = document.ActiveView
Dim tagMode__1 As TagMode = TagMode.TM_ADDBY_CATEGORY
Dim tagorn As TagOrientation = TagOrientation.Horizontal
Dim wallLoc As LocationCurve = TryCast(wall.Location, LocationCurve)
Dim wallStart As XYZ = wallLoc.Curve.GetEndPoint(0)
Dim wallEnd As XYZ = wallLoc.Curve.GetEndPoint(1)
Dim wallMid As XYZ = wallLoc.Curve.Evaluate(0.5, True)
Dim newTag As IndependentTag = document.Create.NewTag(view, wall, True, tagMode__1, tagorn, wallMid)
If newTag Is Nothing Then
Throw New Exception("Create IndependentTag Failed.")
End If
Dim type As WallType = wall.WallType
Dim foundParameter As Parameter = type.LookupParameter("Type Mark")
Dim result As Boolean = foundParameter.[Set]("Hello")
newTag.LeaderEndCondition = LeaderEndCondition.Free
Dim elbowPnt As XYZ = wallMid + New XYZ(5.0, 5.0, 0.0)
newTag.LeaderElbow = elbowPnt
Dim headerPnt As XYZ = wallMid + New XYZ(10.0, 10.0, 0.0)
newTag.TagHeadPosition = headerPnt
Return newTag
End Function
Exceptions
See Also