/// <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); //} } }
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; }
/// <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 IFCExportOptions with the settings in this configuration. /// </summary> /// <param name="options">The IFCExportOptions to update.</param> /// <param name="filterViewId">The id of the view that will be used to select which elements to export.</param> public void UpdateOptions(IFCExportOptions options, ElementId filterViewId) { options.FileVersion = IFCVersion; options.SpaceBoundaryLevel = SpaceBoundaries; options.ExportBaseQuantities = ExportBaseQuantities; options.WallAndColumnSplitting = SplitWallsAndColumns; options.FilterViewId = VisibleElementsOfCurrentView ? filterViewId : ElementId.InvalidElementId; options.AddOption("ExportInternalRevitPropertySets", ExportInternalRevitPropertySets.ToString()); options.AddOption("ExportIFCCommonPropertySets", ExportIFCCommonPropertySets.ToString()); options.AddOption("ExportAnnotations", Export2DElements.ToString()); options.AddOption("Use2DRoomBoundaryForVolume", Use2DRoomBoundaryForVolume.ToString()); options.AddOption("UseFamilyAndTypeNameForReference", UseFamilyAndTypeNameForReference.ToString()); options.AddOption("ExportVisibleElementsInView", VisibleElementsOfCurrentView.ToString()); options.AddOption("ExportPartsAsBuildingElements", ExportPartsAsBuildingElements.ToString()); options.AddOption("UseActiveViewGeometry", UseActiveViewGeometry.ToString()); options.AddOption("ExportSpecificSchedules", ExportSpecificSchedules.ToString()); options.AddOption("ExportBoundingBox", ExportBoundingBox.ToString()); options.AddOption("ExportSolidModelRep", ExportSolidModelRep.ToString()); options.AddOption("ExportSchedulesAsPsets", ExportSchedulesAsPsets.ToString()); options.AddOption("ExportUserDefinedPsets", ExportUserDefinedPsets.ToString()); options.AddOption("ExportUserDefinedParameterMapping", ExportUserDefinedParameterMapping.ToString()); options.AddOption("ExportLinkedFiles", ExportLinkedFiles.ToString()); options.AddOption("IncludeSiteElevation", IncludeSiteElevation.ToString()); options.AddOption("SitePlacement", SitePlacement.ToString()); options.AddOption("TessellationLevelOfDetail", TessellationLevelOfDetail.ToString()); options.AddOption("UseOnlyTriangulation", UseOnlyTriangulation.ToString()); options.AddOption("ActiveViewId", ActiveViewId.ToString()); options.AddOption("StoreIFCGUID", StoreIFCGUID.ToString()); // The active phase may not be valid if we are exporting multiple projects. However, if projects share a template that defines the phases, // then the ActivePhaseId would likely be valid for all. There is some small chance that the ActivePhaseId would be a valid, but different, phase // in different projects, but that is unlikely enough that it seems worth warning against it but allowing the better functionality in general. if (IFCPhaseAttributes.Validate(ActivePhaseId)) { options.AddOption("ActivePhase", ActivePhaseId.ToString()); } options.AddOption("FileType", IFCFileType.ToString()); string uiVersion = IFCUISettings.GetAssemblyVersion(); options.AddOption("AlternateUIVersion", uiVersion); options.AddOption("ConfigName", Name); // Add config name into the option for use in the exporter options.AddOption("ExportUserDefinedPsetsFileName", ExportUserDefinedPsetsFileName); options.AddOption("ExportUserDefinedParameterMappingFileName", ExportUserDefinedParameterMappingFileName); options.AddOption("ExportRoomsInView", ExportRoomsInView.ToString()); options.AddOption("ExcludeFilter", ExcludeFilter.ToString()); options.AddOption("COBieCompanyInfo", COBieCompanyInfo); options.AddOption("COBieProjectInfo", COBieProjectInfo); options.AddOption("IncludeSteelElements", IncludeSteelElements.ToString()); options.AddOption("UseTypeNameOnlyForIfcType", UseTypeNameOnlyForIfcType.ToString()); options.AddOption("UseVisibleRevitNameAsEntityName", UseVisibleRevitNameAsEntityName.ToString()); }
/// <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; } // change description textBoxSetupDescription.Text = selectedConfig.Description; } }
/// <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; } UpdateTextBoxesContent(selectedConfig); IFCExportConfiguration prevConfig = null; if (args.RemovedItems.Count > 0) { prevConfig = m_configMap[args.RemovedItems[0].ToString()]; } } }
/// <summary> /// Updates the IFCExportOptions with the settings in this configuration. /// </summary> /// <param name="options">The IFCExportOptions to update.</param> /// <param name="filterViewId">The id of the view that will be used to select which elements to export.</param> public void UpdateOptions(IFCExportOptions options, ElementId filterViewId) { JavaScriptSerializer ser = new JavaScriptSerializer(); foreach (var prop in GetType().GetProperties()) { switch (prop.Name) { case "Name": options.AddOption("ConfigName", Name); // Add config name into the option for use in the exporter break; case "IFCVersion": options.FileVersion = IFCVersion; break; case "ActivePhaseId": if (IFCPhaseAttributes.Validate(ActivePhaseId)) { options.AddOption(prop.Name, ActivePhaseId.ToString()); } break; case "SpaceBoundaries": options.SpaceBoundaryLevel = SpaceBoundaries; break; case "SplitWallsAndColumns": options.WallAndColumnSplitting = SplitWallsAndColumns; break; case "ExportBaseQuantities": options.ExportBaseQuantities = ExportBaseQuantities; break; case "ProjectAddress": string projectAddrJsonString = ser.Serialize(ProjectAddress); options.AddOption(prop.Name, projectAddrJsonString); break; case "ClassificationSettings": string classificationJsonStr = ser.Serialize(ClassificationSettings); options.AddOption(prop.Name, classificationJsonStr); break; default: var propVal = prop.GetValue(this, null); if (propVal != null) { options.AddOption(prop.Name, propVal.ToString()); } break; } } options.FilterViewId = VisibleElementsOfCurrentView ? filterViewId : ElementId.InvalidElementId; string uiVersion = IFCUISettings.GetAssemblyVersion(); options.AddOption("AlternateUIVersion", uiVersion); }