示例#1
0
        /// <summary>
        /// Creates a builtIn configuration by particular options.
        /// </summary>
        /// <param name="name">The configuration name.</param>
        /// <param name="ifcVersion">The IFCVersion.</param>
        /// <param name="spaceBoundaries">The space boundary level.</param>
        /// <param name="exportBaseQuantities">The ExportBaseQuantities.</param>
        /// <param name="splitWalls">The SplitWallsAndColumns option.</param>
        /// <param name="internalSets">The ExportInternalRevitPropertySets option.</param>
        /// <param name="schedulesAsPSets">The ExportSchedulesAsPsets option.</param>
        /// <param name="userDefinedPSets">The ExportUserDefinedPsets option.</param>
        /// <param name="PlanElems2D">The Export2DElements option.</param>
        /// <param name="exportBoundingBox">The exportBoundingBox option.</param>
        /// <param name="exportLinkedFiles">The exportLinkedFiles option.</param>
        /// <returns>The builtIn configuration.</returns>
        public static IFCExportConfiguration CreateBuiltInConfiguration(IFCVersion ifcVersion,
                                                                        int spaceBoundaries,
                                                                        bool exportBaseQuantities,
                                                                        bool splitWalls,
                                                                        bool internalSets,
                                                                        bool schedulesAsPSets,
                                                                        bool userDefinedPSets,
                                                                        bool userDefinedParameterMapping,
                                                                        bool PlanElems2D,
                                                                        bool exportBoundingBox,
                                                                        bool exportLinkedFiles,
                                                                        string excludeFilter             = "",
                                                                        bool includeSteelElements        = false,
                                                                        KnownERNames exchangeRequirement = KnownERNames.NotDefined,
                                                                        string customName = null)
        {
            IFCExportConfiguration configuration = new IFCExportConfiguration();

            // Items from General Tab
            configuration.Name = string.IsNullOrWhiteSpace(customName) ? ifcVersion.ToLabel() : customName;
            if (exchangeRequirement != KnownERNames.NotDefined)
            {
                configuration.Name = $"{configuration.Name} [{exchangeRequirement.ToShortLabel()}]";
            }

            configuration.IFCVersion          = ifcVersion;
            configuration.ExchangeRequirement = exchangeRequirement;
            configuration.IFCFileType         = IFCFileFormat.Ifc;
            configuration.ActivePhaseId       = ElementId.InvalidElementId.IntegerValue;
            configuration.SpaceBoundaries     = spaceBoundaries;

            configuration.SplitWallsAndColumns = splitWalls;
            configuration.IncludeSteelElements = includeSteelElements;

            // Items from Additional Content Tab
            configuration.Export2DElements  = PlanElems2D;
            configuration.ExportLinkedFiles = exportLinkedFiles;

            // Items from Property Sets Tab
            configuration.ExportInternalRevitPropertySets   = internalSets;
            configuration.ExportBaseQuantities              = exportBaseQuantities;
            configuration.ExportSchedulesAsPsets            = schedulesAsPSets;
            configuration.ExportUserDefinedPsets            = userDefinedPSets;
            configuration.ExportUserDefinedPsetsFileName    = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\" + configuration.Name + @".txt";
            configuration.ExportUserDefinedParameterMapping = userDefinedParameterMapping;

            // Items from Advanced Tab
            configuration.ExportBoundingBox = exportBoundingBox;

            // Items from the Entities to Export Tab
            configuration.ExcludeFilter = excludeFilter;

            configuration.m_isBuiltIn   = true;
            configuration.m_isInSession = false;

            return(configuration);
        }
        /// <summary>
        /// Parse the Exchange Requirement (ER) name string into the associated Enum
        /// </summary>
        /// <param name="erName">The ER Name</param>
        /// <returns>The ER enum</returns>
        public static KnownERNames ParseEREnum(string erName)
        {
            KnownERNames erEnum = KnownERNames.NotDefined;

            if (Enum.TryParse(erName, out erEnum))
            {
                return(erEnum);
            }
            return(erEnum);
        }
示例#3
0
        /// <summary>
        /// Get the UI Name for the Exchange Requirement (ER). Note that this string may be localized
        /// </summary>
        /// <param name="erEnum">The ER Enum value</param>
        /// <returns>The localized ER name string</returns>
        public static string ToFullLabel(this KnownERNames erEnum)
        {
            switch (erEnum)
            {
            case KnownERNames.Architecture:
                return(Resources.ER_Architecture);

            case KnownERNames.BuildingService:
                return(Resources.ER_BuildingService);

            case KnownERNames.Structural:
                return(Resources.ER_Structural);

            default:
                return(string.Empty);
            }
        }
示例#4
0
        /// <summary>
        /// Converts the <see cref="KnownERNames"/> to string.
        /// </summary>
        /// <returns>The string of .</returns>
        public static string ToShortLabel(this KnownERNames erName)
        {
            switch (erName)
            {
            case KnownERNames.Architecture:
                return(Resources.ER_ArchitectureShort);

            case KnownERNames.BuildingService:
                return(Resources.ER_BuildingServiceShort);

            case KnownERNames.Structural:
                return(Resources.ER_StructuralShort);

            default:
                return(string.Empty);
            }
        }
        /// <summary>
        /// Get the enumeration value of the Exchange Requirement given the localized string from the UI
        /// </summary>
        /// <param name="UIERStringValue">the string value from the UI</param>
        /// <returns>the ER enumeration</returns>
        public static KnownERNames GetEREnum(string UIERStringValue)
        {
            KnownERNames erEnum = KnownERNames.NotDefined;

            if (Resources.ER_Architecture.Equals(UIERStringValue))
            {
                erEnum = KnownERNames.Architecture;
            }
            else if (Resources.ER_BuildingService.Equals(UIERStringValue))
            {
                erEnum = KnownERNames.BuildingService;
            }
            else if (Resources.ER_Structural.Equals(UIERStringValue))
            {
                erEnum = KnownERNames.Structural;
            }

            return(erEnum);
        }
 /// <summary>
 /// Get the UI Name for the Exchange Requirement (ER). Note that this string may be localized
 /// </summary>
 /// <param name="erEnum">The ER Enum value</param>
 /// <returns>The localized ER name string</returns>
 public static string GetERNameForUI(KnownERNames erEnum)
 {
     if (erEnum == KnownERNames.Architecture)
     {
         return(Resources.ER_Architecture);
     }
     else if (erEnum == KnownERNames.BuildingService)
     {
         return(Resources.ER_BuildingService);
     }
     else if (erEnum == KnownERNames.Structural)
     {
         return(Resources.ER_Structural);
     }
     else
     {
         return("");
     }
 }
        /// <summary>
        /// Creates a builtIn configuration by particular options.
        /// </summary>
        /// <param name="name">The configuration name.</param>
        /// <param name="ifcVersion">The IFCVersion.</param>
        /// <param name="spaceBoundaries">The space boundary level.</param>
        /// <param name="exportBaseQuantities">The ExportBaseQuantities.</param>
        /// <param name="splitWalls">The SplitWallsAndColumns option.</param>
        /// <param name="internalSets">The ExportInternalRevitPropertySets option.</param>
        /// <param name="schedulesAsPSets">The ExportSchedulesAsPsets option.</param>
        /// <param name="userDefinedPSets">The ExportUserDefinedPsets option.</param>
        /// <param name="PlanElems2D">The Export2DElements option.</param>
        /// <param name="exportBoundingBox">The exportBoundingBox option.</param>
        /// <param name="exportLinkedFiles">The exportLinkedFiles option.</param>
        /// <returns>The builtIn configuration.</returns>
        public static IFCExportConfiguration CreateBuiltInConfiguration(string name,
                                                                        IFCVersion ifcVersion,
                                                                        int spaceBoundaries,
                                                                        bool exportBaseQuantities,
                                                                        bool splitWalls,
                                                                        bool internalSets,
                                                                        bool schedulesAsPSets,
                                                                        bool userDefinedPSets,
                                                                        bool userDefinedParameterMapping,
                                                                        bool PlanElems2D,
                                                                        bool exportBoundingBox,
                                                                        bool exportLinkedFiles,
                                                                        string excludeFilter             = "",
                                                                        bool includeSteelElements        = false,
                                                                        KnownERNames exchangeRequirement = KnownERNames.NotDefined)
        {
            IFCExportConfiguration configuration = new IFCExportConfiguration();

            configuration.Name                                      = name;
            configuration.IFCVersion                                = ifcVersion;
            configuration.IFCFileType                               = IFCFileFormat.Ifc;
            configuration.ExchangeRequirement                       = exchangeRequirement;
            configuration.SpaceBoundaries                           = spaceBoundaries;
            configuration.ExportBaseQuantities                      = exportBaseQuantities;
            configuration.SplitWallsAndColumns                      = splitWalls;
            configuration.ExportInternalRevitPropertySets           = internalSets;
            configuration.ExportIFCCommonPropertySets               = true;
            configuration.Export2DElements                          = PlanElems2D;
            configuration.VisibleElementsOfCurrentView              = false;
            configuration.Use2DRoomBoundaryForVolume                = false;
            configuration.UseFamilyAndTypeNameForReference          = false;
            configuration.ExportPartsAsBuildingElements             = false;
            configuration.UseActiveViewGeometry                     = false;
            configuration.ExportSpecificSchedules                   = false;
            configuration.ExportBoundingBox                         = exportBoundingBox;
            configuration.ExportSolidModelRep                       = false;
            configuration.ExportSchedulesAsPsets                    = schedulesAsPSets;
            configuration.ExportUserDefinedPsets                    = userDefinedPSets;
            configuration.ExportUserDefinedPsetsFileName            = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\" + name + @".txt";
            configuration.ExportUserDefinedParameterMapping         = userDefinedParameterMapping;
            configuration.ExportUserDefinedParameterMappingFileName = "";
            configuration.ExportLinkedFiles                         = exportLinkedFiles;
            configuration.IncludeSiteElevation                      = false;
            // The default tesselationLevelOfDetail will be low
            configuration.TessellationLevelOfDetail = 0.5;
            configuration.UseOnlyTriangulation      = false;
            configuration.StoreIFCGUID                    = false;
            configuration.m_isBuiltIn                     = true;
            configuration.m_isInSession                   = false;
            configuration.ActivePhaseId                   = ElementId.InvalidElementId;
            configuration.ExportRoomsInView               = false;
            configuration.ExcludeFilter                   = excludeFilter;
            configuration.COBieCompanyInfo                = "";
            configuration.COBieProjectInfo                = "";
            configuration.IncludeSteelElements            = includeSteelElements;
            configuration.UseTypeNameOnlyForIfcType       = false;
            configuration.UseVisibleRevitNameAsEntityName = false;
            configuration.ExportAllPhases                 = false;
            configuration.GeoRefCRSName                   = "";
            configuration.GeoRefCRSDesc                   = "";
            configuration.GeoRefEPSGCode                  = "";
            configuration.GeoRefGeodeticDatum             = "";
            configuration.GeoRefMapUnit                   = "";

            return(configuration);
        }