Sample Code Revit Batch Processor 1.1.16 documentation

Contents:

This Page

duHast.Revit.Family.LibraryCleanUp package

Subpackages

Submodules

duHast.Revit.Family.LibraryCleanUp.in_process module

duHast.Revit.Family.LibraryCleanUp.in_process.in_process_family(doc, library_path, output)

duHast.Revit.Family.LibraryCleanUp.post_process module

duHast.Revit.Family.LibraryCleanUp.post_process.move_files(files, destination_directory, output)

Moves files to the specified destination directory.

Parameters:
  • files (list[str]) – List of file paths to be moved.

  • destination_directory (str) – Directory where the files will be moved.

  • output (function) – Output function to log messages.

Returns:

True if all files were moved successfully, False otherwise.

Return type:

bool

duHast.Revit.Family.LibraryCleanUp.post_process.get_part_atom_files_from_families(file_path)

Gets part atom files from the specified family file path.

Parameters:

file_path – list of Path to the family files.

Returns:

List of part atom files.

duHast.Revit.Family.LibraryCleanUp.post_process.move_original_families_to_backup_directory(family_copy_directive_directory, backupPath, output)

Moves original families from the library path to the backup path.

Parameters:
  • family_copy_directive_directory (str) – Directory containing family copy directives.

  • backupPath (str) – Path to the backup directory where families will be moved.

  • output (function) – Output function to log messages.

Returns:

Result object indicating success or failure of the operation.

Return type:

Result

duHast.Revit.Family.LibraryCleanUp.post_process.copy_new_families_to_library(output_path, library_path, output)

Copies new families from the output path to the library path. :param output_path: Path where new families are located. :type output_path: str :param library_path: Path to the library where families will be copied. :type library_path: str :param output: Output function to log messages. :type output: function

Returns:

Result object indicating success or failure of the operation.

Return type:

Result

duHast.Revit.Family.LibraryCleanUp.post_process.post_process_family(output_path, library_path, backup_directory_path, output)

Post-process function to handle the final steps after family processing.

This function copies new families to the library and moves original families to a backup directory.

Parameters:
  • output_path (str) – Path where new families are located.

  • library_path (str) – Path to the library where new families will be copied to.

  • backup_directory_path (str) – Path to the backup directory where original families will be moved.

Returns:

Result object indicating the success or failure of the post-processing step.

Return type:

Result

duHast.Revit.Family.LibraryCleanUp.pre_process module

duHast.Revit.Family.LibraryCleanUp.pre_process.get_family_data_from_file(libraryPath)

Extracts family type data from XML files in the specified library path.

Returns:

Result class instance.

  • result.status: XML conversion status will be returned in result.status. False if an exception occurred, otherwise True.

  • result.message will contain which xml file was read and converted into family type data.

  • result.result will be [FamilyTypeDataStorageManager]

On exception

  • Reload.status (bool) will be False

  • Reload.message will contain the exception message

  • Reload.result will be an empty list

Return type:

Result

duHast.Revit.Family.LibraryCleanUp.pre_process.pre_process(library_path, output_path, task_list_directory_path, code_descriptor_path, output)

Pre-process function to prepare for the family type data extraction.

This function is a placeholder for any pre-processing steps that may be needed before extracting family type data from the library.

Parameters:
  • library_path (str) – Path to the library containing family files to be renamed.

  • output_path (str) – Path where the directives will be written and changed family files will be copied to.

  • task_list_directory_path (str) – Path where the task lists for RBP will be written.

  • code_descriptor_path (str) – Path to the code descriptor file. (AUSHFG)

  • output – Output object to write messages to.

Returns:

Result object indicating the success or failure of the pre-processing step.

Return type:

Result

Module contents