I am currently creating a family instance via Revit API. I need to determine if the same instance already exists in the given location. If it does, I do not wish to create a duplicate.
What is the best way to determine via C# if it already exists?
if (familyinstance.Exists) does not work in the Revit API
Code:
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
Family webAngle = new FilteredElementCollector(doc).OfClass(typeof(Family)).FirstOrDefault(q => q.Name == "ConXWebAngle") as Family;
FamilySymbol fs = webAngle.Symbols.Cast<FamilySymbol>().First(q => q.Name == "W24X68");
using (Transaction t = new Transaction(doc, "Insert Web Angle Clips"))
{
t.Start();
FamilyInstance fi = doc.Create.NewFamilyInstance(pt, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);
//Need to determine if there is already an existing clip in this location.
//If so, there is no need to create another one.
t.Commit();
}