Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.Revit.Family package

Subpackages

Submodules

duHast.Revit.Family.family_element_utils module

Revit families helper functions retrieving elements from a family.

duHast.Revit.Family.family_element_utils.get_all_generic_forms_in_family(doc)

Filters all generic forms (3D extrusions) in family. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A collector of Autodesk.Revit.DB.GenericForm. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_element_utils.get_all_curve_based_elements_in_family(doc)

Filters all curve-based elements in a family, including symbolic lines and model lines.

Parameters:

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

Returns:

A list of Autodesk.Revit.DB.CurveElement.

Return type:

list of Autodesk.Revit.DB.CurveElement

duHast.Revit.Family.family_element_utils.get_all_model_text_elements_in_family(doc)

Filters all model text elements in family. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A collector of Autodesk.Revit.DB.ModelText. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_element_utils.get_all_reference_planes_in_family(doc)

Filters all reference planes in family. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A collector of Autodesk.Revit.DB.ReferencePlane. :rtype: Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_functions module

This module contains a number of helper functions relating to Family elements

duHast.Revit.Family.family_functions.get_name_to_family_dict(rvt_doc)

Create a dictionary of family name and the Family element :param rvt_doc: Revit document :type rvt_doc: Autodesk.Revit.DB.Document :return: Dictionary of family name and Family element :rtype: dict

duHast.Revit.Family.family_geometry module

Revit families geometry helper functions.

duHast.Revit.Family.family_geometry.get_solids_based_bounding_box_from_family_instance(doc, family_instance)

Returns a bounding box of the family instance based on solids in the family instance geometry only.

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

  • family_instance (Autodesk.Revit.DB.FamilyInstance) – The family instance to get the bounding box from.

Returns:

The bounding box of the family instance or None if no solids within the family instance are found.

Return type:

Autodesk.Revit.DB.BoundingBoxXYZ or None

duHast.Revit.Family.family_instance_create module

Revit family instance placement helper functions.

duHast.Revit.Family.family_instance_create.place_a_family_instance_by_level(doc, location_point, family_symbol, target_placement_level, transaction_manager=<function in_transaction>, modify_action=None)

Places a family instance by level.

Note: It is much faster to modify the family instance after placement in the same transaction than to place it in one transaction and modify its parameters in a separate transaction. Use the modify_action parameter to provide a function that modifies the family instance after placement. Function to accept a family instance as a parameter.

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

  • location_point (Autodesk.Revit.DB.XYZ) – The location point of the family instance.

  • family_symbol (Autodesk.Revit.DB.FamilySymbol) – The family symbol to place.

  • target_placement_level (Autodesk.Revit.DB.Level) – The level to place the family instance on.

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

  • modify_action (function) – An action to run after the family instance is placed to modify its properties.

Returns:

A result object.

Return type:

duHast.Utilities.Objects.result.Result

duHast.Revit.Family.family_instance_create.place_a_family_instance_in_basic_wall(doc, location_point, wall, family_symbol, target_placement_level, transaction_manager=<function in_transaction>, modify_action=None)

Places a family instance in a basic wall.

Note: It is much faster to modify the family instance after placement in the same transaction than to place it in one transaction and modify its parameters in a separate transaction. Use the modify_action parameter to provide a function that modifies the family instance after placement. Function to accept a family instance as a parameter.

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

  • location_point (Autodesk.Revit.DB.XYZ) – The location point of the family instance.

  • wall (Autodesk.Revit.DB.Wall) – The wall to place the family instance in.

  • family_symbol (Autodesk.Revit.DB.FamilySymbol) – The family symbol to place.

  • target_placement_level (Autodesk.Revit.DB.Level) – The level to place the family instance on.

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

  • modify_action (function) – An action to run after the family instance is placed to modify its properties.

Returns:

A result object.

Return type:

duHast.Utilities.Objects.result.Result

duHast.Revit.Family.family_load_option module

This class is the default implementation for family load call backs.

class duHast.Revit.Family.family_load_option.FamilyLoadOption(*args: Any, **kwargs: Any)

Bases: IFamilyLoadOptions

OnFamilyFound(familyInUse, overwriteParameterValues)

Defines behavior when a family is found in the model.

Overwrite parameter values is set to True.

Parameters:
  • familyInUse (_type_) – _description_

  • overwriteParameterValues (_type_) – _description_

Returns:

True

Return type:

bool

OnSharedFamilyFound(sharedFamily, familyInUse, source, overwriteParameterValues)

Defines behavior when a shared family is found in the model.

Overwrite parameter values is set to True. In case of any shared sub components already in the model but different in family loaded, the project version will be used.

Parameters:
  • sharedFamily (_type_) – _description_

  • familyInUse (_type_) – _description_

  • source (_type_) – _description_

  • overwriteParameterValues (_type_) – _description_

Returns:

True

Return type:

bool

duHast.Revit.Family.family_parameter_utils module

Revit families parameter helper functions.

duHast.Revit.Family.family_parameter_utils.set_family_parameter_value_by_storage_type(param_w, manager, value)

Set parameter value based on the storage type of the parameter.

Parameters:
  • param_w (Parameter) – The parameter to set the value for.

  • manager (FamilyManager) – The family manager.

  • value (str) – The value to set the parameter to.

Returns:

The result of the operation.

Return type:

res.Result

duHast.Revit.Family.family_parameter_utils.set_family_parameter_value(doc, manager, fam_para, value)

Set parameter value.

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

  • manager (FamilyManager) – The family manager.

  • fam_para (Parameter) – The parameter to set the value for.

  • value (str) – The value to set the parameter to.

Returns:

The result of the operation.

Return type:

res.Result

duHast.Revit.Family.family_parameter_utils.set_parameter_formula(doc, manager, fam_para, formula)

Set parameter value as a formula.

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

  • manager (FamilyManager) – The family manager.

  • fam_para (rdb.Parameter) – The parameter to set the formula for.

  • formula (str) – The formula to set.

Returns:

The result of the operation.

Return type:

res.Result

duHast.Revit.Family.family_parameter_utils.create_family_parameter(doc, parameter_name, parameter_group, parameter_type, is_instance)

Changes a shared family parameter to a standard family parameter.

Note: will need updating to support ForgeType fro Revit 2022 onwards

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

  • parameterName (str) – The shared parameter name.

  • prefix (str, optional) – Revit requires the new parameter to have a different name to the shard parameter, therefore a prefix to the name is applied, defaults to ‘_’

Returns:

Result class instance.

  • Parameter change status returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain the name of the shared parameter and the new family parameter name.

  • result.status will contain the new family parameter.

On exception (handled by optimizer itself!):

  • result.status (bool) will be False.

  • result.message will contain generic exception message.

  • result.status will be an empty list

Return type:

Result

duHast.Revit.Family.family_parameter_utils.associate_parameter_with_other_parameter_on_nested_family_instance(doc, nested_family_instance, target_parameter_name, source_parameter_name)

Associate a nested family instance parameter ( can be type or instance) with a host family parameter.

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

  • nested_family_instance (FamilyInstance) – The nested family instance.

  • target_parameter_name (str) – The target parameter name.

  • source_parameter_name (str) – The source parameter name.

Returns:

The result of the operation.

Return type:

res.Result

duHast.Revit.Family.family_parameter_utils.filter_parameters_by_formula_driven(parameters, keep_if_formulae_driven)

Filter the parameters by whether they are determined by a formula or not.

Parameters:
  • parameters (list) – The list of parameters

  • keep_if_formulae_driven (bool) – True to keep the parameters that are determined by a formula, False otherwise

Returns:

The filtered list of parameters

Return type:

list

duHast.Revit.Family.family_reference_elements module

Revit families helper functions to change the reference type of reference planes and curve based elements.

duHast.Revit.Family.family_reference_elements.set_ref_planes_to_not_a_reference(doc)

This function sets any reference plane with reference type ‘weak’ within a family to reference type ‘not a reference’.

Parameters:

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

Returns:

Result class instance. - result.status (bool): True if at least one reference plane type was successfully changed; otherwise, False. - result.message (str): One row entry per reference plane requiring reference type change. - result.result (not used).

Return type:

Result

duHast.Revit.Family.family_reference_elements.set_symbolic_and_model_lines_to_not_a_reference(doc)

This function sets any model or symbolic curve in a family with reference type ‘weak’ to reference type ‘not a reference’.

Parameters:

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

Returns:

Result class instance. - result.status (bool): True if at least one curve reference type was successfully changed; otherwise, False. - result.message (str): One row entry per curve element requiring reference type change. - result.result (not used).

Return type:

Result

duHast.Revit.Family.family_reload module

Helper functions to load or reload families

duHast.Revit.Family.family_reload.reload_all_families(doc, library_location, include_sub_folders)

Reloads a number of families with setting: parameter values overwritten: True

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

  • library_location (str) – _description_

  • include_sub_folders (bool) – _description_

Raises:

UserWarning – _description_

Returns:

Returns True if any of the reload actions was successful.

Return type:

bool

duHast.Revit.Family.family_reload.get_family_ids_from_symbols(doc)

Get all loadable family ids in file

Parameters:

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

Returns:

List of element ids representing loadable families.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.family_reload.get_new_symbol_ids(pre_load_symbol_id_list, after_load_symbol_list)

Returns a list of symbol ids not present prior to reload.

Compares past in list of id’s and returns ids not in preloadSymbolIdList

Parameters:
  • pre_load_symbol_id_list (list of Autodesk.Revit.DB.ElementId) – List of Ids of symbols prior the reload.

  • after_load_symbol_list (list of Autodesk.Revit.DB.ElementId) – List of ids of symbols after the reload.

Returns:

List of element ids representing Family Symbols.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.family_reload_single module

Helper functions to load or reload families

duHast.Revit.Family.family_reload_single.reload_family(doc, family, family_file_path)

Reloads a single family into a Revit document.

Will reload family provided in in path. By default the type parameter values in the project file will be overwritten with type parameter values in family.

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

  • family (Autodesk.Revit.DB.family) – The family to be reloaded

  • family_file_path (str) – The fully qualified file path of the family to be re-loaded.

Raise:

None

Returns:

Result class instance.

  • Reload status (bool) returned in result.status.

  • Reload message: contains the reload log messages.

  • Return family reference stored in result.result property on successful reload only (single entry in list)

On exception

  • Reload.status (bool) will be False

  • Reload.message will contain the exception message

Return type:

Result

duHast.Revit.Family.family_rename_files_utils module

Helper functions to read rename directives file(s) and return them as a tuple to the caller

These helper function expect a text file in csv format with 4 columns:

  • Current family name: with out the file extension

  • File path : fully qualified file path to the family file.

  • Family category: the Revit category of the family.

  • New family name: the new family name without the file extension.

Note:

  • First row is treated as a header row and its content is ignored.

duHast.Revit.Family.family_rename_files_utils.get_rename_directives(directory_path)

Retrieves file rename directives from a given folder location.

Parameters:

directory_path (str) – Fully qualified folder path to folder containing directives.

Returns:

Result class instance.

  • result.status. True if rename directives where found and loaded successfully, otherwise False.

  • result.message will contain number of directives found in format:’Found rename directives: ‘ + number

  • result.result list of directives

On exception:

  • result.status (bool) will be False.

  • result.message will contain an exception message.

  • result.result will be empty

Return type:

Result

duHast.Revit.Family.family_types_catalogue module

A module with helper function around family types catalogue files.

duHast.Revit.Family.family_types_catalogue.export_catalogue_file(doc, file_path=None)

Export the family types catalogue file.

Parameters:
  • doc (rdb.Family) – The family document to extract the type data from.

  • file_path (str) – The path to save the catalogue file. If None, the file will be saved in the same location as the family with the same name as the family.

duHast.Revit.Family.family_types_get_data_from_document module

A module with helper function around family types data extraction using Revit family document.

duHast.Revit.Family.family_types_get_data_from_xml module

A module with helper function around family types data extraction using Revit xml export functions.

Supports 2 methods of data extraction:

  • from family file on disk

  • from family element instance in document

duHast.Revit.Family.family_types_get_data_from_xml.write_data_to_temp_xml_file_and_read_it_back(an_action_to_write_xml_data)

Write the data to a temp XML file and read it back.

Parameters:

an_action_to_write_xml_data (function) – The action to write the XML data.

Returns:

The data read back from the XML file.

Return type:

XmlDocument or None if an error occurred.

duHast.Revit.Family.family_types_get_data_from_xml.write_data_to_xml_file_and_read_it_back(an_action_to_write_xml_data, xml_file_path)

Write the data to an XML file and read it back.

Parameters:
  • an_action_to_write_xml_data (function) – The action to write the XML data.

  • xml_file_path (str) – The path of the XML file.

Returns:

The data read back from the XML file.

Return type:

XmlDocument or None if an error occurred.

duHast.Revit.Family.family_types_get_data_from_xml.get_type_data_via_XML_from_family_file(application, family_name, family_path, use_temporary_file=True)

Get the family type data from the family document using the XML extraction method. This can be used to extract the type data from a family document within a Revit session but without opening the family in Revit.

Parameters:
  • application (Autodesk.Revit.ApplicationServices.Application) – The Revit application object.

  • family_name (str) – The name of the family.

  • family_path (str) – The path of the family file.

  • use_temporary_file (bool) – Whether to use a temporary file for the XML data.

Returns:

A result object with .result containing a list of family type data objects. (or empty if failed)

Return type:

Result

duHast.Revit.Family.family_types_get_data_from_xml.get_type_data_via_XML_from_family_object(revit_family)

Get the family type data from the family element in a REvit document using the XML extraction method.

Parameters:

revit_family (Autodesk.Revit.DB.Family) – The Revit family object.

Returns:

A result object with .result containing a list of family type data objects. (or empty if failed)

Return type:

Result

duHast.Revit.Family.family_utils module

Revit families helper functions.

duHast.Revit.Family.family_utils.load_family(doc, family_file_path, transaction_manager=<function in_transaction_with_failure_handling>, failure_config=FailureHandlingConfig(roll_back_on_warning=False, print_warnings=False, roll_back_on_error=False, print_errors=False, allowable_failures=None, set_forced_modal_handling=True, set_clear_after_rollback=True, output_function=<function output>), failure_processing_func=<function process_failures>)

Loads or reloads a single family into a Revit document.

Will load/ reload family provided in in path. By default the parameter values in the project file will be overwritten with parameter values in family.

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

  • family_file_path (str) – The fully qualified file path of the family to be loaded.

  • transaction_manager (function) – A function wrapping the load family action in a transaction. Default is in_transaction_with_failure_handling. None assumes a transaction is already in progress.

  • failure_config (FailureHandlingConfig) – The failure handling configuration object. Default is FailureHandlingConfig()

  • failure_processing_func (function) – The function to process failures. Default is process_failures

Raise:

None

Returns:

Result class instance.

  • Reload status (bool) returned in result.status.

  • Reload message: contains the reload log messages.

  • Return family reference stored in result.result property on successful reload only

On exception

  • Reload.status (bool) will be False

  • Reload.message will contain the exception message

Return type:

Result

duHast.Revit.Family.family_utils.get_family_symbols(doc, cats)

Filters all family symbols (Revit family types) of given built in categories from the Revit model.

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

  • cats (ICollection :cats sample: cats = List[rdb.BuiltInCategory] ([rdb.BuiltInCategory.OST_Furniture, rdb.BuiltInCategory.OST_Parking])) – ICollection of Autodesk.Revit.DB.BuiltInCategory values.

Returns:

A collector of Autodesk.Revit.DB.Element matching filter.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_utils.get_family_instances_by_built_in_categories(doc, cats)

Filters all family instances of given built in categories from the Revit model.

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

  • cats (ICollection :cats sample: cats = List[rdb.BuiltInCategory] ([rdb.BuiltInCategory.OST_Furniture, rdb.BuiltInCategory.OST_Parking])) – ICollection of Autodesk.Revit.DB.BuiltInCategory values:

Returns:

A collector of Autodesk.Revit.DB.Element matching filter.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_utils.get_family_instances_of_built_in_category(doc, builtin_cat)

Filters all family instances of a single given built in category from the Revit model.

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

  • builtin_cat (Autodesk.Revit.DB.BuiltInCategory) – single revit builtInCategory Enum value.

Returns:

A collector of Autodesk.Revit.DB.FamilyInstance matching filter.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_utils.get_all_loadable_families(doc)

Filters all families in revit model by whether it is not an InPlace family.

Note: slow filter due to use of lambda and cast to list.

Parameters:

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

Returns:

A list of families matching filter.

Return type:

list Autodesk.Revit.DB.Family

duHast.Revit.Family.family_utils.get_all_loadable_family_ids_through_types(doc)

Get all loadable family ids in file.

Parameters:

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

Returns:

list of family ids

Return type:

[Autodesk.Revit.DB.ElementId]

duHast.Revit.Family.family_utils.get_all_in_place_families(doc)

Filters all families in revit model by whether it is an InPlace family.

Note: slow filter due to use of lambda and cast to list

Parameters:

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

Returns:

A list of families matching filter.

Return type:

list Autodesk.Revit.DB.Family

duHast.Revit.Family.family_utils.get_all_family_instances(doc)

Returns all family instances in document.

Parameters:

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

Returns:

A collector with all family instances in document.

Return type:

Autodesk.Revit.DB.Collector

duHast.Revit.Family.family_utils.is_any_nested_family_instance_label_driven(doc)

Checks whether any family instance in document is driven by the ‘Label’ property.

Parameters:

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

Returns:

True if at least one instance is driven by label property. Otherwise False

Return type:

bool

duHast.Revit.Family.family_utils.get_symbols_from_type(doc, type_ids)

Get all family types belonging to the same family as types past in.

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

  • type_ids (list of Autodesk.Revit.DB.ElementId) –

    • list of element id’s representing family symbols (family types)

Returns:

dictionary: where key is the family id as Autodesk.Revit.DB.ElementId value is a list of all symbol(family type) ids as Autodesk.Revit.DB.ElementId belonging to the family

Return type:

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

duHast.Revit.Family.family_utils.get_family_instances_by_symbol_type_id(doc, type_id)

Filters all family instances of a single given family symbol (type).

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

  • type_id (Autodesk.Revit.DB.ElementId) – The symbol (type) id

Returns:

A collector of Autodesk.Revit.DB.FamilyInstance matching filter.

Return type:

Autodesk.Revit.DB.FilteredElementCollector

duHast.Revit.Family.family_utils.get_all_in_place_type_ids_in_model_of_category(doc, fam_built_in_category)

Filters family symbol (type) ids off all available in place families of single given built in category.

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

  • fam_built_in_category (Autodesk.Revit.DB.BuiltInCategory) – built in revit category

Returns:

A list of Element Ids representing the family symbols matching filter.

Return type:

list Autodesk.Revit.DB.ElementId

duHast.Revit.Family.family_utils.get_family_symbols_ids(doc, cats, exclude_shared_fam=True)

Filters family symbols belonging to list of built in categories past in.

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

  • cats (cats = List[rdb.BuiltInCategory] ([rdb.BuiltInCategory.OST_Furniture, rdb.BuiltInCategory.OST_Parking])) – ICollection of Autodesk.Revit.DB.BuiltInCategory values.

Returns:

A list of Element Ids representing the family symbols matching filter.

Return type:

list Autodesk.Revit.DB.ElementId

duHast.Revit.Family.family_utils.get_all_non_shared_family_symbol_ids(doc)

Filters family symbols (types) belonging to hard coded categories lists (catsLoadableThreeD, catsLoadableTags)

Parameters:

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

Returns:

A list of Element Ids representing the family symbols matching filter.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.family_utils.is_shared_from_family(family)

Returns if the family is shared (true) or not (false)

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

  • family_symbol (Autodesk.Revit.DB.Family) – The family

Returns:

True if family is shared, otherwise False

Return type:

bool

duHast.Revit.Family.family_utils.is_shared_from_symbol(family_symbol)

Returns if the family is shared (true) or not (false)

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

  • family_symbol (Autodesk.Revit.DB.FamilySymbol) – The family symbol (type)

Returns:

True if family is shared, otherwise False

Return type:

bool

duHast.Revit.Family.purge_unused_family_types module

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

duHast.Revit.Family.purge_unused_family_types.family_all_types_in_use(fam_type_ids, used_type_ids)

Checks if symbols (types) of a family are in use in a model. Check is done by comparing entries of fam_type_ids with used_type_ids. :param fam_type_ids: list of symbol(type) ids of a family :type fam_type_ids: list Autodesk.Revit.DB.ElementId :param used_type_ids: list of symbol(type) ids in use in a project :type used_type_ids: list Autodesk.Revit.DB.ElementId :return: False if a single symbol id contained in list fam_type_ids has a match in list used_type_ids, otherwise True. :rtype: bool

duHast.Revit.Family.purge_unused_family_types.get_unused_in_place_ids_for_purge(doc, unused_type_getter)

Filters symbol (type) IDs and family IDs of families.

The returned list of IDs can be either unused family symbols or entire families if none of their symbols are in use. In terms of purging, it’s faster to delete an entire family definition rather than deleting its symbols first and then the definition.

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

  • unused_type_getter (function (doc) -> list of Autodesk.Revit.DB.ElementId) – A function returning IDs of unused symbols (family types) as a list. It requires the current model document as an argument.

Returns:

A list of Element IDs representing the family symbols and/or family IDs matching the filter.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.purge_unused_family_types.get_used_unused_type_ids(doc, type_id_getter, use_type=0, exclude_shared_fam=True)

Filters types obtained by passing in the type_id_getter method and, depending on use_type, returns either the used or unused symbols of a family.

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

  • type_id_getter (function (doc, ICollection, bool) -> list of Autodesk.Revit.DB.ElementId) – A function returning IDs of symbols (family types) as a list. It requires the following arguments: - The current model document. - ICollection of built-in categories. - A boolean: exclude shared families.

  • use_type (int) – 0 for no dependent elements (not used); 1 for has dependent elements (is in use).

Returns:

A list of Element IDs representing the family symbols matching the filter.

Return type:

list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.purge_unused_family_types.get_unused_family_types(doc, exclude_shared_fam=True)

Filters unused non shared family (symbols) type ids in model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :param exclude_shared_fam: Default is True (exclude any shared families from filter result) :type exclude_shared_fam: bool :return: A list of Element Ids representing the family symbols matching filter. :rtype: list of Autodesk.Revit.DB.ElementId

duHast.Revit.Family.purge_unused_family_types.get_unused_non_shared_family_symbols_and_type_ids_to_purge(doc)

Filters unused, non shared and in place family (symbols) type ids in model which can be purged from the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of Element Ids representing the family symbols matching filter. :rtype: list of Autodesk.Revit.DB.ElementId

Module contents