Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Walls package

Subpackages

Submodules

duHast.Revit.Walls.curtain_wall_elements module

Revit curtain walls helper functions.

duHast.Revit.Walls.curtain_wall_elements.REPORT_CURTAINWALL_ELEMENTS_HEADER = ['HOSTFILE', 'CURTAINWALL_ELEMENT_TYPEID', 'ReplaceMeTYPENAME']

header used in reports

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_PANEL_EMPTY_FAMILY_NAME = 'Empty System Panel'

Built in family name for empty system panel

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_PANEL_SYSTEM_FAMILY_NAME = 'Empty System Panel'

Built in family name for empty system panel

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_V_FAMILY_NAME = 'V Corner Mullion'

Built in family name for V-shaped mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_CIRCULAR_FAMILY_NAME = 'Circular Mullion'

Built in family name for circular mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_QUAD_FAMILY_NAME = 'Quad Corner Mullion'

Built in family name for quad corner mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_L_FAMILY_NAME = 'L Corner Mullion'

Built in family name for L-shaped corner mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_RECT_FAMILY_NAME = 'Rectangular Mullion'

Built in family name for rectangular mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_MULLION_TRAPEZ_FAMILY_NAME = 'Trapezoid Corner Mullion'

Built in family name for trapezoid corner mullion

duHast.Revit.Walls.curtain_wall_elements.CURTAINWALL_ELEMENTS_CATEGORY_FILTER = [Autodesk.Revit.DB.BuiltInCategory.OST_CurtainWallPanels, Autodesk.Revit.DB.BuiltInCategory.OST_CurtainWallMullions]

category filter for all element filters by category

duHast.Revit.Walls.curtain_wall_elements.get_all_curtain_wall_element_types_by_category(doc)

Gets a filtered element collector of all curtain wall element types in the model:

Filters by multiple categories.

  • curtain wall panels

  • curtain wall mullions

  • in place family symbols!

Parameters:

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

Returns:

A filtered element collector containing curtain wall element types.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.curtain_wall_elements.build_curtain_wall_element_type_dictionary(collector, dic)

Returns the dictionary past in with keys and or values added retrieved from collector past in.

Keys are built in curtain wall element type names. TODO: this code repeats across a number of modules. Use generic instead!

Parameters:
  • collector (Autodesk.Revit.DB.FilteredElementCollector) – A filtered element collector containing curtain wall element types.

  • dic (dictionary (key str, value list of Autodesk.Revit.DB.ElementId)) – A dictionary containing key: curtain wall element type name, value: list of ids belonging to that type.

Returns:

A dictionary containing key: built in curtain wall element type name, value: list of ids belonging to that type.

Return type:

dictionary (key str, value list of Autodesk.Revit.DB.ElementId)

duHast.Revit.Walls.curtain_wall_elements.sort_curtain_wall_element_types_by_family_name(doc)

Returns a dictionary containing all curtain wall element types in the model.

Key values are as per BUILTIN_TYPE_FAMILY_NAMES. TODO: This code repeats across a number of modules. Use generic instead!

Parameters:

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

Returns:

A dictionary containing key: curtain wall element type family name, value: list of ids.

Return type:

dic { str: [Autodesk.Revit.DB.ElementId]}

duHast.Revit.Walls.curtain_wall_elements.get_curtain_wall_element_instances_by_category(doc)

Gets all CurtainWallElement elements instances placed in model.

Includes:

  • curtain wall panels

  • curtain wall mullions

Parameters:

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

Returns:

A filtered element collector containing curtain wall element types.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.curtain_wall_elements.get_all_curtain_wall_element_type_ids_by_category(doc)

Gets all Curtain Wall Element element type ids available in model.

Includes:

  • curtain wall panels

  • curtain wall mullions

Parameters:

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

Returns:

List of element ids representing curtain wall element types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.curtain_wall_elements.get_all_curtain_wall_element_types_by_category_excl_in_place(doc)

Gets all Curtain Wall Element element type available in model. Excludes in place family symbols.

Includes:

  • curtain wall panels

  • curtain wall mullions

Parameters:

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

Returns:

List of curtain wall element types.

Return type:

list of Autodesk.Revit.DB.ElementType

duHast.Revit.Walls.curtain_wall_elements.get_all_curtain_wall_element_type_ids_by_category_excl_symbols(doc)

Gets all Curtain Wall Element element type ids available in model. Excludes in place family symbols.

Includes:

  • curtain wall panels

  • curtain wall mullions

Parameters:

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

Returns:

List of element ids representing curtain wall element types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.curtain_wall_elements.get_all_curtain_wall_non_shared_symbol_ids_by_category(doc)

Gets a list of all loadable, non shared, family symbols (types) in the model of categories:

  • curtain wall panels

  • curtain wall mullions

Parameters:

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

Returns:

List of element ids representing curtain wall family symbols.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.curtain_wall_elements.get_curtain_wall_panels(doc, curtain_wall_instance)

Returns a list of panel instances that are hosted in a curtain wall, excluding any family instances.

Parameters:
  • doc (Document) – The current Revit model document.

  • curtain_wall_instance (FamilyInstance) – The curtain wall instance for which to retrieve the panel instances.

Returns:

A list of panel instances hosted in the curtain wall.

Return type:

list[Panel]

duHast.Revit.Walls.curtain_walls module

This module contains a Revit curtain walls utility functions.

duHast.Revit.Walls.curtain_walls.CURTAIN_WALL_FAMILY_NAME

Built in wall family name for curtain wall

duHast.Revit.Walls.curtain_walls.get_all_curtain_wall_type_ids(doc)

Gets type ids off all available curtain wall types in model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing curtain wall types. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.curtain_walls.get_all_curtain_wall_instances(doc, available_ids)

Gets all curtain wall elements placed in model…ignores legend elements. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :param available_ids: Filter: curtain wall type ids to check wall instances for. :type available_ids: list of Autodesk.Revit.DB.ElementId :return: List of wall instances :rtype: List of Autodesk.Revit.DB.Wall

duHast.Revit.Walls.curtain_walls.get_placed_curtain_wall_type_ids(doc, available_ids)

Gets all used curtain wall types in model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :param available_ids: Filter: curtain wall type ids to check wall types for. :type available_ids: list of Autodesk.Revit.DB.ElementId :return: List of wall instances :rtype: List of Autodesk.Revit.DB.Wall

duHast.Revit.Walls.purge_unused_curtain_wall_element_types module

This module contains a number of helper functions relating to purging Revit curtain wall elements.

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.get_used_curtain_wall_element_type_ids(doc)

Gets all used Curtain Wall Element element type ids available in model. Used: at least one instance of this type is placed in the model. Includes: - curtain wall panels - curtain wall mullions :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing curtain wall element types. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.family_no_types_in_use(fam_type_ids, un_used_type_ids)

Compares two lists of ids. True if any id is not in un_used_type_ids. TODO: check for more generic list comparison and remove this function. :param fam_type_ids: List of family type ids to check. :type fam_type_ids: List of Autodesk.Revit.DB.ElementId :param un_used_type_ids: Reference list of ids. :type un_used_type_ids: List of Autodesk.Revit.DB.ElementId :return: True if any id from fam_type_ids is not in un_used_type_ids. :rtype: bool

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.get_unused_non_symbol_curtain_wall_element_type_ids_to_purge(doc)

Gets all unused Curtain Wall Element element type ids which can be safely deleted from the model. This method can be used to safely delete unused in curtain wall element types. There is no requirement by Revit to have at least one curtain wall element definition in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing unused in curtain wall element types. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.get_used_curtain_wall_symbol_ids(doc)

Gets a list of all used loadable, non shared, family symbols (types) in the model of categories: - curtain wall panels - curtain wall mullions Used: at least one family instance of this symbol (type) is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing curtain wall family symbols. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.get_unused_curtain_wall_symbol_ids(doc)

Gets a list of all used loadable, non shared, family symbols (types) in the model of categories: - curtain wall panels - curtain wall mullions Unused: Not one family instance of this symbol (type) is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing curtain wall family symbols. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_curtain_wall_element_types.get_unused_curtain_wall_symbol_ids_for_purge(doc)

Gets symbol(type) ids and family ids (when no type is in use) of curtain wall element families which can be safely deleted from the model. This method can be used to safely delete unused curtain wall element types. There is no requirement by Revit to have at least one in place wall definition in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing unused curtain wall element symbols (types) and families. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types module

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

duHast.Revit.Walls.purge_unused_wall_types.get_used_stacked_wall_type_ids(doc)

Returns all used stack wall type ids. Used: at least one instance of this type is placed in the model.

Parameters:

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

Returns:

List of element ids representing used stacked wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_used_in_place_wall_type_ids(doc)

Gets all used in place type ids in the model. Used: at least one instance of this type is placed in the model.

Parameters:

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

Returns:

List of element ids representing used in place wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_used_curtain_wall_type_ids(doc)

Gets type ids off all used curtain wall types. Used: at least one instance of this type is placed in the model.

Parameters:

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

Returns:

List of element ids representing used in curtain wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_used_basic_wall_type_ids(doc)

Gets type ids off all used basic wall types. Used: at least one instance of this type is placed in the model.

Parameters:

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

Returns:

List of element ids representing all basic wall types in use.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_unused_basic_wall_type_ids_to_purge(doc)

Gets type ids off all unused basic wall types in model. This method can be used to safely delete unused basic wall types. In the case that no basic wall instance using any of the types is placed, this will return all but one type id since Revit requires at least one basic wall type definition to be in the model.

Parameters:

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

Returns:

List of element ids representing all basic wall types not in use.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_unused_curtain_wall_type_ids_to_purge(doc)

Gets type ids off all unused curtain wall types. This method can be used to safely delete unused curtain wall types. In the case that no curtain wall instance using any of the types is placed, this will return all but one type id since Revit requires at least one curtain wall type definition to be in the model.

Parameters:

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

Returns:

List of element ids representing unused in curtain wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_unused_in_place_wall_type_ids(doc)

Gets all unused in place type ids in the model. Unused: Not one instance of this type is placed in the model.

Parameters:

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

Returns:

List of element ids representing unused in place wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_unused_in_place_wall_ids_for_purge(doc)

Gets symbol(type) ids and family ids (when no type is in use) of in place wall families which can be safely deleted from the model. This method can be used to safely delete unused in place wall types. There is no requirement by Revit to have at least one in place wall definition in the model.

Parameters:

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

Returns:

List of element ids representing unused in place wall types and families.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.purge_unused_wall_types.get_unused_stacked_wall_type_ids_to_purge(doc)

Gets all unused stacked wall type id’s. This method can be used to safely delete unused wall types: In the case that no wall instance using any of the types is placed this will return all but one type id since Revit requires at least one wall type definition to be in the model.

Parameters:

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

Returns:

List of element ids representing not used stacked wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.stacked_walls module

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

duHast.Revit.Walls.stacked_walls.STACKED_WALL_FAMILY_NAME

Built in wall family name for stacked wall

duHast.Revit.Walls.stacked_walls.get_all_stacked_wall_instances(doc)

Gets all stacked wall elements placed in model…ignores legend elements. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A filtered element collector containing wall instances. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.stacked_walls.get_all_stacked_wall_types(doc)

Gets all stacked wall element types used by instances placed in model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A filtered element collector containing stacked wall types. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.stacked_walls.get_all_stacked_wall_type_ids(doc)

Gets all stacked wall element types available in model.

Parameters:

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

Returns:

List of element ids representing stacked wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.wall_functions module

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

duHast.Revit.Walls.wall_functions.get_walls_from_boundary_segments(rvt_doc, bnd_seg_list)

Get a flat list of walls from a list of room boundary segments. :param rvt_doc: Revit document :type rvt_doc: Autodesk.Revit.DB.Document :param bnd_seg_list: List of room boundary segments :type bnd_seg_list: list :return: List of wall elements :rtype: list

duHast.Revit.Walls.walls module

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

duHast.Revit.Walls.walls.BASIC_WALL_FAMILY_NAME

Built in wall family name for basic wall

duHast.Revit.Walls.walls.BUILTIN_WALL_TYPE_FAMILY_NAMES = [Autodesk.Revit.DB.WallKind.Stacked, Autodesk.Revit.DB.WallKind.Curtain, Autodesk.Revit.DB.WallKind.Basic]

List of all Built in wall family names

duHast.Revit.Walls.walls.get_all_wall_types_by_category(doc)

Gets all wall types in a model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A filtered element collector containing wall types. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.walls.get_all_wall_types_by_class(doc)

This will return a filtered element collector of all wall types by class in the model

It will therefore not return any in place wall types since revit treats those as families… :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A filtered element collector containing wall types. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.walls.get_in_place_wall_family_instances(doc)

Returns all instances in place families of category wall in the model.

Parameters:

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

Returns:

A filtered element collector containing in place wall instances.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Walls.walls.get_all_in_place_wall_type_ids(doc)

Gets all type ids off all available in place families of category wall.

Parameters:

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

Returns:

List of element ids representing in place wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.walls.get_all_basic_wall_type_ids(doc)

Gets type ids off all available basic wall types in the model.

Parameters:

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

Returns:

List of element ids representing all basic wall types.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.walls.get_all_basic_wall_instances(doc, available_ids)

Gets all basic wall elements placed in model…ignores legend elements.

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

  • available_ids (list of Autodesk.Revit.DB.ElementId) – Filter: curtain wall type ids to check wall instances for.

Returns:

List of element ids representing all basic wall instances.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.walls.get_used_basic_wall_type_ids(doc, available_ids)

Gets all basic wall types used in model.

Used: at least one instance of this type is placed in the model.

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

  • available_ids (list of Autodesk.Revit.DB.ElementId) – Filter: basic wall type ids to check wall instances for.

Returns:

List of element ids representing all basic wall types in use.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Walls.walls.get_location_reference_type_name(wall_instance)

Gets the location line reference type name of a wall instance.

# 0- Wall Centerline; # 1- Core Centerline; # 2- Finish Face: Exterior; # 3- Finish Face: Interior; # 4- Core Face: Exterior and # 5- Core Face: Interior.

Parameters:

wall_instance (Autodesk.Revit.DB.Element) – Wall instance to get the location line reference type name for.

Returns:

Name of the reference type.

Return type:

str

duHast.Revit.Walls.walls.set_location_reference_type_name(doc, wall_instance, reference_type_name)

Sets the location line reference type name of a wall instance.

Possible values are:

  • Wall Centerline

  • Core Centerline

  • Finish Face: Exterior

  • Finish Face: Interior

  • Core Face: Exterior

  • Core Face: Interior

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

  • wall_instance (Autodesk.Revit.DB.Element) – Wall instance to change the location line reference type name for.

  • reference_type_name (str) – Name of the reference type to set.

Returns:

Result object with success status and message.

Return type:

duHast.Utilities.Objects.result.Result

Module contents