Sample Code Revit Batch Processor 1.1.16 documentation
Prints a result class instance to the pyRevit console.
result (Result) – The result instance to be printed.
header (str) – The header to be printed before the result.
Prints a header to the pyRevit console.
header (str) – The header to be printed.
Prints an error message to the pyRevit console.
message (str) – The error message to be printed.
Gets the user options for saving out families
Options are: save out to single directory, exclude existing families, overwrite existing families
forms (Forms) – the forms object
the user options
dict
Gets the directories to process
forms (Forms) – the forms object
the directories to process
list
Gets the directories to process
forms (Forms) – the forms object
the directories to process
list
Very simple wrapper function to get a file path from the user.
forms (pyRevit forms module) – pyRevit forms
title (str) – The title of the file picker dialog.
file_extension (str) – The file extension to filter for. Example: “csv”
multi_file (bool, optional) – Single vs multi file selection, defaults to False (single file)
The file path(s) selected by the user. None if no file was selected.
str, [str],None
Get the path to the bin directory of the extension. If a bin directory is provided, it will be used. Otherwise, the function will look for bin directories in the sys.path and return the shortest one.
bin_directory (str or None) – Optional path to the bin directory. If not provided, the function will search for bin directories in sys.path.
Result object with status, message, and list of bin paths found.
Find DLL path based on exact or startswith matching.
dll_name – Name of the DLL to find (e.g., “MyLibrary.dll”)
bin_path – Directory to search for the DLL
exact_match – If True, looks for an exact match of dll_name. If False, looks for files that start with dll_name.
Full path to the DLL if found, otherwise None
Check if an assembly with the given name is already loaded
assembly_name – Name of the assembly to check (e.g., “MyLibrary”)
True if assembly is loaded, False otherwise
Loads dlls from the libs folder of the duHast extension. Useful if a dll is not loaded through the startup script of a pyRevit extension.
expects the bin folder to be in the sys.path which means it needs to be located in the root folder of the extension: YourExtension.extensionbin
dlls_to_load (list) – List of dlls to load.
Result object with status and message.
Extract path up to and including target folder.
full_path: Full file or directory path target_folder: Folder name to search for (e.g., ‘lib’) endswith: If True, match folders ending with target_folder.
If False (default), exact match only.
Path ending with target_folder + ‘' or None if target_folder not found
Extract path up to and including ‘lib’ directory.
full_path: Full file or directory path
Path ending with ‘lib’ or None if ‘lib’ not found
Extract path up to and including ‘lib’ directory.
full_path: Full file or directory path
Path ending with ‘lib’ or None if ‘lib’ not found
Check if bin folder comes directly after a folder ending with .extension
path: Full directory path
True if bin is directly after .extension folder
Get the path to the bin directory based on the location of the script folder. Assumes that the bin folder is located in the root of the extension and that the script folder is located somewhere within the extension.
script_folder: Full path to the folder where the script is located
Path to the bin directory if found, otherwise None
Deafult element name builder is used to build the element name shown in the UI by combining the element name and element Id
element (Autodesk.Revit.DB.Element) – An element
A name of the element.
str
lists Elements provided by element getter function in UI and returns the users selection
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
None if nothing was selected. Otherwise a list of element ids
None or [Autodesk.Revit.ElementId]