/***************************************************/ 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 static FilterByViewSpecific FilterByViewSpecific(IBHoMObject view) { int elementId = view.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", view.BHoM_Guid)); return(null); } else { return new FilterByViewSpecific { ViewId = elementId } }; } /***************************************************/ }
public static FilterByFamilyType FilterByFamilyType(IBHoMObject bHoMObject) { int elementId = bHoMObject.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", bHoMObject.BHoM_Guid)); return(null); } else { return new FilterByFamilyType { FamilyTypeId = elementId } }; } /***************************************************/ }
public static FilterByParameterElementId FilterByParameterElementId(string parameterName, IBHoMObject idElement) { int elementId = idElement.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", idElement.BHoM_Guid)); return(null); } else { return new FilterByParameterElementId { ParameterName = parameterName, ElementId = elementId } }; } /***************************************************/ }
public static FilterByLink FilterByLink(IBHoMObject linkInstance) { int elementId = linkInstance.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError($"Valid ElementId has not been found. BHoM Guid: {linkInstance.BHoM_Guid}"); return(null); } else { return new FilterByLink { LinkName = elementId.ToString() } }; } /***************************************************/ }
public static FilterTypesOfFamily FilterTypesOfFamily(IBHoMObject family) { int elementId = family.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", family.BHoM_Guid)); return(null); } else { return new FilterTypesOfFamily { FamilyId = elementId } }; } /***************************************************/ }
public static FilterMemberElements FilterMemberElements(IBHoMObject element) { int elementId = element.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", element.BHoM_Guid)); return(null); } else { return new FilterMemberElements { ParentId = elementId } }; } /***************************************************/ }
public static FilterViewsByTemplate FilterViewsByTemplate(IBHoMObject viewTemplate) { int elementId = viewTemplate.ElementId(); if (elementId == -1) { BH.Engine.Reflection.Compute.RecordError(String.Format("Valid ElementId has not been found. BHoM Guid: {0}", viewTemplate.BHoM_Guid)); return(null); } else { return new FilterViewsByTemplate { TemplateId = elementId } }; } /***************************************************/ }