Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Views.Reporting package

Subpackages

Submodules

duHast.Revit.Views.Reporting.schedules_report module

This module contains the Revit view schedule report functionality.

duHast.Revit.Views.Reporting.schedules_report.SCHEDULE_TYPES = [Autodesk.Revit.DB.ViewType.Schedule, Autodesk.Revit.DB.ViewType.ColumnSchedule, Autodesk.Revit.DB.ViewType.PanelSchedule]

list of schedule types to be reported on.

duHast.Revit.Views.Reporting.schedules_report.get_schedules_report_data(doc, host_name)

Gets schedule data to be written to report file. The data returned includes all schedule properties available in the file.

For View types reported on refer to SCHEDULE_TYPES list.

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

  • host_name (str) – The file hostname, which is added to data returned

Returns:

list of list of view properties.

Return type:

list of list of str

duHast.Revit.Views.Reporting.schedules_report.get_schedules_report_data_filtered(doc, host_name, schedule_properties)

Gets schedule data to be written to report file. The data returned is filtered by property list past in.

For View types reported on refer to SCHEDULE_TYPES list.

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

  • host_name (str) – The file hostname, which is added to data returned

  • schedule_properties (list of str) – List of view properties to be extracted from schedules.

Returns:

list of list of view properties.

Return type:

list of list of str

duHast.Revit.Views.Reporting.schedules_report.write_schedule_data(doc, file_name, current_file_name)

Writes to file all schedule properties.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current revit file name which will be appended to data in the report.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.schedules_report.write_schedule_data_by_property_names(doc, file_name, current_file_name, view_properties)

Writes to file sheet properties as nominated in past in list.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current Revit file name which will be appended to data in the report.

  • sheet_properties (list of str) – List of sheet properties to be extracted from sheets.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.sheets_report module

This module contains the Revit sheet report functionality.

duHast.Revit.Views.Reporting.sheets_report.get_sheet_report_data(doc, host_name)

Gets sheet data to be written to report file. The data returned includes all sheet properties available in the file. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :param host_name: The file hostname, which is added to data returned :type host_name: str :return: list of list of sheet properties. :rtype: list of list of str

duHast.Revit.Views.Reporting.sheets_report.get_sheets_report_data_filtered(doc, host_name, sheet_properties)

Gets sheet data to be written to report file. The data returned is filtered by property list past in.

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

  • host_name (str) – The file hostname, which is added to data returned

  • view_properties (list of str) – List of view properties to be extracted from sheets.

Returns:

list of list of view properties.

Return type:

list of list of str

duHast.Revit.Views.Reporting.sheets_report.write_sheet_data(doc, file_name, current_file_name)

Writes to file all sheet properties.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current revit file name which will be appended to data in the report.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.sheets_report.write_sheet_data_by_property_names(doc, file_name, current_file_name, sheet_properties)

Writes to file sheet properties as nominated in past in list.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current Revit file name which will be appended to data in the report.

  • sheet_properties (list of str) – List of sheet properties to be extracted from sheets.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.view_property_filter module

This module contains the view property data filter.

duHast.Revit.Views.Reporting.view_property_filter.filter_data_by_properties(data, headers, properties, default_headers)

Filters view data by supplied property names. Data gets filtered twice: property needs to exist in headers list as well as in properties list.

Parameters:
  • data (list of list of str) – List of sheet properties to be kept.

  • headers (list of str) – Filter: list of headers representing property names.

  • properties (list of str) – list of optional properties to be extracted from data

  • default_headers (list of str) – list of view properties always extracted from data

Returns:

List of sheet properties matching filters.

Return type:

list of list of str

duHast.Revit.Views.Reporting.view_property_utils module

This module contains the view property utilities.

duHast.Revit.Views.Reporting.view_property_utils.convert_view_data_to_list(view_data, headers)

Converts a list of dictionaries of view properties names and values to a list of properties only.

Parameters:
  • view_data ([{}]) – List of dictionaries representing view properties

  • headers ([str]) – list of properties

Returns:

A list of lists of view property values.

Return type:

[[str]]

duHast.Revit.Views.Reporting.view_reports_json_props module

This module contains node names for view reports in json format.

duHast.Revit.Views.Reporting.views_data_3d_hash_report module

This module contains the Revit view template data to 3D hash report functionality.

duHast.Revit.Views.Reporting.views_data_3d_hash_report.convert_vt_data_to_3d_flattened(json_files, progress_call_back=None)

Converts view template graphic overrides data stored in files into flattened json formatted hash table array for import to power bi.

Parameters:
  • json_files ([str]) – List of files containing view template data of Revit project files. ( One json file per Revit project file)

  • progress_call_back (func(counter, overall_counter), optional) – A call back function accepting as arguments the number of the current file processed and the number of overall files to be processed, defaults to None

Returns:

Result class instance. - .status True if flattened array was successfully created. Otherwise False. - .message will contain array size. -. result will contain the flatten array as first value in list

Return type:

Result

duHast.Revit.Views.Reporting.views_data_3d_hash_report_utilities module

This module contains utility functions - hash tables from view settings.

duHast.Revit.Views.Reporting.views_data_report module

This module contains the Revit view report functionality.

duHast.Revit.Views.Reporting.views_data_report.write_graphics_settings_report(revit_file_name, file_path, data)

Write view graphic settings to file.

Parameters:
  • revit_file_name (str) – The revit file name (without path or file extension)

  • file_path (str) – Fully qualified file path

  • data ({str:Any}) – json dictionary to be written to file

Returns:

Result class instance.

  • result.status False if file failed to write, otherwise True.

  • result.message will contain file name of file written.

  • result.result: empty list

On exception:

  • result.status (bool) will be False.

  • result.message will contain the exception message.

  • result.result: will be an empty list

Return type:

Result

duHast.Revit.Views.Reporting.views_data_report.read_view_data_from_file(file_path)

Reads a view data report file into a list of view graphic setting instances

Parameters:

file_path (str) – Fully qualified file path of report file.

Raises:

ValueError – If data node is missing from file

Returns:

list of settings if files was read successfully otherwise an exception will be raised.

Return type:

ViewGraphicsSettings

duHast.Revit.Views.Reporting.views_report module

This module contains the Revit view report functionality.

duHast.Revit.Views.Reporting.views_report.VIEW_TYPES = [Autodesk.Revit.DB.ViewType.FloorPlan, Autodesk.Revit.DB.ViewType.CeilingPlan, Autodesk.Revit.DB.ViewType.Elevation, Autodesk.Revit.DB.ViewType.ThreeD, Autodesk.Revit.DB.ViewType.DraftingView, Autodesk.Revit.DB.ViewType.EngineeringPlan, Autodesk.Revit.DB.ViewType.AreaPlan, Autodesk.Revit.DB.ViewType.Section, Autodesk.Revit.DB.ViewType.Detail, Autodesk.Revit.DB.ViewType.Walkthrough, Autodesk.Revit.DB.ViewType.Rendering]

list of view types to be reported on.

duHast.Revit.Views.Reporting.views_report.get_views_report_data(doc, host_name)

Gets view data to be written to report file. The data returned includes all views properties available in the file.

For View types reported on refer to VIEW_TYPES list.

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

  • host_name (str) – The file hostname, which is added to data returned

Returns:

list of list of view properties.

Return type:

list of list of str

duHast.Revit.Views.Reporting.views_report.get_views_report_data_filtered(doc, host_name, view_properties)

Gets view data to be written to report file. The data returned is filtered by property list past in.

For View types reported on refer to VIEW_TYPES list.

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

  • host_name (str) – The file hostname, which is added to data returned

  • view_properties (list of str) – List of view properties to be extracted from views.

Returns:

list of list of view properties.

Return type:

list of list of str

duHast.Revit.Views.Reporting.views_report.write_views_data(doc, file_name, current_file_name)

Writes to file all views properties.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current revit file name which will be appended to data in the report.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.views_report.write_view_data_by_property_names(doc, file_name, current_file_name, view_properties)

Writes to file sheet properties as nominated in past in list.

file type: csv

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

  • file_name (str) – The fully qualified file path of the report file.

  • current_file_name (str) – The current Revit file name which will be appended to data in the report.

  • sheet_properties (list of str) – List of sheet properties to be extracted from sheets.

Returns:

Result class instance. - .status True if data was written successfully. Otherwise False. - .message will contain write status.

Return type:

Result

duHast.Revit.Views.Reporting.views_report_header module

This module contains the header row for any Revit sheet and views reports.

duHast.Revit.Views.Reporting.views_report_header.REPORT_VIEWS_HEADER = ['HOSTFILE', 'Id', 'CREATED BY', 'LAST CHANGED BY', 'OWNER']

header used in views report

duHast.Revit.Views.Reporting.views_report_header.REPORT_SHEETS_HEADER = ['HOSTFILE', 'Id', 'CREATED BY', 'LAST CHANGED BY', 'OWNER']

header used in sheets report

duHast.Revit.Views.Reporting.views_report_header.REPORT_SCHEDULES_HEADER = ['HOSTFILE', 'Id', 'CREATED BY', 'LAST CHANGED BY', 'OWNER']

header used in schedules report

duHast.Revit.Views.Reporting.views_report_header.get_sheets_report_headers(doc)

A list of headers used in report files Hardcoded header list is expanded by parameters added to sheet category in model.

Note: if no sheet views are in a file this will report the hardcoded header only.

Parameters:

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

Returns:

List of headers.

Return type:

list str

duHast.Revit.Views.Reporting.views_report_header.get_schedules_report_headers(doc)

A list of headers used in report files Hardcoded header list is expanded by parameters added to PlanView class in model.

Note: if no schedule views are in a file this will report the hardcoded header only.

Parameters:

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

Returns:

List of headers.

Return type:

list str

duHast.Revit.Views.Reporting.views_report_header.get_views_report_headers(doc)

A list of headers used in report files Hardcoded header list is expanded by parameters added to PlanView class in model. Revit ui only lists ‘views’ ‘sheets’ and ‘schedules’ as a categories to add project parameters to. Therefore any parameters attached to class ViewPlan should apply to all other view types with exception of schedules and sheets.

Note: if no plan views are in a file this will report the hardcoded header only.

Parameters:

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

Returns:

List of headers.

Return type:

list str

Module contents