Sample Code Revit Batch Processor 1.1.11 documentation
Get all grids in model
doc (Autodesk.Revit.DB.Document) – The current model document.
A collector with all grids in model.
Autodesk.Revit.DB.FilteredElementCollector
Get all multi segmented grids in model
doc (Autodesk.Revit.DB.Document) – The current model document.
A collector with all multi segmented grids in model.
Autodesk.Revit.DB.FilteredElementCollector
Get all grids 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
Get all multi segmented grids 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 multi segmented grids in view.
Autodesk.Revit.DB.FilteredElementCollector
Gets a unique list of grids id’s making up the multi segment grids past in.
multi_segment_grids ([_type_]) – List of multi segment grids
List of individual grid ids.
:rtype:[Autodesk.Revit.DB.ElementId]
Returns only linear grid visible in view.
Will exclude multi segment grids and arc based grids.
doc (Autodesk.Revit.DB.Document) – Current model document.
view (Autodesk.Revit.DB.View) – The view.
List of linear grids.
[Autodesk.Revit.DB.Grid]
Gets all grid head types in the model.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector with grid head types
Autodesk.Revit.DB.FilteredElementCollector
Gets all grid types in the model
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector with grid types
Autodesk.Revit.DB.FilteredElementCollector
Gets all grid types ids in the model.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
A filtered element collector with grid type ids
Autodesk.Revit.DB.FilteredElementCollector
Gets all valid grid types, based on a past in grid, available in model.
Uses grid.GetValidTypes() to get the grid types.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
g (Autodesk.Revit.DB.Grid) – A grid
A nested set of lists containing grid type id and grid type name
list of lists [[GridTypeId as Revit ElementId, grid type name as string],[…]]
Gets the grid type name of a grid.
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
g (Autodesk.Revit.DB.Grid) – A grid.
The grid type name.
str
Gets the grid type Id based on it’s name, if no match found it returns the Revit Invalid Element Id
doc (Autodesk.Revit.DB.Document) – Current Revit model document.
grid_type_name (str) – The grid type name.
The grids type Id or if not match is found Autodesk.Revit.DB.ElementId.InvalidElementId
Autodesk.Revit.DB.ElementId
Returns true if a given parameter on a grid has a value meeting the parameter condition.
g (Autodesk.Revit.DB.Grid) – A grid.
para_name (str) – A parameter Name.
para_condition (func(arg1,arg2)) – A function evaluating the parameter value. First argument is the value to be checked against. Second argument is the actual parameter value.
condition_value (var) – The value to be checked against.
True if parameter value is evaluated to True otherwise False.
bool
Gets the maximum extent of a grid.
g (Autodesk.Revit.DB.Grid) – A grid.
A string in format [maxX,maxY,maxZ]
str
Gets the minimum extent of a grid.
g (Autodesk.Revit.DB.Grid) – A grid.
A string in format [minX,minY,minZ]
str
This will return all ids grid head family types in the model
Gets grid curve (line from a view. Will return none if grid is out of view scope
grid (Autodesk.Revit.DB.Grid) – The grid element.
view (Autodesk.Revit.DB.View) – The view of which the get the grid extend from.
A curve object if grid is visible in view, otherwise None
[Autodesk.Revit.DB.Curve] or None
Get the z value of Grid plane by view based on first grid found visible in view.
grids ([Autodesk.Revit.DB.Grid]) – Grids in the model
view (Autodesk.Revit.DB.View) – the view
The view plane Z value or 0.0 if no grid found in view.
float
Note: Any grid appearance modification in a view will throw an exception if the grid is not actually visible in the view.
Changes all grids in view to 2D
Note: Any grid 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.
grids ([Autodesk.Revit.DB.Grid]) – List of grids to be changed to 2D.
view (Autodesk.Revit.DB.View) – The view in which to change the grids
Result class instance. - result.status. True if all grids where set to 2D, otherwise False. - result.message will contain the name(s) of the grid(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 grid name. - result.result will be empty
Toggles grid bubble visibility on the specified end for a given grid.
doc (Autodesk.Revit.DB.Document) – The current model document.
grid (Autodesk.Revit.DB.Grid) – The grid of which a bubble’s visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which a grid bubble’s visibility is to be toggled.
end_identifier (Autodesk.Revit.DB.DatumEnds) – An enumerated type representing ends of a datum plane.
show_bubble (bool) – True if the bubble will be switched on, False if it will be switched off.
Result class instance.
result.status (bool): True if the grid bubble(s) visibility was set successfully, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble 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 grid name.
result.result (list) will be empty.
Hides both bubbles of grids in the given view.
doc (Autodesk.Revit.DB.Document) – The current model document.
grid (Autodesk.Revit.DB.Grid) – The grid for which bubble visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
Result class instance.
result.status (bool): True if all grid bubble(s) visibility was switched off successfully, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble 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 grid name.
result.result (list) will be empty.
Turns on grid bubbles at the zero end in the specified view.
doc (Autodesk.Revit.DB.Document) – The current model document.
grid (List[Autodesk.Revit.DB.Grid]) – The grids for which bubble visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
Result class instance.
result.status (bool): True if all grid bubble(s) visibility at the zero end was set to visible successfully, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble 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 grid name.
result.result (list) will be empty.
Turns on grid bubbles at one end in the specified view.
doc (Autodesk.Revit.DB.Document) – The current model document.
grid (List[Autodesk.Revit.DB.Grid]) – The grids for which bubble visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
Result class instance.
result.status (bool): True if all grid bubble(s) visibility at one end was set to visible successfully, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble 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 grid name.
result.result (list) will be empty.
Toggles grid bubble visibility on a specified end for a given grid in given views.
doc (Autodesk.Revit.DB.Document) – The current model document.
grid (Autodesk.Revit.DB.Grid) – The grid of which bubble visibility is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
end_identifier (Autodesk.Revit.DB.DatumEnds) – The end of the grid to be modified.
Result class instance.
result.status (bool): True if the grid bubble(s) visibility was changed successfully, otherwise False.
result.message (str): Contains the name of the grid where bubble visibility was changed.
result.result (list): Empty list.
On exception:
result.status (bool) will be False.
result.message (str) will contain a generic exception message including the grid name.
result.result (list) will be empty.
Toggles grid bubble visibility on one end for given grids.
doc (Autodesk.Revit.DB.Document) – The current model document.
grids (List[Autodesk.Revit.DB.Grid]) – The grids of which bubble visibility at one end is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
Result class instance.
result.status (bool): True if the bubble visibility at one end was changed successfully for all grids, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble visibility was changed.
result.result (list): Empty list.
On exception:
result.status (bool) will be False.
result.message (str) will contain a generic exception message including the grid name.
result.result (list) will be empty.
Toggles grid bubble visibility on zero end for given grids.
doc (Autodesk.Revit.DB.Document) – The current model document.
grids (List[Autodesk.Revit.DB.Grid]) – The grids of which bubble visibility at zero end is to be toggled.
view (Autodesk.Revit.DB.View) – The view in which grid bubble visibility is to be toggled.
Result class instance.
result.status (bool): True if the bubble visibility at zero end was changed successfully for all grids, otherwise False.
result.message (str): Contains the name(s) of the grid(s) where bubble visibility was changed.
result.result (list): Empty list.
On exception:
result.status (bool) will be False.
result.message (str) will contain a generic exception message including the grid name.
result.result (list) will be empty.
Extends all linear grids to intersection points with crop box on active view.
doc (Autodesk.Revit.DB.Document) – The current model document.
Result class instance.
result.status. True if all grids in active view got extended successfully, otherwise False.
result.message will contain the name(s) of the grids extended.
result.result empty list
On exception:
result.status (bool) will be False.
result.message will contain generic exception message.
result.result will be empty
Bases: tuple
Create new instance of grid_properties(is_grid_in_scope, datum_extent_type_zero, datum_extent_type_one, grid_curve, end_zero_bubble, end_one_bubble, is_grid_hidden)
Alias for field number 2
Alias for field number 1
Alias for field number 5
Alias for field number 4
Alias for field number 3
Alias for field number 6
Alias for field number 0
returns a dictionary where grid id is the key and values are a list of properties:
inScope (bool)
isVisible (bool)
end zero, end One: Extent type for both ends ( 2D vs 3D) (None if not in scope)
curve: the curve (line) describing the grid extent in view (None if not in scope)
end bubble one end bubble zero: bool describing which bubble isi visible in view (None if not in scope)
active_view (Autodesk.Revit.DB.View) – The active view.
grids_in_model ([Autodesk.Revit.DB.Grid]) – Grids in the model.
Result class instance.
result.status: True.
result.message will contain the names of the grids not in scope only.
result.result contains a named tuple: grid_properties:
- {
bool, is the grid in scope (inside the crop region) # Datum Extent type at End 0, # Datum Extend type at End 1, curve, describing the start and end point of grid bool, #bubble visible at zero end bool, # bubble visible at 1 end bool # is the grid visible
}
On exception
result.status (bool) will be True (exception is ignored)
result.message will contain the message grid not in scope for view
Changes grids in a number views to match the extend, visibility, bubble visibility of grids in template view
doc (Autodesk.Revit.DB.Document) – Current model document.
grids_in_model ([Autodesk.Revit.DB.Grid]) – Grids in the model
grid_template_data (A named tuple: grid_properties bool, is the grid in scope (inside the crop region) # Datum Extent type at End 0, # Datum Extend type at End 1, curve, describing the start and end point of grid bool, # bubble visible at zero end bool, # bubble visible at 1 end bool # is the grid visible) – A dictionary describing the appearance of each grid in the template view
views_to_change_grid_elements (ProgressBase
) – A list of views in which to update the grid graphics
callback – A progress call back function
Propagates grid extends and visibility from the active view to all other views selected in UI.
doc (Autodesk.Revit.DB.Document) – Current model document.
viewsToChangeGridElements ([Autodesk.Revit.DB.View]) – A list of views in which to update the grid graphics
callback – A progress call back function
Result class instance.
result.status: True.
result.message will contain the names of the grids amended.
result.result an empty list
On exception
result.status (bool) will be False
result.message will contain the exception message
Workset modifier method. Moves all grids to one workset.
Rules format:
[‘Model name’, [[workset modifier method,[worksetName]]]]
doc (Autodesk.Revit.DB.Document) – The current model document.
worksetRules (List) – The workset rules in the specified format.
A result object.
Type
Workset modifier method. Moves grids matching a type condition to a particular workset.
Default workset type rules example:
[[‘model name’, [[ModifyGridWorkSetsByTypeName, [[‘workset name’, util.ConDoesNotEqual, ‘grid type name’],[‘workset name’, util.ConDoesEqual, ‘grid type name’]]]]]]
doc (Autodesk.Revit.DB.Document) – The current model document.
worksetRules (List) – The workset rules in the specified format.
A result object.
Type
Workset modifier method. Moves grids matching parameter condition to a particular workset
Default workset type rules example:
[[‘model name’, [[ModifyGridWorkSetsByParameterValue, [[‘workset name’, util.ConTwoStartWithOne, ‘Name’, ‘name starts with value’]]]]]]
doc (Autodesk.Revit.DB.Document) – The current model document.
worksetRules (_type_) – _description_
returns a result object
_type_
Modifies worksets of grids as per workset rules format.
Default workset type rules example:
[[‘model name’, [[ModifyGridWorkSetsDefault, [[‘default workset name’] # There should only be one per model]]]]]
doc (Autodesk.Revit.DB.Document) – The current model document.
revitFileName (_type_) – _description_
worksetRules (_type_) – _description_
returns a result object
Result class instance.
result.status: View deletion status returned in result.status. False if an exception occurred, otherwise True.
result.message: will contain the fully qualified file path of the exported file
result.result: will be an empty list
On exception
Reload.status (bool) will be False
Reload.message will contain the exception message
this will return all ids of unused grid types in the model to be purged
doc (Autodesk.Revit.DB.Document) – The current model document.
List of grid types which can be purged
[]
this will return all ids of unused family symbols (types) of grid head families
doc (Autodesk.Revit.DB.Document) – The current model document.
A list of grid head family ids.
[Autodesk.Revit.DB.ElementId]
this will return all ids of unused grid head symbols and families to be purged
doc (Autodesk.Revit.DB.Document) – The current model document.
A list of family ids.
[Autodesk.Revit.DB.ElementId]