-
Notifications
You must be signed in to change notification settings - Fork 14
Pull examples
- It is 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 both Grasshopper and Dynamo. All source files are available in samples.
- It is highly recommended to switch to Manual mode when working with Dynamo and BHoM.
One of the more practical ways to specify elements for pull is simply selecting them in Revit and using FilterBySelection
.
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 Structural (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
.
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
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.
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
.
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.
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.
-
Overview:
What is Revit_Toolkit for?
Code structure
Building from source and debugging
License
Sample scripts -
Adapter:
Basics
Revit <-> BHoM conversion
BHoM vs Revit identity
Handling of Parameters
Conventions
Setup in Revit
Setup in Grasshopper
Setup in Dynamo
Setup in Excel
Details -
Pull:
Basics
Requests and filtering
Pull of Geometry and Representation
Pull from Links
Pull in Grasshopper
Pull in Dynamo
Pull in Excel
Examples
Explicit family vs type mapping
Details -
Push:
Basics
Push modes
Updating Revit types
FamilyLibrary
Push in Grasshopper
Push in Dynamo
Push in Excel
Examples
Details -
Remove:
Basics
Remove in Grasshopper
Remove in Dynamo
Remove in Excel
Examples
Details -
References:
BHoM Wiki
BHoM Adapter