Ejemplo n.º 1
0
        /// <summary>
        /// Creates a property from element or its type's parameter.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="element">The element.</param>
        /// <param name="elementType">The element type, if it is appropriate to look in it for value.</param>
        /// <returns>The property handle.</returns>
        IFCAnyHandle CreatePropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, string owningPsetName, Element element, Element elementType,
                                                       PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType, string propertyName)
        {
            string localizedRevitParameterName = LocalizedRevitParameterName(ExporterCacheManager.LanguageType);
            string revitParameterName          = RevitParameterName;

            IFCAnyHandle propHnd = null;

            if (localizedRevitParameterName != null)
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    localizedRevitParameterName = localizedRevitParameterName + "[Type]";
                    propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                                propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            revitParameterName, propertyName, RevitBuiltInParameter,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    revitParameterName = revitParameterName + "[Type]";
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
                //When querying values from ProjectInfo we need to try alternative parameter names too.
                //These names are constructed as shown below.
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ProjectInfo))
                {
                    revitParameterName = owningPsetName + "." + revitParameterName;
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (elementType != null))
            {
                return(CreatePropertyFromElementOrSymbol(file, exporterIFC, owningPsetName, elementType, null,
                                                         propertyType, valueType, propertyEnumerationType, propertyName));
            }
            return(propHnd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a property from element or its type's parameter.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="element">The element.</param>
        /// <param name="elementType">The element type, if it is appropriate to look in it for value.</param>
        /// <returns>The property handle.</returns>
        IFCAnyHandle CreatePropertyFromElementOrSymbol(IFCFile file, ExporterIFC exporterIFC, Element element, Element elementType,
                                                       PropertyType propertyType, PropertyValueType valueType, Type propertyEnumerationType, string propertyName)
        {
            string localizedRevitParameterName = LocalizedRevitParameterName(ExporterCacheManager.LanguageType);
            string revitParameterName          = RevitParameterName;

            IFCAnyHandle propHnd = null;

            if (localizedRevitParameterName != null)
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    localizedRevitParameterName = localizedRevitParameterName + "[Type]";
                    propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                localizedRevitParameterName, propertyName, BuiltInParameter.INVALID,
                                                                                propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd))
            {
                propHnd = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                            revitParameterName, propertyName, RevitBuiltInParameter,
                                                                            propertyType, valueType, propertyEnumerationType);
                if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (element is ElementType || element is FamilySymbol))
                {
                    revitParameterName = revitParameterName + "[Type]";
                    propHnd            = PropertySetEntryMap.CreatePropertyFromElementBase(file, exporterIFC, element,
                                                                                           revitParameterName, propertyName, RevitBuiltInParameter,
                                                                                           propertyType, valueType, propertyEnumerationType);
                }
            }

            if (IFCAnyHandleUtil.IsNullOrHasNoValue(propHnd) && (elementType != null))
            {
                return(CreatePropertyFromElementOrSymbol(file, exporterIFC, elementType, null,
                                                         propertyType, valueType, propertyEnumerationType, propertyName));
            }
            return(propHnd);
        }