diff --git a/Common_glTF_Exporter/Core/GlTFExportContext.cs b/Common_glTF_Exporter/Core/GlTFExportContext.cs index 0d9ba19..0958c59 100644 --- a/Common_glTF_Exporter/Core/GlTFExportContext.cs +++ b/Common_glTF_Exporter/Core/GlTFExportContext.cs @@ -316,7 +316,7 @@ public void OnPolymesh(PolymeshTopology polymesh) if (preferences.normals) { - GLTFExportUtils.AddNormals(preferences, CurrentTransform, polymesh, currentGeometry.CurrentItem.Normals); + GLTFExportUtils.AddNormals(CurrentTransform, polymesh, currentGeometry.CurrentItem.Normals); } } @@ -331,6 +331,8 @@ public void OnPolymesh(PolymeshTopology polymesh) /// Element Id. public void OnElementEnd(ElementId elementId) { + element = doc.GetElement(elementId); + if (currentVertices == null || !currentVertices.List.Any()) { return; @@ -343,7 +345,7 @@ public void OnElementEnd(ElementId elementId) return; } - if (!Util.CanBeLockOrHidden(element, view, isRFA)) + if (!Util.CanBeLockOrHidden(element, view, isRFA) || element is RevitLinkInstance) { return; } diff --git a/Common_glTF_Exporter/Export/MeshOpt.cs b/Common_glTF_Exporter/Export/MeshOpt.cs index e4df45a..475f4d1 100644 --- a/Common_glTF_Exporter/Export/MeshOpt.cs +++ b/Common_glTF_Exporter/Export/MeshOpt.cs @@ -3,6 +3,8 @@ using System.IO; using System.Reflection; using System.Collections.Generic; +using Autodesk.Revit.DB; +using System; namespace Common_glTF_Exporter.Export { @@ -55,10 +57,18 @@ public static void Compress(Preferences preferences) Gltf.GltfPack.gltfpack(fileToCompress, fileToCompressTemp, "report.txt", settings); - #endif +#endif - files.ForEach(x => File.Delete(x)); - File.Move(fileToCompressTemp, fileToCompress); + if (File.Exists(fileToCompressTemp)) + { + files.ForEach(x => File.Delete(x)); + File.Move(fileToCompressTemp, fileToCompress); + } + else + { + Console.WriteLine("The Compression didn't work"); + } + if (preferences.format == FormatEnum.gltf) { diff --git a/Common_glTF_Exporter/Transform/ModelRotation.cs b/Common_glTF_Exporter/Transform/ModelRotation.cs index b770b05..e69042a 100644 --- a/Common_glTF_Exporter/Transform/ModelRotation.cs +++ b/Common_glTF_Exporter/Transform/ModelRotation.cs @@ -14,7 +14,7 @@ public static List Get(bool flipAxis) } else { - return new List { 0, 0, 0, 0}; + return new List { 0, 0, 0, 1}; } } } diff --git a/Common_glTF_Exporter/Utils/glTFExportUtils.cs b/Common_glTF_Exporter/Utils/glTFExportUtils.cs index 13ea10f..0ea30f9 100644 --- a/Common_glTF_Exporter/Utils/glTFExportUtils.cs +++ b/Common_glTF_Exporter/Utils/glTFExportUtils.cs @@ -1,5 +1,6 @@ namespace Common_glTF_Exporter.Utils { + using System; using System.Collections.Generic; using System.Linq; using Autodesk.Revit.DB; @@ -122,7 +123,7 @@ public static GLTFBinaryData AddGeometryMeta(List buffers, List normals) + public static void AddNormals(Transform transform, PolymeshTopology polymesh, List normals) { IList polymeshNormals = polymesh.GetNormals();