public static Solid GET_TEXT_SOLID_FROM_IndependentTag(IndependentTag independentTag)
{
Solid Sum_solid = null;
Document doc = independentTag.Document;
FamilySymbol tagType = independentTag.Document.GetElement(independentTag.GetTypeId()) as FamilySymbol;
Family family = tagType.Family;
Document familyDoc = doc.EditFamily(family);
if (null != familyDoc && familyDoc.IsFamilyDocument == true)
{
var collector = new FilteredElementCollector(familyDoc).OfClass(typeof(TextElement)).Cast<TextElement>();
var familyView = new FilteredElementCollector(familyDoc).OfClass(typeof(Autodesk.Revit.DB.View)).Cast<Autodesk.Revit.DB.View>().FirstOrDefault();
foreach (TextElement x in collector)
{
var bb =x.get_BoundingBox(familyView);
Solid solid = CreateSolidFromBoundingBox(bb);
if (Sum_solid == null)
{
Sum_solid = solid;
}
else
{
try
{
Sum_solid = BooleanOperationsUtils.ExecuteBooleanOperation(Sum_solid, solid, BooleanOperationsType.Union);
}
catch { }
}
}
}
return Sum_solid;
}