Esempio n. 1
0
        /***************************************************/

        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);
        }
Esempio n. 2
0
        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
                }
            };
        }

        /***************************************************/
    }
Esempio n. 3
0
        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
                }
            };
        }

        /***************************************************/
    }
Esempio n. 5
0
        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()
                }
            };
        }

        /***************************************************/
    }
Esempio n. 6
0
        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
                }
            };
        }

        /***************************************************/
    }
Esempio n. 7
0
        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
                }
            };
        }

        /***************************************************/
    }
Esempio n. 8
0
        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
                }
            };
        }

        /***************************************************/
    }