示例#1
0
        /// <summary>
        /// Gets IFC type name of an element.
        /// </summary>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <returns>
        /// The IFC type name.
        /// </returns>
        public static string GetIFCEnumTypeName(ExporterIFC exporterIFC, Element element)
        {
            string ifcEnumType = ExporterIFCUtils.GetIFCType(element, exporterIFC);

            return(ifcEnumType);
        }
示例#2
0
        /// <summary>
        /// Gets export type for an element.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="enumTypeValue">
        /// The output string value represents the enum type.
        /// </param>
        /// <returns>
        /// The IFCExportType.
        /// </returns>
        public static IFCExportType GetExportType(ExporterIFC exporterIFC, Element element,
                                                  out string enumTypeValue)
        {
            enumTypeValue = "";
            IFCExportType exportType = IFCExportType.DontExport;

            // Get potential override value first.
            {
                string symbolClassName;

                string exportAsEntity = "IFCExportAs";
                string exportAsType   = "IFCExportType";

                ParameterUtil.GetStringValueFromElementOrSymbol(element, exportAsEntity, out symbolClassName);
                ParameterUtil.GetStringValueFromElementOrSymbol(element, exportAsType, out enumTypeValue);

                if (!String.IsNullOrEmpty(symbolClassName))
                {
                    exportType = ElementFilteringUtil.GetExportTypeFromClassName(symbolClassName);
                    if (exportType != IFCExportType.DontExport)
                    {
                        return(exportType);
                    }
                }
            }

            Category category = element.Category;

            if (category == null)
            {
                return(IFCExportType.DontExport);
            }

            ElementId categoryId = category.Id;

            string ifcClassName = ExporterIFCUtils.GetIFCClassName(element, exporterIFC);

            if (ifcClassName != "")
            {
                enumTypeValue = ExporterIFCUtils.GetIFCType(element, exporterIFC);
                // if using name, override category id if match is found.
                if (!ifcClassName.Equals("Default", StringComparison.OrdinalIgnoreCase))
                {
                    exportType = ElementFilteringUtil.GetExportTypeFromClassName(ifcClassName);
                }
            }

            // if not set, fall back on category id.
            if (exportType == IFCExportType.DontExport)
            {
                //bool exportSeparately = true;
                exportType = ElementFilteringUtil.GetExportTypeFromCategoryId(categoryId, out enumTypeValue /*, out bool exportSeparately*/);
            }

            // if not set, fall back on symbol functions.
            // allow override of IfcBuildingElementProxy.
            if ((exportType == IFCExportType.DontExport) || (exportType == IFCExportType.ExportBuildingElementProxy))
            {
                // TODO: add isColumn.
                //if (familySymbol.IsColumn())
                //exportType = IFCExportType.ExportColumnType;
                //else
                FamilyInstance familyInstance = element as FamilyInstance;
                if (familyInstance != null)
                {
                    switch (familyInstance.StructuralType)
                    {
                    case Autodesk.Revit.DB.Structure.StructuralType.Beam:
                        exportType = IFCExportType.ExportBeam;
                        break;

                    case Autodesk.Revit.DB.Structure.StructuralType.Footing:
                        exportType = IFCExportType.ExportFooting;
                        break;
                    }
                }
            }

            return(exportType);
        }