Sample Code Revit Batch Processor 1.1.14 documentation
These helper function expect a text file in csv format with 5 columns:
SOURCE_FAMILY_NAME = 0
SOURCE_FAMILY_CATEGORY_NAME = 1
SOURCE_FAMILY_TYPE_NAME = 2
TARGET_FAMILY_NAME = 3
TARGET_FAMILY_TYPE = 4
Note:
First row is treated as a header row and its content is ignored.
Retrieves file swap directives from a given folder location.
directory_path (str) – Fully qualified folder path to folder containing directives.
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
This list contains 3D element categories and is used in obsolete revit family purge function any revit category commented out with note ‘purged else where’ can be found in list ‘catsLoadableThreeDOther’
Contains 3D family categories which needed specific purge code, rather then checking for unplaced family instances. i.e. built in revit type settings
This list contains 2D element categories and is used in obsolete revit family purge function.any revit category commented out with note ‘purged else where’ can be found in list ‘catsLoadableTagsOther’
Contains 2D family categories which needed specific purge code, rather then checking for unplaced family instances i.e. built in revit type settings
Reports:
all family located in library folder(s)
Get all family files from a directory. (ignores subdirectories)
directory (str) – directory to search for family files
list of family files
[FileItem]
Get all xml files from a directory. (ignores subdirectories)
directory (str) – directory to search for xml files
list of xml files
[FileItem]
Check if a file item exists in a list of file items based on the name property.
instances ([FileItem]) – list of file items
name_to_check (str) – name to check
True if a file item with the name exists, False otherwise
bool
Check if any family files require an xml file update
family_files ([FileItem
]) – the family files to check
xml_files ([FileItem
]) – the xml files to check against
a list of family files that require updating
list
Write the family type data to an XML file.
application (Autodesk.Revit.ApplicationServices.Application) – The Revit application object.
family_path (str) – The path of the family file.
xml_path (str) – The path of the XML file.
A result object with .status True if successful.
Create an xml file for a given family file.
revit_application (Application) – revit application object
family_file (str) – family file to create xml file for
Write the data to a temp XML file and read it back.
an_action_to_write_xml_data (function returning a Result object) – The action to write the XML data.
Result class instance.
result.status: True if data was written and read back successfully, False otherwise.
result.message will contain the log data.
result.result will be a XML document object.
On exception
Reload.status (bool) will be False
Reload.message will contain the exception message
Reload.result will be an empty list.
Write the data to an XML file and read it back.
an_action_to_write_xml_data (function) – The action to write the XML data.
xml_file_path (str) – The path of the XML file.
Result class instance.
result.status: True if data was written and read back successfully, False otherwise.
result.message will contain log data
result.result will be a XML document object.
On exception
Reload.status (bool) will be False
Reload.message will contain the exception message
Reload.result will be an empty list.
Create xml files for all families in a list of directories using Revit API PartAtomExport function.
revit_application (Application) – revit application object
process_directories ([str]) – list of directories to process
progress_callback (ProgressBase) – progress callback object
Result object
Separate module for ease of testing and maintainability.
Get the XML namespace manager for the XML document. Also adds the required namespaces.
doc_xml (XmlDocument) – The XML document.
An XML namespace manager.
XmlNamespaceManager
Get a parameter from the XML node.
xml_node (XmlNode) – The XML node.
family_name (str) – The name of the family.
root_category_path (str) – The root category path.
family_path (str) – The path of the family file.
family_type_name (str) – The name of the family type.
default_value (str) – The default value to use if the parameter value is not set.
A family type parameter data storage object.
Get all unique parameters from the family type XML document by inspecting every part node representing a family type.
Note: The part atom export will only contain parameters for a family type if they have a value set.
doc_xml (XmlDocument) – The XML document.
A list of family type parameter data storage objects.
Add missing empty parameters to the list of parameters for a family type.
all_parameters_in_atom_export ([FamilyTypeParameterDataStorage
]) – The list of all parameters in the atom export.
parameters_in_type ([FamilyTypeParameterDataStorage
]) – The list of parameters for the family type.
root_name_path (str) – The root name path.
root_category_path (str) – The root category path.
family_name (str) – The name of the family.
family_path (str) – The path of the family file.
family_type_name (str) – The name of the family type.
The list of parameters for the family type.
Read the XML data into the storage object.
Note all names and values will be encoded to ascii.
doc_xml (XmlDocument) – The XML document.
family_name (str) – The name of the family.
family_path (str) – The path of the family file.
root_category_path (str) – The root category path.
A family type data storage manager object.
Removes all xml files in the process directories with no associated family files.
process_dirs (list) – List of directories to process.
Result object with status and message.