/***************************************************/ public static Element Element(this IBHoMObject bHoMObject, Document document) { ElementId elementId = bHoMObject.ElementId(); if (elementId != null && elementId.IntegerValue > 0) { return(document.GetElement(elementId)); } string uniqueId = bHoMObject.UniqueId(); if (!string.IsNullOrWhiteSpace(uniqueId)) { return(document.GetElement(uniqueId)); } return(null); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static bool Delete(IBHoMObject bHoMObject, Document document) { ElementId elementId = BH.Revit.Engine.Core.Query.ElementId(bHoMObject); if (elementId == null) { string uniqueId = bHoMObject.UniqueId(); if (!string.IsNullOrWhiteSpace(uniqueId)) { Element element = document.GetElement(uniqueId); if (element != null) { elementId = element.Id; } } } if (elementId == null || elementId.IntegerValue < 0) { return(false); } return(Delete(elementId, document, false).Count() != 0); }