Hi,
how to delete family from project (not symbol or instance) ?
Can not to use ActiveDocument.Delete(ElementID) becouse can not find the ID for loaded family.
Thank you for advance.
Solved! Go to Solution.
Link copied
Hi,
how to delete family from project (not symbol or instance) ?
Can not to use ActiveDocument.Delete(ElementID) becouse can not find the ID for loaded family.
Thank you for advance.
Solved! Go to Solution.
The way you can find the element id of the family is by filtering for families and then finding the desired family by name or some other characteristic:
void DeleteFamilyTest() { Family famToDelete = null; FilteredElementCollector fec = new FilteredElementCollector(uidoc.Document); fec.OfClass(typeof(Family)); foreach (Element e in fec.ToElements()) { Family f = e as Family; if (null != f && f.Name.Equals("SomeFamilyName")) { famToDelete = f; } } if (null != famToDelete) { uidoc.Document.Delete(famToDelete.Id); } }
Hope this helps!