コード例 #1
0
        /// <summary>
        /// Creates a new property set options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        /// <remarks>Please initialize this after all other code, as it relies on a consistent cache otherwise.</remarks>
        public static PropertySetOptions Create(ExporterIFC exporterIFC, ExportOptionsCache cache)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            PropertySetOptions propertySetOptions = new PropertySetOptions();

            propertySetOptions.m_ExportInternalRevit = (cache.FileVersion != IFCVersion.IFC2x3CV2);

            // "Revit property sets" override
            propertySetOptions.ExportInternalRevitOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportIFCCommonPropertySets" override
            propertySetOptions.ExportIFCCommonOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportIFCCommonPropertySets");

            // "ExportSchedulesAsPsets" override
            propertySetOptions.ExportSchedulesAsPsetsOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportSchedulesAsPsets");

            // "ExportUserDefinedPsets" override
            propertySetOptions.ExportUserDefinedPsetsOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportUserDefinedPsets");

            // "ExportUserDefinedPsetsFileName" override
            propertySetOptions.ExportUserDefinedPsetsFileName = ExportOptionsCache.GetNamedStringOption(options, "ExportUserDefinedPsetsFileName");

            return(propertySetOptions);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new property set options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        /// <remarks>Please initialize this after all other code, as it relies on a consistent cache otherwise.</remarks>
        public static PropertySetOptions Create(ExporterIFC exporterIFC, ExportOptionsCache cache)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            PropertySetOptions propertySetOptions = new PropertySetOptions();

            propertySetOptions.m_ExportInternalRevit = (!(cache.ExportAs2x3CoordinationView2 || cache.ExportAs2x3COBIE24DesignDeliverable));

            // "Revit property sets" override
            propertySetOptions.ExportInternalRevitOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportIFCCommonPropertySets" override
            propertySetOptions.ExportIFCCommonOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportIFCCommonPropertySets");

            // "ExportSchedulesAsPsets" override
            propertySetOptions.ExportSchedulesAsPsetsOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportSchedulesAsPsets");

            // "ExportUserDefinedPsets" override
            propertySetOptions.ExportUserDefinedPsetsOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportUserDefinedPsets");

            // "ExportUserDefinedPsetsFileName" override
            propertySetOptions.ExportUserDefinedPsetsFileName = OptionsUtil.GetNamedStringOption(options, "ExportUserDefinedPsetsFileName");

            // "ExportSpecificSchedules" overrid
            propertySetOptions.ExportSpecificSchedulesOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportSpecificSchedules");

            return(propertySetOptions);
        }
コード例 #3
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document document, Autodesk.Revit.DB.View filterView)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();
            cache.FileVersion = exporterIFC.FileVersion;
            cache.FileName = exporterIFC.FileName;
            cache.ExportBaseQuantities = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected. 
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels = false;
            cache.ExportAnnotationsOverride = null;
            cache.FilterViewForExport = filterView;
            cache.ExportBoundingBoxOverride = null;
            cache.IncludeSiteElevation = false;
            cache.UseCoarseTessellation = true;

            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, cache);

            String use2DRoomBoundary = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool? use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");
            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                cache.ExportAs2x2 ||
                (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool? exportAdvancedSweptSolids = GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");
            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;

            // Set GUIDOptions here.
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool? allowGUIDParameterOverride = GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;

                bool? storeIFCGUID = GetNamedBooleanOption(options, "StoreIFCGUID");
                if (storeIFCGUID != null)
                    cache.GUIDOptions.StoreIFCGUID = storeIFCGUID.Value;
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool? useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool? useVisibleRevitNameAsEntityName = GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;
            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                ElementId elementId = ParseElementId(singleElementValue);
                
                List<ElementId> ids = new List<ElementId>();
                ids.Add(elementId);
                cache.ElementsForExport = ids;
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                IList<ElementId> ids = ParseElementIds(elementsToExportValue);
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List<ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = GetNamedBooleanOption(options, "ExportBoundingBox");

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = GetNamedStringOption(options, "AlternateUIVersion");

            // Include IFCSITE elevation in the site local placement origin
            bool? includeIfcSiteElevation = GetNamedBooleanOption(options, "IncludeSiteElevation");
            cache.IncludeSiteElevation = includeIfcSiteElevation != null ? includeIfcSiteElevation.Value : false;

            // Use coarse tessellation for floors, railings, ramps, spaces and stairs.
            bool? useCoarseTessellation = GetNamedBooleanOption(options, "UseCoarseTessellation");
            cache.UseCoarseTessellation = useCoarseTessellation != null ? useCoarseTessellation.Value : true;

            /// Allow exporting a mix of extrusions and BReps as a solid model, if possible.
            bool? canExportSolidModelRep = GetNamedBooleanOption(options, "ExportSolidModelRep");
            cache.CanExportSolidModelRep = canExportSolidModelRep != null ? canExportSolidModelRep.Value : false;

            // Set the phase we are exporting
            cache.ActivePhaseId = ElementId.InvalidElementId;
            
            String activePhaseElementValue;
            if (options.TryGetValue("ActivePhase", out activePhaseElementValue))
                cache.ActivePhaseId = ParseElementId(activePhaseElementValue);

            if ((cache.ActivePhaseId == ElementId.InvalidElementId) && (cache.FilterViewForExport != null))
            {
                Parameter currPhase = cache.FilterViewForExport.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                    cache.ActivePhaseId = currPhase.AsElementId();
            }

            if (cache.ActivePhaseId == ElementId.InvalidElementId)
            {
                PhaseArray phaseArray = document.Phases;
                Phase lastPhase = phaseArray.get_Item(phaseArray.Size - 1);
                cache.ActivePhaseId = lastPhase.Id;
                cache.ActivePhaseElement = lastPhase;
            }
            else
            {
                cache.ActivePhaseElement = document.GetElement(cache.ActivePhaseId) as Phase;
            }

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            cache.SelectedConfigName = GetNamedStringOption(options, "ConfigName");

            bool? bExportLinks = GetNamedBooleanOption(options, "ExportingLinks");
            cache.ExportingLink = (bExportLinks.HasValue && bExportLinks.Value == true);

            if (cache.ExportingLink)
            {
                int? numInstances = GetNamedIntOption(options, "NumberOfExportedLinkInstances");
                for (int ii = 0; ii < numInstances; ii++)
                {
                    string optionName = (ii == 0) ? "ExportLinkInstanceTransform" : "ExportLinkInstanceTransform" + (ii + 1).ToString();
                    String aLinkInstanceTransform = GetNamedStringOption(options, optionName);

                    Transform currTransform = null;
                    if (!String.IsNullOrEmpty(aLinkInstanceTransform))
                    {
                        //reconstruct transform
                        Transform tr = ParseTransform(aLinkInstanceTransform);
                        //set to cache
                        if (tr != null)
                            currTransform = tr;
                    }

                    string fileName = null;

                    if (ii > 0)
                    {
                        optionName = "ExportLinkInstanceFileName" + (ii + 1).ToString();
                        fileName = GetNamedStringOption(options, optionName);
                    }

                    if (currTransform == null)
                        cache.m_LinkInstanceInfos.Add(new Tuple<string, Transform>(fileName, Transform.Identity));
                    else
                        cache.m_LinkInstanceInfos.Add(new Tuple<string, Transform>(fileName, currTransform));
                }
            }

            return cache;
        }
コード例 #4
0
ファイル: Exporter.cs プロジェクト: whztt07/RevitIFC
        /// <summary>
        /// Performs the export of elements, including spatial and non-spatial elements.
        /// </summary>
        /// <param name="exporterIFC">The IFC exporter object.</param>
        /// <param name="element ">The element to export.</param>
        public virtual void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.Element element)
        {
            if (!CanExportElement(exporterIFC, element))
            {
                if (element is RevitLinkInstance && !ExporterCacheManager.ExportOptionsCache.ExportingLink)
                {
                    IDictionary<String, String> options = exporterIFC.GetOptions();
                    bool? bExportLinks = ExportOptionsCache.GetNamedBooleanOption(options, "ExportLinkedFiles");
                    if (bExportLinks.HasValue && bExportLinks.Value == true)
                    {
                        bool bStoreIFCGUID = ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID;
                        ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID = true;
                        GUIDUtil.CreateGUID(element);
                        ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID = bStoreIFCGUID;
                    }
                }
                return;
            }

            //WriteIFCExportedElements
            if (m_Writer != null)
            {
                Category category = element.Category;
                m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name));
            }

            try
            {
                using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true))
                {
                    ExportElementImpl(exporterIFC, element, productWrapper);
                    ExporterUtil.ExportRelatedProperties(exporterIFC, element, productWrapper);
                }

                // We are going to clear the parameter cache for the element (not the type) after the export.
                // We do not expect to need the parameters for this element again, so we can free up the space.
                if (!(element is ElementType) && !ExporterStateManager.ShouldPreserveElementParameterCache(element))
                    ParameterUtil.RemoveElementFromCache(element);
            }
            catch (System.Exception ex)
            {
                HandleUnexpectedException(ex, exporterIFC, element);
            }
        }
コード例 #5
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document document, Autodesk.Revit.DB.View filterView)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();

            cache.FileVersion            = exporterIFC.FileVersion;
            cache.FileName               = exporterIFC.FileName;
            cache.ExportBaseQuantities   = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel     = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected. Or if it is exported as IFC4RV
            cache.ExportParts = (filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly);
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAnnotationsOverride             = null;

            // We are going to default to "true" for IncludeSteelElements to allow the default API
            // export to match the default UI.
            bool?includeSteelElements = OptionsUtil.GetNamedBooleanOption(options, "IncludeSteelElements");

            cache.IncludeSteelElements = includeSteelElements.HasValue && includeSteelElements.Value;

            // There is a bug in the native code that doesn't allow us to cast the filterView to any sub-type of View.  Work around this by re-getting the element pointer.
            if (filterView != null)
            {
                cache.FilterViewForExport = filterView.Document.GetElement(filterView.Id) as View;
            }
            else
            {
                cache.FilterViewForExport = null;
            }

            cache.ExportBoundingBoxOverride = null;
            cache.IncludeSiteElevation      = false;

            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, cache);

            String use2DRoomBoundary       = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool?  use2DRoomBoundaryOption = OptionsUtil.GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");

            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                 cache.ExportAs2x2 ||
                 (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool?exportAdvancedSweptSolids = OptionsUtil.GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");

            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;

            // Set GUIDOptions here.
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool?allowGUIDParameterOverride = OptionsUtil.GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                {
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;
                }

                bool?storeIFCGUID = OptionsUtil.GetNamedBooleanOption(options, "StoreIFCGUID");
                if (storeIFCGUID != null)
                {
                    cache.GUIDOptions.StoreIFCGUID = storeIFCGUID.Value;
                }
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool?useFamilyAndTypeNameForReference = OptionsUtil.GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool?useVisibleRevitNameAsEntityName = OptionsUtil.GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();

                bool?useOnlyTypeNameForIfcType = OptionsUtil.GetNamedBooleanOption(options, "UseTypeNameOnlyForIfcType");
                cache.NamingOptions.UseTypeNameOnlyForIfcType =
                    (useOnlyTypeNameForIfcType != null) && useOnlyTypeNameForIfcType.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;

            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                ElementId elementId = ParseElementId(singleElementValue);

                List <ElementId> ids = new List <ElementId>();
                ids.Add(elementId);
                cache.ElementsForExport = ids;
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                IList <ElementId> ids = ParseElementIds(elementsToExportValue);
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List <ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = OptionsUtil.GetNamedBooleanOption(options, "ExportBoundingBox");

            bool?exportRoomsInView = OptionsUtil.GetNamedBooleanOption(options, "ExportRoomsInView");

            cache.ExportRoomsInView = exportRoomsInView != null ? exportRoomsInView.Value : false;

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = OptionsUtil.GetNamedStringOption(options, "AlternateUIVersion");

            // Include IFCSITE elevation in the site local placement origin
            bool?includeIfcSiteElevation = OptionsUtil.GetNamedBooleanOption(options, "IncludeSiteElevation");

            cache.IncludeSiteElevation = includeIfcSiteElevation != null ? includeIfcSiteElevation.Value : false;

            string siteTransformation = OptionsUtil.GetNamedStringOption(options, "SitePlacement");

            if (!string.IsNullOrEmpty(siteTransformation))
            {
                SiteTransformBasis trfBasis = SiteTransformBasis.Shared;
                if (Enum.TryParse(siteTransformation, out trfBasis))
                {
                    cache.SiteTransformation = trfBasis;
                }
            }
            // We have two ways to get information about level of detail:
            // 1. The old Boolean "UseCoarseTessellation".
            // 2. The new double "TessellationLevelOfDetail".
            // We will combine these both into a LevelOfDetail integer that can be used by different elements differently.
            // The scale is from 1 (Extra Low) to 4 (High), where :
            // UseCoarseTessellation = true -> 1, UseCoarseTessellation = false -> 4
            // TessellationLevelOfDetail * 4 = LevelOfDetail
            // TessellationLevelOfDetail takes precedence over UseCoarseTessellation.

            cache.LevelOfDetail = ExportTessellationLevel.Low;

            bool?useCoarseTessellation = OptionsUtil.GetNamedBooleanOption(options, "UseCoarseTessellation");

            if (useCoarseTessellation.HasValue)
            {
                cache.LevelOfDetail = useCoarseTessellation.Value ? ExportTessellationLevel.ExtraLow : ExportTessellationLevel.High;
            }

            double?tessellationLOD = OptionsUtil.GetNamedDoubleOption(options, "TessellationLevelOfDetail");

            if (tessellationLOD.HasValue)
            {
                int levelOfDetail = (int)(tessellationLOD.Value * 4.0 + 0.5);
                // Ensure LOD is between 1 to 4, inclusive.
                levelOfDetail       = Math.Min(Math.Max(levelOfDetail, 1), 4);
                cache.LevelOfDetail = (ExportTessellationLevel)levelOfDetail;
            }

            bool?useOnlyTriangulation = OptionsUtil.GetNamedBooleanOption(options, "UseOnlyTriangulation");

            cache.UseOnlyTriangulation = useOnlyTriangulation.HasValue ? useOnlyTriangulation.Value : false;

            /// Allow exporting a mix of extrusions and BReps as a solid model, if possible.
            bool?canExportSolidModelRep = OptionsUtil.GetNamedBooleanOption(options, "ExportSolidModelRep");

            cache.CanExportSolidModelRep = canExportSolidModelRep != null ? canExportSolidModelRep.Value : false;

            // Set the phase we are exporting
            cache.ActivePhaseId = ElementId.InvalidElementId;

            String activePhaseElementValue;

            if (options.TryGetValue("ActivePhase", out activePhaseElementValue))
            {
                cache.ActivePhaseId = ParseElementId(activePhaseElementValue);
            }

            if ((cache.ActivePhaseId == ElementId.InvalidElementId) && (cache.FilterViewForExport != null))
            {
                Parameter currPhase = cache.FilterViewForExport.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                {
                    cache.ActivePhaseId = currPhase.AsElementId();
                }
            }

            if (cache.ActivePhaseId == ElementId.InvalidElementId)
            {
                PhaseArray phaseArray = document.Phases;
                Phase      lastPhase  = phaseArray.get_Item(phaseArray.Size - 1);
                cache.ActivePhaseId      = lastPhase.Id;
                cache.ActivePhaseElement = lastPhase;
            }
            else
            {
                cache.ActivePhaseElement = document.GetElement(cache.ActivePhaseId) as Phase;
            }

            bool?useActiveViewGeometry = OptionsUtil.GetNamedBooleanOption(options, "UseActiveViewGeometry");

            cache.UseActiveViewGeometry = useActiveViewGeometry.HasValue ? useActiveViewGeometry.Value : false;

            if (cache.UseActiveViewGeometry)
            {
                int? viewId       = OptionsUtil.GetNamedIntOption(options, "ActiveViewId");
                int  activeViewId = viewId.HasValue ? viewId.Value : -1;
                View activeView   = null;
                try
                {
                    activeView = document.GetElement(new ElementId(activeViewId)) as View;
                }
                catch
                {
                }
                cache.ActiveView = activeView;
            }

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            string erName = OptionsUtil.GetNamedStringOption(options, "ExchangeRequirement");

            Enum.TryParse(erName, out cache.m_exchangeRequirement);
            // Get stored File Header information from the UI and use it for export
            IFCFileHeaderItem fileHeaderItem = new IFCFileHeaderItem();

            new IFCFileHeader().GetSavedFileHeader(document, out fileHeaderItem);
            if (cache.m_exchangeRequirement != KnownERNames.NotDefined)
            {
                // It override existing value (if present) in the saved FileHeader, to use the selected ER from the UI
                fileHeaderItem.FileDescription = "ExchangeRequirement [" + erName + "]";
            }
            cache.FileHeaderItem = fileHeaderItem;

            cache.SelectedConfigName = OptionsUtil.GetNamedStringOption(options, "ConfigName");

            cache.SelectedParametermappingTableName = OptionsUtil.GetNamedStringOption(options, "ExportUserDefinedParameterMappingFileName");

            bool?bExportLinks = OptionsUtil.GetNamedBooleanOption(options, "ExportingLinks");

            cache.ExportingLink = (bExportLinks.HasValue && bExportLinks.Value == true);

            if (cache.ExportingLink)
            {
                int?numInstances = OptionsUtil.GetNamedIntOption(options, "NumberOfExportedLinkInstances");
                for (int ii = 0; ii < numInstances; ii++)
                {
                    string optionName             = (ii == 0) ? "ExportLinkInstanceTransform" : "ExportLinkInstanceTransform" + (ii + 1).ToString();
                    String aLinkInstanceTransform = OptionsUtil.GetNamedStringOption(options, optionName);

                    Transform currTransform = null;
                    if (!String.IsNullOrEmpty(aLinkInstanceTransform))
                    {
                        //reconstruct transform
                        Transform tr = ParseTransform(aLinkInstanceTransform);
                        //set to cache
                        if (tr != null)
                        {
                            currTransform = tr;
                        }
                    }

                    string fileName = null;

                    if (ii > 0)
                    {
                        optionName = "ExportLinkInstanceFileName" + (ii + 1).ToString();
                        fileName   = OptionsUtil.GetNamedStringOption(options, optionName);
                    }

                    if (currTransform == null)
                    {
                        cache.m_LinkInstanceInfos.Add(new Tuple <string, Transform>(fileName, Transform.Identity));
                    }
                    else
                    {
                        cache.m_LinkInstanceInfos.Add(new Tuple <string, Transform>(fileName, currTransform));
                    }
                }
            }

            cache.ExcludeFilter = OptionsUtil.GetNamedStringOption(options, "ExcludeFilter");

            // Geo Reference info
            cache.GeoRefCRSName       = OptionsUtil.GetNamedStringOption(options, "GeoRefCRSName");
            cache.GeoRefCRSDesc       = OptionsUtil.GetNamedStringOption(options, "GeoRefCRSDesc");
            cache.GeoRefEPSGCode      = OptionsUtil.GetNamedStringOption(options, "GeoRefEPSGCode");
            cache.GeoRefGeodeticDatum = OptionsUtil.GetNamedStringOption(options, "GeoRefGeodeticDatum");
            cache.GeoRefMapUnit       = OptionsUtil.GetNamedStringOption(options, "GeoRefMapUnit");

            return(cache);
        }
コード例 #6
0
ファイル: ExportOptionsCache.cs プロジェクト: whztt07/BIM-IFC
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();

            cache.FileVersion            = exporterIFC.FileVersion;
            cache.FileName               = exporterIFC.FileName;
            cache.ExportBaseQuantities   = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel     = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected.
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels           = false;
            cache.ExportAnnotationsOverride = null;
            cache.ExportInternalRevitPropertySetsOverride = null;
            cache.FilterViewForExport = filterView;

            String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");

            cache.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

            String use2DRoomBoundary       = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool?  use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");

            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                 cache.ExportAs2x2 ||
                 (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool?useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");

            cache.UseFamilyAndTypeNameForReference = (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;

            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                int elementIdAsInt;
                if (Int32.TryParse(singleElementValue, out elementIdAsInt))
                {
                    List <ElementId> ids = new List <ElementId>();
                    ids.Add(new ElementId(elementIdAsInt));
                    cache.ElementsForExport = ids;
                }
                else
                {
                    // Error - the option supplied could not be mapped to int.
                    // TODO: consider logging this error later and handling results better.
                    throw new Exception("Option 'SingleElement' did not map to a usable element id");
                }
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                String[]         elements = elementsToExportValue.Split(';');
                List <ElementId> ids      = new List <ElementId>();
                foreach (String element in elements)
                {
                    int elementIdAsInt;
                    if (Int32.TryParse(element, out elementIdAsInt))
                    {
                        ids.Add(new ElementId(elementIdAsInt));
                    }
                    else
                    {
                        // Error - the option supplied could not be mapped to int.
                        // TODO: consider logging this error later and handling results better.
                        throw new Exception("Option 'ElementsForExport' substring " + element + " did not map to a usable element id");
                    }
                }
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List <ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "Revit property sets" override
            cache.ExportInternalRevitPropertySetsOverride = GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            return(cache);
        }
コード例 #7
0
        /// <summary>
        /// Creates a new property set options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        /// <remarks>Please initialize this after all other code, as it relies on a consistent cache otherwise.</remarks>
        public static PropertySetOptions Create(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView,
            ExportOptionsCache cache)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            PropertySetOptions propertySetOptions = new PropertySetOptions();

            propertySetOptions.m_ExportInternalRevit = (cache.FileVersion != IFCVersion.IFC2x3CV2);

            // "Revit property sets" override
            propertySetOptions.ExportInternalRevitOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportIFCCommonPropertySets" override
            propertySetOptions.ExportIFCCommonOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportIFCCommonPropertySets");

            return propertySetOptions;
        }
コード例 #8
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document document, Autodesk.Revit.DB.View filterView)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();

            cache.FileVersion            = exporterIFC.FileVersion;
            cache.FileName               = exporterIFC.FileName;
            cache.ExportBaseQuantities   = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel     = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected.
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels           = false;
            cache.ExportAnnotationsOverride = null;

            // There is a bug in the native code that doesn't allow us to cast the filterView to any sub-type of View.  Work around this by re-getting the element pointer.
            if (filterView != null)
            {
                cache.FilterViewForExport = filterView.Document.GetElement(filterView.Id) as View;
            }
            else
            {
                cache.FilterViewForExport = null;
            }

            cache.ExportBoundingBoxOverride = null;
            cache.IncludeSiteElevation      = false;
            cache.UseCoarseTessellation     = true;

            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, cache);

            String use2DRoomBoundary       = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool?  use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");

            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                 cache.ExportAs2x2 ||
                 (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool?exportAdvancedSweptSolids = GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");

            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;

            // Set GUIDOptions here.
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool?allowGUIDParameterOverride = GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                {
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;
                }

                bool?storeIFCGUID = GetNamedBooleanOption(options, "StoreIFCGUID");
                if (storeIFCGUID != null)
                {
                    cache.GUIDOptions.StoreIFCGUID = storeIFCGUID.Value;
                }
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool?useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool?useVisibleRevitNameAsEntityName = GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;

            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                ElementId elementId = ParseElementId(singleElementValue);

                List <ElementId> ids = new List <ElementId>();
                ids.Add(elementId);
                cache.ElementsForExport = ids;
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                IList <ElementId> ids = ParseElementIds(elementsToExportValue);
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List <ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = GetNamedBooleanOption(options, "ExportBoundingBox");

            bool?exportRoomsInView = GetNamedBooleanOption(options, "ExportRoomsInView");

            cache.ExportRoomsInView = exportRoomsInView != null ? exportRoomsInView.Value : false;

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = GetNamedStringOption(options, "AlternateUIVersion");

            // Include IFCSITE elevation in the site local placement origin
            bool?includeIfcSiteElevation = GetNamedBooleanOption(options, "IncludeSiteElevation");

            cache.IncludeSiteElevation = includeIfcSiteElevation != null ? includeIfcSiteElevation.Value : false;

            // Use coarse tessellation for floors, railings, ramps, spaces and stairs.
            bool?useCoarseTessellation = GetNamedBooleanOption(options, "UseCoarseTessellation");

            cache.UseCoarseTessellation = useCoarseTessellation != null ? useCoarseTessellation.Value : true;

            // Tessellation level of detail as set by the UI
            double?tessellationLOD = GetNamedDoubleOption(options, "TessellationLevelOfDetail");

            if (tessellationLOD.HasValue)
            {
                cache.TessellationLevelOfDetail = tessellationLOD.Value;
            }
            else
            {
                cache.TessellationLevelOfDetail = cache.UseCoarseTessellation ? 0.25 : 1.0;
            }

            /// Allow exporting a mix of extrusions and BReps as a solid model, if possible.
            bool?canExportSolidModelRep = GetNamedBooleanOption(options, "ExportSolidModelRep");

            cache.CanExportSolidModelRep = canExportSolidModelRep != null ? canExportSolidModelRep.Value : false;

            // Set the phase we are exporting
            cache.ActivePhaseId = ElementId.InvalidElementId;

            String activePhaseElementValue;

            if (options.TryGetValue("ActivePhase", out activePhaseElementValue))
            {
                cache.ActivePhaseId = ParseElementId(activePhaseElementValue);
            }

            if ((cache.ActivePhaseId == ElementId.InvalidElementId) && (cache.FilterViewForExport != null))
            {
                Parameter currPhase = cache.FilterViewForExport.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                {
                    cache.ActivePhaseId = currPhase.AsElementId();
                }
            }

            if (cache.ActivePhaseId == ElementId.InvalidElementId)
            {
                PhaseArray phaseArray = document.Phases;
                Phase      lastPhase  = phaseArray.get_Item(phaseArray.Size - 1);
                cache.ActivePhaseId      = lastPhase.Id;
                cache.ActivePhaseElement = lastPhase;
            }
            else
            {
                cache.ActivePhaseElement = document.GetElement(cache.ActivePhaseId) as Phase;
            }

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            cache.SelectedConfigName = GetNamedStringOption(options, "ConfigName");

            bool?bExportLinks = GetNamedBooleanOption(options, "ExportingLinks");

            cache.ExportingLink = (bExportLinks.HasValue && bExportLinks.Value == true);

            if (cache.ExportingLink)
            {
                int?numInstances = GetNamedIntOption(options, "NumberOfExportedLinkInstances");
                for (int ii = 0; ii < numInstances; ii++)
                {
                    string optionName             = (ii == 0) ? "ExportLinkInstanceTransform" : "ExportLinkInstanceTransform" + (ii + 1).ToString();
                    String aLinkInstanceTransform = GetNamedStringOption(options, optionName);

                    Transform currTransform = null;
                    if (!String.IsNullOrEmpty(aLinkInstanceTransform))
                    {
                        //reconstruct transform
                        Transform tr = ParseTransform(aLinkInstanceTransform);
                        //set to cache
                        if (tr != null)
                        {
                            currTransform = tr;
                        }
                    }

                    string fileName = null;

                    if (ii > 0)
                    {
                        optionName = "ExportLinkInstanceFileName" + (ii + 1).ToString();
                        fileName   = GetNamedStringOption(options, optionName);
                    }

                    if (currTransform == null)
                    {
                        cache.m_LinkInstanceInfos.Add(new Tuple <string, Transform>(fileName, Transform.Identity));
                    }
                    else
                    {
                        cache.m_LinkInstanceInfos.Add(new Tuple <string, Transform>(fileName, currTransform));
                    }
                }
            }

            return(cache);
        }
コード例 #9
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document document, Autodesk.Revit.DB.View filterView)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();
            cache.FileVersion = exporterIFC.FileVersion;
            cache.FileName = exporterIFC.FileName;
            cache.ExportBaseQuantities = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected. 
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels = false;
            cache.ExportAnnotationsOverride = null;

            // There is a bug in the native code that doesn't allow us to cast the filterView to any sub-type of View.  Work around this by re-getting the element pointer.
            if (filterView != null)
                cache.FilterViewForExport = filterView.Document.GetElement(filterView.Id) as View;
            else
                cache.FilterViewForExport = null;

            cache.ExportBoundingBoxOverride = null;
            cache.IncludeSiteElevation = false;

            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, cache);

            String use2DRoomBoundary = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool? use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");
            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                cache.ExportAs2x2 ||
                (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool? exportAdvancedSweptSolids = GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");
            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;

            // Set GUIDOptions here.
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool? allowGUIDParameterOverride = GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;

                bool? storeIFCGUID = GetNamedBooleanOption(options, "StoreIFCGUID");
                if (storeIFCGUID != null)
                    cache.GUIDOptions.StoreIFCGUID = storeIFCGUID.Value;
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool? useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool? useVisibleRevitNameAsEntityName = GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;
            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                ElementId elementId = ParseElementId(singleElementValue);

                List<ElementId> ids = new List<ElementId>();
                ids.Add(elementId);
                cache.ElementsForExport = ids;
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                IList<ElementId> ids = ParseElementIds(elementsToExportValue);
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List<ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = GetNamedBooleanOption(options, "ExportBoundingBox");

            bool? exportRoomsInView = GetNamedBooleanOption(options, "ExportRoomsInView");
            cache.ExportRoomsInView = exportRoomsInView != null ? exportRoomsInView.Value : false;

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = GetNamedStringOption(options, "AlternateUIVersion");

            // Include IFCSITE elevation in the site local placement origin
            bool? includeIfcSiteElevation = GetNamedBooleanOption(options, "IncludeSiteElevation");
            cache.IncludeSiteElevation = includeIfcSiteElevation != null ? includeIfcSiteElevation.Value : false;

            // We have two ways to get information about level of detail:
            // 1. The old Boolean "UseCoarseTessellation".
            // 2. The new double "TessellationLevelOfDetail".
            // We will combine these both into a LevelOfDetail integer that can be used by different elements differently.
            // The scale is from 1 (Extra Low) to 4 (High), where :
            // UseCoarseTessellation = true -> 1, UseCoarseTessellation = false -> 4
            // TessellationLevelOfDetail * 4 = LevelOfDetail
            // TessellationLevelOfDetail takes precedence over UseCoarseTessellation.

            cache.LevelOfDetail = 2;   // Default: Low

            bool? useCoarseTessellation = GetNamedBooleanOption(options, "UseCoarseTessellation");
            if (useCoarseTessellation.HasValue)
                cache.LevelOfDetail = useCoarseTessellation.Value ? 1 : 4;

            double? tessellationLOD = GetNamedDoubleOption(options, "TessellationLevelOfDetail");
            if (tessellationLOD.HasValue)
            {
                cache.LevelOfDetail = (int)(tessellationLOD.Value * 4.0 + 0.5);
                // Ensure LOD is between 1 to 4, inclusive.
                cache.LevelOfDetail = Math.Min(Math.Max(cache.LevelOfDetail, 1), 4);
            }

            /// Allow exporting a mix of extrusions and BReps as a solid model, if possible.
            bool? canExportSolidModelRep = GetNamedBooleanOption(options, "ExportSolidModelRep");
            cache.CanExportSolidModelRep = canExportSolidModelRep != null ? canExportSolidModelRep.Value : false;

            // Set the phase we are exporting
            cache.ActivePhaseId = ElementId.InvalidElementId;

            String activePhaseElementValue;
            if (options.TryGetValue("ActivePhase", out activePhaseElementValue))
                cache.ActivePhaseId = ParseElementId(activePhaseElementValue);

            if ((cache.ActivePhaseId == ElementId.InvalidElementId) && (cache.FilterViewForExport != null))
            {
                Parameter currPhase = cache.FilterViewForExport.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                    cache.ActivePhaseId = currPhase.AsElementId();
            }

            if (cache.ActivePhaseId == ElementId.InvalidElementId)
            {
                PhaseArray phaseArray = document.Phases;
                Phase lastPhase = phaseArray.get_Item(phaseArray.Size - 1);
                cache.ActivePhaseId = lastPhase.Id;
                cache.ActivePhaseElement = lastPhase;
            }
            else
            {
                cache.ActivePhaseElement = document.GetElement(cache.ActivePhaseId) as Phase;
            }

            bool? useActiveViewGeometry = GetNamedBooleanOption(options, "UseActiveViewGeometry");
            cache.UseActiveViewGeometry = useActiveViewGeometry.HasValue ? useActiveViewGeometry.Value : false;

            if (cache.UseActiveViewGeometry)
            {
                int? viewId = GetNamedIntOption(options, "ActiveViewId");
                int activeViewId = viewId.HasValue ? viewId.Value : -1;
                View activeView = null;
                try
                {
                    activeView = document.GetElement(new ElementId(activeViewId)) as View;
                }
                catch
                {
                }
                cache.ActiveView = activeView;
            }

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            cache.SelectedConfigName = GetNamedStringOption(options, "ConfigName");

            cache.SelectedParametermappingTableName = GetNamedStringOption(options, "ExportUserDefinedParameterMappingFileName");

            bool? bExportLinks = GetNamedBooleanOption(options, "ExportingLinks");
            cache.ExportingLink = (bExportLinks.HasValue && bExportLinks.Value == true);

            if (cache.ExportingLink)
            {
                int? numInstances = GetNamedIntOption(options, "NumberOfExportedLinkInstances");
                for (int ii = 0; ii < numInstances; ii++)
                {
                    string optionName = (ii == 0) ? "ExportLinkInstanceTransform" : "ExportLinkInstanceTransform" + (ii + 1).ToString();
                    String aLinkInstanceTransform = GetNamedStringOption(options, optionName);

                    Transform currTransform = null;
                    if (!String.IsNullOrEmpty(aLinkInstanceTransform))
                    {
                        //reconstruct transform
                        Transform tr = ParseTransform(aLinkInstanceTransform);
                        //set to cache
                        if (tr != null)
                            currTransform = tr;
                    }

                    string fileName = null;

                    if (ii > 0)
                    {
                        optionName = "ExportLinkInstanceFileName" + (ii + 1).ToString();
                        fileName = GetNamedStringOption(options, optionName);
                    }

                    if (currTransform == null)
                        cache.m_LinkInstanceInfos.Add(new Tuple<string, Transform>(fileName, Transform.Identity));
                    else
                        cache.m_LinkInstanceInfos.Add(new Tuple<string, Transform>(fileName, currTransform));
                }
            }

            return cache;
        }
コード例 #10
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();
            cache.FileVersion = exporterIFC.FileVersion;
            cache.FileName = exporterIFC.FileName;
            cache.ExportBaseQuantities = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected. 
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels = false;
            cache.ExportAnnotationsOverride = null;
            cache.FilterViewForExport = filterView;
            cache.ExportSurfaceStylesOverride = null;
            cache.ExportBoundingBoxOverride = null;
            
            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, filterView, cache);

            String use2DRoomBoundary = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool? use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");
            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                cache.ExportAs2x2 ||
                (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

                bool? exportAdvancedSweptSolids = GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");
            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;
            
            // Set GUIDOptions here.
            cache.GUIDOptions = new GUIDOptions();
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool? allowGUIDParameterOverride = GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool? useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool? useVisibleRevitNameAsEntityName = GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;
            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                int elementIdAsInt;
                if (Int32.TryParse(singleElementValue, out elementIdAsInt))
                {
                    List<ElementId> ids = new List<ElementId>();
                    ids.Add(new ElementId(elementIdAsInt));
                    cache.ElementsForExport = ids;
                }
                else
                {
                    // Error - the option supplied could not be mapped to int.
                    // TODO: consider logging this error later and handling results better.
                    throw new Exception("Option 'SingleElement' did not map to a usable element id");
                }
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                String[] elements = elementsToExportValue.Split(';');
                List<ElementId> ids = new List<ElementId>();
                foreach (String element in elements)
                {
                    int elementIdAsInt;
                    if (Int32.TryParse(element, out elementIdAsInt))
                    {
                        ids.Add(new ElementId(elementIdAsInt));
                    }
                    else
                    {
                        // Error - the option supplied could not be mapped to int.
                        // TODO: consider logging this error later and handling results better.
                        throw new Exception("Option 'ElementsForExport' substring " + element + " did not map to a usable element id");
                    }
                }
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List<ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportSurfaceStyles" override
            cache.ExportSurfaceStylesOverride = GetNamedBooleanOption(options, "ExportSurfaceStyles");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = GetNamedBooleanOption(options, "ExportBoundingBox");

            // Whether or not to export GSA Gross Design Area.
            cache.ExportGSAGrossDesignArea = GetNamedBooleanOption(options, "ExportGSAGrossDesignArea");

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = GetNamedStringOption(options, "AlternateUIVersion");

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            cache.SelectedConfigName = GetNamedStringOption(options, "ConfigName");

            return cache;
        }
コード例 #11
0
        /// <summary>
        /// Creates a new property set options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        /// <remarks>Please initialize this after all other code, as it relies on a consistent cache otherwise.</remarks>
        public static PropertySetOptions Create(ExporterIFC exporterIFC, ExportOptionsCache cache)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            PropertySetOptions propertySetOptions = new PropertySetOptions();

            propertySetOptions.m_ExportInternalRevit = (cache.FileVersion != IFCVersion.IFC2x3CV2);

            // "Revit property sets" override
            propertySetOptions.ExportInternalRevitOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportIFCCommonPropertySets" override
            propertySetOptions.ExportIFCCommonOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportIFCCommonPropertySets");

            // "ExportSchedulesAsPsets" override
            propertySetOptions.ExportSchedulesAsPsetsOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportSchedulesAsPsets");
            
            // "ExportUserDefinedPsets" override
            propertySetOptions.ExportUserDefinedPsetsOverride = ExportOptionsCache.GetNamedBooleanOption(options, "ExportUserDefinedPsets");

            // "ExportUserDefinedPsetsFileName" override
            propertySetOptions.ExportUserDefinedPsetsFileName = ExportOptionsCache.GetNamedStringOption(options, "ExportUserDefinedPsetsFileName");
           
            return propertySetOptions;
        }
コード例 #12
0
ファイル: ExportOptionsCache.cs プロジェクト: whztt07/BIM-IFC
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView)
        {
            IDictionary<String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();
            cache.FileVersion = exporterIFC.FileVersion;
            cache.FileName = exporterIFC.FileName;
            cache.ExportBaseQuantities = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected. 
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels = false;
            cache.ExportAnnotationsOverride = null;
            cache.ExportInternalRevitPropertySetsOverride = null;
            cache.FilterViewForExport = filterView;

            String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
            cache.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

            String use2DRoomBoundary = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool? use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");
            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") || 
                cache.ExportAs2x2 || 
                (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool? useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
            cache.UseFamilyAndTypeNameForReference = (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;
            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                int elementIdAsInt;
                if (Int32.TryParse(singleElementValue, out elementIdAsInt))
                {
                    List<ElementId> ids = new List<ElementId>();
                    ids.Add(new ElementId(elementIdAsInt));
                    cache.ElementsForExport = ids;
                }
                else
                {
                    // Error - the option supplied could not be mapped to int.
                    // TODO: consider logging this error later and handling results better.
                    throw new Exception("Option 'SingleElement' did not map to a usable element id");
                }
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                String[] elements = elementsToExportValue.Split(';');
                List<ElementId> ids = new List<ElementId>();
                foreach (String element in elements)
                {
                    int elementIdAsInt;
                    if (Int32.TryParse(element, out elementIdAsInt))
                    {
                        ids.Add(new ElementId(elementIdAsInt));
                    }
                    else
                    {
                        // Error - the option supplied could not be mapped to int.
                        // TODO: consider logging this error later and handling results better.
                        throw new Exception("Option 'ElementsForExport' substring " + element + " did not map to a usable element id");
                    }
                }
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List<ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "Revit property sets" override
            cache.ExportInternalRevitPropertySetsOverride = GetNamedBooleanOption(options, "ExportInternalRevitPropertySets");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            return cache;
        }
コード例 #13
0
        /// <summary>
        /// Creates a new export options cache from the data in the ExporterIFC passed from Revit.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC handle passed during export.</param>
        /// <returns>The new cache.</returns>
        public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document document, Autodesk.Revit.DB.View filterView)
        {
            IDictionary <String, String> options = exporterIFC.GetOptions();

            ExportOptionsCache cache = new ExportOptionsCache();

            cache.FileVersion            = exporterIFC.FileVersion;
            cache.FileName               = exporterIFC.FileName;
            cache.ExportBaseQuantities   = exporterIFC.ExportBaseQuantities;
            cache.WallAndColumnSplitting = exporterIFC.WallAndColumnSplitting;
            cache.SpaceBoundaryLevel     = exporterIFC.SpaceBoundaryLevel;
            // Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected.
            cache.ExportParts = filterView != null && filterView.PartsVisibility == PartsVisibility.ShowPartsOnly;
            cache.ExportPartsAsBuildingElementsOverride = null;
            cache.ExportAllLevels           = false;
            cache.ExportAnnotationsOverride = null;
            cache.FilterViewForExport       = filterView;
            cache.ExportBoundingBoxOverride = null;
            cache.IncludeSiteElevation      = false;
            cache.UseCoarseTessellation     = true;

            cache.PropertySetOptions = PropertySetOptions.Create(exporterIFC, cache);

            String use2DRoomBoundary       = Environment.GetEnvironmentVariable("Use2DRoomBoundaryForRoomVolumeCalculationOnIFCExport");
            bool?  use2DRoomBoundaryOption = GetNamedBooleanOption(options, "Use2DRoomBoundaryForVolume");

            cache.Use2DRoomBoundaryForRoomVolumeCreation =
                ((use2DRoomBoundary != null && use2DRoomBoundary == "1") ||
                 cache.ExportAs2x2 ||
                 (use2DRoomBoundaryOption != null && use2DRoomBoundaryOption.GetValueOrDefault()));

            bool?exportAdvancedSweptSolids = GetNamedBooleanOption(options, "ExportAdvancedSweptSolids");

            cache.ExportAdvancedSweptSolids = (exportAdvancedSweptSolids.HasValue) ? exportAdvancedSweptSolids.Value : false;

            // Set GUIDOptions here.
            {
                // This option should be rarely used, and is only for consistency with old files.  As such, it is set by environment variable only.
                String use2009GUID = Environment.GetEnvironmentVariable("Assign2009GUIDToBuildingStoriesOnIFCExport");
                cache.GUIDOptions.Use2009BuildingStoreyGUIDs = (use2009GUID != null && use2009GUID == "1");

                bool?allowGUIDParameterOverride = GetNamedBooleanOption(options, "AllowGUIDParameterOverride");
                if (allowGUIDParameterOverride != null)
                {
                    cache.GUIDOptions.AllowGUIDParameterOverride = allowGUIDParameterOverride.Value;
                }

                bool?storeIFCGUID = GetNamedBooleanOption(options, "StoreIFCGUID");
                if (storeIFCGUID != null)
                {
                    cache.GUIDOptions.StoreIFCGUID = storeIFCGUID.Value;
                }
            }

            // Set NamingOptions here.
            cache.NamingOptions = new NamingOptions();
            {
                bool?useFamilyAndTypeNameForReference = GetNamedBooleanOption(options, "UseFamilyAndTypeNameForReference");
                cache.NamingOptions.UseFamilyAndTypeNameForReference =
                    (useFamilyAndTypeNameForReference != null) && useFamilyAndTypeNameForReference.GetValueOrDefault();

                bool?useVisibleRevitNameAsEntityName = GetNamedBooleanOption(options, "UseVisibleRevitNameAsEntityName");
                cache.NamingOptions.UseVisibleRevitNameAsEntityName =
                    (useVisibleRevitNameAsEntityName != null) && useVisibleRevitNameAsEntityName.GetValueOrDefault();
            }

            // "SingleElement" export option - useful for debugging - only one input element will be processed for export
            String singleElementValue;
            String elementsToExportValue;

            if (options.TryGetValue("SingleElement", out singleElementValue))
            {
                ElementId elementId = ParseElementId(singleElementValue);

                List <ElementId> ids = new List <ElementId>();
                ids.Add(elementId);
                cache.ElementsForExport = ids;
            }
            else if (options.TryGetValue("ElementsForExport", out elementsToExportValue))
            {
                IList <ElementId> ids = ParseElementIds(elementsToExportValue);
                cache.ElementsForExport = ids;
            }
            else
            {
                cache.ElementsForExport = new List <ElementId>();
            }

            // "ExportAnnotations" override
            cache.ExportAnnotationsOverride = GetNamedBooleanOption(options, "ExportAnnotations");

            // "ExportSeparateParts" override
            cache.ExportPartsAsBuildingElementsOverride = GetNamedBooleanOption(options, "ExportPartsAsBuildingElements");

            // "ExportBoundingBox" override
            cache.ExportBoundingBoxOverride = GetNamedBooleanOption(options, "ExportBoundingBox");

            // Using the alternate UI or not.
            cache.AlternateUIVersionOverride = GetNamedStringOption(options, "AlternateUIVersion");

            // Include IFCSITE elevation in the site local placement origin
            bool?includeIfcSiteElevation = GetNamedBooleanOption(options, "IncludeSiteElevation");

            cache.IncludeSiteElevation = includeIfcSiteElevation != null ? includeIfcSiteElevation.Value : false;

            // Use coarse tessellation for floors, railings, ramps, spaces and stairs.
            bool?useCoarseTessellation = GetNamedBooleanOption(options, "UseCoarseTessellation");

            cache.UseCoarseTessellation = useCoarseTessellation != null ? useCoarseTessellation.Value : true;

            /// Allow exporting a mix of extrusions and BReps as a solid model, if possible.
            bool?canExportSolidModelRep = GetNamedBooleanOption(options, "ExportSolidModelRep");

            cache.CanExportSolidModelRep = canExportSolidModelRep != null ? canExportSolidModelRep.Value : false;

            // Set the phase we are exporting
            cache.ActivePhase = ElementId.InvalidElementId;

            String activePhaseElementValue;

            if (options.TryGetValue("ActivePhase", out activePhaseElementValue))
            {
                cache.ActivePhase = ParseElementId(activePhaseElementValue);
            }

            if ((cache.ActivePhase == ElementId.InvalidElementId) && (cache.FilterViewForExport != null))
            {
                Parameter currPhase = cache.FilterViewForExport.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                {
                    cache.ActivePhase = currPhase.AsElementId();
                }
            }

            if (cache.ActivePhase == ElementId.InvalidElementId)
            {
                PhaseArray phaseArray = document.Phases;
                Phase      lastPhase  = phaseArray.get_Item(phaseArray.Size - 1);
                cache.ActivePhase = lastPhase.Id;
            }

            // "FileType" - note - setting is not respected yet
            ParseFileType(options, cache);

            cache.SelectedConfigName = GetNamedStringOption(options, "ConfigName");

            return(cache);
        }