Skip to content

New option: ExportAllPhases, ignores phases and exports all elements #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: Release_22.x.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Source/IFCExporterUIOverride/IFCExportConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,21 @@ public KnownERNames ExchangeRequirement {
/// </summary>
public bool UseVisibleRevitNameAsEntityName { get; set; } = false;

/// <summary>
/// Value indicating whether to export all phases in the view or not
/// </summary>
public bool ExportAllPhases { get; set; } = false;

#endregion // AdvancedTab


// Items under Entities to Export Tab
#region EntitiesToExportTab

/// <summary>
/// Exclude filter string (element list in an arrary, seperated with semicolon ';')
/// </summary>
public string ExcludeFilter { get; set; } = "";
/// <summary>
/// Exclude filter string (element list in an arrary, seperated with semicolon ';')
/// </summary>
public string ExcludeFilter { get; set; } = "";

#endregion // EntitiesToExportTab

Expand Down
6 changes: 6 additions & 0 deletions Source/IFCExporterUIOverride/IFCExportConfigurationsMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public void AddSavedConfigurations()
configuration.UseTypeNameOnlyForIfcType = bool.Parse(configMap[s_useTypeNameOnlyForIfcType]);
if (configMap.ContainsKey(s_useVisibleRevitNameAsEntityName))
configuration.UseVisibleRevitNameAsEntityName = bool.Parse(configMap[s_useVisibleRevitNameAsEntityName]);
if (configMap.ContainsKey(s_exportAllPhases))
configuration.ExportAllPhases = bool.Parse(configMap[s_exportAllPhases]);
if (configMap.ContainsKey(s_useOnlyTriangulation))
configuration.UseOnlyTriangulation = bool.Parse(configMap[s_useOnlyTriangulation]);
if (configMap.ContainsKey(s_setupTessellationLevelOfDetail))
Expand Down Expand Up @@ -296,6 +298,9 @@ public void AddSavedConfigurations()
Field fieldUseVisibleRevitNameAsEntityName = m_schema.GetField(s_useVisibleRevitNameAsEntityName);
if (fieldUseVisibleRevitNameAsEntityName != null)
configuration.UseVisibleRevitNameAsEntityName = configEntity.Get<bool>(s_useVisibleRevitNameAsEntityName);
Field fieldExportAllPhases = m_schema.GetField(s_exportAllPhases);
if (fieldExportAllPhases != null)
configuration.ExportAllPhases = configEntity.Get<bool>(s_exportAllPhases);
Field fieldTessellationLevelOfDetail = m_schema.GetField(s_setupTessellationLevelOfDetail);
if (fieldTessellationLevelOfDetail != null)
configuration.TessellationLevelOfDetail = configEntity.Get<double>(s_setupTessellationLevelOfDetail);
Expand Down Expand Up @@ -349,6 +354,7 @@ public void AddSavedConfigurations()
private const string s_setupSitePlacement = "SitePlacement";
private const string s_useTypeNameOnlyForIfcType = "UseTypeNameOnlyForIfcType";
private const string s_useVisibleRevitNameAsEntityName = "UseVisibleRevitNameAsEntityName";
private const string s_exportAllPhases = "ExportAllPhases";
// Used for COBie 2.4
private const string s_cobieCompanyInfo = "COBieCompanyInfo";
private const string s_cobieProjectInfo = "COBieProjectInfo";
Expand Down
1 change: 1 addition & 0 deletions Source/IFCExporterUIOverride/IFCExporterUIWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<CheckBox Content="{x:Static p:Resources.ExportLinkedFiles}" Margin="10,29,0,0" x:Name="checkBoxExportLinkedFiles" Checked="checkBoxExportLinkedFiles_Checked" Unchecked="checkBoxExportLinkedFiles_Checked" HorizontalAlignment="Left" Width="570" Height="16" VerticalAlignment="Top" />
<CheckBox Content="{x:Static p:Resources.ExportVisibleElementsInView}" Margin="10,50,0,0" Name="checkboxVisibleElementsCurrView" Checked="checkboxVisibleElementsCurrView_Checked" Unchecked="checkboxVisibleElementsCurrView_Checked" RenderTransformOrigin="0.634,0.968" HorizontalAlignment="Left" Width="570" Height="16" VerticalAlignment="Top" />
<CheckBox Content="{x:Static p:Resources.ExportRoomsInView}" x:Name="checkBoxExportRoomsInView" Checked="checkBoxExportRoomsInView_Checked" Unchecked="checkBoxExportRoomsInView_Checked" IsEnabled="False" Margin="30,71,0,0" HorizontalAlignment="Left" Width="550" Height="16" VerticalAlignment="Top" />
<CheckBox Content="{x:Static p:Resources.ExportAllPhases}" HorizontalAlignment="Left" x:Name="checkBoxExportAllPhases" VerticalAlignment="Top" Checked="checkBoxExportAllPhases_Checked" Unchecked="checkBoxExportAllPhases_Checked" Height="16" Width="567" Margin="10,90,0,0" Grid.ColumnSpan="5" />
</Grid>
</TabItem>
<TabItem Header="{x:Static p:Resources.PropertySets}" x:Name="PropertySets">
Expand Down
17 changes: 15 additions & 2 deletions Source/IFCExporterUIOverride/IFCExporterUIWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private void UpdatePhaseAttributes(IFCExportConfiguration configuration)
}
}

comboboxActivePhase.IsEnabled = !configuration.VisibleElementsOfCurrentView;
comboboxActivePhase.IsEnabled = !(configuration.VisibleElementsOfCurrentView || configuration.ExportAllPhases);
}

/// <summary>
Expand Down Expand Up @@ -326,6 +326,7 @@ private void UpdateActiveConfigurationOptions(IFCExportConfiguration configurati
checkboxIncludeIfcSiteElevation.IsChecked = configuration.IncludeSiteElevation;
checkboxStoreIFCGUID.IsChecked = configuration.StoreIFCGUID;
checkBoxExportRoomsInView.IsChecked = configuration.ExportRoomsInView;
checkBoxExportAllPhases.IsChecked = configuration.ExportAllPhases;
comboBoxLOD.SelectedIndex = (int)(Math.Round(configuration.TessellationLevelOfDetail * 4) - 1);
checkboxIncludeSteelElements.IsChecked = configuration.IncludeSteelElements;
comboBoxSitePlacement.SelectedIndex = (int)configuration.SitePlacement;
Expand Down Expand Up @@ -373,6 +374,7 @@ private void UpdateActiveConfigurationOptions(IFCExportConfiguration configurati
checkboxExportSchedulesAsPsets,
checkBoxExportSpecificSchedules,
checkBoxExportRoomsInView,
checkBoxExportAllPhases,
checkBoxLevelOfDetails,
comboboxActivePhase,
checkboxExportUserDefinedPset,
Expand All @@ -393,7 +395,7 @@ private void UpdateActiveConfigurationOptions(IFCExportConfiguration configurati
{
element.IsEnabled = !configuration.IsBuiltIn;
}
comboboxActivePhase.IsEnabled = comboboxActivePhase.IsEnabled && !configuration.VisibleElementsOfCurrentView;
comboboxActivePhase.IsEnabled = comboboxActivePhase.IsEnabled && !(configuration.VisibleElementsOfCurrentView || configuration.ExportAllPhases);
userDefinedPropertySetFileName.IsEnabled = userDefinedPropertySetFileName.IsEnabled && configuration.ExportUserDefinedPsets;
userDefinedParameterMappingTable.IsEnabled = userDefinedParameterMappingTable.IsEnabled && configuration.ExportUserDefinedParameterMapping;
buttonBrowse.IsEnabled = buttonBrowse.IsEnabled && configuration.ExportUserDefinedPsets;
Expand Down Expand Up @@ -1411,6 +1413,17 @@ private void checkBoxExportRoomsInView_Checked(object sender, RoutedEventArgs e)
}
}

private void checkBoxExportAllPhases_Checked(object sender, RoutedEventArgs e)
{
CheckBox checkBox = (CheckBox)sender;
IFCExportConfiguration configuration = GetSelectedConfiguration();
if (configuration != null)
{
configuration.ExportAllPhases = GetCheckbuttonChecked(checkBox);
UpdatePhaseAttributes(configuration);
}
}

private void comboBoxLOD_SelectionChanged(object sender, RoutedEventArgs e)
{
string selectedItem = (string)comboBoxLOD.SelectedItem;
Expand Down
9 changes: 9 additions & 0 deletions Source/IFCExporterUIOverride/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Source/IFCExporterUIOverride/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@
<data name="Export" xml:space="preserve">
<value>Export</value>
</data>
<data name="ExportAllPhases" xml:space="preserve">
<value>Alle Elemente unabhängig von der Phase exportieren</value>
</data>
<data name="ExportElementsVisibleInView" xml:space="preserve">
<value>Nur in der Ansicht sichtbare Elemente exportieren</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions Source/IFCExporterUIOverride/Properties/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@
<data name="Export" xml:space="preserve">
<value>Exporter…</value>
</data>
<data name="ExportAllPhases" xml:space="preserve">
<value>Exporter tous les éléments, quelle que soit la phase</value>
</data>
<data name="ExportElementsVisibleInView" xml:space="preserve">
<value>Exporter uniquement les éléments visibles dans la vue actuelle</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions Source/IFCExporterUIOverride/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@
<data name="Export" xml:space="preserve">
<value>Export</value>
</data>
<data name="ExportAllPhases" xml:space="preserve">
<value>Export all elements regardless of phase</value>
</data>
<data name="ExportElementsVisibleInView" xml:space="preserve">
<value>Export only elements visible in current view</value>
</data>
Expand Down
21 changes: 20 additions & 1 deletion Source/Revit.IFC.Common/Revit.IFC.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,33 @@
<DefineConstants>TRACE;IFC_OPENSOURCE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="AdWindows, Version=3.1.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Revit_All_Main_Versions_API_x64.2022.1.0\lib\net48\AdWindows.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPI, Version=22.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\..\packages\Revit_All_Main_Versions_API_x64.2022.1.0\lib\net48\RevitAPI.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Autodesk\Revit 2022\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIIFC, Version=22.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Autodesk\Revit 2022\RevitAPIIFC.dll</HintPath>
</Reference>
<Reference Include="RevitAPIUI, Version=22.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\..\packages\Revit_All_Main_Versions_API_x64.2022.1.0\lib\net48\RevitAPIUI.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.XML" />
<Reference Include="UIFramework, Version=22.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\..\packages\Revit_All_Main_Versions_API_x64.2022.1.0\lib\net48\UIFramework.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Enums\CommonEnum.cs" />
Expand Down Expand Up @@ -116,6 +132,9 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project=".\Revit.IFC.Common.props" />
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "C:\ProgramData\Autodesk\ApplicationPlugins\IFC 2022.bundle\Contents\2022\" /F /R /Y /I</PostBuildEvent>
Expand Down
4 changes: 3 additions & 1 deletion Source/Revit.IFC.Export/Utility/ElementFilteringUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static ElementFilter GetExportFilter(Document document, ExporterIFC expo
filters.Add(GetDesignOptionFilter());

// Phases: only for non-spatial elements. For spatial elements, we will do a check afterwards.
if (!forSpatialElements && !ExporterCacheManager.ExportOptionsCache.ExportingLink)
if (!forSpatialElements && !ExporterCacheManager.ExportOptionsCache.ExportingLink && !ExporterCacheManager.ExportOptionsCache.ExportAllPhases)
filters.Add(GetPhaseStatusFilter(document));

return new LogicalAndFilter(filters);
Expand Down Expand Up @@ -558,6 +558,8 @@ public static bool IsRoomInInvalidPhase(Element element)
Parameter phaseParameter = element.get_Parameter(BuiltInParameter.ROOM_PHASE);
if (phaseParameter != null)
{
if (ExporterCacheManager.ExportOptionsCache.ExportAllPhases)
return true;
ElementId phaseId = phaseParameter.AsElementId();
if (phaseId != ElementId.InvalidElementId && phaseId != ExporterCacheManager.ExportOptionsCache.ActivePhaseId)
return true;
Expand Down
13 changes: 13 additions & 0 deletions Source/Revit.IFC.Export/Utility/ExportOptionsCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ public static ExportOptionsCache Create(ExporterIFC exporterIFC, Document docume
cache.ActiveView = activeView;
}

bool? exportAllPhases = OptionsUtil.GetNamedBooleanOption(options, "ExportAllPhases");
cache.ExportAllPhases = exportAllPhases.HasValue ? exportAllPhases.Value : false;

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

Expand Down Expand Up @@ -729,6 +732,16 @@ public bool UseActiveViewGeometry
set;
}

/// <summary>
/// True to export all elements regardless of phase
/// False to use default export options.
/// </summary>
public bool ExportAllPhases
{
get;
set;
}

/// <summary>
/// Whether or not export the Part element from host.
/// Export Part element only if 'Current View Only' is checked and 'Show Parts' is selected.
Expand Down