public void CreateTag(TagMode tagMode,
FamilySymbolWrapper tagSymbol, bool leader,
TagOrientation tagOrientation)
{
foreach(FamilyInstance beam in m_beamList)
{
//Get the start point and end point of the selected beam.
Autodesk.Revit.DB.LocationCurve location = beam.Location as Autodesk.Revit.DB.LocationCurve;
Autodesk.Revit.DB.Curve curve = location.Curve;
Transaction t = new Transaction(m_revitDoc.Document);
t.Start("Create new tag");
//Create tag on the beam's start and end.
IndependentTag tag1 = m_docCreator.NewTag(
m_view, beam, leader, tagMode, tagOrientation, curve.get_EndPoint(0));
IndependentTag tag2 = m_docCreator.NewTag(
m_view, beam, leader, tagMode, tagOrientation, curve.get_EndPoint(1));
//Change the tag's object Type.
tag1.ChangeTypeId(tagSymbol.FamilySymbol.Id);
tag2.ChangeTypeId(tagSymbol.FamilySymbol.Id);
t.Commit();
}
}