Skip to content

Commit

Permalink
BatchRvtUtil: Scripts: revit_file_util.py: fix bug (using wrong prope…
Browse files Browse the repository at this point in the history
…rty of BasicFileInfo for Revit 2020+)
  • Loading branch information
DanRumery committed May 10, 2020
1 parent 38f0855 commit 2caa69f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion BatchRvtUtil/Scripts/revit_file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 2caa69f

Please sign in to comment.