Пример #1
0
        /// <summary>
        /// Shows the IFC export setup window when clicking the buttonEditSetup.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonEditSetup_Click(object sender, RoutedEventArgs args)
        {
            IFCExportConfiguration     selectedConfig    = GetSelectedConfiguration();
            IFCExportConfigurationsMap configurationsMap = new IFCExportConfigurationsMap(m_configMap);
            IFCExporterUIWindow        editorWindow      = new IFCExporterUIWindow(configurationsMap, selectedConfig.Name);

            // the SelectionChanged event will be temporary disabled when the Modify Config Window is active
            //   (it is particularly useful for COBie v2.4 setup to avoid the function is called repeatedly)
            currentSelectedSetup.SelectionChanged -= currentSelectedSetup_SelectionChanged;

            editorWindow.Owner = this;
            bool?ret = editorWindow.ShowDialog();

            if (ret.HasValue)
            {
                m_EditConfigVisited = ret.Value;
            }

            if (editorWindow.DialogResult.HasValue && editorWindow.DialogResult.Value)
            {
                // Check here for changes in configurations. If changed, the changes will be saved into the storage
                configurationsMap.UpdateSavedConfigurations(m_configMap);
                currentSelectedSetup.Items.Clear();
                m_configMap = configurationsMap;
                string selectedConfigName = editorWindow.GetSelectedConfigurationName();

                UpdateCurrentSelectedSetupCombo(selectedConfigName);

                updateFileName();
            }

            // The SelectionChanged event will be activated again after the Modify Config Window is closed
            currentSelectedSetup.SelectionChanged += currentSelectedSetup_SelectionChanged;
        }
        private void UpdatePhaseAttributes(IFCExportConfiguration configuration)
        {
            if (configuration.VisibleElementsOfCurrentView)
            {
                UIDocument uiDoc     = new UIDocument(IFCCommandOverrideApplication.TheDocument);
                Parameter  currPhase = uiDoc.ActiveView.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                {
                    configuration.ActivePhaseId = currPhase.AsElementId();
                }
                else
                {
                    configuration.ActivePhaseId = ElementId.InvalidElementId;
                }
            }

            if (!IFCPhaseAttributes.Validate(configuration.ActivePhaseId))
            {
                configuration.ActivePhaseId = ElementId.InvalidElementId;
            }

            foreach (IFCPhaseAttributes attribute in comboboxActivePhase.Items.Cast <IFCPhaseAttributes>())
            {
                if (configuration.ActivePhaseId == attribute.PhaseId)
                {
                    comboboxActivePhase.SelectedItem = attribute;
                    break;
                }
            }

            comboboxActivePhase.IsEnabled = !configuration.VisibleElementsOfCurrentView;
        }
        private void comboBoxLOD_SelectionChanged(object sender, RoutedEventArgs e)
        {
            string selectedItem = (string)comboBoxLOD.SelectedItem;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                double levelOfDetail = 0;
                if (string.Compare(selectedItem, Properties.Resources.DetailLevelExtraLow) == 0)
                {
                    levelOfDetail = 0.25;
                }
                else if (string.Compare(selectedItem, Properties.Resources.DetailLevelLow) == 0)
                {
                    levelOfDetail = 0.5;
                }
                else if (string.Compare(selectedItem, Properties.Resources.DetailLevelMedium) == 0)
                {
                    levelOfDetail = 0.75;
                }
                else
                {
                    // detail level is high
                    levelOfDetail = 1;
                }
                configuration.TessellationLevelOfDetail = levelOfDetail;
            }
        }
Пример #4
0
        /// <summary>
        /// Shows the IFC export setup window when clicking the buttonEditSetup.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonEditSetup_Click(object sender, RoutedEventArgs args)
        {
            IFCExportConfiguration     selectedConfig    = GetSelectedConfiguration();
            IFCExportConfigurationsMap configurationsMap = new IFCExportConfigurationsMap(m_configMap);
            IFCExporterUIWindow        editorWindow      = new IFCExporterUIWindow(configurationsMap, selectedConfig.Name);

            // the SelectionChanged event will be temporary disabled when the Modify Config Window is active
            //   (it is particularly useful for COBie v2.4 setup to avoid the function is called repeatedly)
            currentSelectedSetup.SelectionChanged -= currentSelectedSetup_SelectionChanged;

            editorWindow.ShowDialog();
            if (editorWindow.DialogResult.HasValue && editorWindow.DialogResult.Value)
            {
                IFCCommandOverrideApplication.PotentiallyUpdatedConfigurations = true;
                currentSelectedSetup.Items.Clear();
                m_configMap = configurationsMap;
                String selectedConfigName = editorWindow.GetSelectedConfigurationName();

                UpdateCurrentSelectedSetupCombo(selectedConfigName);

                updateFileName();
            }

            // The SelectionChanged event will be activated again after the Modify Config Window is closed
            currentSelectedSetup.SelectionChanged += currentSelectedSetup_SelectionChanged;
        }
Пример #5
0
        /// <summary>
        /// Gets the file filters for save dialog.
        /// </summary>
        /// <returns>The file filter.</returns>
        public String GetFileFilter()
        {
            IFCExportConfiguration  selectedConfig = GetSelectedConfiguration();
            IFCFileFormatAttributes selectedItem   = new IFCFileFormatAttributes(selectedConfig.IFCFileType);

            return(selectedItem.GetFileFilter());
        }
Пример #6
0
        /// <summary>
        /// Updates the description when current configuration change.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void currentSelectedSetup_SelectionChanged(object sender, SelectionChangedEventArgs args)
        {
            IFCExportConfiguration selectedConfig = GetSelectedConfiguration();

            if (selectedConfig != null)
            {
                if (!IFCPhaseAttributes.Validate(selectedConfig.ActivePhaseId))
                {
                    selectedConfig.ActivePhaseId = ElementId.InvalidElementId;
                }

                // Display the IFC Version
                textBoxSetupDescription.Text = selectedConfig.FileVersionDescription;

                IFCExportConfiguration prevConfig = null;
                if (args.RemovedItems.Count > 0)
                {
                    prevConfig = m_configMap[args.RemovedItems[0].ToString()];
                }
                //if (GetSelectedConfiguration().IFCVersion == IFCVersion.IFC2x3FM && (prevConfig == null || prevConfig.IFCVersion != IFCVersion.IFC2x3FM))
                //{
                //// For COBie, we will always pop up the configuration window to make sure all items are initialized and user update them if necessary
                //buttonEditSetup_Click(sender, args);
                //}
            }
        }
Пример #7
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.</param>
        /// <param name="internalSets">The ExportInternalRevitPropertySets.</param>
        /// <param name="PlanElems2D">The Export2DElements.</param>
        /// <returns>The builtIn configuration.</returns>
        public static IFCExportConfiguration CreateBuiltInConfiguration(string name,
                                                                        IFCVersion ifcVersion,
                                                                        int spaceBoundaries,
                                                                        bool exportBaseQuantities,
                                                                        bool splitWalls,
                                                                        bool internalSets,
                                                                        bool PlanElems2D)
        {
            IFCExportConfiguration configuration = new IFCExportConfiguration();

            configuration.Name                             = name;
            configuration.IFCVersion                       = ifcVersion;
            configuration.IFCFileType                      = IFCFileFormat.Ifc;
            configuration.SpaceBoundaries                  = spaceBoundaries;
            configuration.ExportBaseQuantities             = exportBaseQuantities;
            configuration.SplitWallsAndColumns             = splitWalls;
            configuration.ExportInternalRevitPropertySets  = internalSets;
            configuration.Export2DElements                 = PlanElems2D;
            configuration.VisibleElementsOfCurrentView     = false;
            configuration.Use2DRoomBoundaryForVolume       = false;
            configuration.UseFamilyAndTypeNameForReference = false;
            configuration.ExportPartsAsBuildingElements    = false;
            configuration.m_isBuiltIn                      = true;
            configuration.m_isInSession                    = false;
            return(configuration);
        }
 /// <summary>
 /// Constructs a copy configuration by providing name and defined configuration.
 /// </summary>
 /// <param name="name">The name of copy configuration.</param>
 /// <param name="other">The defined configuration to copy.</param>
 private IFCExportConfiguration(String name, IFCExportConfiguration other)
 {
     this.Name                             = name;
     this.IFCVersion                       = other.IFCVersion;
     this.IFCFileType                      = other.IFCFileType;
     this.SpaceBoundaries                  = other.SpaceBoundaries;
     this.ExportBaseQuantities             = other.ExportBaseQuantities;
     this.SplitWallsAndColumns             = other.SplitWallsAndColumns;
     this.ExportInternalRevitPropertySets  = other.ExportInternalRevitPropertySets;
     this.ExportIFCCommonPropertySets      = other.ExportIFCCommonPropertySets;
     this.Export2DElements                 = other.Export2DElements;
     this.VisibleElementsOfCurrentView     = other.VisibleElementsOfCurrentView;
     this.Use2DRoomBoundaryForVolume       = other.Use2DRoomBoundaryForVolume;
     this.UseFamilyAndTypeNameForReference = other.UseFamilyAndTypeNameForReference;
     this.ExportPartsAsBuildingElements    = other.ExportPartsAsBuildingElements;
     this.ExportBoundingBox                = other.ExportBoundingBox;
     this.ExportSolidModelRep              = other.ExportSolidModelRep;
     this.ExportSchedulesAsPsets           = other.ExportSchedulesAsPsets;
     this.ExportUserDefinedPsets           = other.ExportUserDefinedPsets;
     this.ExportUserDefinedPsetsFileName   = other.ExportUserDefinedPsetsFileName;
     this.ExportLinkedFiles                = other.ExportLinkedFiles;
     this.IncludeSiteElevation             = other.IncludeSiteElevation;
     this.UseCoarseTessellation            = other.UseCoarseTessellation;
     this.TessellationLevelOfDetail        = other.TessellationLevelOfDetail;
     this.ActivePhaseId                    = other.ActivePhaseId;
     this.ExportRoomsInView                = other.ExportRoomsInView;
     this.m_isBuiltIn                      = false;
     this.m_isInSession                    = false;
 }
Пример #9
0
        /// <summary>
        /// Duplicates this configuration by giving a new name.
        /// </summary>
        /// <param name="newName">The new name of the copy configuration.</param>
        /// <returns>The duplicated configuration.</returns>
        public IFCExportConfiguration Duplicate(String newName)
        {
            IFCExportConfiguration dup = Clone();

            dup.Name = newName;
            return(dup);
        }
Пример #10
0
        /// <summary>
        /// Adds the saved configuration from document to the map.
        /// </summary>
        /// <param name="document">The document storing the saved configuration.</param>
        public void AddSavedConfigurations(Document document)
        {
            if (m_schema == null)
            {
                m_schema = Schema.Lookup(s_schemaId);
            }

            if (m_schema != null)
            {
                foreach (DataStorage storedSetup in GetSavedConfigurations(document))
                {
                    Entity configEntity = storedSetup.GetEntity(m_schema);
                    IFCExportConfiguration configuration = IFCExportConfiguration.CreateDefaultConfiguration();
                    configuration.Name = configEntity.Get <String>(s_setupName);
                    //configuration.Description = configEntity.Get<String>(s_setupDescription);
                    configuration.IFCVersion                       = (IFCVersion)configEntity.Get <int>(s_setupVersion);
                    configuration.IFCFileType                      = (IFCFileFormat)configEntity.Get <int>(s_setupFileFormat);
                    configuration.SpaceBoundaries                  = configEntity.Get <int>(s_setupSpaceBoundaries);
                    configuration.ExportBaseQuantities             = configEntity.Get <bool>(s_setupQTO);
                    configuration.SplitWallsAndColumns             = configEntity.Get <bool>(s_splitWallsAndColumns);
                    configuration.Export2DElements                 = configEntity.Get <bool>(s_setupExport2D);
                    configuration.ExportInternalRevitPropertySets  = configEntity.Get <bool>(s_setupExportRevitProps);
                    configuration.Use2DRoomBoundaryForVolume       = configEntity.Get <bool>(s_setupUse2DForRoomVolume);
                    configuration.UseFamilyAndTypeNameForReference = configEntity.Get <bool>(s_setupUseFamilyAndTypeName);
                    configuration.ExportPartsAsBuildingElements    = configEntity.Get <bool>(s_setupExportPartsAsBuildingElements);

                    Add(configuration);
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Sets the dialog result when clicking the Cancel button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">Event arguments that contains the event data.</param>
        private void buttonCancel_Click(object sender, RoutedEventArgs args)
        {
            Result = IFCExportResult.Cancel;
            IFCExportConfiguration selectedConfig = GetSelectedConfiguration();

            LastSelectedConfig[selectedConfig.Name] = selectedConfig;
            Close();
        }
 /// <summary>
 /// Set the in-session configuration to cache.
 /// </summary>
 /// <param name="configuration">The the in-session configuration.</param>
 public static void SetInSession(IFCExportConfiguration configuration)
 {
     if (!configuration.IsInSession)
     {
         throw new ArgumentException("SetInSession requires an In-Session configuration", "configuration");
     }
     s_inSessionConfiguration = configuration;
 }
Пример #13
0
        public IFCExportConfiguration Clone()
        {
            IFCExportConfiguration theClone = (IFCExportConfiguration)this.MemberwiseClone();

            theClone.ProjectAddress         = this.ProjectAddress.Clone();
            theClone.ClassificationSettings = this.ClassificationSettings.Clone();
            return(theClone);
        }
 /// <summary>
 /// Gets the new duplicated setup name.
 /// </summary>
 /// <param name="configuration">The configuration to duplicate.</param>
 /// <returns>The new duplicated setup name.</returns>
 private String GetDuplicateSetupName(IFCExportConfiguration configuration)
 {
     if (configuration == null)
     {
         configuration = GetSelectedConfiguration();
     }
     return(GetFirstIncrementalName(configuration.Name));
 }
        /// <summary>
        /// Remove a configuration from the listbox and the map.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void buttonDeleteSetup_Click(object sender, RoutedEventArgs e)
        {
            IFCExportConfiguration configuration = (IFCExportConfiguration)listBoxConfigurations.SelectedItem;

            m_configurationsMap.Remove(configuration.Name);
            listBoxConfigurations.Items.Remove(configuration);
            listBoxConfigurations.SelectedIndex = 0;
        }
Пример #16
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(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)
        {
            IFCExportConfiguration configuration = new IFCExportConfiguration();

            configuration.Name                                      = name;
            configuration.IFCVersion                                = ifcVersion;
            configuration.IFCFileType                               = IFCFileFormat.Ifc;
            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;

            return(configuration);
        }
Пример #17
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);
        }
Пример #18
0
        /// <summary>
        /// Creates a new default configuration.
        /// </summary>
        /// <returns>The new default configuration.</returns>
        public static IFCExportConfiguration CreateDefaultConfiguration()
        {
            IFCExportConfiguration defConfig = new IFCExportConfiguration
            {
                Name = "<< Default >>"
            };

            return(defConfig);
        }
        /// <summary>
        /// Updates the configuration ExportSolidModelRep when the "Export Solid Models when Possible" option changed in the check box.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkboxExportSolidModelRep_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.ExportSolidModelRep = GetCheckbuttonChecked(checkBox);
            }
        }
        /// <summary>
        /// Updates the result after the Use2DRoomVolumes is picked.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkBoxUse2DRoomVolumes_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.Use2DRoomBoundaryForVolume = GetCheckbuttonChecked(checkBox);
            }
        }
        /// <summary>
        /// Updates the configuration StoreIFCGUID when the Store IFC GUID changed in the check box.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkboxStoreIFCGUID_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.StoreIFCGUID = GetCheckbuttonChecked(checkBox);
            }
        }
        /// <summary>
        /// Update checkbox for user-defined Pset option
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkboxExportUserDefinedPset_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.ExportUserDefinedPsets = GetCheckbuttonChecked(checkBox);
            }
        }
Пример #23
0
        /// <summary>
        /// Returns the name of selected configuration.
        /// </summary>
        /// <returns>The name of selected configuration.</returns>
        public String GetSelectedConfigurationName()
        {
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration == null)
            {
                return(null);
            }
            return(configuration.Name);
        }
        /// <summary>
        /// Updates the configuration SpaceBoundaries when the space boundary level changed in the combobox.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void comboboxSpaceBoundaries_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IFCSpaceBoundariesAttributes attributes    = (IFCSpaceBoundariesAttributes)comboboxSpaceBoundaries.SelectedItem;
            IFCExportConfiguration       configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.SpaceBoundaries = attributes.Level;
            }
        }
        /// <summary>
        /// Updates the configuration IncludeSiteElevation when the Export Bounding Box changed in the check box.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkboxIfcSiteElevation_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.IncludeSiteElevation = GetCheckbuttonChecked(checkBox);
            }
        }
        /// <summary>
        /// Updates the configuration ActivePhase when the active phase changed in the combobox.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void comboboxActivePhase_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IFCPhaseAttributes     attributes    = (IFCPhaseAttributes)comboboxActivePhase.SelectedItem;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.ActivePhaseId = attributes.PhaseId;
            }
        }
        /// <summary>
        /// Updates the configuration IFCFileType when FileType changed in the combobox.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void comboboxFileType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IFCFileFormatAttributes attributes    = (IFCFileFormatAttributes)comboboxFileType.SelectedItem;
            IFCExportConfiguration  configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.IFCFileType = attributes.FileType;
            }
        }
        /// <summary>
        /// Updates the configuration IFCVersion when IFCType changed in the combobox.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void comboboxIfcType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            IFCVersionAttributes   attributes    = (IFCVersionAttributes)comboboxIfcType.SelectedItem;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.IFCVersion = attributes.Version;
            }
        }
        /// <summary>
        /// Updates the result after the FamilyAndTypeName is picked.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkBoxFamilyAndTypeName_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.UseFamilyAndTypeNameForReference = GetCheckbuttonChecked(checkBox);
            }
        }
        /// <summary>
        /// Updates the configuration UseCoarseTessellation when the Use Coarse Tessellation changed in the check box.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Event arguments that contains the event data.</param>
        private void checkboxUseCoarseTessellation_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;
            IFCExportConfiguration configuration = GetSelectedConfiguration();

            if (configuration != null)
            {
                configuration.UseCoarseTessellation = GetCheckbuttonChecked(checkBox);
            }
        }
Пример #31
0
 /// <summary>
 /// Constructs a copy from a defined configuration.
 /// </summary>
 /// <param name="other">The configuration to copy.</param>
 private IFCExportConfiguration(IFCExportConfiguration other)
 {
     this.Name = other.Name;
     this.IFCVersion = other.IFCVersion;
     this.IFCFileType = other.IFCFileType;
     this.SpaceBoundaries = other.SpaceBoundaries;
     this.ExportBaseQuantities = other.ExportBaseQuantities;
     this.SplitWallsAndColumns = other.SplitWallsAndColumns;
     this.ExportInternalRevitPropertySets = other.ExportInternalRevitPropertySets;
     this.ExportIFCCommonPropertySets = other.ExportIFCCommonPropertySets;
     this.Export2DElements = other.Export2DElements;
     this.VisibleElementsOfCurrentView = other.VisibleElementsOfCurrentView;
     this.Use2DRoomBoundaryForVolume = other.Use2DRoomBoundaryForVolume;
     this.UseFamilyAndTypeNameForReference = other.UseFamilyAndTypeNameForReference;
     this.ExportPartsAsBuildingElements = other.ExportPartsAsBuildingElements;
     this.ExportSurfaceStyles = other.ExportSurfaceStyles;
     this.m_isBuiltIn = other.m_isBuiltIn;
     this.m_isInSession = other.m_isInSession;
 }
 /// <summary>
 /// Add a configuration to the map list to show in dialog.
 /// </summary>
 /// <param name="configuration">The configuration to add.</param>
 private void AddToConfigList(IFCExportConfiguration configuration)
 {
     m_configMap.Add(configuration);
 }
Пример #33
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(string name,
                            IFCVersion ifcVersion,
                            int spaceBoundaries,
                            bool exportBaseQuantities,
                            bool splitWalls,
                            bool internalSets,
                            bool schedulesAsPSets,
                            bool userDefinedPSets,
                            bool PlanElems2D,
                            bool exportBoundingBox,
                            bool exportLinkedFiles)
 {
     IFCExportConfiguration configuration = new IFCExportConfiguration();
     configuration.Name = name;
     configuration.IFCVersion = ifcVersion;
     configuration.IFCFileType = IFCFileFormat.Ifc;
     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.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.ExportLinkedFiles = exportLinkedFiles;
     configuration.IncludeSiteElevation = false;
     configuration.UseCoarseTessellation = true;
     configuration.StoreIFCGUID = false;
     configuration.m_isBuiltIn = true;
     configuration.m_isInSession = false;
     configuration.ActivePhaseId = ElementId.InvalidElementId;
     return configuration;
 }
Пример #34
0
 /// <summary>
 /// Constructs a copy configuration by providing name and defined configuration. 
 /// </summary>
 /// <param name="name">The name of copy configuration.</param>
 /// <param name="other">The defined configuration to copy.</param>
 private IFCExportConfiguration(String name, IFCExportConfiguration other)
 {
     this.Name = name;
     this.IFCVersion = other.IFCVersion;
     this.IFCFileType = other.IFCFileType;
     this.SpaceBoundaries = other.SpaceBoundaries;
     this.ExportBaseQuantities = other.ExportBaseQuantities;
     this.SplitWallsAndColumns = other.SplitWallsAndColumns;
     this.ExportInternalRevitPropertySets = other.ExportInternalRevitPropertySets;
     this.ExportIFCCommonPropertySets = other.ExportIFCCommonPropertySets;
     this.Export2DElements = other.Export2DElements;
     this.VisibleElementsOfCurrentView = other.VisibleElementsOfCurrentView;
     this.Use2DRoomBoundaryForVolume = other.Use2DRoomBoundaryForVolume;
     this.UseFamilyAndTypeNameForReference = other.UseFamilyAndTypeNameForReference;
     this.ExportPartsAsBuildingElements = other.ExportPartsAsBuildingElements;
     this.ExportBoundingBox = other.ExportBoundingBox;
     this.ExportSolidModelRep = other.ExportSolidModelRep;
     this.ExportSchedulesAsPsets = other.ExportSchedulesAsPsets;
     this.ExportUserDefinedPsets = other.ExportUserDefinedPsets;
     this.ExportUserDefinedPsetsFileName = other.ExportUserDefinedPsetsFileName;
     this.ExportLinkedFiles = other.ExportLinkedFiles;
     this.IncludeSiteElevation = other.IncludeSiteElevation;
     this.UseCoarseTessellation = other.UseCoarseTessellation;
     this.ActivePhaseId = other.ActivePhaseId;
     this.m_isBuiltIn = false;
     this.m_isInSession = false;
 }
Пример #35
0
 /// <summary>
 /// Gets the new duplicated setup name.
 /// </summary>
 /// <param name="configuration">The configuration to duplicate.</param>
 /// <returns>The new duplicated setup name.</returns>
 private String GetDuplicateSetupName(IFCExportConfiguration configuration)
 {
     if (configuration == null)
         configuration = GetSelectedConfiguration();
     return GetFirstIncrementalName(configuration.Name);
 }
Пример #36
0
        private void UpdatePhaseAttributes(IFCExportConfiguration configuration)
        {
            if (configuration.VisibleElementsOfCurrentView)
            {
                UIDocument uiDoc = new UIDocument(IFCCommandOverrideApplication.TheDocument);
                Parameter currPhase = uiDoc.ActiveView.get_Parameter(BuiltInParameter.VIEW_PHASE);
                if (currPhase != null)
                    configuration.ActivePhaseId = currPhase.AsElementId();
                else
                    configuration.ActivePhaseId = ElementId.InvalidElementId;
            }

            if (!IFCPhaseAttributes.Validate(configuration.ActivePhaseId))
                configuration.ActivePhaseId = ElementId.InvalidElementId;
            
            foreach (IFCPhaseAttributes attribute in comboboxActivePhase.Items.Cast<IFCPhaseAttributes>())
            {
                if (configuration.ActivePhaseId == attribute.PhaseId)
                {
                    comboboxActivePhase.SelectedItem = attribute;
                    break;
                }
            }

            comboboxActivePhase.IsEnabled = !configuration.VisibleElementsOfCurrentView;
        }
Пример #37
0
        /// <summary>
        /// Gets the in-session  configuration.
        /// </summary>
        /// <returns>The in-session  configuration.</returns>
        public static IFCExportConfiguration GetInSession()
        {
            if (s_inSessionConfiguration == null)
            {
                s_inSessionConfiguration = new IFCExportConfiguration();
                s_inSessionConfiguration.Name = Resources.InSessionConfiguration;
                s_inSessionConfiguration.m_isInSession = true;
            }

            return s_inSessionConfiguration;
        }
 /// <summary>
 /// Constructs a copy from a defined configuration.
 /// </summary>
 /// <param name="other">The configuration to copy.</param>
 private IFCExportConfiguration(IFCExportConfiguration other)
 {
     this.Name = other.Name;
     this.IFCVersion = other.IFCVersion;
     this.IFCFileType = other.IFCFileType;
     this.SpaceBoundaries = other.SpaceBoundaries;
     this.ExportBaseQuantities = other.ExportBaseQuantities;
     this.SplitWallsAndColumns = other.SplitWallsAndColumns;
     this.ExportInternalRevitPropertySets = other.ExportInternalRevitPropertySets;
     this.ExportIFCCommonPropertySets = other.ExportIFCCommonPropertySets;
     this.Export2DElements = other.Export2DElements;
     this.VisibleElementsOfCurrentView = other.VisibleElementsOfCurrentView;
     this.Use2DRoomBoundaryForVolume = other.Use2DRoomBoundaryForVolume;
     this.UseFamilyAndTypeNameForReference = other.UseFamilyAndTypeNameForReference;
     this.ExportPartsAsBuildingElements = other.ExportPartsAsBuildingElements;
     this.UseActiveViewGeometry = other.UseActiveViewGeometry;
     this.ExportSpecificSchedules = other.ExportSpecificSchedules;
     this.ExportBoundingBox = other.ExportBoundingBox;
     this.ExportSolidModelRep = other.ExportSolidModelRep;
     this.ExportSchedulesAsPsets = other.ExportSchedulesAsPsets;
     this.ExportUserDefinedPsets = other.ExportUserDefinedPsets;
     this.ExportUserDefinedPsetsFileName = other.ExportUserDefinedPsetsFileName;
     this.ExportLinkedFiles = other.ExportLinkedFiles;
     this.IncludeSiteElevation = other.IncludeSiteElevation;
     this.TessellationLevelOfDetail = other.TessellationLevelOfDetail;
     this.StoreIFCGUID = other.StoreIFCGUID;
     this.m_isBuiltIn = other.m_isBuiltIn;
     this.m_isInSession = other.m_isInSession;
     this.ActivePhaseId = other.ActivePhaseId;
     this.ExportRoomsInView = other.ExportRoomsInView;
 }
Пример #39
0
 /// <summary>
 /// Set the in-session configuration to cache.
 /// </summary>
 /// <param name="configuration">The the in-session configuration.</param>
 public static void SetInSession(IFCExportConfiguration configuration)
 {
     if (!configuration.IsInSession)
     {
         throw new ArgumentException("SetInSession requires an In-Session configuration", "configuration");
     }
     s_inSessionConfiguration = configuration;
 }
Пример #40
0
        /// <summary>
        /// Updates the active configuration options to the controls.
        /// </summary>
        /// <param name="configuration">The active configuration.</param>
        private void UpdateActiveConfigurationOptions(IFCExportConfiguration configuration)
        {
            foreach (IFCVersionAttributes attribute in comboboxIfcType.Items.Cast<IFCVersionAttributes>())
            {
                if (attribute.Version == configuration.IFCVersion)
                {
                    comboboxIfcType.SelectedItem = attribute;
                }
            }

            foreach (IFCFileFormatAttributes format in comboboxFileType.Items.Cast<IFCFileFormatAttributes>())
            {
                if (configuration.IFCFileType == format.FileType)
                    comboboxFileType.SelectedItem = format;
            }

            foreach (IFCSpaceBoundariesAttributes attribute in comboboxSpaceBoundaries.Items.Cast<IFCSpaceBoundariesAttributes>())
            {
                if (configuration.SpaceBoundaries == attribute.Level)
                    comboboxSpaceBoundaries.SelectedItem = attribute;
            }

            checkboxExportBaseQuantities.IsChecked = configuration.ExportBaseQuantities;
            checkboxSplitWalls.IsChecked = configuration.SplitWallsAndColumns;
            checkbox2dElements.IsChecked = configuration.Export2DElements;
            checkboxInternalPropertySets.IsChecked = configuration.ExportInternalRevitPropertySets;
            checkboxVisibleElementsCurrView.IsChecked = configuration.VisibleElementsOfCurrentView;
            checkBoxUse2DRoomVolumes.IsChecked = configuration.Use2DRoomBoundaryForVolume;
            checkBoxFamilyAndTypeName.IsChecked = configuration.UseFamilyAndTypeNameForReference;
            checkBoxExportPartsAsBuildingElements.IsChecked = configuration.ExportPartsAsBuildingElements;

            UIElement[] configurationElements = new UIElement[]{comboboxIfcType, 
                                                                comboboxFileType, 
                                                                comboboxSpaceBoundaries, 
                                                                checkboxExportBaseQuantities,
                                                                checkboxSplitWalls,
                                                                checkbox2dElements,
                                                                checkboxInternalPropertySets,
                                                                checkboxVisibleElementsCurrView,
                                                                checkBoxUse2DRoomVolumes,
                                                                checkBoxFamilyAndTypeName,
                                                                checkBoxExportPartsAsBuildingElements};
            foreach (UIElement element in configurationElements)
            {
                element.IsEnabled = !configuration.IsBuiltIn;
            }
        }
Пример #41
0
        /// <summary>
        /// Updates the active configuration options to the controls.
        /// </summary>
        /// <param name="configuration">The active configuration.</param>
        private void UpdateActiveConfigurationOptions(IFCExportConfiguration configuration)
        {
            foreach (IFCVersionAttributes attribute in comboboxIfcType.Items.Cast<IFCVersionAttributes>())
            {
                if (attribute.Version == configuration.IFCVersion)
                {
                    comboboxIfcType.SelectedItem = attribute;
                    break;
                }
            }

            foreach (IFCFileFormatAttributes format in comboboxFileType.Items.Cast<IFCFileFormatAttributes>())
            {
                if (configuration.IFCFileType == format.FileType)
                {
                    comboboxFileType.SelectedItem = format;
                    break;
                }
            }

            foreach (IFCSpaceBoundariesAttributes attribute in comboboxSpaceBoundaries.Items.Cast<IFCSpaceBoundariesAttributes>())
            {
                if (configuration.SpaceBoundaries == attribute.Level)
                {
                    comboboxSpaceBoundaries.SelectedItem = attribute;
                    break;
                }
            }

            UpdatePhaseAttributes(configuration);

            checkboxExportBaseQuantities.IsChecked = configuration.ExportBaseQuantities;
            checkboxSplitWalls.IsChecked = configuration.SplitWallsAndColumns;
            checkbox2dElements.IsChecked = configuration.Export2DElements;
            checkboxInternalPropertySets.IsChecked = configuration.ExportInternalRevitPropertySets;
            checkboxIFCCommonPropertySets.IsChecked = configuration.ExportIFCCommonPropertySets;
            checkboxVisibleElementsCurrView.IsChecked = configuration.VisibleElementsOfCurrentView;
            checkBoxUse2DRoomVolumes.IsChecked = configuration.Use2DRoomBoundaryForVolume;
            checkBoxFamilyAndTypeName.IsChecked = configuration.UseFamilyAndTypeNameForReference;
            checkBoxExportPartsAsBuildingElements.IsChecked = configuration.ExportPartsAsBuildingElements;
            checkboxExportBoundingBox.IsChecked = configuration.ExportBoundingBox;
            checkboxExportSolidModelRep.IsChecked = configuration.ExportSolidModelRep;
            checkboxExportSchedulesAsPsets.IsChecked = configuration.ExportSchedulesAsPsets;
            checkboxExportUserDefinedPset.IsChecked = configuration.ExportUserDefinedPsets;
            userDefinedPropertySetFileName.Text = configuration.ExportUserDefinedPsetsFileName;
            checkBoxExportLinkedFiles.IsChecked = configuration.ExportLinkedFiles;
            checkboxIncludeIfcSiteElevation.IsChecked = configuration.IncludeSiteElevation;
            checkboxUseCoarseTessellation.IsChecked = configuration.UseCoarseTessellation;
            checkboxStoreIFCGUID.IsChecked = configuration.StoreIFCGUID;

            UIElement[] configurationElements = new UIElement[]{comboboxIfcType, 
                                                                comboboxFileType, 
                                                                comboboxSpaceBoundaries, 
                                                                checkboxExportBaseQuantities,
                                                                checkboxSplitWalls,
                                                                checkbox2dElements,
                                                                checkboxInternalPropertySets,
                                                                checkboxIFCCommonPropertySets,
                                                                checkboxVisibleElementsCurrView,
                                                                checkBoxExportPartsAsBuildingElements,
                                                                checkBoxUse2DRoomVolumes,
                                                                checkBoxFamilyAndTypeName,
                                                                checkboxExportBoundingBox,
                                                                checkboxExportSolidModelRep,
                                                                checkBoxExportLinkedFiles,
                                                                checkboxIncludeIfcSiteElevation,
                                                                checkboxUseCoarseTessellation,
                                                                checkboxStoreIFCGUID,
                                                                checkboxExportSchedulesAsPsets,
                                                                comboboxActivePhase,
                                                                checkboxExportUserDefinedPset,
                                                                userDefinedPropertySetFileName,
                                                                buttonBrowse
                                                                };
            foreach (UIElement element in configurationElements)
            {
                element.IsEnabled = !configuration.IsBuiltIn;
            }
            comboboxActivePhase.IsEnabled = comboboxActivePhase.IsEnabled && !configuration.VisibleElementsOfCurrentView;
            userDefinedPropertySetFileName.IsEnabled = userDefinedPropertySetFileName.IsEnabled && configuration.ExportUserDefinedPsets;
            buttonBrowse.IsEnabled = buttonBrowse.IsEnabled && configuration.ExportUserDefinedPsets;
        }
Пример #42
0
 /// <summary>
 /// Adds a configuration to the map.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public void Add(IFCExportConfiguration configuration)
 {
     m_configurations.Add(configuration.Name, configuration);
 }
Пример #43
0
        /// <summary>
        /// Creates a new configuration, either a default or a copy configuration.
        /// </summary>
        /// <param name="configuration">The specific configuration, null to create a defult configuration.</param>
        /// <param name="name">The name of the new configuration.</param>
        /// <returns>The new configuration.</returns>
        private IFCExportConfiguration CreateNewEditableConfiguration(IFCExportConfiguration configuration, String name)
        {
            // create new configuration based on input, or default configuration.
            IFCExportConfiguration newConfiguration;
            if (configuration == null)
            {
                newConfiguration = IFCExportConfiguration.CreateDefaultConfiguration();
                newConfiguration.Name = name;
            }
            else
                newConfiguration = configuration.Duplicate(name);
            m_configurationsMap.Add(newConfiguration);

            // set new configuration as selected
            listBoxConfigurations.Items.Add(newConfiguration);
            listBoxConfigurations.SelectedItem = newConfiguration;

            return configuration;
        }
        /// <summary>
        /// Updates the active configuration options to the controls.
        /// </summary>
        /// <param name="configuration">The active configuration.</param>
        private void UpdateActiveConfigurationOptions(IFCExportConfiguration configuration)
        {
            foreach (IFCVersionAttributes attribute in comboboxIfcType.Items.Cast<IFCVersionAttributes>())
            {
                if (attribute.Version == configuration.IFCVersion)
                {
                    comboboxIfcType.SelectedItem = attribute;
                    break;
                }
            }

            foreach (IFCFileFormatAttributes format in comboboxFileType.Items.Cast<IFCFileFormatAttributes>())
            {
                if (configuration.IFCFileType == format.FileType)
                {
                    comboboxFileType.SelectedItem = format;
                    break;
                }
            }

            foreach (IFCSpaceBoundariesAttributes attribute in comboboxSpaceBoundaries.Items.Cast<IFCSpaceBoundariesAttributes>())
            {
                if (configuration.SpaceBoundaries == attribute.Level)
                {
                    comboboxSpaceBoundaries.SelectedItem = attribute;
                    break;
                }
            }

            UpdatePhaseAttributes(configuration);

            checkboxExportBaseQuantities.IsChecked = configuration.ExportBaseQuantities;
            checkboxSplitWalls.IsChecked = configuration.SplitWallsAndColumns;
            checkbox2dElements.IsChecked = configuration.Export2DElements;
            checkboxInternalPropertySets.IsChecked = configuration.ExportInternalRevitPropertySets;
            checkboxIFCCommonPropertySets.IsChecked = configuration.ExportIFCCommonPropertySets;
            checkboxVisibleElementsCurrView.IsChecked = configuration.VisibleElementsOfCurrentView;
            checkBoxUse2DRoomVolumes.IsChecked = configuration.Use2DRoomBoundaryForVolume;
            checkBoxFamilyAndTypeName.IsChecked = configuration.UseFamilyAndTypeNameForReference;
            checkBoxExportPartsAsBuildingElements.IsChecked = configuration.ExportPartsAsBuildingElements;
            checkboxExportBoundingBox.IsChecked = configuration.ExportBoundingBox;
            checkboxExportSolidModelRep.IsChecked = configuration.ExportSolidModelRep;
            checkboxExportSchedulesAsPsets.IsChecked = configuration.ExportSchedulesAsPsets;
            checkboxExportUserDefinedPset.IsChecked = configuration.ExportUserDefinedPsets;
            userDefinedPropertySetFileName.Text = configuration.ExportUserDefinedPsetsFileName;
            checkBoxExportLinkedFiles.IsChecked = configuration.ExportLinkedFiles;
            checkboxIncludeIfcSiteElevation.IsChecked = configuration.IncludeSiteElevation;
            checkboxUseCoarseTessellation.IsChecked = configuration.UseCoarseTessellation;
            sliderLODValue.Value = configuration.TessellationLevelOfDetail;
            checkboxStoreIFCGUID.IsChecked = configuration.StoreIFCGUID;
            checkBoxExportRoomsInView.IsChecked = configuration.ExportRoomsInView;

            UIElement[] configurationElements = new UIElement[]{comboboxIfcType, 
                                                                comboboxFileType, 
                                                                comboboxSpaceBoundaries, 
                                                                checkboxExportBaseQuantities,
                                                                checkboxSplitWalls,
                                                                checkbox2dElements,
                                                                checkboxInternalPropertySets,
                                                                checkboxIFCCommonPropertySets,
                                                                checkboxVisibleElementsCurrView,
                                                                checkBoxExportPartsAsBuildingElements,
                                                                checkBoxUse2DRoomVolumes,
                                                                checkBoxFamilyAndTypeName,
                                                                checkboxExportBoundingBox,
                                                                checkboxExportSolidModelRep,
                                                                checkBoxExportLinkedFiles,
                                                                checkboxIncludeIfcSiteElevation,
                                                                checkboxUseCoarseTessellation,
                                                                checkboxStoreIFCGUID,
                                                                checkboxExportSchedulesAsPsets,
                                                                checkBoxExportRoomsInView,
                                                                comboboxActivePhase,
                                                                checkboxExportUserDefinedPset,
                                                                userDefinedPropertySetFileName,
                                                                buttonBrowse
                                                                };
            foreach (UIElement element in configurationElements)
            {
                element.IsEnabled = !configuration.IsBuiltIn;
            }
            comboboxActivePhase.IsEnabled = comboboxActivePhase.IsEnabled && !configuration.VisibleElementsOfCurrentView;
            userDefinedPropertySetFileName.IsEnabled = userDefinedPropertySetFileName.IsEnabled && configuration.ExportUserDefinedPsets;
            buttonBrowse.IsEnabled = buttonBrowse.IsEnabled && configuration.ExportUserDefinedPsets;

            // ExportRoomsInView option will only be enabled if it is not currently disabled AND the "export elements visible in view" option is checked
            bool? cboVisibleElementInCurrentView = checkboxVisibleElementsCurrView.IsChecked;
            checkBoxExportRoomsInView.IsEnabled = checkBoxExportRoomsInView.IsEnabled && cboVisibleElementInCurrentView.HasValue ? cboVisibleElementInCurrentView.Value : false;

			// This is to enable the Tessellation related checkbox for Reference view only.
			// At the same time, it set the slider to be visible if the checkbox is unchecked
            if (string.Compare(configuration.Name, "IFC4 Reference View") == 0)
            {
                checkboxUseCoarseTessellation.IsEnabled = true;
                if (checkboxUseCoarseTessellation.IsChecked == true)
                {
                    DocPanel_tessellation.Visibility = System.Windows.Visibility.Hidden;
        }
                else
                {
                    DocPanel_tessellation.Visibility = System.Windows.Visibility.Visible;
                    sliderLODValue.IsEnabled = true;
					// 0.25 is the default value of Coarse tessellation
                    if (checkboxUseCoarseTessellation.IsChecked == true)
                        sliderLODValue.Value = 0.25;
                }
            }
            else
            {
                DocPanel_tessellation.Visibility = System.Windows.Visibility.Hidden;
            }
        }
Пример #45
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.</param>
 /// <param name="internalSets">The ExportInternalRevitPropertySets.</param>
 /// <param name="PlanElems2D">The Export2DElements.</param>
 /// <returns>The builtIn configuration.</returns>
 public static IFCExportConfiguration CreateBuiltInConfiguration(string name, 
                            IFCVersion ifcVersion, 
                            int spaceBoundaries,
                            bool exportBaseQuantities,
                            bool splitWalls,
                            bool internalSets,
                            bool PlanElems2D)
 {
     IFCExportConfiguration configuration = new IFCExportConfiguration();
     configuration.Name = name; 
     configuration.IFCVersion = ifcVersion; 
     configuration.IFCFileType = IFCFileFormat.Ifc; 
     configuration.SpaceBoundaries = spaceBoundaries;
     configuration.ExportBaseQuantities = exportBaseQuantities;                    
     configuration.SplitWallsAndColumns = splitWalls;
     configuration.ExportInternalRevitPropertySets = internalSets;
     configuration.Export2DElements = PlanElems2D;
     configuration.VisibleElementsOfCurrentView = false;   
     configuration.Use2DRoomBoundaryForVolume = false;
     configuration.UseFamilyAndTypeNameForReference = false;
     configuration.ExportPartsAsBuildingElements = false;
     configuration.m_isBuiltIn = true;
     configuration.m_isInSession = false; 
     return configuration;
 }
Пример #46
0
        /// <summary>
        /// Gets the in-session  configuration.
        /// </summary>
        /// <returns>The in-session  configuration.</returns>
        public static IFCExportConfiguration GetInSession()
        {
            if (s_inSessionConfiguration == null)
            {
                s_inSessionConfiguration = new IFCExportConfiguration();
                s_inSessionConfiguration.Name = Resources.InSessionConfiguration;
                s_inSessionConfiguration.ExportUserDefinedPsetsFileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\DefaultUserDefinedParameterSets.txt";
                s_inSessionConfiguration.m_isInSession = true;
            }

            return s_inSessionConfiguration;
        }