Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Views.Utility package

Submodules

duHast.Revit.Views.Utility.convert_data_to_override_storage module

Data category and filter override instances to storage object helper functions.

duHast.Revit.Views.Utility.convert_data_to_override_storage.convert_to_category_override_storage(doc, category_data_instance)

Retrieves the corresponding category object from the Revit document based on the category names provided in the category data instance.

Args:

doc (Revit Document): The Revit document object. category_data_instance (CategoryData): An instance of the CategoryData class representing the category and subcategory names, and visibility information.

Returns:

RevitCategoryOverride or None: The created RevitCategoryOverride object if a match is found, otherwise None.

duHast.Revit.Views.Utility.convert_data_to_override_storage.convert_to_category_override_storage_objects(doc, category_data_objects)

Converts a list of category data objects into category override storage objects.

Args:

doc (Revit Document): The Revit document object. category_data_objects (list): A list of category data objects.

Returns:

list: A list of category override storage objects representing the converted category data objects.

duHast.Revit.Views.Utility.convert_data_to_override_storage.convert_to_filter_override_storage(doc, filter_data_instance)

Converts a filter data instance into a RevitFilterOverride object.

Args:

doc (Revit Document): The current Revit model document. filter_data_instance (FilterDataInstance): The filter data instance to be converted.

Returns:

RevitFilterOverride: The converted filter override object, or None if the filter does not exist in the model.

duHast.Revit.Views.Utility.convert_data_to_override_storage.convert_to_filter_override_storage_objects(doc, filter_data_objects)

Converts a list of filter data objects into a list of RevitFilterOverride objects.

Args:

doc (Revit Document): The current Revit model document. filter_data_objects (list): A list of filter data objects to be converted.

Returns:

list: A list of RevitFilterOverride objects that represent the converted filter data objects.

duHast.Revit.Views.Utility.convert_data_to_revit_override module

Data storage to Category override object helper functions.

duHast.Revit.Views.Utility.convert_data_to_revit_override.get_colour(data_colour)

Creates a Revit Color object instance from a ColourBase object

Parameters:

data_colour – A ColourBase instance.

Returns:

None if ColourBase values are -1, or larger then 255, otherwise a Color instance.

Return type:

Autodesk.Revit.DB.Color

duHast.Revit.Views.Utility.convert_data_to_revit_override.get_fill_pattern_id(doc, data_pattern)

Returns the first fill pattern id in model matching name provided, or None if none was found.

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

  • data_pattern (PatternSettingBase) – A pattern settings base object instance

Returns:

The pattern id if a match eas found or Invalid Element Id (-1)

Return type:

Autodesk.Revit.DB.ElementId

duHast.Revit.Views.Utility.convert_data_to_revit_override.get_line_pattern_id(doc, data_pattern)

Returns the first line pattern id in model matching name provided, or None if none was found.

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

  • data_pattern (PatternSettingBase) – A pattern settings base object instance

Returns:

The pattern id if a match eas found or Invalid Element Id (-1)

Return type:

Autodesk.Revit.DB.ElementId

duHast.Revit.Views.Utility.convert_data_to_revit_override.convert_to_revit_graphic_override(doc, data_override, is_filter_override=False)

Creates a Revit OverrideGraphicSettings instance from settings stored in an OverrideByCategory object.

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

  • data_override (OverrideByCategory) – An OverrideByCategory object

  • is_filter_override (bool, optional) – Flag indicating an override for a filter (True), defaults to False

Returns:

An OverrideGraphicSettings instance

Return type:

Autodesk.Revit.DB.OverrideGraphicSettings

duHast.Revit.Views.Utility.convert_revit_override_to_data module

Category override to data storage class helper functions.

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_projection_overrides(view_override_graphic, line_patterns, fill_patterns)

Retrieves projection override settings from an OverridesGraphicSettings object

Parameters:
  • view_override_graphic (Autodesk.Revit.DB.OverridesGraphicSettings) – An overrides graphic setting

  • line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model

  • fill_patterns ([Autodesk.Revit.DB.FillPatternElement]) – All fill patterns in the model

Returns:

An overrides projections object instance.

Return type:

OverrideProjection

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_cut_overrides(view_override_graphic, line_patterns, fill_patterns)

Retrieves cut override settings from an OverridesGraphicSettings object

Parameters:
  • view_override_graphic (Autodesk.Revit.DB.OverridesGraphicSettings) – An overrides graphic setting

  • line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model

  • fill_patterns ([Autodesk.Revit.DB.FillPatternElement]) – All fill patterns in the model

Returns:

An overrides projections object instance.

Return type:

OverrideCut

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_view_category_overrides(view, categories_in_model, line_patterns, fill_patterns)

Returns the category overrides for all categories past in for a given view.

Parameters:
  • view (Autodesk.Revit.DB.View) – The view from which to retrieve the category overrides.

  • categories_in_model (_type_) – All categories in the model.

  • line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model

  • fill_patterns ([Autodesk.Revit.DB.FillPatternElement]) – All fill patterns in the model

Returns:

A list of all category overrides for a view.

Return type:

[OverrideByCategory]

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_view_filter_overrides(doc, view, line_patterns, fill_patterns)

Returns the filter overrides for all filter applied to a given view.

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

  • view (Autodesk.Revit.DB.View) – The view from which to retrieve the category overrides.

  • line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model

  • fill_patterns ([Autodesk.Revit.DB.FillPatternElement]) – All fill patterns in the model

Returns:

A list of all filter overrides for a view.

Return type:

[OverrideByFilter]

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_view_settings(doc, view)

retrieves the filter and category graphic overrides from a view

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

  • view (_type_) – _description_

Returns:

A ViewGraphicsSettings instance with retrieved setting.

Return type:

ViewGraphicsSettings

duHast.Revit.Views.Utility.convert_revit_override_to_data.get_views_graphic_settings_data(doc, views, progress_callback=None)

Gets view data graphic settings from the model.

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

  • views ([Autodesk.Revit.DB.View]) – Views of which to report graphical overrides on. (View must support graphical overrides, otherwise an exception will be thrown!)

Progress_callback:

A progress call back object, default is None

Returns:

list of ViewGraphicsSettings instances

Return type:

[ViewGraphicsSettings]

duHast.Revit.Views.Utility.sheet_parameters module

This module contains a number of helper functions relating to Sheets

duHast.Revit.Views.Utility.sheet_parameters.get_sheet_number(sht)

Get the sheet number of a sheet :param sht: The sheet to get the number of :type sht: ViewSheet :return: The sheet number :rtype: str

duHast.Revit.Views.Utility.sheet_parameters.get_sheet_name(sht)

Get the sheet name of a sheet :param sht: The sheet to get the name of :type sht: ViewSheet :return: The sheet name :rtype: str

duHast.Revit.Views.Utility.sheet_parameters.get_sheet_num_name_comb(sht, num_first=True, separator=' - ')

Get the sheet number and name of a sheet and returns the the combination of the two. Typically helpful for logging/printing.

Parameters:
  • num_first (bool) – Whether the sheet number should be first in the string. Defaults to True

  • splitter (str) – The string to split the sheet number and name with. Defaults to ‘ - ‘

Returns:

The sheet number and name

Return type:

str

duHast.Revit.Views.Utility.view_parameters module

This module contains a number of helper functions relating to Revit views.

duHast.Revit.Views.Utility.view_parameters.get_sheet_from_view(view, sht_num_elem_dict)

Get the sheet of a view. Sheet number to element dictionary can be produced with get_sheet_num_to_elem_dict function from duHast.Revit.Views.Utility.sheets :param view: The view to get the sheet of :type view: View :param sht_num_elem_dict: A dictionary of sheet numbers and sheets :type sht_num_elem_dict: dict :return: The sheet of the view :rtype: ViewSheet

duHast.Revit.Views.Utility.view_types module

This module contains a base helper functions relating to Revit view types.

duHast.Revit.Views.Utility.view_types.get_view_type_enum_to_name_dict()

Get a dictionary of the ViewType enum to verbose name e.g. FloorPlan to Floor Plan :return: A dictionary in format of Autodesk.Revit.DB.ViewType.FloorPlan: “Floor Plan” :rtype: dict

Module contents