Sample Code Revit Batch Processor 1.1.11 documentation
PROPERTY_MATERIAL_NAME
PROPERTY_MATERIAL_NAME_VALUE_DEFAULT
PROPERTY_MATERIAL_ID
PROPERTY_LINE_WEIGHT_PROJECTION_NAME
PROPERTY_LINE_WEIGHT_CUT_NAME
PROPERTY_LINE_COLOUR_RED_NAME
PROPERTY_LINE_COLOUR_GREEN_NAME
PROPERTY_LINE_COLOUR_BLUE_NAME
CATEGORY_GRAPHIC_STYLE_PROJECTION
CATEGORY_GRAPHIC_STYLE_CUT
CATEGORY_GRAPHIC_STYLE_3D
subcategory renaming sampled dictionary key is the current subcategory name, value is the new subcategory name
list of built in parameters attached to family elements containing subcategory ids
value: sub category
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
A dictionary.
dictionary {str: Autodesk.Revit.DB.Category}
Checks whether a given subcategory exists in the family.
Note: Only subcategory directly belonging to the family category will be checked for a match.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
sub_cat_name (str) – The name of the subcategory to be checked against.
True if subcategory exists in family, otherwise False
bool
Deletes a given subcategory from the family.
Note: Only subcategory directly belonging to the family category will be checked for a match.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
sub_cat_name (str) – The name of the subcategory to be deleted.
True if subcategory exists in family and was deleted successfully, otherwise False
bool
value: category
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
A dictionary.
dictionary {str: Autodesk.Revit.DB.Category}
Returns all family subcategories which do not belong to the actual family category.
key: category name value: dictionary : key sub cat name, value: subcategory
Note: custom subcategories have an Id greater 0
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
A dictionary.
dictionary {str: {str:Autodesk.Revit.DB.Category} }
Returns all family custom subcategories which do not belong to the actual family category. Custom categories have an Id greater then 0.
key: category name value: dictionary : key sub cat name, value: subcategory
Note: custom subcategories have an Id greater 0
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
A dictionary.
dictionary {str: {str:Autodesk.Revit.DB.Category} }
Returns all family pre defined categories which do not belong to the actual family category.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
A list of categories.
[Autodesk.Revit.DB.Category]
Returns categories by their built in definition
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
built_in_defs ([Autodesk.Revit.DB.BuiltInCategory]) – list of BuiltInCategory Enumeration values
list of categories
[Autodesk.Revit.DB.Category]
Changes the family category to new one specified by name. (this will not re-instate any custom sub categories created under the new family category)
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
new_category_name (str) – The name of the new family category.
True only if the category was changed successfully. Any other case False! (That includes situations when the family is already of the new category)
bool
Bases: tuple
Create new instance of category_data(category_name, sub_category_name, id)
Alias for field number 0
Alias for field number 2
Alias for field number 1
Returns all categories and subcategories in a model
doc (Autodesk.Revit.DB.Document) – The current model document.
List of named tuples of type category_data
Returns a category based on the build in category enum value.
doc (Autodesk.Revit.DB.Document) – The current model document.
built_in_category (Autodesk.Revit.DB.BuiltInCategory) – The built in category
A category
Autodesk.Revit.DB.Category
Returns a built in category enum value based on the category object.
doc (Autodesk.Revit.DB.Document) – The current model document.
category (Autodesk.Revit.DB.Category) – The category object
The built in category enum value
Autodesk.Revit.DB.BuiltInCategory
Retrieves a category object from a document based on the given main category name and optional sub category name.
doc (document object): The document object from which to retrieve the category. main_category_name (str): The name of the main category to search for. sub_category_name (str): The name of the sub category to search for within the main category.
category object: The retrieved category object if a match is found. None: If no match is found.
Returns the built in category enum value based on the category name.(i.e. OST_Walls)
category_name (str) – The category name
The built in category enum value
Autodesk.Revit.DB.BuiltInCategory
Sets line cut settings for a category object.
doc (Autodesk.Revit.DB.Document) – A Revit Document object
category (Autodesk.Revit.DB.Category) – A Revit Category object
line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model
line_cut_style (LineCut
) – An overrides projections object instance.
Retrieves line cut settings from a category object.
category (Autodesk.Revit.DB.Category) – A Revit Category object
line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model
An overrides projections object instance.
Sets line projection settings for a category object.
doc (Autodesk.Revit.DB.Document) – A Revit Document object
category (Autodesk.Revit.DB.Category) – A Revit Category object
line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model
line_projection_style (LineProjection
) – An overrides projections object instance.
Retrieves line projection settings from a category object.
category (Autodesk.Revit.DB.Category) – A Revit Category object
line_patterns ([AutoDesk.Revit.LinePatternElement]) – All line patterns in the model
An overrides projections object instance.
Sets the material of a category object.
doc (Autodesk.Revit.DB.Document) – A Revit Document object
category (Autodesk.Revit.DB.Category) – A Revit Category object
material_id (int) – The id of the material to be set
Sets category graphics settings for a Revit model.
doc (Autodesk.Revit.DB.Document) – A Revit Document object
category_style_source ([ObjectStyle
]) – A list of category graphics settings
category_style_target ([ObjectStyle
]) – A list of category graphics settings
A result object with the success status and the comparison result
Retrieves all category graphics settings from a Revit model.
doc (Autodesk.Revit.DB.Document) – A Revit Document object
A result object with the success status and the category graphics settings
Retrieves all line pattern ids as integer values from list of category graphics settings.
categories ([ObjectStyle
]) – A list of category graphics settings
A list of line pattern ids
[int]
Compares two lists of category graphics settings.
Notes:
The comparison is based on the main category name and sub category name.
if a style exists in list 1 but not in list 2 it will be reported as an equal style.
if a style exists in list 2 but not in list 1 it will not be reported.
category_styles_1 ([ObjectStyle
]) – A list of category graphics settings
category_styles_2 ([ObjectStyle
]) – A list of category graphics settings
A result object with the success status and the comparison result
. result is a list of dictionaries with the main and sub category names as keys and the category graphics settings from both lists as values.
Changes the current family category to the new one specified.
Revit’s default behavior when changing the category of a family is to discard all custom subcategories created and assign elements which are on those custom subcategories to the new family category. This function will also re-create any user-created subcategories under the new category and assign elements to them to match the subcategory they were on before the category change.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
new_category_name (str) – The new family category.
Result class instance. - result.status (bool): True if all custom subcategories were re-created under the new family category and elements were moved to those subcategories, otherwise False. - result.message (str): Confirmation of successful creation of subcategories and element move. - result.result (list): Empty list.
result.status (bool): False.
result.message (str): Generic exception message.
result.result (list): Empty.
Creates a new subcategory to the family category and returns it.
Note: if a subcategory with the name provided already exist it will be returned instead of trying to create another one with the same name.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
new_sub_category_name (str) – The new subcategory name
The new subcategory. Exception “The name ‘xys’ is already in use” if subcategory with the same name is already in file.
A category. (or str if exception occurred)
Creates a new category and applies properties stored.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
new_cat_name (str) – The new sub category name.
saved_cat_props (list of dictionaries in format as per GetCategoryProperties(cat) method.) – Dictionary containing subcategory properties.
ignore_missing_cut_style (bool) – If true will not flag an exception if applying styles fails on missing cut style.
Result class instance. - result.status. True if category was created or already existed in file, otherwise False. - result.message will contain the name of the category created. - result.result returns new category, if category already exists in file it will return that On exception: - result.status (bool) will be False. - result.message will contain generic exception message. - result.result will be empty
Creates a new subcategory and transfer properties from existing subcategory.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
new_cat_name (str) – The new sub category name.
existing_cat_name (str) – The existing subcategory name
Result class instance. - result.status. True if category was created or already existed in file, otherwise False. - result.message will contain the name of the category created. - result.result returns new category, if category already exists in file it will return that On exception: - result.status (bool) will be False. - result.message will contain generic exception message. - result.result will be empty
Renames a family custom subcategory.
Note: Only subcategories directly belonging to the family category will be checked for a match.
The Revit API currently does not allow changing a subcategory name. This method instead:
Duplicates the old subcategory with the new name.
Moves all elements belonging to the old subcategory to the new subcategory.
Deletes the old subcategory.
If the new subcategory already exists in the file:
Moves all elements belonging to the old subcategory to the new subcategory.
Deletes the old subcategory.
doc (Autodesk.Revit.DB.Document) – Current Revit family document.
old_sub_cat_name (str) – The subcategory name to be renamed.
new_sub_cat_name (str) – The new subcategory name.
Result class instance. - result.status (bool): True if the subcategory was renamed successfully, otherwise False. - result.message (str): Rename process messages. - result.result (list): Empty list.
result.status (bool): False.
result.message (str): Generic exception message.
result.result (list): Empty.