Sample Code Revit Batch Processor 1.1.11 documentation
Bases: IFamilyData
Class constructor
rootPath (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
rootCategoryPath (str) – The path of the family category in a tree: rootCategoryName :: nestedCategoryNameOne :: nestedCategoryTwo This includes the actual category name as the last node.
Collects all base data from the document and stores it in the class property .data
doc (Autodesk.Revit.DB.Document) – Current family document
Bases: IFamilyProcessor
Class constructor.
Calls processor instance with the document and root path provided and adds processor instance to class property .data
doc (Autodesk.Revit.DB.Document) – Current family document.
rootPath (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
rootCategoryPath (str) – The path of the nested family in in terms of category in a tree: rootFamilyCategory :: nestedFamilyOneCategory :: nestedFamilyTwoCategory This includes the actual family category as the last node.
Bases: IFamilyDataStorage
Class constructor
Notes:
This is just for completeness, the class is not used in the current version of the software.
Bases: IFamilyDataStorageUsedBy
Class constructor
Collects data from current family document and then recursively from any nested family.
Bases: Base
Class constructor taking a list of processor instances as argument.
data_processors ([IFamilyProcessor]) – List of processor instances
Entry point for recursive family looper.
Processes root family as well as actions any post processing.
doc (Autodesk.Revit.DB.Document) – The family document.
root_name (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
root_category (str) – The path of the nested family category in a tree: rootFamilyCategory :: nestedFamilyOneCategory :: nestedFamilyTwoCategory This includes the actual family category as the last node.
Result class instance.
.status True if all data processor instances ran without an exception. Otherwise False.
.message will contain each processor type and its processing status’
contains all instances of the following storage classes from reports read from files:
FamilyBaseDataStorage
CategoryDataStorage
WarningsDataStorage
LinePatternDataStorage
SharedParameterDataStorage
These storage instances belong to a specific family only identified by unique combination of family name nesting path and family category nesting path
Bases: Base
Family data container class.
Contains all instances of the following storage classes from reports read from files:
FamilyBaseDataStorage
CategoryDataStorage
WarningsDataStorage
LinePatternDataStorage
SharedParameterDataStorage
Note: There is the possibility that only one of the storage classes is populated, this is due to the fact that the data is read from separate files and not all data is always present in each file.
family_base_data_storage ([FamilyBaseDataStorage
]) – a list of FamilyBaseDataStorage instances
category_data_storage ([FamilyCategoryDataStorage
]) – a list of FamilyCategoryDataStorage instances
line_pattern_data_storage ([FamilyLinePatternDataStorage
]) – a list of FamilyLinePatternDataStorage instances
shared_parameter_data_storage ([FamilySharedParameterDataStorage
]) – a list of FamilySharedParameterDataStorage instances
warnings_data_storage ([FamilyWarningsDataStorage
]) – a list of FamilyWarningsDataStorage instances
kwargs (_type_) – _description_
ValueError – type mismatch if any of the past in lists are not of the correct type
Will add a family base data storage instance and infer some other class properties from it.
Note: if storage data properties root_name_path and root_category_path are different to the current values all other storage properties will be wiped to avoid mismatches!
other (FamilyBaseDataStorage
) – A family base data storage instance added to this class
TypeError – If other is not an instance of FamilyBaseDataStorage a type error will be raised.
Will add a category data storage instance.
Note: an exception will be raised if family_nesting_path and family_category_nesting_path do not match the current values!
other (FamilyCategoryDataStorage
) – a data storage instance
TypeError – If other is not an instance of FamilyCategoryDataStorage a type error will be raised.
Will add a line pattern data storage instance.
Note: an exception will be raised if family_nesting_path and family_category_nesting_path do not match the current values!
other (FamilyLinePatternDataStorage
) – a data storage instance
TypeError – If other is not an instance of FamilyLinePatternDataStorage a type error will be raised.
Will add a shared parameter data storage instance.
Note: an exception will be raised if family_nesting_path and family_category_nesting_path do not match the current values!
other (FamilySharedParameterDataStorage
) – a data storage instance
TypeError – If other is not an instance of FamilySharedParameterDataStorage a type error will be raised.
Will add a warnings data storage instance.
Note: an exception will be raised if family_nesting_path and family_category_nesting_path do not match the current values!
other (FamilyWarningsDataStorage
) – a data storage instance
TypeError – If other is not an instance of FamilyWarningsDataStorage a type error will be raised.
Adds a new data storage instance to this container.
other (IFamilyDataStorage
) – The new data storage instance.
TypeError – If other is not an instance of IFamilyDataStorage a type error will be raised.
Returns all family base data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage instance
{str:[[str]]}
Returns all family category data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage instance
{str:[[str]]}
Returns all family line pattern data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage instance
{str:[[str]]}
Returns all family shared parameter data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage instance
{str:[[str]]}
Returns all family warnings data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage instance
{str:[[str]]}
returns a dictionary where key is the storage data type and value is a list of string representing the data storage
Returns all family base data instance storage property as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage property name
{str:[[str]]}
Returns all family category data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage property name
{str:[[str]]}
Returns all family line pattern data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage property name
{str:[[str]]}
Returns all family shared parameter data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage property name
{str:[[str]]}
Returns all family warnings data instance storage as string
A dictionary where key is the storage data type, and value is a nested list of strings representing each storage property name
{str:[[str]]}
returns a dictionary where key is the storage data type and value is a nested list of list of string representing the data storage property names
Dictionary
{str:[[str]]}
contains:
an entire family nesting tree structure represented as other FamilyDataFamily instances
all FamilyDataContainer instances belonging to this family only ( identified by unique combination on family name nesting path and family category nesting path )
Bases: Base
Family data class.
contains an entire family nesting tree structure represented as family data container instances
family_name (str) – The name of the family.
family_category (str) – The Revit category of the family.
family_file_path (str) – The file path of the family.
Compares family_name and family_category properties only
other (FamilyDataFamily
) – Another FamilyDataFamily instance
True if family_name and family_category are equal otherwise false
bool
Get the longest unique family name nesting path(s) and family category nesting path(s) of the family data.
The longest unique nesting path as a list of tuples, or None if family is not processed.
list[(family_name_nesting, family_category_nesting)] or None
Process the family data.
build the nesting by name path
build the nesting by level
Add a data container to the family data.
Add a nested family instance.
nested_family_instance (FamilyDataFamily
) – The family instance to be added
TypeError – If nested_family_instance is not an instance of FamilyDataFamily a type error will be raised.
Returns the data storage within each storage container within this family as well as within the nested families as a a list of string.
A dictionary where key is the data storage type, and value is a nested list of lists containing the data storage string value
{key:[[str]]}
Returns all property names used in storage instances in containers within this family and any nested families.
A dictionary where key is the data storage type, and value is a list containing the data storage properties as string values
{key:[[str]]}
Check if the family data has circular nesting.
Circular nesting is defined as a situation where a nesting path property of a container contains the same family more than once.
returns a list of tuples in format:
0 index the nesting level at which the circular nesting occurs
1 index a string in format: family name :: family category
2 the entire family name nesting path this circular reference appeared on
Bases: FamilyDirectiveBase
Class constructor
Bases: FamilyDirectiveBase
Class constructor
Bases: IFamilyData
Class constructor
rootPath (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
rootCategoryPath (str) – The path of the family category in a tree: rootCategoryName :: nestedCategoryNameOne :: nestedCategoryTwo This includes the actual category name as the last node.
Collects all base data from the document and stores it in the class property .data
doc (Autodesk.Revit.DB.Document) – Current family document
Bases: IFamilyProcessor
Class constructor.
Calls processor instance with the document and root path provided and adds processor instance to class property .data
doc (Autodesk.Revit.DB.Document) – Current family document.
rootPath (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
rootCategoryPath (str) – The path of the nested family in in terms of category in a tree: rootFamilyCategory :: nestedFamilyOneCategory :: nestedFamilyTwoCategory This includes the actual family category as the last node.
Bases: IFamilyDataStorage
Class constructor
Used to store values of family parameters by family type.
Bases: Base
Class constructor
Get the root storage objects.
The IFamilyDataStorage objects referring to the root family.
list
Get the property names of the storage object.
The property names.
list
Notes:
any revit specific data types i.e. ElementId need to be converted to int or string for JSON to work and in order for these classes to be used outside the Revit API!
any string values need to be encoded to utf-8 and decoded back to utf-8 to avoid encoding issues
Bases: Base
Class constructor
Update the usage of this storage object with the usage of another storage object by:
adding the use counter of the other storage object to this storage object’s use counter
appending the root name path of the other storage object to this storage object’s used_by list
Get the data from the object als dictionary.
Note data type fixing is applied to:
ElementIds
System.Byte values
Convert the instance of this class to json.
A Json object.
json
Notes:
used to store used by other nested families data in root family data storage class.
Bases: Base
Class constructor
Actions any pre processing before family data will be collected.
doc (Autodesk.Revit.DB.Document) – The family document.
_description_
_type_
Gather data on the root family and any nested families
doc (Autodesk.Revit.DB.Document) – The family document.
root_path (str) – The path of the nested family in a tree: rootFamilyName :: nestedFamilyNameOne :: nestedFamilyTwo This includes the actual family name as the last node.
root_category_path (str) – The path of the nested family category in a tree: rootFamilyCategory :: nestedFamilyOneCategory :: nestedFamilyTwoCategory This includes the actual family category as the last node.
Actions any post processing after family data has been collected.
doc (Autodesk.Revit.DB.Document) – The family document.
Returns list of data storage instances.
List of iFamilyStorage instances.
[iFamilyStorage]
Returns data objects as JSON formatted strings.
JSON formatted string.
str
Returns data storage objects as nested list of strings, where each inner list represents the values of a data storage object.
Strings are UTF 8 encoded
list of list of strings.
[str]
Returns the headers of the data storage objects.
list of strings.
[str]