From 2caa69f60d289b7fdc00ab95e845d1794440573a Mon Sep 17 00:00:00 2001 From: Dan Rumery Date: Mon, 11 May 2020 00:39:59 +1000 Subject: [PATCH] BatchRvtUtil: Scripts: revit_file_util.py: fix bug (using wrong property of BasicFileInfo for Revit 2020+) --- BatchRvtUtil/Scripts/revit_file_util.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/BatchRvtUtil/Scripts/revit_file_util.py b/BatchRvtUtil/Scripts/revit_file_util.py index b3a4b6c..a6e25b3 100644 --- a/BatchRvtUtil/Scripts/revit_file_util.py +++ b/BatchRvtUtil/Scripts/revit_file_util.py @@ -311,9 +311,19 @@ def TryGetBasicFileInfo(revitFilePath): basicfileInfo = None return basicFileInfo +def GetSavedInVersion(basicFileInfo): + savedInVersion = None + try: + # <= Revit 2019 + savedInVersion = basicFileInfo.SavedInVersion + except System.MissingMemberException, e: + # Revit 2020+ + savedInVersion = basicFileInfo.Format + return savedInVersion + def GetRevitFileVersion(revitFilePath): basicFileInfo = TryGetBasicFileInfo(revitFilePath) - savedInVersion = basicFileInfo.SavedInVersion if basicFileInfo is not None else None + savedInVersion = GetSavedInVersion(basicFileInfo) if basicFileInfo is not None else None return savedInVersion def IsLocalModel(revitFilePath):