Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.ModelHealth package

Subpackages

Submodules

duHast.Revit.ModelHealth.model_health module

Model health report functions.

Model health report metrics can either be displayed in a family where each parameter is assigned to a metric and or data can be exported to text files which can be used to visualize key metrics over time.

duHast.Revit.ModelHealth.model_health.get_instances_of_model_health(doc)

Gets all instances of the model health tracker family in a model.

Built in parameter containing family name when filtering familyInstance elements: BuiltInParameter.ELEM_FAMILY_PARAM This is a faster filter in terms of performance then LINQ query refer to: https://jeremytammik.github.io/tbc/a/1382_filter_shortcuts.html

Parameters:

doc (Autodesk.Revit.DB.Document) – Current Revit model document.

Returns:

A list containing all model health tracker families in the model.

Return type:

list of Autodesk.Revit.DB.FamilyInstance

duHast.Revit.ModelHealth.model_health.get_parameters_of_instance(fam_instance, doc)

Updates parameter values of model tracker family instance.

Parameters:
  • fam_instance (Autodesk.Revit.DB.FamilyInstance) – An instance of the model health tracker family.

  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

Returns:

Result class instance.

  • .status True if all parameters where found on the family and got updated successfully or no update at all was required. Otherwise False.

  • .message will be ‘Failed to get value for’

Return type:

Result

duHast.Revit.ModelHealth.model_health.health_data_action

alias of healthDataAction

duHast.Revit.ModelHealth.model_health.PARAM_ACTIONS = {'ValueArrowHeadStyles': healthDataAction(get_data=<function get_number_of_arrow_head_types>, report_file_name='_NumberOfArrowHeadStyles'), 'ValueArrowHeadStylesUnused': healthDataAction(get_data=<function get_number_of_unused_arrow_head_types>, report_file_name='_NumberOfArrowHeadStylesUnused'), 'ValueCADImports': healthDataAction(get_data=<function get_number_of_cad_imports>, report_file_name='_NumberOfCadImports'), 'ValueCADLinksToModel': healthDataAction(get_data=<function get_number_of_cad_links_to_model>, report_file_name='_NumberOfCadLinksModel'), 'ValueCADLinksToView': healthDataAction(get_data=<function get_number_of_cad_links_to_view>, report_file_name='_NumberOfCadLinksView'), 'ValueDateLastUpdated': healthDataAction(get_data=<function get_current_date>, report_file_name='_DateLastUpdated'), 'ValueDesignOptions': healthDataAction(get_data=<function get_number_of_design_options>, report_file_name='_NumberOfDesignOptions'), 'ValueDesignSets': healthDataAction(get_data=<function get_number_of_design_sets>, report_file_name='_NumberOfDesignSets'), 'ValueDetailGroups': healthDataAction(get_data=<function get_number_of_detail_groups>, report_file_name='_NumberOfDetailGroups'), 'ValueDetailGroupsUnplaced': healthDataAction(get_data=<function get_number_of_unplaced_detail_groups>, report_file_name='_NumberOfUnplacedDetailGroups'), 'ValueDimensionStyles': healthDataAction(get_data=<function get_number_of_dimension_types>, report_file_name='_NumberOfDimStyles'), 'ValueDimensionStylesUnused': healthDataAction(get_data=<function get_number_of_unused_dimension_types>, report_file_name='_NumberOfDimStylesUnused'), 'ValueFamilies': healthDataAction(get_data=<function get_number_of_families>, report_file_name='_NumberOfFamilies'), 'ValueFamiliesInPlace': healthDataAction(get_data=<function get_number_of_in_place_families>, report_file_name='_NumberOfInPlaceFamilies'), 'ValueFileSize': healthDataAction(get_data=<function get_current_file_size>, report_file_name='_FileSize'), 'ValueFillPatterns': healthDataAction(get_data=<function get_number_of_fill_patterns>, report_file_name='_NumberOfFillPatterns'), 'ValueFilledRegions': healthDataAction(get_data=<function get_number_of_filled_regions>, report_file_name='_NumberOfRegions'), 'ValueImageImports': healthDataAction(get_data=<function get_number_of_image_imports>, report_file_name='_NumberOfImageImports'), 'ValueImageLinks': healthDataAction(get_data=<function get_number_of_image_links>, report_file_name='_NumberOfImageLinks'), 'ValueLinePatterns': healthDataAction(get_data=<function get_number_of_line_patterns>, report_file_name='_NumberOfLinePatterns'), 'ValueLineStyles': healthDataAction(get_data=<function get_number_of_line_styles>, report_file_name='_NumberOfLineStyles'), 'ValueModelGroups': healthDataAction(get_data=<function get_number_of_model_groups>, report_file_name='_NumberOfModelGroups'), 'ValueModelGroupsUnplaced': healthDataAction(get_data=<function get_number_of_unplaced_model_groups>, report_file_name='_NumberOfUnplacedModelGroups'), 'ValueRooms': healthDataAction(get_data=<function get_number_of_rooms>, report_file_name='_NumberOfRooms'), 'ValueRoomsNotEnclosed': healthDataAction(get_data=<function get_number_of_not_enclosed_rooms>, report_file_name='_NumberOfNotEnclosedRooms'), 'ValueRoomsRedundant': healthDataAction(get_data=<function get_number_of_redundant_rooms>, report_file_name='_NumberOfRedundantRooms'), 'ValueRoomsUnplaced': healthDataAction(get_data=<function get_number_of_unplaced_rooms>, report_file_name='_NumberOfUnplacedRooms'), 'ValueSheets': healthDataAction(get_data=<function get_number_of_sheets>, report_file_name='_NumberOfSheets'), 'ValueTextStyles': healthDataAction(get_data=<function get_number_of_text_types>, report_file_name='_NumberOfTextStyles'), 'ValueTextStylesUnused': healthDataAction(get_data=<function get_number_of_unused_text_types>, report_file_name='_NumberOfTextStylesUnused'), 'ValueViewFilters': healthDataAction(get_data=<function get_number_of_view_filters>, report_file_name='_NumberOfViewFilters'), 'ValueViewFiltersUnused': healthDataAction(get_data=<function get_number_of_unused_view_filters>, report_file_name='_NumberOfViewFiltersUnused'), 'ValueViewTemplates': healthDataAction(get_data=<function get_number_of_view_templates>, report_file_name='_NumberOfViewTemplates'), 'ValueViewTemplatesUnused': healthDataAction(get_data=<function get_number_of_unused_view_templates>, report_file_name='_NumberOfViewTemplatesUnused'), 'ValueViews': healthDataAction(get_data=<function get_number_of_views>, report_file_name='_NumberOfViews'), 'ValueViewsNotPlaced': healthDataAction(get_data=<function get_number_of_unplaced_views>, report_file_name='_NumberOfViewsNotPlaced'), 'ValueWarnings': healthDataAction(get_data=<function get_number_of_warnings>, report_file_name='_NumberOfWarnings'), 'ValueWorksets': healthDataAction(get_data=<function get_workset_number>, report_file_name='_NumberOfWorksets')}

List of actions reporting model health metrics and their associated parameter name

duHast.Revit.ModelHealth.model_health.update_model_health_tracer_family(doc, revit_file_path)

Updates instances of model health tracker family in project.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revit_file_path (str) – Fully qualified revit model file path.

Returns:

Result class instance.

  • .status True if all model key health metric where updated successfully. Otherwise False.

  • .message will be listing each parameter update: old value to new value

Return type:

Result

duHast.Revit.ModelHealth.model_health.write_model_health_report(doc, revit_file_path, output_directory)

Write out health tracker data to file.

Each value gets written to a separate file. The file name is made up of time stamp and the revit file name.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Current Revit model document.

  • revit_file_path (str) – Fully qualified revit model file path.

  • output_directory (str) – The directory path of where to write the data to.

Returns:

Result class instance.

  • .status True if data was written to files successfully. Otherwise False.

  • .message will be contain data file path for each file.

Return type:

Result

Module contents