Sample Code Revit Batch Processor 1.1.16 documentation

Contents:

This Page

duHast.pyRevit.UI package

Submodules

duHast.pyRevit.UI.doc_selector module

A module to provide pyRevit UI helpers for selecting a Revit document (active or linked).

duHast.pyRevit.UI.doc_selector.get_docs_for_selection(doc)

Returns a list containing the active document followed by all loaded linked documents.

Parameters:

doc (Autodesk.Revit.DB.Document) – The active Revit document.

Returns:

List of documents available for selection.

Return type:

list[Autodesk.Revit.DB.Document]

duHast.pyRevit.UI.doc_selector.pick_document(doc, forms, button_name='Select document', multiselect=False)

Prompts the user to select a Revit document (active or linked) via a pyRevit SelectFromList dialog.

Parameters:
  • doc (Autodesk.Revit.DB.Document) – The active Revit document.

  • forms (module) – The pyRevit forms module.

  • button_name (str) – Label on the selection button.

  • multiselect (bool) – Allow selecting multiple documents.

Returns:

The selected document, a list of selected documents, or None if cancelled.

Return type:

Autodesk.Revit.DB.Document or list[Autodesk.Revit.DB.Document] or None

duHast.pyRevit.UI.multiselectors module

A module to provide pyRevit multiselectors for some standard Revit elements.

duHast.pyRevit.UI.multiselectors.room_selector(rvt_doc, multiple=True)

pyRevit Select from list UI object to pick room or rooms. :param rvt_doc: Revit Document :type rvt_doc: Document :param multiple: Allow multiple selection :type multiple: bool :return: Room or list of rooms :rtype: Room or list[Room]

duHast.pyRevit.UI.multiselectors.pick_room(rvt_doc)

PyRevit multiselector to pick a single room.

duHast.pyRevit.UI.multiselectors.pick_rooms(rvt_doc)

PyRevit multiselector to pick multiple rooms.

duHast.pyRevit.UI.multiselectors.level_selector(rvt_doc, multiple=True)
duHast.pyRevit.UI.multiselectors.pick_level(rvt_doc)

PyRevit multiselector to pick a single level.

duHast.pyRevit.UI.multiselectors.pick_levels(rvt_doc)

PyRevit multiselector to pick multiple levels.

duHast.pyRevit.UI.ui_element_selection module

This module contains a number of helper functions relating to py Revit element selection from list.

duHast.pyRevit.UI.ui_element_selection.default_name_builder(element)

Deafult element name builder is used to build the element name shown in the UI by combining the element name and element Id

Parameters:

element (Autodesk.Revit.DB.Element) – An element

Returns:

A name of the element.

Return type:

str

duHast.pyRevit.UI.ui_element_selection.get_element_selection_from_user(doc, forms, element_getter, element_selection_description, multiselect=True, ui_element_name_builder=<function default_name_builder>)

lists Elements provided by element getter function in UI and returns the users selection

Parameters:
  • doc (Autodesk.Revit.DB.Document) – Ther current Revit model.

  • forms (_type_) – pyRevit forms

  • element_getter (_type_) – Function accpeting the document as the only argument returning a list of elements or empty list.

  • element_selection_description (str) – Text to be displayes on button to prompt user

Returns:

None if nothing was selected. Otherwise a list of element ids

Return type:

None or [Autodesk.Revit.ElementId]

Module contents