Skip to content

Commit 45d2d71

Browse files
author
Wawan Solihin
committed
Updates for 22.5.1 that fixes some issues with crash and failure to export
1 parent 6656907 commit 45d2d71

File tree

27 files changed

+227
-298
lines changed

27 files changed

+227
-298
lines changed

Install/Program Files to Install/bundle/Contents/Resources/ADSKIFCExporterHelp.htm

+11
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ <h2 id="VersionHistory" name="VersionHistory">Version History</h2>
238238

239239
<div class="versionset">
240240

241+
<div class="version">22.5.1.0</div><div class="versioninfo-bullet">
242+
243+
<br><p>
244+
Bugfix:
245+
<ul>
246+
<li> Fixed several issues that may cause IFC export to fail.
247+
</ul>
248+
</p>
249+
</div>
250+
<br>
251+
241252
<div class="version">22.5.0.0</div><div class="versioninfo-bullet">
242253

243254
<br><p>

Install/Program Files to Install/bundle/PackageContents.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2022" SeriesMax="R2022" />
99
<Components Description="2022">
1010
<RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2022" SeriesMax="R2022" />
11-
<ComponentEntry AppName="IFC For Revit 2022" Version="22.5.0" ModuleName="./Contents/2022/IFCExporterUIOverride.addin" AppDescription="IFC For Revit 2022" />
12-
<ComponentEntry AppName="IFC For Revit 2022" Version="22.5.0" ModuleName="./Contents/2022/Revit.IFC.addin" AppDescription="IFC For Revit 2022" />
11+
<ComponentEntry AppName="IFC For Revit 2022" Version="22.5.1" ModuleName="./Contents/2022/IFCExporterUIOverride.addin" AppDescription="IFC For Revit 2022" />
12+
<ComponentEntry AppName="IFC For Revit 2022" Version="22.5.1" ModuleName="./Contents/2022/Revit.IFC.addin" AppDescription="IFC For Revit 2022" />
1313
</Components>
1414
</ApplicationPackage>

Install/RevitIFCSetupWix/Product.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
33
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
44

5-
<Product Id="84E339EB-2C2E-4966-8886-749B9348B457" Name="Revit IFC 2022" Language="1033" Version="22.5.0.0" Manufacturer="Autodesk" UpgradeCode="254F4C8A-9ECA-4690-A718-21ACD3849485">
5+
<Product Id="BAC3CA99-6D8E-43B7-BFAC-CA8E477D0FFE" Name="Revit IFC 2022" Language="1033" Version="22.5.1.0" Manufacturer="Autodesk" UpgradeCode="254F4C8A-9ECA-4690-A718-21ACD3849485">
66
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
77

88
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

Install/RevitIFCSetupWix/RevitIFCSetupWix.wixproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ProductVersion>3.8</ProductVersion>
77
<ProjectGuid>7dfbd495-c588-4c7b-b8f6-5b793adb06f2</ProjectGuid>
88
<SchemaVersion>2.0</SchemaVersion>
9-
<OutputName>IFC for Revit 2022.5.0.0</OutputName>
9+
<OutputName>IFC for Revit 2022.5.1.0</OutputName>
1010
<OutputType>Package</OutputType>
1111
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
1212
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>

Install/RevitIFCSetupWix/buildInstaller.bat

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ rem It is necessary to add the Wix bin directory to the system path temporarily
1111
SET PATH=%PATH%;%WixRoot%
1212

1313
candle.exe -dProjectDir=%2 -ext WixUtilExtension %2Product.wxs
14-
light.exe -ext WixUtilExtension -out RevitIFC2022.5.0.msi product.wixobj -ext WixUIExtension
14+
light.exe -ext WixUtilExtension -out RevitIFC2022.5.1.msi product.wixobj -ext WixUIExtension
1515

16-
copy RevitIFC2022.5.0.msi %1..\Releasex64
17-
del RevitIFC2022.5.0.msi
16+
copy RevitIFC2022.5.1.msi %1..\Releasex64
17+
del RevitIFC2022.5.1.msi
1818

19-
echo %1..\Releasex64\RevitIFC2022.5.0.msi
19+
echo %1..\Releasex64\RevitIFC2022.5.1.msi

Source/IFCExporterUIOverride/IFCAddressInformationUI.xaml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
Title="{x:Static p:Resources.AddressInformation}"
99
ResizeMode ="NoResize"
1010
Name="AddressTab"
11-
Closing="Window_Closing"
1211
SaveWindowSettings="True"
1312
mc:Ignorable="d"
1413
Initialized="AddressTab_Initialized"

Source/IFCExporterUIOverride/IFCAddressInformationUI.xaml.cs

-16
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ private string getUserDefinedStringFromIFCPurposeList()
5252
return ifcPurposeList[4];
5353
}
5454

55-
/// <summary>
56-
/// The file to store the previous window bounds.
57-
/// </summary>
58-
string m_SettingFile = "IFCAddressInformationUIWindowSettings_v30.txt"; // update the file when resize window bounds.
59-
6055
/// <summary>
6156
/// initialization of IFCAssignemt class
6257
/// </summary>
@@ -90,17 +85,6 @@ private void OnInit(object sender, RoutedEventArgs e)
9085
DataContext = m_newAddressItem;
9186
}
9287

93-
/// <summary>
94-
/// Saves the window bounds when close the window.
95-
/// </summary>
96-
/// <param name="sender">The source of the event.</param>
97-
/// <param name="e">Event arguments that contains the event data.</param>
98-
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
99-
{
100-
// Save restore bounds for the next time this window is opened
101-
IFCUISettings.SaveWindowBounds(m_SettingFile, this.RestoreBounds);
102-
}
103-
10488
/// <summary>
10589
/// Event when the Purpose combo box is initialized. The list of enum text for Purpose is added here
10690
/// </summary>

Source/IFCExporterUIOverride/IFCExport.xaml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
WindowStyle="SingleBorderWindow"
1313
ContentRendered="ChildWindow_ContentRendered"
1414
SaveWindowSettings="True"
15-
Closing="Window_Closing"
1615
Height="390"
1716
Width="730" MinWidth="550" MinHeight="305">
1817
<Grid Margin="10,0" RenderTransformOrigin="0,0">

Source/IFCExporterUIOverride/IFCExport.xaml.cs

-17
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public partial class IFCExport : ChildWindow
5252
/// </summary>
5353
IFCExportResult m_Result = IFCExportResult.Invalid;
5454

55-
/// <summary>
56-
/// The file to store the previous window bounds.
57-
/// </summary>
58-
string m_SettingFile = "IFCExportSettings_v36.txt"; // update the file when resize window bounds.
59-
6055
/// <summary>
6156
/// The list of documents to export as chosen by the user.
6257
/// </summary>
@@ -726,18 +721,6 @@ private void currentSelectedSetup_SelectionChanged(object sender, SelectionChang
726721
}
727722
}
728723

729-
/// <summary>
730-
/// Saves the window bounds when close the window.
731-
/// </summary>
732-
/// <param name="sender">The source of the event.</param>
733-
/// <param name="e">Event arguments that contains the event data.</param>
734-
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
735-
{
736-
// Save restore bounds for the next time this window is opened
737-
IFCUISettings.SaveWindowBounds(m_SettingFile, this.RestoreBounds);
738-
}
739-
740-
741724
/// <summary>
742725
/// Changes the name of the IFC files to be exported on clicking the checkboxes.
743726
/// </summary>

Source/IFCExporterUIOverride/IFCExporterUIWindow.xaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
Height="560"
1111
Width="887"
1212
WindowStyle="SingleBorderWindow"
13-
ResizeMode="NoResize"
14-
Closing="Window_Closing">
13+
ResizeMode="NoResize">
1514
<Grid Margin="4,4,4,4">
1615
<Grid.RowDefinitions>
1716
<RowDefinition Height="479*"/>

Source/IFCExporterUIOverride/IFCExporterUIWindow.xaml.cs

-16
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public partial class IFCExporterUIWindow : ChildWindow
5252
/// </summary>
5353
IFCExportConfigurationsMap m_configurationsMap;
5454

55-
/// <summary>
56-
/// The file to store the previous window bounds.
57-
/// </summary>
58-
string m_SettingFile = "IFCExporterUIWindowSettings_v35.txt"; // update the file when resize window bounds.
59-
6055
IDictionary<string, TreeViewItem> m_TreeViewItemDict = new Dictionary<string, TreeViewItem>();
6156

6257
/// <summary>
@@ -1131,17 +1126,6 @@ private void comboboxActivePhase_SelectionChanged(object sender, SelectionChange
11311126
}
11321127
}
11331128

1134-
/// <summary>
1135-
/// Saves the window bounds when close the window.
1136-
/// </summary>
1137-
/// <param name="sender">The source of the event.</param>
1138-
/// <param name="e">Event arguments that contains the event data.</param>
1139-
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
1140-
{
1141-
// Save restore bounds for the next time this window is opened
1142-
IFCUISettings.SaveWindowBounds(m_SettingFile, this.RestoreBounds);
1143-
}
1144-
11451129
/// <summary>
11461130
/// Updates the configuration ExportPartsAsBuildingElements when the Export separate parts changed in the combobox.
11471131
/// </summary>

Source/IFCExporterUIOverride/IFCUIUtility.cs

-18
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,6 @@ namespace BIM.IFC.Export.UI
3434
/// </summary>
3535
static public class IFCUISettings
3636
{
37-
/// <summary>
38-
/// Save the restore bounds of the window.
39-
/// </summary>
40-
/// <param name="filename">The file to store the Rect data.</param>
41-
/// <param name="restoreBounds">The Rect object.</param>
42-
static public void SaveWindowBounds(string filename, Rect restoreBounds)
43-
{
44-
// Save restore bounds for the next time this window is opened
45-
IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForAssembly();
46-
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(filename, FileMode.Create, storage))
47-
using (StreamWriter writer = new StreamWriter(stream))
48-
{
49-
// Write restore bounds value to file
50-
writer.WriteLine(restoreBounds.ToString());
51-
writer.WriteLine(GetAssemblyVersion());
52-
}
53-
}
54-
5537
/// <summary>
5638
/// Get the assembly version of the UI.
5739
/// </summary>

Source/IFCExporterUIOverride/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@
6666
// The following information is used in the Open Source version as the release version number.
6767
// The number will show up in the Title bar of the export dialog as well as at the IFC header file
6868
// This number must be manually updated prior to releasing the new version
69-
[assembly: AssemblyVersion("22.5.0.0")]
70-
[assembly: AssemblyFileVersion("22.5.0.0")]
69+
[assembly: AssemblyVersion("22.5.1.0")]
70+
[assembly: AssemblyFileVersion("22.5.1.0")]
7171
#endif

Source/Revit.IFC.Common/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
[assembly: AssemblyTrademark("")]
1414
[assembly: AssemblyCulture("")]
1515

16-
[assembly: AssemblyVersion("22.5.0.0")]
17-
[assembly: AssemblyFileVersion("22.5.0.0")]
16+
[assembly: AssemblyVersion("22.5.1.0")]
17+
[assembly: AssemblyFileVersion("22.5.1.0")]
1818
#endif
1919

2020

Source/Revit.IFC.Common/Revit.IFC.Common.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
</PropertyGroup>
5151
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
5252
<DefineConstants>TRACE;IFC_OPENSOURCE</DefineConstants>
53+
<DebugType>pdbonly</DebugType>
54+
<DebugSymbols>true</DebugSymbols>
5355
</PropertyGroup>
5456
<ItemGroup>
5557
<Reference Include="RevitAPI">

Source/Revit.IFC.Common/Utility/IFCAnyHandleUtil.cs

+52-45
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,12 @@ public static void EventClear()
256256
public static string GetIFCEntityTypeName(IFCEntityType entityType)
257257
{
258258
string entityTypeName;
259-
try
259+
if (!m_sIFCEntityTypeToNames.TryGetValue(entityType, out entityTypeName))
260260
{
261-
if (!m_sIFCEntityTypeToNames.TryGetValue(entityType, out entityTypeName))
262-
{
263-
entityTypeName = entityType.ToString();
264-
m_sIFCEntityTypeToNames[entityType] = entityTypeName;
265-
}
266-
return entityTypeName;
267-
}
268-
catch
269-
{
270-
return null;
261+
entityTypeName = entityType.ToString();
262+
m_sIFCEntityTypeToNames[entityType] = entityTypeName;
271263
}
264+
return entityTypeName;
272265
}
273266

274267
/// <summary>
@@ -445,7 +438,6 @@ public static void SetAttribute(IFCAnyHandle handle, string name, string value)
445438
// This allows you to set empty strings, which may not always be intended, but should be allowed.
446439
if (value != null)
447440
{
448-
value = new string(value.Where(c => !char.IsControl(c)).ToArray());
449441
int maxStrLen = IFCLimits.CalculateMaxAllowedSize(value);
450442
if (value.Length > maxStrLen)
451443
{
@@ -1247,15 +1239,7 @@ public static void SetAttribute(IFCAnyHandle handle, string name, IFCData value)
12471239
/// <returns>The collection of attribute values.</returns>
12481240
public static T GetValidAggregateInstanceAttribute<T>(IFCAnyHandle handle, string name) where T : ICollection<IFCAnyHandle>, new()
12491241
{
1250-
IFCData ifcData = null;
1251-
try
1252-
{
1253-
ifcData = handle.GetAttribute(name);
1254-
}
1255-
catch
1256-
{
1257-
return default(T);
1258-
}
1242+
IFCData ifcData = handle.GetAttribute(name);
12591243

12601244
T aggregateAttribute = default(T);
12611245

@@ -1717,6 +1701,44 @@ public static string GetRepresentationType(IFCAnyHandle representation)
17171701
return null;
17181702
}
17191703

1704+
/// <summary>
1705+
/// Get the base representation in case of MappedItem
1706+
/// </summary>
1707+
/// <param name="representation">the representation</param>
1708+
/// <returns>the base representation type</returns>
1709+
/// <exception cref="ArgumentException"></exception>
1710+
public static string GetBaseRepresentationType(IFCAnyHandle representation)
1711+
{
1712+
if (!IsSubTypeOf(representation, IFCEntityType.IfcRepresentation))
1713+
throw new ArgumentException("The operation is not valid for this handle.");
1714+
1715+
IFCData ifcData = representation.GetAttribute("RepresentationType");
1716+
if (ifcData.PrimitiveType == IFCDataPrimitiveType.String)
1717+
{
1718+
string repType = ifcData.AsString();
1719+
if (repType.Equals("MappedRepresentation", StringComparison.InvariantCultureIgnoreCase))
1720+
{
1721+
HashSet<IFCAnyHandle> mapItems = GetItems(representation);
1722+
if (mapItems.Count > 0)
1723+
{
1724+
// The mapped representation should be of the same type. Use the first one will suffice
1725+
IFCAnyHandle mapSrc = GetInstanceAttribute(mapItems.First(), "MappingSource");
1726+
if (!IsNullOrHasNoValue(mapSrc))
1727+
{
1728+
IFCAnyHandle mapRep = GetInstanceAttribute(mapSrc, "MappedRepresentation");
1729+
if (!IsNullOrHasNoValue(mapRep))
1730+
{
1731+
repType = GetRepresentationType(mapRep);
1732+
}
1733+
}
1734+
}
1735+
}
1736+
return repType;
1737+
}
1738+
1739+
return null;
1740+
}
1741+
17201742
/// <summary>
17211743
/// Gets set of Items of a representation handle.
17221744
/// </summary>
@@ -1853,7 +1875,13 @@ public static void AssociatesAddRelated(IFCAnyHandle relAssociates, IFCAnyHandle
18531875
}
18541876
else
18551877
{
1856-
aggregate.Add(IFCData.CreateIFCAnyHandle(related));
1878+
IFCData newData = IFCData.CreateIFCAnyHandle(related);
1879+
try
1880+
{
1881+
//if (!aggregate.Contains(newData))
1882+
aggregate.Add(newData);
1883+
}
1884+
catch { }
18571885
}
18581886
}
18591887

@@ -1938,21 +1966,7 @@ public static void AddProductRepresentations(IFCAnyHandle productHandle, IList<I
19381966
/// <returns>True if it is null or has no value, false otherwise.</returns>
19391967
public static bool IsNullOrHasNoValue(IFCAnyHandle handle)
19401968
{
1941-
if (handle == null || !handle.HasValue)
1942-
return true;
1943-
1944-
// Temporary code for 2022 until HasValue is set propertly when handle has become invalid
1945-
bool staleHandle = false;
1946-
try
1947-
{
1948-
string entityTypeName = handle.TypeName;
1949-
}
1950-
catch
1951-
{
1952-
staleHandle = true;
1953-
}
1954-
1955-
return staleHandle;
1969+
return handle == null || !handle.HasValue;
19561970
}
19571971

19581972
/// <summary>
@@ -1991,14 +2005,7 @@ public static bool IsSubTypeOf(IFCAnyHandle handle, IFCEntityType type)
19912005
/// <returns>True if the handle entity is an entity of either the given type or one of its sub-types.</returns>
19922006
public static bool IsValidSubTypeOf(IFCAnyHandle handle, IFCEntityType type)
19932007
{
1994-
try
1995-
{
1996-
return handle.IsSubTypeOf(GetIFCEntityTypeName(type));
1997-
}
1998-
catch
1999-
{
2000-
return false;
2001-
}
2008+
return handle.IsSubTypeOf(GetIFCEntityTypeName(type));
20022009
}
20032010

20042011
/// <summary>

Source/Revit.IFC.EntityTree/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
// The following information is used in the Open Source version as the release version number.
4343
// The number will show up in the Title bar of the export dialog as well as at the IFC header file
4444
// This number must be manually updated prior to releasing the new version
45-
[assembly: AssemblyVersion("22.5.0.0")]
46-
[assembly: AssemblyFileVersion("22.5.0.0")]
45+
[assembly: AssemblyVersion("22.5.1.0")]
46+
[assembly: AssemblyFileVersion("22.5.1.0")]

0 commit comments

Comments
 (0)