Sample Code Revit Batch Processor 1.1.11 documentation
Get all levels in model
doc (Autodesk.Revit.DB.Document) – The current model document.
A collector with all levels in model.
Autodesk.Revit.DB.FilteredElementCollector
Get all levels in a view
doc (Autodesk.Revit.DB.Document) – The current model document.
view (Autodesk.Revit.DB.View) – The view to get grids from.
A collector with all grids in view.
Autodesk.Revit.DB.FilteredElementCollector
Gets a filtered element collector of all levels in the model ascending by project elevation.
Filters by category.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector of levels
Autodesk.Revit.DB.FilteredElementCollector
Gets a filtered element collector of all levels in the model descending by project elevation.
Filters by category.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector of levels
Autodesk.Revit.DB.FilteredElementCollector
Gets a filtered element collector of all level head types in the model.
Filters by category.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector of level heads
Autodesk.Revit.DB.FilteredElementCollector
Gets a filtered element collector of all level types in the model.
Filters by category.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector of level types.
Autodesk.Revit.DB.FilteredElementCollector
Gets a list of all level type ids in the model.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A list of all level type ids.
list of Autodesk.Revit.DB.ElementId
Gets ids of all level head family symbols (types) in the model.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A list of symbol ids.
list of Autodesk.Revit.DB.ElementId
Returns the nearest level matching the Z value and the offset adjustment from the level (in metric!!) in a tuple.
Note: Will return None if the placement level could not be determined. Nearest level is the level with the shortest absolute distance to the Z value and which is not in the ignore_level_names list. If the Z value is below the lowest level elevation in the model the lowest level will be returned. If the Z value is above the highest level elevation in the model the highest level will be returned.
z (float) – The Z coordinate (metric!)
levels (list) – List of levels in the model. (sorted ascending)
Returns the level and the offset adjustment (in metric) from the source family instance level.
tuple
Returns the nearest lowest level below the Z value and the offset adjustment from the level (in metric) in a tuple.
Note: Will return None if the placement level could not be determined. Nearest level is the level below or at the Z value and which is not in the ignore_level_names list.
z (float) – The Z coordinate (metric!)
levels (list) – List of levels in the model. (needs to be sorted ascending)
Returns the level and the offset adjustment (in metric) from the source family instance level.
tuple
Note: Any level appearance modification in a view will throw an exception if the level is not actually visible in the view.
Changes all levels in view to 2D
Note: Any level past in, which is not visible in the view, will throw an exception when attempting to set to 2D.
doc (Autodesk.Revit.DB.Document) – The current model document.
levels ([Autodesk.Revit.DB.Level]) – List of levels to be changed to 2D.
view (Autodesk.Revit.DB.View) – The view in which to change the levels
Result class instance. - result.status. True if all levels where set to 2D, otherwise False. - result.message will contain the name(s) of the level(s) changed to 2D - result.result empty list On exception: - result.status (bool) will be False. - result.message will contain generic exception message including the level name. - result.result will be empty
Toggles level head visibility on specified end for given level.
doc (Autodesk.Revit.DB.Document) – The current model document.
level (Autodesk.Revit.DB.Level) – The level of which a heads visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level heads visibility is to be toggled.
end_identifier – which end.
show_head (bool) – True head will switched on, False it will be switched off
Result class instance. - result.status. True if all levels head(s) visibility was set successfully, otherwise False. - result.message will contain the name(s) of the level(s) where a head visibility was set. - result.result empty list On exception: - result.status (bool) will be False. - result.message will contain generic exception message including the level name. - result.result will be empty
Hides both heads of levels in the given view.
doc (Autodesk.Revit.DB.Document) – The current model document.
level (Autodesk.Revit.DB.Level) – The level of which a head’s visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level head’s visibility is to be toggled.
Result class instance.
result.status (bool): True if all levels’ head(s) visibility was switched off successfully, otherwise False.
result.message (str): Contains the name(s) of the level(s) where a head visibility was set.
result.result (list): Empty list.
On exception:
result.status (bool) will be False.
result.message (str) will contain a generic exception message including the level name.
result.result (list) will be empty.
Turns on level heads at zero end in specified view.
doc (Autodesk.Revit.DB.Document) – The current model document.
level ([Autodesk.Revit.DB.Level]) – The levels of which a heads visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level heads visibility is to be toggled.
Result class instance.
result.status. True if all levels head(s) visibility at zero end was set to visible successfully, otherwise False.
result.message will contain the name(s) of the level(s) where a head visibility was set.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message including the level name.
result.result will be empty
Turns on level heads at One end in specified view.
doc (Autodesk.Revit.DB.Document) – The current model document.
level ([Autodesk.Revit.DB.Level]) – The levels of which a heads visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level heads visibility is to be toggled.
Result class instance.
result.status. True if all levels head(s) visibility at one end was set to visible successfully, otherwise False.
result.message will contain the name(s) of the level(s) where a head visibility was set.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message including the level name.
result.result will be empty
Toggles level head visibility on specified end for given level in given views.
doc (Autodesk.Revit.DB.Document) – The current model document.
level (Autodesk.Revit.DB.Level) – The level of which a heads visibility is to be toggled.
view (Autodesk.Revit.DB.DatumEnds) – The view in which a level heads visibility is to be toggled.
end_identifier – The end of the level to be modified.
Result class instance.
result.status. True if all levels head(s) visibility was changed successfully, otherwise False.
result.message will contain the name(s) of the level(s) where a head visibility was changed.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message including the level name.
result.result will be empty
Toggles level head visibility on one end for given levels
doc (Autodesk.Revit.DB.Document) – The current model document.
levels ([Autodesk.Revit.DB.Level]) – The levels of which a heads visibility at one end is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level heads visibility is to be toggled.
Result class instance.
result.status. True if all levels head(s) visibility at one end was changed successfully, otherwise False.
result.message will contain the name(s) of the level(s) where a head visibility was changed.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message including the level name.
result.result will be empty
Toggles level head visibility on zero end for given levels
doc (Autodesk.Revit.DB.Document) – The current model document.
levels ([Autodesk.Revit.DB.Level]) – The levels of which a head visibility at zero end is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a level heads visibility is to be toggled.
Result class instance.
result.status. True if all level head(s) visibility at one end was changed successfully, otherwise False.
result.message will contain the name(s) of the level(s) where a head visibility was changed.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message including the level name.
result.result will be empty
Gets all ids of unused level types in the model. Unused: not one instance per level type is placed in the model. This method can be used to safely delete unused level types from the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of level type ids. :rtype: list of Autodesk.Revit.DB.ElementId
Gets all ids of unused family symbols (types) of level head families. Unused: not one instance per symbol is placed in the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of symbol ids. :rtype: list of Autodesk.Revit.DB.ElementId
Gets ids of all unused level head symbols and families. Unused: not one instance per level symbol is placed in the model. This method can be used to safely delete unused level symbols or families from the model. :param doc: Current Revit model document. :type doc: Autodesk.Revit.DB.Document :return: A list of symbol and or family ids. :rtype: list of Autodesk.Revit.DB.ElementId