Revit Pull examples
Note
- It's worth having a look at Using the BHoM section and the rest of Revit_Toolkit Wiki before reading this page.
- Most of the scripts are presented in Grasshopper. All source files are available in samples.
Pulling selection
One of the more practical ways to specify elements for pull is simply selecting them in Revit and using FilterBySelection
.
Inspecting parameters
As explained in Handling of parameters section, each BHoM object representing a pulled Revit element has a fragment containing information about all parameters of the latter. These can be queried either as a batch or only value of a chosen one can be extracted. The example below shows both options excercised on a pulled wall.
Advanced filters
It is possible to combine multiple filters with each other to create very specified queries. The example below shows how to pull all elements that can be converted to either structural bars or structural panels, which also have a parameter Enable Analytical Model (checkbox type) equal to true
.
Sometimes pull needs to be done in more than one step. Below it is shown how to first pull the active view and then use it to pull all detail items that belong to it. As can be seen, FilterByViewSpecific takes BHoMObject as an argument - it knows that this object represents a given Revit view thanks to relationship explained in BHoM vs Revit identity section.
Another example of two step pull is pulling family type: first the family itself is pulled, then it is queried for all its types. Worth noting is the fact that error in Grasshopper component is caused by the empty input - once the pull is executed successfully, it will turn standard gray.
It is important to distinguish pulling types (above) from pulling elements of a given type. Example below shows the latter (pulling actual HEA 300 beams, instead of HEA 300 family type).
The next example shows how to pull plan views, which name starts with Structural prefix. Such view can be then manipulated (with Push) or used for further queries.
For those familiar with Revit API, it is possible to filter the elements by their API type. It is worth noticing that this method works only for types that inherit from Autodesk.Revit.DB.Element
.
Disciplines
As mentioned in Conversion from Revit section, depending on the discipline set in Action config, Revit elements can be converted to different BHoM objects. A vivid example of that is shown in the script below. Revit walls are being converted to:
- BH.oM.Physical.Elements.Wall
for Physical discipline
- BH.oM.Structure.Elements.Panel
for Structural discipline
- BH.oM.Environment.Elements.Panel
for Environmental discipline
Pulling energy analysis model
Energy analysis is a specific discipline that requires information about meta information (e.g. topology or building location) that is often not needed for other disciplines. Therefore EnergyAnalysisModelRequest
in order to ease the process of pulling comprehensive data from Revit energy analysis model.
Pulling edges
A hidden feature of action config: pulling any elements together with their geometry as shown in Revit! In case below, of framing elements. As explained in Pull of Geometry and Representation section, the edges are stored in BHoM object's CustomData
under Revit_edges key - easiest way to retrieve it is to use GetProperty
component (only in Grasshopper), alternatively the object and its CustomData
can be decomposed with Explode
.
Pulling representations
Is it also possible to pull the mesh representation of a Revit element - this can be achieved by setting RepresentationConfig
of the RevitPullConfig
as explained in Pull of Geometry and Representation section.
Mapping parameters on Pull
As explained in Parameter mapping section, values stored in parameters of a Revit element or its type under different names can be mapped into a single parameter wrapper in BHoM. The script below pulls all columns from the model and copies over from their type parameter values named b or Height to a single BHoM parameter named ProfileHeight. What is more, it overwrites BHoM objects' names with Column Location Mark parameter values.
Note: The script is meant to be run with the Revit sample named rst_basic_sample_project.rvt available in Revit samples folder.