Esempio n. 1
0
        /// <summary>
        /// Generic check for the PreDefinedType string from IFC_EXPORT_PREDEFINEDTYPE*.
        /// </summary>
        /// <typeparam name="TEnum">The Enum to verify</typeparam>
        /// <param name="element">The element.</param>
        /// <param name="elementType">The optional element type.</param>
        /// <param name="ifcEnumTypeStr">Enum String if already obtained from IFC_EXPORT_ELEMENT*_AS or IFC_EXPORT_PREDEFINEDTYPE*</param>
        /// <returns>"NotDefined if the string is not defined as Enum</returns>
        public static TEnum GetPreDefinedType <TEnum>(Element element, Element elementType, string ifcEnumTypeStr) where TEnum : struct
        {
            TEnum enumValue;

            Enum.TryParse("NotDefined", true, out enumValue);

            string value = ExporterUtil.GetExportTypeFromTypeParameter(element, elementType);

            if (string.IsNullOrEmpty(value))
            {
                value = ifcEnumTypeStr;
            }

            if (!string.IsNullOrEmpty(value))
            {
                Enum.TryParse(value, true, out enumValue);
            }

            return(enumValue);
        }