General:
diff --git a/Install/Program Files to Install/bundle/PackageContents.xml b/Install/Program Files to Install/bundle/PackageContents.xml
index 20e57e1b..13a58057 100644
--- a/Install/Program Files to Install/bundle/PackageContents.xml
+++ b/Install/Program Files to Install/bundle/PackageContents.xml
@@ -4,7 +4,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/Install/RevitIFCSetupWix/Product.wxs b/Install/RevitIFCSetupWix/Product.wxs
index 1ec55d79..44081799 100644
--- a/Install/RevitIFCSetupWix/Product.wxs
+++ b/Install/RevitIFCSetupWix/Product.wxs
@@ -2,7 +2,7 @@
-
+
diff --git a/Install/RevitIFCSetupWix/RevitIFCSetupWix.wixproj b/Install/RevitIFCSetupWix/RevitIFCSetupWix.wixproj
index 46deae8d..ecdfc4ba 100644
--- a/Install/RevitIFCSetupWix/RevitIFCSetupWix.wixproj
+++ b/Install/RevitIFCSetupWix/RevitIFCSetupWix.wixproj
@@ -6,7 +6,7 @@
3.8
7dfbd495-c588-4c7b-b8f6-5b793adb06f2
2.0
- IFC for Revit 2021.4.1.0
+ IFC for Revit 2021.4.2.0
Package
$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets
$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets
diff --git a/Install/RevitIFCSetupWix/buildInstaller.bat b/Install/RevitIFCSetupWix/buildInstaller.bat
index 105db81a..01545360 100644
--- a/Install/RevitIFCSetupWix/buildInstaller.bat
+++ b/Install/RevitIFCSetupWix/buildInstaller.bat
@@ -11,9 +11,9 @@ rem It is necessary to add the Wix bin directory to the system path temporarily
SET PATH=%PATH%;%WixRoot%
candle.exe -dProjectDir=%2 -ext WixUtilExtension %2Product.wxs
-light.exe -ext WixUtilExtension -out RevitIFC2021.4.1.msi product.wixobj -ext WixUIExtension
+light.exe -ext WixUtilExtension -out RevitIFC2021.4.2.msi product.wixobj -ext WixUIExtension
-copy RevitIFC2021.4.1.msi %1..\Releasex64
-del RevitIFC2021.4.1.msi
+copy RevitIFC2021.4.2.msi %1..\Releasex64
+del RevitIFC2021.4.2.msi
-echo %1..\Releasex64\RevitIFC2021.4.1.msi
+echo %1..\Releasex64\RevitIFC2021.4.2.msi
diff --git a/Source/IFCExporterUIOverride/IFCCommandOverrideApplication.cs b/Source/IFCExporterUIOverride/IFCCommandOverrideApplication.cs
index e957c42e..fe8e00d3 100644
--- a/Source/IFCExporterUIOverride/IFCCommandOverrideApplication.cs
+++ b/Source/IFCExporterUIOverride/IFCCommandOverrideApplication.cs
@@ -307,7 +307,16 @@ public void OnIFCExport(object sender, CommandEventArgs args)
if (selectedConfig.ExportLinkedFiles == true)
{
exportOptions.AddOption("ExportingLinks", true.ToString());
- ExportLinkedDocuments(document, fullName, linksGUIDsCache, exportOptions);
+ try
+ {
+ // Newer version of export linked documents
+ ExportLinkedDocuments(document, fullName, linksGUIDsCache, exportOptions);
+ }
+ catch
+ {
+ // Older version which uses copy of linked file, doesn't work for cloud documents
+ ExportLinkedDocumentsOldVersion(document, fullName, linksGUIDsCache, exportOptions);
+ }
exportOptions.AddOption("ExportingLinks", false.ToString());
}
}
@@ -396,6 +405,20 @@ private void AddExpandedElementIdContent(ref string messageString, string format
messageString += string.Format(formatString, ElementIdListToString(items));
}
+ private string GetLinkFileName(Document linkDocument, string linkPathName)
+ {
+ int index = linkPathName.LastIndexOf("\\");
+ if (index <= 0)
+ return linkDocument.Title;
+
+ string linkFileName = linkPathName.Substring(index + 1);
+ // remove the extension
+ index = linkFileName.LastIndexOf('.');
+ if (index > 0)
+ linkFileName = linkFileName.Substring(0, index);
+ return linkFileName;
+ }
+
public void ExportLinkedDocuments(Autodesk.Revit.DB.Document document, string fileName, Dictionary linksGUIDsCache, IFCExportOptions exportOptions)
{
// get the extension
@@ -440,17 +463,254 @@ public void ExportLinkedDocuments(Autodesk.Revit.DB.Document document, string fi
linkPathName = linkDocument.PathName;
// get the link file name
- String linkFileName = "";
- index = linkPathName.LastIndexOf("\\");
- if (index > 0)
- linkFileName = linkPathName.Substring(index + 1);
+ string linkFileName = GetLinkFileName(linkDocument, linkPathName);
+
+ // add to names count dictionary
+ if (!rvtLinkNamesDict.Keys.Contains(linkFileName))
+ rvtLinkNamesDict.Add(linkFileName, 0);
+ rvtLinkNamesDict[linkFileName]++;
+
+ // add to names instances dictionary
+ if (!rvtLinkNamesToInstancesDict.Keys.Contains(linkPathName))
+ rvtLinkNamesToInstancesDict.Add(linkPathName, new List());
+ rvtLinkNamesToInstancesDict[linkPathName].Add(rvtLinkInstance);
+ }
+ }
+ catch
+ {
+ }
+
+ // get the link instances
+ // We will keep track of the instances we can't export.
+ // Reasons we can't export:
+ // 1. The path for the linked instance doesn't exist.
+ // 2. Couldn't create a temporary document for exporting the linked instance.
+ // 3. The document for the linked instance can't be found.
+ // 4. The linked instance is mirrored, non-conformal, or scaled.
+ IList pathDoesntExist = new List();
+ IList noTempDoc = new List();
+ IList cantFindDoc = new List();
+ IList nonConformalInst = new List();
+ IList scaledInst = new List();
+ IList instHasReflection = new List();
+
+ foreach (KeyValuePair> linkPathNames in rvtLinkNamesToInstancesDict)
+ {
+ string linkPathName = linkPathNames.Key;
+
+ // get the link instances
+ List currRvtLinkInstances = rvtLinkNamesToInstancesDict[linkPathName];
+ IList serTransforms = new List();
+ IList linkFileNames = new List();
+
+ Document linkDocument = null;
+ double lengthScaleFactorLink = 1.0;
+
+ foreach (RevitLinkInstance currRvtLinkInstance in currRvtLinkInstances)
+ {
+ // Nothing to report if the element itself is null.
+ if (currRvtLinkInstance == null)
+ continue;
+
+ // get the link document and the unit scale
+ if (linkDocument == null)
+ {
+ linkDocument = currRvtLinkInstance.GetLinkDocument();
+
+ lengthScaleFactorLink = UnitUtils.ConvertFromInternalUnits(
+ 1.0,
+ linkDocument.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId());
+ }
+
+ if (linkDocument == null)
+ {
+ cantFindDoc.Add(currRvtLinkInstance.Id);
+ continue;
+ }
+
+ // get the link transform
+ Transform tr = currRvtLinkInstance.GetTransform();
+
+ // We can't handle non-conformal, scaled, or mirrored transforms.
+ if (!tr.IsConformal)
+ {
+ nonConformalInst.Add(currRvtLinkInstance.Id);
+ continue;
+ }
+
+ if (tr.HasReflection)
+ {
+ instHasReflection.Add(currRvtLinkInstance.Id);
+ continue;
+ }
+
+ if (!MathUtil.IsAlmostEqual(tr.Determinant, 1.0))
+ {
+ scaledInst.Add(currRvtLinkInstance.Id);
+ continue;
+ }
+
+ // get the link file path and name
+ String linkFileName = GetLinkFileName(linkDocument, linkPathName);
+
+ //if link was an IFC file then make a different formating to the file name
+ if ((linkPathName.Length >= 4 && linkPathName.Substring(linkPathName.Length - 4).ToLower() == ".ifc") ||
+ (linkPathName.Length >= 7 && linkPathName.Substring(linkPathName.Length - 7).ToLower() == ".ifcxml") ||
+ (linkPathName.Length >= 7 && linkPathName.Substring(linkPathName.Length - 7).ToLower() == ".ifczip"))
+ {
+ String fName = fileName;
+
+ //get output path and add to the new file name
+ index = fName.LastIndexOf("\\");
+ if (index > 0)
+ fName = fName.Substring(0, index + 1);
+ else
+ fName = "";
+
+ //construct IFC file name
+ linkFileName = fName + linkFileName + "-";
+
+ //add guid
+ linkFileName += linksGUIDsCache[currRvtLinkInstance.Id];
+ }
else
- linkFileName = linkDocument.Title;
+ {
+ // check if there are multiple instances with the same name
+ bool bMultiple = (rvtLinkNamesDict[linkFileName] > 1);
- // remove the extension
- index = linkFileName.LastIndexOf('.');
- if (index > 0)
- linkFileName = linkFileName.Substring(0, index);
+ // add the path
+ linkFileName = fileName + "-" + linkFileName;
+
+ // add the guid
+ if (bMultiple)
+ {
+ linkFileName += "-";
+ linkFileName += linksGUIDsCache[currRvtLinkInstance.Id];
+ }
+ }
+
+ // add the extension
+ linkFileName += sExtension;
+
+ linkFileNames.Add(linkFileName);
+
+ // scale the transform origin
+ tr.Origin *= lengthScaleFactorLink;
+
+ // serialize transform
+ serTransforms.Add(SerializeTransform(tr));
+ }
+
+ // IFC export requires an open transaction, although no changes should be made
+ if (linkDocument != null)
+ {
+ Transaction transaction = new Transaction(linkDocument, "Export IFC Link");
+ transaction.Start();
+ FailureHandlingOptions failureOptions = transaction.GetFailureHandlingOptions();
+ failureOptions.SetClearAfterRollback(false);
+ transaction.SetFailureHandlingOptions(failureOptions);
+
+ // export
+ try
+ {
+ int numLinkInstancesToExport = linkFileNames.Count;
+ exportOptions.AddOption("NumberOfExportedLinkInstances", numLinkInstancesToExport.ToString());
+
+ for (int ind = 0; ind < numLinkInstancesToExport; ind++)
+ {
+ string optionName = (ind == 0) ? "ExportLinkInstanceTransform" : "ExportLinkInstanceTransform" + (ind + 1).ToString();
+ exportOptions.AddOption(optionName, serTransforms[ind]);
+
+ // Don't pass in file name for the first link instance.
+ if (ind == 0)
+ continue;
+ optionName = "ExportLinkInstanceFileName" + (ind + 1).ToString();
+ exportOptions.AddOption(optionName, linkFileNames[ind]);
+ }
+ // Pass in the first value; the rest will be in the options.
+ String path_ = Path.GetDirectoryName(linkFileNames[0]);
+ String fileName_ = Path.GetFileName(linkFileNames[0]);
+ bool result = linkDocument.Export(path_, fileName_, exportOptions); // pass in the options here
+ }
+ catch
+ {
+ }
+
+ // rollback the transaction
+ transaction.RollBack();
+ }
+
+ // Show user errors, if any.
+ int numBadInstances = pathDoesntExist.Count + noTempDoc.Count + cantFindDoc.Count + nonConformalInst.Count
+ + scaledInst.Count + instHasReflection.Count;
+ if (numBadInstances > 0)
+ {
+ using (TaskDialog taskDialog = new TaskDialog(Properties.Resources.IFCExport))
+ {
+ taskDialog.MainInstruction = string.Format(Properties.Resources.LinkInstanceExportErrorMain, numBadInstances);
+ taskDialog.MainIcon = TaskDialogIcon.TaskDialogIconWarning;
+ taskDialog.TitleAutoPrefix = false;
+
+ string expandedContent = "";
+ AddExpandedStringContent(ref expandedContent, Properties.Resources.LinkInstanceExportErrorPath, pathDoesntExist);
+ AddExpandedStringContent(ref expandedContent, Properties.Resources.LinkInstanceExportCantCreateDoc, noTempDoc);
+ AddExpandedElementIdContent(ref expandedContent, Properties.Resources.LinkInstanceExportCantFindDoc, cantFindDoc);
+ AddExpandedElementIdContent(ref expandedContent, Properties.Resources.LinkInstanceExportNonConformal, nonConformalInst);
+ AddExpandedElementIdContent(ref expandedContent, Properties.Resources.LinkInstanceExportScaled, scaledInst);
+ AddExpandedElementIdContent(ref expandedContent, Properties.Resources.LinkInstanceExportHasReflection, instHasReflection);
+
+ taskDialog.ExpandedContent = expandedContent;
+ TaskDialogResult result = taskDialog.Show();
+ }
+ }
+ }
+ }
+
+ public void ExportLinkedDocumentsOldVersion(Autodesk.Revit.DB.Document document, string fileName, Dictionary linksGUIDsCache, IFCExportOptions exportOptions)
+ {
+ // get the extension
+ int index = fileName.LastIndexOf('.');
+ if (index <= 0)
+ return;
+ string sExtension = fileName.Substring(index);
+ fileName = fileName.Substring(0, index);
+
+ // get all the revit link instances
+ FilteredElementCollector collector = new FilteredElementCollector(document);
+ ElementFilter elementFilter = new ElementClassFilter(typeof(RevitLinkInstance));
+ List rvtLinkInstances = collector.WherePasses(elementFilter).Cast().ToList();
+
+ IDictionary rvtLinkNamesDict = new Dictionary();
+ IDictionary> rvtLinkNamesToInstancesDict = new Dictionary>();
+
+ try
+ {
+ // get the link types
+ foreach (RevitLinkInstance rvtLinkInstance in rvtLinkInstances)
+ {
+ // get the instance
+ if (rvtLinkInstance == null)
+ continue;
+
+ // check the cache
+ if (linksGUIDsCache.Keys.Contains(rvtLinkInstance.Id) == false)
+ continue;
+
+ // get the link document
+ Document linkDocument = rvtLinkInstance.GetLinkDocument();
+ if (linkDocument == null)
+ continue;
+
+ // get the link file path and name
+ String linkPathName = "";
+ Parameter originalFileNameParam = linkDocument.ProjectInformation.LookupParameter("Original IFC File Name");
+ if (originalFileNameParam != null && originalFileNameParam.StorageType == StorageType.String)
+ linkPathName = originalFileNameParam.AsString();
+ else
+ linkPathName = linkDocument.PathName;
+
+ // get the link file name
+ string linkFileName = GetLinkFileName(linkDocument, linkPathName);
// add to names count dictionary
if (!rvtLinkNamesDict.Keys.Contains(linkFileName))
diff --git a/Source/IFCExporterUIOverride/Properties/AssemblyInfo.cs b/Source/IFCExporterUIOverride/Properties/AssemblyInfo.cs
index 4dc719d9..249a4f7e 100644
--- a/Source/IFCExporterUIOverride/Properties/AssemblyInfo.cs
+++ b/Source/IFCExporterUIOverride/Properties/AssemblyInfo.cs
@@ -66,6 +66,6 @@
// The following information is used in the Open Source version as the release version number.
// The number will show up in the Title bar of the export dialog as well as at the IFC header file
// This number must be manually updated prior to releasing the new version
-[assembly: AssemblyVersion("21.4.1.0")]
-[assembly: AssemblyFileVersion("21.4.1.0")]
+[assembly: AssemblyVersion("21.4.2.0")]
+[assembly: AssemblyFileVersion("21.4.2.0")]
#endif
\ No newline at end of file
diff --git a/Source/IFCExporterUIOverride/Properties/Resources.de.resx b/Source/IFCExporterUIOverride/Properties/Resources.de.resx
index 1a66cd38..463359a2 100644
--- a/Source/IFCExporterUIOverride/Properties/Resources.de.resx
+++ b/Source/IFCExporterUIOverride/Properties/Resources.de.resx
@@ -184,7 +184,7 @@
Teile als Gebäudeelemente exportieren
- Allgemeine IFC-Eigenschaftensätze exportieren
+ Allgemeine Einstellungen
IFC 2x3 Basic FM Handover View
@@ -786,6 +786,12 @@
Triangulation erzwingen
+
+ Nur Typnamen als IFCType-Namen verwenden
+
+
+ Sichtbaren Revit-Namen als IFCEntity-Namen verwenden
+
Ostwert
diff --git a/Source/Revit.IFC.Common/Properties/AssemblyInfo.cs b/Source/Revit.IFC.Common/Properties/AssemblyInfo.cs
index 1e25daf5..210c20c8 100644
--- a/Source/Revit.IFC.Common/Properties/AssemblyInfo.cs
+++ b/Source/Revit.IFC.Common/Properties/AssemblyInfo.cs
@@ -13,8 +13,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("21.4.1.0")]
-[assembly: AssemblyFileVersion("21.4.1.0")]
+[assembly: AssemblyVersion("21.4.2.0")]
+[assembly: AssemblyFileVersion("21.4.2.0")]
#endif
diff --git a/Source/Revit.IFC.Export/Properties/AssemblyInfo.cs b/Source/Revit.IFC.Export/Properties/AssemblyInfo.cs
index 19fa8dda..b5c11268 100644
--- a/Source/Revit.IFC.Export/Properties/AssemblyInfo.cs
+++ b/Source/Revit.IFC.Export/Properties/AssemblyInfo.cs
@@ -14,8 +14,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("21.4.1.0")]
-[assembly: AssemblyFileVersion("21.4.1.0")]
+[assembly: AssemblyVersion("21.4.2.0")]
+[assembly: AssemblyFileVersion("21.4.2.0")]
#endif
diff --git a/Source/Revit.IFC.Import/Properties/AssemblyInfo.cs b/Source/Revit.IFC.Import/Properties/AssemblyInfo.cs
index cdb5981c..2ba7ffb5 100644
--- a/Source/Revit.IFC.Import/Properties/AssemblyInfo.cs
+++ b/Source/Revit.IFC.Import/Properties/AssemblyInfo.cs
@@ -12,8 +12,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("21.4.1.0")]
-[assembly: AssemblyFileVersion("21.4.1.0")]
+[assembly: AssemblyVersion("21.4.2.0")]
+[assembly: AssemblyFileVersion("21.4.2.0")]
#endif
#region Using directives
diff --git a/Source/RevitIFCTools/Properties/AssemblyInfo.cs b/Source/RevitIFCTools/Properties/AssemblyInfo.cs
index acc0f2f5..4af090c8 100644
--- a/Source/RevitIFCTools/Properties/AssemblyInfo.cs
+++ b/Source/RevitIFCTools/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("21.4.1.0")]
-[assembly: AssemblyFileVersion("21.4.1.0")]
+[assembly: AssemblyVersion("21.4.2.0")]
+[assembly: AssemblyFileVersion("21.4.2.0")]