Sample Code Revit Batch Processor 1.1.15 documentation

Contents:

This Page

duHast.Revit.DetailItems package

Subpackages

Submodules

duHast.Revit.DetailItems.curve_create module

This module contains a number of functions around Revit 2D curve creation.

duHast.Revit.DetailItems.curve_create.draw_line_between_points(doc, view, start_point, end_point, transaction_manager=<function in_transaction>)

Draws a line between two points in a Revit view. :param doc: The Revit document. :type doc: Autodesk.Revit.DB.Document :param view: The view in which to draw the line. :type view: Autodesk.Revit.DB.View :param start_point: The start point of the line. :type start_point: Autodesk.Revit.DB.XYZ :param end_point: The end point of the line. :type end_point: Autodesk.Revit.DB.XYZ :return: Result object containing the status of the operation. :rtype: Result

duHast.Revit.DetailItems.curve_create.draw_2D_lines_on_bounding_box(doc, bounding_box, view, transaction_manager=<function in_transaction>)

Draw 2D lines on the bounding box of an element in view provided

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

  • bounding_box (Autodesk.Revit.DB.BoundingBoxXYZ) – The bounding box of the element.

  • view (Autodesk.Revit.DB.View) – The view in which to draw the lines.

  • transaction_manager (function) – The transaction manager to use.

Returns:

Result object containing the status of the operation.

Return type:

Result

duHast.Revit.DetailItems.curve_create.draw_2D_lines_on_bounding_box_and_separate_point(doc, bounding_box, additional_point, view, transaction_manager=<function in_transaction>)

Draw 2D lines on the bounding box of an element in view provided and in addition lines from each corner of the bounding box to the additional point.

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

  • bounding_box (Autodesk.Revit.DB.BoundingBoxXYZ) – The bounding box of the element.

  • additional_point (Autodesk.Revit.DB.XYZ) – The additional point to draw lines to.

  • view (Autodesk.Revit.DB.View) – The view in which to draw the lines.

  • transaction_manager (function) – The transaction manager to use.

Returns:

Result object containing the status of the operation.

Return type:

Result

duHast.Revit.DetailItems.detail_items module

This module contains a number of functions around Revit detail items.

duHast.Revit.DetailItems.detail_items.ELEMENT_TYPE = 'Autodesk.Revit.DB.ElementType'

class name Autodesk.Revit.DB.ElementType

duHast.Revit.DetailItems.detail_items.FILLED_REGION_TYPE = 'Autodesk.Revit.DB.FilledRegionType'

class name Autodesk.Revit.DB.FilledRegionType

duHast.Revit.DetailItems.detail_items.FAMILY_SYMBOL = 'Autodesk.Revit.DB.FamilySymbol'

class name Autodesk.Revit.DB.FamilySymbol

duHast.Revit.DetailItems.detail_items.DETAIL_COMPONENT_TYPES = ['Autodesk.Revit.DB.ElementType', 'Autodesk.Revit.DB.FilledRegionType', 'Autodesk.Revit.DB.FamilySymbol']

List of class names which can be detailed components

duHast.Revit.DetailItems.detail_items.get_all_detail_types_by_category(doc)

Gets all detail component types in the model.

Filters by built in category.

Parameters:

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

Returns:

A filtered element collector containing detail component types.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.DetailItems.detail_items.get_all_repeating_detail_type_ids_available(doc)

Get all repeating detail type id’s in model.

Parameters:

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

Returns:

A list of element ids representing repeating detail types.

Return type:

list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.detail_items.get_all_detail_symbol_ids_available(doc)

Gets all detail symbol (types) ids in model.

Parameters:

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

Returns:

A list of element ids representing detail symbols.

Return type:

list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.detail_items.get_detail_symbols_used_in_repeating_details(doc, ids_repeat_det)

Gets the ids of all symbols used in repeating details.

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

  • idsRepeatDet (list Autodesk.Revit.DB.ElementIds) – List of repeating detail type ids.

Returns:

List of family symbol (type) ids.

Return type:

list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.filled_regions module

This module contains a number of functions around Revit filled regions.

duHast.Revit.DetailItems.filled_regions.get_filled_regions_in_model(doc)

Gets all filled region instances in a model.

Filters by class.

Parameters:

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

Returns:

A list containing floor instances.

Return type:

list Autodesk.Revit.DB.FilledRegion

duHast.Revit.DetailItems.filled_regions.get_all_filled_region_type_ids_available(doc)

Gets all filled region types ids in model.

Parameters:

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

Returns:

A list of element ids representing filled region types.

Return type:

list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.filled_regions.get_filled_region_curve_loops(filled_region)

Gets the curve loops of a filled region. :param filled_region: A filled region instance. :type filled_region: Autodesk.Revit.DB.FilledRegion

Returns:

A list of curve loops.

Return type:

list Autodesk.Revit.DB.CurveLoop

duHast.Revit.DetailItems.filled_regions.get_filled_region_loop_area(doc, view, filled_region, loop_index=0)

Gets loop area of a filled region. This will create a temporary filled region using just the loop and get the area.

Parameters:
  • filled_region (Autodesk.Revit.DB.FilledRegion) – A filled region instance.

  • loop_index (int) – The index of the loop to get the area for.

Returns:

The area of the loop.

Return type:

float

duHast.Revit.DetailItems.filled_regions.get_filled_region_area(filled_region)

Gets the area of a filled region using the built-in parameter.

Parameters:

filled_region (Autodesk.Revit.DB.FilledRegion) – A filled region instance.

Returns:

The area of the filled region.

Return type:

float

duHast.Revit.DetailItems.filled_regions_create module

This module contains a number of functions around creating Revit filled regions.

duHast.Revit.DetailItems.filled_regions_create.create_filled_region_by_view(doc, view, curve_loops, filled_region_type, transaction_manager=<function in_transaction>)

Creates a filled region in the specified view.

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

  • view (Autodesk.Revit.DB.View) – The view to create the filled region in.

  • curve_loops (list Autodesk.Revit.DB.CurveLoop) – The curve loops to use for the filled region.

  • filled_region_type (Autodesk.Revit.DB.ElementId) – The type of filled region to create.

Returns:

A result object containing the created filled region instance.

Return type:

Result

duHast.Revit.DetailItems.purge_unused_detail_item_types module

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

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_used_repeating_detail_type_ids(doc)

Gets all used repeating detail type ids in the model. Used: at least one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of element ids representing repeating detail types. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_unused_repeating_detail_type_ids(doc)

Gets all unused repeating detail type ids in the model. Unused: not one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of element ids representing repeating detail types. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_unused_repeating_detail_type_ids_for_purge(doc)

Gets type ids off all unused repeating detail types in model. This method can be used to safely delete unused repeating detail 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 repeating detail type definition to be in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing all repeating detail types not in use. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_all_used_detail_symbol_ids(doc)

Gets all used detail symbol type ids in model. Used: at least one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of family symbol (type) ids. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_all_unused_detail_symbol_ids(doc)

Gets all unused detail symbol type ids in model. Unused: Not one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of family symbol (type) ids. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_all_unused_detail_symbol_ids_for_purge(doc)

Gets type ids off all unused detail symbols (types) in model. This method can be used to safely delete all unused detail symbols (types) and families. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing all unused detail symbols and families not in use. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_used_filled_region_type_ids(doc)

Gets all used filled region type ids in model. Used: at least one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of filled region type ids. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_unused_filled_region_type_ids(doc)

‘ Gets all unused filled region type ids in model. Unused: Not one instance of this type is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of filled region type ids. :rtype: list Autodesk.Revit.DB.ElementIds

duHast.Revit.DetailItems.purge_unused_detail_item_types.get_unused_filled_region_type_ids_for_purge(doc)

Gets ids off all unused filled region types in model. This method can be used to safely delete all unused filled region types in model. In the case that no filled region instance using any of the types is placed, this will return all but one type id since Revit requires at least one filled region type definition to be in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: List of element ids representing all unused filled region types not in use. :rtype: list of Autodesk.Revit.DB.ElementId

Module contents