From 8059bf083759bb7f1c54ed8fd351c558b2c02750 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 18 Dec 2020 11:10:20 +0100 Subject: [PATCH 1/5] Added my first check within the modelchecker_check RVT Links --- .../checks/modelchecker_check.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 28ad06d41..2d5a55a88 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -288,6 +288,16 @@ def checkModel(doc, output): except: pass + # RVTLinks + rvtlinks_id_collector = ( + DB.FilteredElementCollector(doc) + .OfCategory(DB.BuiltInCategory.OST_RvtLinks) + .WhereElementIsNotElementType() + .ToElementIds() + ) + rvtlinksCount = len(rvtlinks_id_collector) + # print(str(rvtlinksCount)+" Revit Link") + # sheets sheets_id_collector = ( DB.FilteredElementCollector(doc) @@ -388,6 +398,7 @@ def checkModel(doc, output): scheduleNotOnSheet = scheduleCount - len(schedulesOnSheet) # tresholds + rvtlinksTres = 100 viewTres = 500 viewNotOnSheetTres = viewCount * 0.2 copiedViewTres = viewCount * 0.2 @@ -396,6 +407,7 @@ def checkModel(doc, output): schedulesNotOnSheetTres = scheduleCount * 0.3 htmlRow1 = ( + dashboardRectMaker(rvtlinksCount, "RVT Links", rvtlinksTres) + dashboardRectMaker(viewCount, "Views", viewTres) + dashboardRectMaker( copiedView, "Copied Views", copiedViewTres From f6de4bfad7153f70071f02ce2978f3e7414d657b Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 18 Dec 2020 20:04:29 +0100 Subject: [PATCH 2/5] Landslide --- .../checks/modelchecker_check.py | 52 +++++++++++++++++-- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 2d5a55a88..805d0e279 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -237,6 +237,11 @@ def dashboardCenterMaker(value): html_code = "
" + content + "
" print(coreutils.prepare_html_str(html_code)) +def dashboardLeftMaker(value): + """dashboard HTMl maker - div for left aligning""" + content = str(value) + html_code = "
" + content + "
" + print(coreutils.prepare_html_str(html_code)) def path2fileName(file_path, divider): """returns file name - everything in path from "\\" or "/" to the end""" @@ -273,7 +278,7 @@ def checkModel(doc, output): # detached file printedName = file_path output.print_md("# MODEL CHECKER") - output.print_md("## " + printedName) + # first JS to avoid error in IE output window when at first run # this is most likely not proper way @@ -288,6 +293,11 @@ def checkModel(doc, output): except: pass + # RVT Links section header + output.print_md("## RVT Files
") + output.print_md("### Current file: " ) + output.print_md(printedName) + # RVTLinks rvtlinks_id_collector = ( DB.FilteredElementCollector(doc) @@ -296,7 +306,41 @@ def checkModel(doc, output): .ToElementIds() ) rvtlinksCount = len(rvtlinks_id_collector) - # print(str(rvtlinksCount)+" Revit Link") + # output.print_md(str(rvtlinksCount) +" Revit Links") + + # RVTLinks pinned + rvtlinks_collector = ( + DB.FilteredElementCollector(doc) + .OfCategory(DB.BuiltInCategory.OST_RvtLinks) + .WhereElementIsNotElementType() + .ToElements() + ) + rvtlinkspinnedCount, rvtlinksNames = [], [] + for x in rvtlinks_collector: + rvtlinkspinnedCount.append(x.Pinned) + rvtlinksNames.append(x.Name) + rvtlinkspinnedCountTrue = sum(rvtlinkspinnedCount) + output.print_md("### " + str(rvtlinksCount) + " RVT Links") + output.print_md("
".join(rvtlinksNames)) + # print(str(rvtlinkspinnedCountTrue) +" Revit Links pinned") + + # tresholds + rvtlinksTres = 100 + rvtlinksPinnedTres = -1 + if rvtlinksCount == rvtlinkspinnedCountTrue : + rvtlinksPinnedTres = rvtlinksCount + else : + pass + output.print_md(str(rvtlinksPinnedTres)) + + htmlRow0 = ( + dashboardRectMaker(rvtlinksCount, "RVTLinks", rvtlinksTres) + + dashboardRectMaker(rvtlinkspinnedCountTrue, "RVTLinks pinned", rvtlinksPinnedTres) + ) + dashboardLeftMaker(htmlRow0) + + # Views section header + output.print_md("## Views / Sheets / Schedules") # sheets sheets_id_collector = ( @@ -398,7 +442,6 @@ def checkModel(doc, output): scheduleNotOnSheet = scheduleCount - len(schedulesOnSheet) # tresholds - rvtlinksTres = 100 viewTres = 500 viewNotOnSheetTres = viewCount * 0.2 copiedViewTres = viewCount * 0.2 @@ -407,7 +450,6 @@ def checkModel(doc, output): schedulesNotOnSheetTres = scheduleCount * 0.3 htmlRow1 = ( - dashboardRectMaker(rvtlinksCount, "RVT Links", rvtlinksTres) + dashboardRectMaker(viewCount, "Views", viewTres) + dashboardRectMaker( copiedView, "Copied Views", copiedViewTres @@ -427,7 +469,7 @@ def checkModel(doc, output): schedulesNotOnSheetTres ) ) - dashboardCenterMaker(htmlRow1) + dashboardLeftMaker(htmlRow1) # warnings allWarnings_collector = doc.GetWarnings() From 011706e32cf94ddd38cc8beadc8860015646d98c Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Tue, 22 Dec 2020 13:58:02 +0100 Subject: [PATCH 3/5] Refac of data collection and dispay I organized the file as follow in order to modularize it later on more easily: - Collectors - Thresholds (would like to have it in a separate file to be able to set it differently depending on the size of the project) - Graphics all are grouped now todo: - thresholds in a config file - UI with presets: modelchecker big project, model charcker small projects all grabing the proper thresholds set --- .../checks/modelchecker_check.py | 420 +++++++++++------- 1 file changed, 271 insertions(+), 149 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 805d0e279..068a35568 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -279,7 +279,6 @@ def checkModel(doc, output): printedName = file_path output.print_md("# MODEL CHECKER") - # first JS to avoid error in IE output window when at first run # this is most likely not proper way try: @@ -293,11 +292,9 @@ def checkModel(doc, output): except: pass - # RVT Links section header - output.print_md("## RVT Files
") - output.print_md("### Current file: " ) - output.print_md(printedName) - + ### Collectors ### + + ### RVTLinks collector # RVTLinks rvtlinks_id_collector = ( DB.FilteredElementCollector(doc) @@ -308,40 +305,23 @@ def checkModel(doc, output): rvtlinksCount = len(rvtlinks_id_collector) # output.print_md(str(rvtlinksCount) +" Revit Links") - # RVTLinks pinned + # RVTLinks pinned rvtlinks_collector = ( DB.FilteredElementCollector(doc) .OfCategory(DB.BuiltInCategory.OST_RvtLinks) .WhereElementIsNotElementType() .ToElements() ) + rvtlinkspinnedCount, rvtlinksNames = [], [] + for x in rvtlinks_collector: rvtlinkspinnedCount.append(x.Pinned) rvtlinksNames.append(x.Name) rvtlinkspinnedCountTrue = sum(rvtlinkspinnedCount) - output.print_md("### " + str(rvtlinksCount) + " RVT Links") - output.print_md("
".join(rvtlinksNames)) # print(str(rvtlinkspinnedCountTrue) +" Revit Links pinned") - # tresholds - rvtlinksTres = 100 - rvtlinksPinnedTres = -1 - if rvtlinksCount == rvtlinkspinnedCountTrue : - rvtlinksPinnedTres = rvtlinksCount - else : - pass - output.print_md(str(rvtlinksPinnedTres)) - - htmlRow0 = ( - dashboardRectMaker(rvtlinksCount, "RVTLinks", rvtlinksTres) + - dashboardRectMaker(rvtlinkspinnedCountTrue, "RVTLinks pinned", rvtlinksPinnedTres) - ) - dashboardLeftMaker(htmlRow0) - - # Views section header - output.print_md("## Views / Sheets / Schedules") - + ### View collectors # sheets sheets_id_collector = ( DB.FilteredElementCollector(doc) @@ -360,10 +340,16 @@ def checkModel(doc, output): .ToElements() ) scheduleCount = 0 + ### scheduleNames = [] for schedule in schedules_id_collector: - if schedule.Name[:19] != "": + if ( + schedule.Name[:19] != "" + # to support french files + or schedule.Name[:28] != "" + ): scheduleCount += 1 - + ### scheduleNames.append((schedule.Name)) + ### output.print_md("
".join(scheduleNames)) # views views_id_collector = ( DB.FilteredElementCollector(doc) @@ -381,8 +367,12 @@ def checkModel(doc, output): viewNameString[-6:-2] == "Copy" or viewNameString[-4:] == "Copy" or viewNameString[:7] == "Section" + # to support french files + or viewNameString[-7:-2] == "Copie" + or viewNameString[-5:] == "Copie" + or viewNameString[-5:] == "Coupe" + ): - # if viewNameString[:7] == "Section": copiedView += 1 except: pass @@ -409,7 +399,7 @@ def checkModel(doc, output): # schedules not on sheets schedulesOnSheet = [] - scheduleCollector1 = ( + ScheduleCollectorInstances = ( DB.FilteredElementCollector(doc) .OfClass(DB.ScheduleSheetInstance) .WhereElementIsNotElementType() @@ -431,7 +421,7 @@ def checkModel(doc, output): schedulesOnSheet.append(schedName) # there is need to iterate class and category filter to get all schedule - UnionWith didn't work - for schedule in scheduleCollector1: + for schedule in ScheduleCollectorInstances: schedName = schedule.Name if schedName[:19] != "": if schedName not in schedulesOnSheet: @@ -441,35 +431,6 @@ def checkModel(doc, output): schedulesOnSheet.append(schedName) scheduleNotOnSheet = scheduleCount - len(schedulesOnSheet) - # tresholds - viewTres = 500 - viewNotOnSheetTres = viewCount * 0.2 - copiedViewTres = viewCount * 0.2 - sheetsTres = 500 - scheduleTres = 500 - schedulesNotOnSheetTres = scheduleCount * 0.3 - - htmlRow1 = ( - dashboardRectMaker(viewCount, "Views", viewTres) - + dashboardRectMaker( - copiedView, "Copied Views", copiedViewTres - ) - + dashboardRectMaker(sheetCount, "Sheets", sheetsTres) - + dashboardRectMaker( - scheduleCount, "Schedules", scheduleTres - ) - + dashboardRectMaker( - viewsNotOnSheet, - "Views
not on Sheet", - viewNotOnSheetTres - ) - + dashboardRectMaker( - scheduleNotOnSheet, - "Schedules
not on Sheet", - schedulesNotOnSheetTres - ) - ) - dashboardLeftMaker(htmlRow1) # warnings allWarnings_collector = doc.GetWarnings() @@ -531,43 +492,7 @@ def checkModel(doc, output): dwgCount = len(dwg_collector) linkedDwg = dwgCount - importedDwg - # tresholds - warningsTres = 500 - criticalWarningsTres = 0 - materialsTres = 150 - linePatternsTres = 100 - importedDwgTres = 0 - linkedDwgTres = viewCount / 2 - dwgNotCurrentViewTres = 0 - - # dashboard row 2 - htmlRow2 = ( - dashboardRectMaker( - allWarningsCount, "Warnings", warningsTres - ) - + dashboardRectMaker( - criticalWarningCount, - "Critical
Warnings", - criticalWarningsTres - ) - + dashboardRectMaker( - materialCount, "Materials", materialsTres - ) - + dashboardRectMaker( - linePatternCount, "Line Patterns", linePatternsTres - ) - + dashboardRectMaker( - importedDwg, "Imported DWGs", importedDwgTres - ) - + dashboardRectMaker( - linkedDwg, "Linked DWGs", linkedDwgTres - ) - + dashboardRectMaker( - dwgNotCurrentView, "DWGs in 3D", dwgNotCurrentViewTres - ) - ) - dashboardCenterMaker(htmlRow2) - + # families graphFCatHeadings = [] graphFCatData = [] @@ -586,18 +511,6 @@ def checkModel(doc, output): NotParamFamiliesCount += 1 familyCount = families.GetElementCount() - # tresholds - familiesTres = 500 - if familyCount < 500: - inPlaceFamilyTres = familyCount * 0.2 - else: - inPlaceFamilyTres = 500 * 0.2 - notParamFamiliesTres = familyCount * 0.3 - textnoteWFtres = 0 - textnoteCaps = 0 - rampTres = 0 - archTres = 0 - # Text notes width factor != 1 textNoteType_collector = ( DB.FilteredElementCollector(doc) @@ -638,36 +551,6 @@ def checkModel(doc, output): .GetElementCount() ) - # dashboard row3 - htmlRow3 = ( - dashboardRectMaker(familyCount, "Families", familiesTres) - + dashboardRectMaker( - inPlaceFamilyCount, - "In Place
Families", - inPlaceFamilyTres - ) - + dashboardRectMaker( - NotParamFamiliesCount, - "Families
not parametric", - notParamFamiliesTres - ) - + dashboardRectMaker( - textnoteWFcount, - "Text - Width
Factor changed", - textnoteWFtres - ) - + dashboardRectMaker( - capsCount, "Text - AllCaps", textnoteCaps - ) - + dashboardRectMaker(ramp_collector, "Ramps", rampTres) - + dashboardRectMaker( - archColumn_collector, - "Architecural
Columns", - archTres - ) - ) - dashboardCenterMaker(htmlRow3) - # detail groups detailGroupCount = ( DB.FilteredElementCollector(doc) @@ -714,42 +597,280 @@ def checkModel(doc, output): .GetElementCount() ) - # tresholds + ### tresholds ### + # RVT links + rvtlinksTres = 100 + rvtlinksPinnedTres = -1 # The logic for threshold sometimes needs to be reverted + if rvtlinksCount == rvtlinkspinnedCountTrue : + rvtlinksPinnedTres = rvtlinksCount + else : + pass + # Views + viewTres = 500 + viewNotOnSheetTres = viewCount * 0.2 + copiedViewTres = viewCount * 0.2 + # Sheets + sheetsTres = 500 + # Schedules + scheduleTres = 500 + schedulesNotOnSheetTres = scheduleCount * 0.3 + # Warnings + warningsTres = 500 + criticalWarningsTres = 0 + # Materials + materialsTres = 150 + # Line patterns + linePatternsTres = 100 + # DWGs + importedDwgTres = 0 + linkedDwgTres = viewCount / 2 + dwgNotCurrentViewTres = 0 + # Families + familiesTres = 500 + if familyCount < 500: + inPlaceFamilyTres = familyCount * 0.2 + else: + inPlaceFamilyTres = 500 * 0.2 + notParamFamiliesTres = familyCount * 0.3 + #TextNotes + textnoteWFtres = 0 + textnoteCaps = 0 + # Ramps + rampTres = 0 + # Architectural columns + archTres = 0 + # Groups detailGroupTypeTres = 30 detailGroupTres = 500 modelGroupTypeTres = 30 modelGroupTres = 200 + # Reference planes noNameRefPTres = 0 + # Elements count elementsTres = 1000000 + + ### Dashaboard starts here ### + + ## RVT file dashboard section + output.print_md("## RVT Files
") + output.print_md("### Current file: " ) + output.print_md(printedName) + + ## RVT Links dashboard section + # print RVT links names + output.print_md("## RVT Links") + output.print_md("
".join(rvtlinksNames)) + # Make row + htmlRowRVTlinks = ( + dashboardRectMaker(rvtlinksCount, "RVTLinks", rvtlinksTres) + + dashboardRectMaker(rvtlinkspinnedCountTrue, "RVTLinks
pinned", rvtlinksPinnedTres) + ) + dashboardLeftMaker(htmlRowRVTlinks) + + ## Views dashboard section + # print Views section header + output.print_md("## Views") - # dashboard - htmlRow4 = ( + # Make row + htmlRowViews = ( + dashboardRectMaker(viewCount, "Views", viewTres) + + dashboardRectMaker( + copiedView, "Copied Views", copiedViewTres + ) + + dashboardRectMaker( + viewsNotOnSheet, + "Views
not on Sheet", + viewNotOnSheetTres + ) + ) + dashboardLeftMaker(htmlRowViews) + + ## Schedule dashboard section + # print Schedules section header + output.print_md("## Schedules") + + # Make row + htmlRowSchedules = ( + dashboardRectMaker( + scheduleCount, "Schedules", scheduleTres + ) + + dashboardRectMaker( + scheduleNotOnSheet, + "Schedules
not on Sheet", + schedulesNotOnSheetTres + ) + ) + dashboardLeftMaker(htmlRowSchedules) + + ## Sheets dashboard section + # print Sheets section header + output.print_md("## Sheets") + + # Make row + htmlRowSheets = ( + dashboardRectMaker(sheetCount, "Sheets", sheetsTres) + ) + dashboardLeftMaker(htmlRowSheets) + + ## Warnings dashboard section + # print Warnings section header + output.print_md("## Warnings") + # Make row + htmlRowWarnings = ( + dashboardRectMaker( + allWarningsCount, "Warnings", warningsTres + ) + + dashboardRectMaker( + criticalWarningCount, + "Critical
Warnings", + criticalWarningsTres + ) + ) + dashboardLeftMaker(htmlRowWarnings) + + ## Materials dashboard section + # print Materials section header + output.print_md("## Materials") + + # Make row + htmlRowMaterials = ( + dashboardRectMaker( + materialCount, "Materials", materialsTres + ) + ) + dashboardLeftMaker(htmlRowMaterials) + + ## Line patterns dashboard section + # print Line patterns section header + output.print_md("## Line patterns") + + # Make row + htmlRowLinePatterns = (dashboardRectMaker( + linePatternCount, "Line Patterns", linePatternsTres + ) + ) + dashboardLeftMaker(htmlRowLinePatterns) + + ## DWGs dashboard section + # print DWGs section header + output.print_md("## DWGs") + + # Make row + htmlRowDWGs = (dashboardRectMaker( + importedDwg, "Imported DWGs", importedDwgTres + ) + + dashboardRectMaker( + linkedDwg, "Linked DWGs", linkedDwgTres + ) + + dashboardRectMaker( + dwgNotCurrentView, "DWGs in 3D", dwgNotCurrentViewTres + ) + ) + dashboardLeftMaker(htmlRowDWGs) + + ## Loadable Families dashboard section + # print Loadable Families section header + output.print_md("## Loadable Families") + + # Make row + htmlRowLoadableFamilies = ( + dashboardRectMaker(familyCount, "Families", familiesTres) + + dashboardRectMaker( + inPlaceFamilyCount, + "In Place
Families", + inPlaceFamilyTres + ) + + dashboardRectMaker( + NotParamFamiliesCount, + "Families
not parametric", + notParamFamiliesTres + ) + ) + dashboardLeftMaker(htmlRowLoadableFamilies) + + ## Text Notes dashboard section + # print Text Notes section header + output.print_md("## Text Notes") + + # Make row + htmlRowTextNotes = (dashboardRectMaker( + textnoteWFcount, + "Text - Width
Factor changed", + textnoteWFtres + ) + + dashboardRectMaker( + capsCount, "Text - AllCaps", textnoteCaps + ) + ) + dashboardLeftMaker(htmlRowTextNotes) + + ## System families dashboard section + # print System families section header + output.print_md("## System Families") + + # Make row + htmlRowTextNotes = (dashboardRectMaker( + ramp_collector, "Ramps", rampTres) + + dashboardRectMaker( + archColumn_collector, + "Architecural
Columns", + archTres + ) + ) + dashboardLeftMaker(htmlRowTextNotes) + + + ## Groups dashboard section + # print Groups section header + output.print_md("## Groups") + # Make row + htmlRowGroupsTypes = ( dashboardRectMaker( detailGroupTypeCount, "Detail Group
Types", detailGroupTypeTres ) - + dashboardRectMaker( - detailGroupCount, "Detail Groups", detailGroupTres - ) + dashboardRectMaker( modelGroupTypeCount, "Model Group
Types", modelGroupTypeTres ) + ) + dashboardLeftMaker(htmlRowGroupsTypes) + + htmlRowGroups = (dashboardRectMaker( + detailGroupCount, "Detail Groups", detailGroupTres + ) + dashboardRectMaker( modelGroupCount, "Model Groups", modelGroupTres ) - + dashboardRectMaker( + ) + dashboardLeftMaker(htmlRowGroups) + + ## Reference Planes dashboard section + # print Reference Planes section header + output.print_md("## Reference Planes") + # Make row + htmlRowRefPlanes = ( + dashboardRectMaker( noNameRefPCount, "NoName
Reference Planes", noNameRefPTres ) - + dashboardRectMaker( + ) + dashboardLeftMaker(htmlRowRefPlanes) + + ## Elements count dashboard section + # print Elements count section header + output.print_md("## Elements count") + + # Make row + htmlRowElementsCount = (dashboardRectMaker( elementCount, "Elements", elementsTres ) ) - dashboardCenterMaker(htmlRow4) + dashboardLeftMaker(htmlRowElementsCount) + # divider print("\n\n\n\n") @@ -940,6 +1061,7 @@ def checkModel(doc, output): chartFCategories.draw() + class ModelChecker(PreflightTestCase): """Revit model quality check""" From a2953bff46ddf4d843a3b3e1c29cbdbb8cf4a2fc Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Tue, 22 Dec 2020 17:50:32 +0100 Subject: [PATCH 4/5] added refplanes count and threshold and fixed for french version --- .../pyRevitTools.extension/checks/modelchecker_check.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 068a35568..04d97135c 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -585,9 +585,10 @@ def checkModel(doc, output): .OfClass(DB.ReferencePlane) .ToElements() ) + RefPCount = len(refPlaneCollector) noNameRefPCount = 0 for refPlane in refPlaneCollector: - if refPlane.Name == "Reference Plane": + if (refPlane.Name == "Reference Plane" or refPlane.Name == "Plan de référence"): # for french compatibility noNameRefPCount += 1 # Element Count @@ -646,6 +647,7 @@ def checkModel(doc, output): modelGroupTres = 200 # Reference planes noNameRefPTres = 0 + RefPTres = 20 # Elements count elementsTres = 1000000 @@ -857,6 +859,11 @@ def checkModel(doc, output): "NoName
Reference Planes", noNameRefPTres ) + + dashboardRectMaker( + RefPCount, + "Reference Planes", + RefPTres + ) ) dashboardLeftMaker(htmlRowRefPlanes) From 38603581cd09359ed94e6767e06fc7b7d5231b78 Mon Sep 17 00:00:00 2001 From: jmcouffin Date: Fri, 8 Jan 2021 18:23:04 +0100 Subject: [PATCH 5/5] Massive graphic refact + added rvt links and phases data --- .../checks/modelchecker_check.py | 86 ++++++++++++++----- pyrevitlib/pyrevit/output/outputstyles.css | 49 +++++++---- 2 files changed, 96 insertions(+), 39 deletions(-) diff --git a/extensions/pyRevitTools.extension/checks/modelchecker_check.py b/extensions/pyRevitTools.extension/checks/modelchecker_check.py index 04d97135c..9f8dd5e24 100644 --- a/extensions/pyRevitTools.extension/checks/modelchecker_check.py +++ b/extensions/pyRevitTools.extension/checks/modelchecker_check.py @@ -277,7 +277,8 @@ def checkModel(doc, output): except: # detached file printedName = file_path - output.print_md("# MODEL CHECKER") + output.print_md("# **MODEL CHECKER**") + output.print_md("---") # first JS to avoid error in IE output window when at first run # this is most likely not proper way @@ -302,6 +303,11 @@ 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") @@ -598,6 +604,33 @@ def checkModel(doc, output): .GetElementCount() ) + def inner_lists(lst): + if all(isinstance(x, list) for x in lst): + return [x for inner in lst for x in inner_lists(inner)] + else: + return [lst] + #Get list of phases in Doc and RVT Links + #Get current document + linkdocPhasesName = [] + + def DocPhases(doc, links = []): + #Get document phases + docPhases = doc.Phases + #Get document phases names + docPhasesName = [] + for i in docPhases: + docPhasesName.append(i.Name) + #Get links phases + for x in links: + linkdocPhases = [] + for y in x.Phases: + linkdocPhases.append(y.Name) + linkdocPhasesName.append(linkdocPhases) + return docPhasesName, linkdocPhasesName + + #Call for phases definition + phase = inner_lists(DocPhases(doc,rvtlinkdocs)) + ### tresholds ### # RVT links rvtlinksTres = 100 @@ -650,18 +683,24 @@ def checkModel(doc, output): RefPTres = 20 # Elements count elementsTres = 1000000 + ### Dashaboard starts here ### ## RVT file dashboard section - output.print_md("## RVT Files
") + output.print_md("# RVT Files
") output.print_md("### Current file: " ) output.print_md(printedName) ## RVT Links dashboard section # print RVT links names - output.print_md("## RVT Links") - output.print_md("
".join(rvtlinksNames)) + 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) + @@ -671,7 +710,7 @@ def checkModel(doc, output): ## Views dashboard section # print Views section header - output.print_md("## Views") + output.print_md("# Views") # Make row htmlRowViews = ( @@ -689,7 +728,7 @@ def checkModel(doc, output): ## Schedule dashboard section # print Schedules section header - output.print_md("## Schedules") + output.print_md("# Schedules") # Make row htmlRowSchedules = ( @@ -706,7 +745,7 @@ def checkModel(doc, output): ## Sheets dashboard section # print Sheets section header - output.print_md("## Sheets") + output.print_md("# Sheets") # Make row htmlRowSheets = ( @@ -716,7 +755,7 @@ def checkModel(doc, output): ## Warnings dashboard section # print Warnings section header - output.print_md("## Warnings") + output.print_md("# Warnings") # Make row htmlRowWarnings = ( dashboardRectMaker( @@ -732,7 +771,7 @@ def checkModel(doc, output): ## Materials dashboard section # print Materials section header - output.print_md("## Materials") + output.print_md("# Materials") # Make row htmlRowMaterials = ( @@ -744,7 +783,7 @@ def checkModel(doc, output): ## Line patterns dashboard section # print Line patterns section header - output.print_md("## Line patterns") + output.print_md("# Line patterns") # Make row htmlRowLinePatterns = (dashboardRectMaker( @@ -755,7 +794,7 @@ def checkModel(doc, output): ## DWGs dashboard section # print DWGs section header - output.print_md("## DWGs") + output.print_md("# DWGs") # Make row htmlRowDWGs = (dashboardRectMaker( @@ -772,7 +811,7 @@ def checkModel(doc, output): ## Loadable Families dashboard section # print Loadable Families section header - output.print_md("## Loadable Families") + output.print_md("# Loadable Families") # Make row htmlRowLoadableFamilies = ( @@ -792,7 +831,7 @@ def checkModel(doc, output): ## Text Notes dashboard section # print Text Notes section header - output.print_md("## Text Notes") + output.print_md("# Text Notes") # Make row htmlRowTextNotes = (dashboardRectMaker( @@ -808,7 +847,7 @@ def checkModel(doc, output): ## System families dashboard section # print System families section header - output.print_md("## System Families") + output.print_md("# System Families") # Make row htmlRowTextNotes = (dashboardRectMaker( @@ -824,7 +863,7 @@ def checkModel(doc, output): ## Groups dashboard section # print Groups section header - output.print_md("## Groups") + output.print_md("# Groups") # Make row htmlRowGroupsTypes = ( dashboardRectMaker( @@ -851,7 +890,7 @@ def checkModel(doc, output): ## Reference Planes dashboard section # print Reference Planes section header - output.print_md("## Reference Planes") + output.print_md("# Reference Planes") # Make row htmlRowRefPlanes = ( dashboardRectMaker( @@ -869,7 +908,7 @@ def checkModel(doc, output): ## Elements count dashboard section # print Elements count section header - output.print_md("## Elements count") + output.print_md("# Elements count") # Make row htmlRowElementsCount = (dashboardRectMaker( @@ -878,6 +917,13 @@ def checkModel(doc, output): ) dashboardLeftMaker(htmlRowElementsCount) + ## Phases dashboard section + # print Phases section header + output.print_md("# Phases\n") + rvtlinkdocsName.insert(0,printedName) + filePhases = rvtlinkdocsName,[','.join(i) for i in phase] + output.print_table(zip(*filePhases), columns=["File Name","Phases"], formats=None, title='', last_line_style='') + # divider print("\n\n\n\n") @@ -944,7 +990,7 @@ def checkModel(doc, output): chartCategories.options.title = { "display": True, "text": "Element Count by Category", - "fontSize": 18, + "fontSize": 25, "fontColor": "#000", "fontStyle": "bold", } @@ -1006,7 +1052,7 @@ def checkModel(doc, output): chartWorksets.options.title = { "display": True, "text": "Element Count by Workset", - "fontSize": 18, + "fontSize": 25, "fontColor": "#000", "fontStyle": "bold", } @@ -1045,7 +1091,7 @@ def checkModel(doc, output): chartFCategories.options.title = { "display": True, "text": "InPlace Family Count by Category", - "fontSize": 18, + "fontSize": 25, "fontColor": "#000", "fontStyle": "bold", } diff --git a/pyrevitlib/pyrevit/output/outputstyles.css b/pyrevitlib/pyrevit/output/outputstyles.css index 5d4e1ebc9..e54e8704f 100644 --- a/pyrevitlib/pyrevit/output/outputstyles.css +++ b/pyrevitlib/pyrevit/output/outputstyles.css @@ -186,27 +186,34 @@ tr:nth-child(odd) { } .dashboardRectNormal { - background-color: #a6c844; + background-color: #9cbf72; font-size: 3em; - margin: 3px; + font-variant: ; + margin: 2px; padding: 10px 8px 8px 8px; - color: #fff; - height: 80px; - min-width: 80px; - text-align: center; + color: #324320; + height: 100px; + width: 130px; + text-align: left; + font-weight: bold; display: inline-table; + box-shadow: 1px 1px 2px; + text-transform: uppercase; } .dashboardRectMediocre { - background-color: #fa0; + background-color: #ffb444; font-size: 3em; - margin: 3px; + margin: 2px; padding: 10px 8px 8px 8px; - color: #fff; - height: 80px; - min-width: 80px; - text-align: center; + color: #653f0c; + height: 100px; + width: 130px; + text-align: left; + font-weight: bold; display: inline-table; + box-shadow: 1px 1px 2px; + text-transform: uppercase; } .dashboardRectMediocre:hover{ @@ -214,15 +221,18 @@ tr:nth-child(odd) { } .dashboardRectCritical{ - background-color: #a00; + background-color: #e26d70; font-size: 3em; - margin: 3px; + margin: 2px; padding: 10px 8px 8px 8px; - color: #fff; - height: 80px; - min-width: 80px; - text-align: center; + color: #521114; + height: 100px; + width: 130px; + text-align: left; + font-weight: bold; display: inline-table; + box-shadow: 1px 1px 2px; + text-transform: uppercase; } .dashboardRectCritical:hover{ @@ -231,7 +241,8 @@ tr:nth-child(odd) { .dashboardSmall { font-size: 0.4em; -} + font-weight: bold; + } .dashboardCenter { text-align: center;