From 231532ee410509cbe87e59337a539a1706449ad3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Couffin Date: Mon, 4 Mar 2024 12:54:40 +0100 Subject: [PATCH] Update script.py fix for #2122 --- .../ptools2.stack/Get RVT Info.pushbutton/script.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools2.stack/Get RVT Info.pushbutton/script.py b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools2.stack/Get RVT Info.pushbutton/script.py index 538a32e30..2ecadf499 100644 --- a/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools2.stack/Get RVT Info.pushbutton/script.py +++ b/extensions/pyRevitTools.extension/pyRevit.tab/Project.panel/ptools2.stack/Get RVT Info.pushbutton/script.py @@ -2,6 +2,7 @@ #pylint: disable=E0401,C0103 from pyrevit import forms from pyrevit.revit import files +from pyrevit import DB rvt_file = forms.pick_file(files_filter='Revit Files |*.rvt;*.rte;*.rfa|' 'Revit Model |*.rvt|' @@ -9,9 +10,13 @@ 'Revit Family |*.rfa') if rvt_file: mfile = files.get_file_info(rvt_file) - print("Created in: {0} ({1}({2}))".format(mfile.RevitProduct.Name, + bfi = DB.BasicFileInfo.Extract(rvt_file) + if mfile.RevitProduct is not None: + print("Created in: {0} ({1}({2}))".format(mfile.RevitProduct, mfile.RevitProduct.BuildNumber, mfile.RevitProduct.BuildTarget)) + else: + print("Created in: {0}".format(bfi.Format)) print("Workshared: {0}".format("Yes" if mfile.IsWorkshared else "No")) if mfile.IsWorkshared: print("Central Model Path: {0}".format(mfile.CentralModelPath))