From a4a91b548088619294fb98454553905c253ac907 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 11:37:36 +0100 Subject: [PATCH 1/9] use case when no linked files handled --- .../checks/modelchecker_check.py | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 9f8dd5e24..482ebcd38 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -695,18 +695,21 @@ def DocPhases(doc, links = []): ## RVT Links dashboard section # print RVT links names output.print_md("# RVT Links") - rvtlinkdocsNameFormated = [] - for i in rvtlinkdocsName: - rvtlinkdocsNameFormated.append([i]) - for j in rvtlinkdocsNameFormated: - j.append(' ') - output.print_table(rvtlinkdocsNameFormated, columns=['Files list'], formats=None, title='', last_line_style='') - # Make row - htmlRowRVTlinks = ( - dashboardRectMaker(rvtlinksCount, "RVTLinks", rvtlinksTres) + - dashboardRectMaker(rvtlinkspinnedCountTrue, "RVTLinks
pinned", rvtlinksPinnedTres) - ) - dashboardLeftMaker(htmlRowRVTlinks) + if rvtlinksNames == [] : + output.print_md("No links") + else: + rvtlinkdocsNameFormated = [] + for i in rvtlinkdocsName: + rvtlinkdocsNameFormated.append([i]) + for j in rvtlinkdocsNameFormated: + j.append(' ') + output.print_table(rvtlinkdocsNameFormated, columns=['Files list'], formats=None, title='', last_line_style='') + # Make row + htmlRowRVTlinks = ( + dashboardRectMaker(rvtlinksCount, "RVTLinks", rvtlinksTres) + + dashboardRectMaker(rvtlinkspinnedCountTrue, "RVTLinks
pinned", rvtlinksPinnedTres) + ) + dashboardLeftMaker(htmlRowRVTlinks) ## Views dashboard section # print Views section header From 2eef870c5678235830250966350902bf3f73a6af Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 13:05:47 +0100 Subject: [PATCH 2/9] use case when no linked files handled --- .idea/.gitignore | 8 +++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/modules.xml | 8 +++ .idea/preflight.iml | 8 +++ .idea/vcs.xml | 6 ++ .../checks/modelchecker_check.py | 55 +++++++++++-------- 6 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/preflight.iml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..c0532470e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../:\pyRevit\preflight\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..000b43d40 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/preflight.iml b/.idea/preflight.iml new file mode 100644 index 000000000..d0876a78d --- /dev/null +++ b/.idea/preflight.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 482ebcd38..23fb5091c 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -303,29 +303,32 @@ def checkModel(doc, output): .WhereElementIsNotElementType() .ToElementIds() ) - revitLinksdoc = DB.FilteredElementCollector(doc).OfClass(DB.RevitLinkInstance) rvtlinkdocs, rvtlinkdocsName = [], [] - for i in revitLinksdoc: - rvtlinkdocs.append(i.GetLinkDocument()) - rvtlinkdocsName.append(i.GetLinkDocument().Title) - rvtlinksCount = len(rvtlinks_id_collector) - # output.print_md(str(rvtlinksCount) +" Revit Links") - - # RVTLinks pinned - rvtlinks_collector = ( - DB.FilteredElementCollector(doc) - .OfCategory(DB.BuiltInCategory.OST_RvtLinks) - .WhereElementIsNotElementType() - .ToElements() - ) + if not len(rvtlinks_id_collector): + pass + else: + revitLinksdoc = DB.FilteredElementCollector(doc).OfClass(DB.RevitLinkInstance) + for i in revitLinksdoc: + rvtlinkdocs.append(i.GetLinkDocument()) + rvtlinkdocsName.append(i.GetLinkDocument().Title) + rvtlinksCount = len(rvtlinks_id_collector) + # output.print_md(str(rvtlinksCount) +" Revit Links") + + # RVTLinks pinned + rvtlinks_collector = ( + DB.FilteredElementCollector(doc) + .OfCategory(DB.BuiltInCategory.OST_RvtLinks) + .WhereElementIsNotElementType() + .ToElements() + ) - rvtlinkspinnedCount, rvtlinksNames = [], [] + rvtlinkspinnedCount, rvtlinksNames = [], [] - for x in rvtlinks_collector: - rvtlinkspinnedCount.append(x.Pinned) - rvtlinksNames.append(x.Name) - rvtlinkspinnedCountTrue = sum(rvtlinkspinnedCount) - # print(str(rvtlinkspinnedCountTrue) +" Revit Links pinned") + for x in rvtlinks_collector: + rvtlinkspinnedCount.append(x.Pinned) + rvtlinksNames.append(x.Name) + rvtlinkspinnedCountTrue = sum(rvtlinkspinnedCount) + # print(str(rvtlinkspinnedCountTrue) +" Revit Links pinned") ### View collectors # sheets @@ -635,10 +638,14 @@ def DocPhases(doc, links = []): # RVT links rvtlinksTres = 100 rvtlinksPinnedTres = -1 # The logic for threshold sometimes needs to be reverted - if rvtlinksCount == rvtlinkspinnedCountTrue : - rvtlinksPinnedTres = rvtlinksCount - else : + + if not len(rvtlinks_id_collector): pass + else: + if rvtlinksCount == rvtlinkspinnedCountTrue : + rvtlinksPinnedTres = rvtlinksCount + else : + pass # Views viewTres = 500 viewNotOnSheetTres = viewCount * 0.2 @@ -695,7 +702,7 @@ def DocPhases(doc, links = []): ## RVT Links dashboard section # print RVT links names output.print_md("# RVT Links") - if rvtlinksNames == [] : + if not len(rvtlinks_id_collector): output.print_md("No links") else: rvtlinkdocsNameFormated = [] From 5b933f48d19653688c7a6ea561d556a414cc4c47 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 17:53:11 +0100 Subject: [PATCH 3/9] use case when no linked files handled --- .../checks/modelchecker_check.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 23fb5091c..5aa0655d5 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -261,6 +261,10 @@ def checkModel(doc, output): printedName = "Not saved file" else: # workshared file + project_info_collector = doc.ProjectInformation + projectNumber = project_info_collector.Number + projectName = project_info_collector.Name + projectClient = project_info_collector.ClientName try: central_path = revit.query.get_central_path(doc) try: @@ -695,9 +699,9 @@ def DocPhases(doc, links = []): ### Dashaboard starts here ### ## RVT file dashboard section - output.print_md("# RVT Files
") - output.print_md("### Current file: " ) - output.print_md(printedName) + output.print_md("# RVT File
") + projectInfo = "Current file name: "+ printedName + "
Project Name: " + projectName + "
Project Number: " + str(projectNumber) + "
Client Name: " + projectClient + output.print_md(projectInfo) ## RVT Links dashboard section # print RVT links names From 8e0af5d1e8665cc4b147a629147f61967d063b01 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:02:25 +0100 Subject: [PATCH 4/9] Delete .gitignore --- .idea/.gitignore | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index c0532470e..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/../../../../:\pyRevit\preflight\.idea/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ From 8bf064f5b6572857fe82471dc848f5bcaec6cd15 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:02:36 +0100 Subject: [PATCH 5/9] Delete profiles_settings.xml --- .idea/inspectionProfiles/profiles_settings.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2..000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file From ae4d6a1d57ed6311972cf0a4b1631c21cd1bb770 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:02:58 +0100 Subject: [PATCH 6/9] Delete modules.xml --- .idea/modules.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/modules.xml diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 000b43d40..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 3c9c70e8dbf80f4747d4322b6da0aa4c46df3fb8 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:03:10 +0100 Subject: [PATCH 7/9] Delete preflight.iml --- .idea/preflight.iml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .idea/preflight.iml diff --git a/.idea/preflight.iml b/.idea/preflight.iml deleted file mode 100644 index d0876a78d..000000000 --- a/.idea/preflight.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 16eb35f2b2b9b960b7eb5a27819d56f6e838bca2 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:03:18 +0100 Subject: [PATCH 8/9] Delete vcs.xml --- .idea/vcs.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 43cbed689d85d1600770fc7f6e2d3e99e01f4f09 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 15 Jan 2021 21:08:51 +0100 Subject: [PATCH 9/9] fixed the not saved project info --- .../pyRevitTools.extension/checks/modelchecker_check.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 5aa0655d5..265124b5a 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -256,15 +256,14 @@ def checkModel(doc, output): # printing file name and heading name = doc.PathName + project_info_collector = doc.ProjectInformation + projectNumber = project_info_collector.Number + projectName = project_info_collector.Name + projectClient = project_info_collector.ClientName if len(name) == 0: # name = "Not saved file" printedName = "Not saved file" else: - # workshared file - project_info_collector = doc.ProjectInformation - projectNumber = project_info_collector.Number - projectName = project_info_collector.Name - projectClient = project_info_collector.ClientName try: central_path = revit.query.get_central_path(doc) try: