-
Notifications
You must be signed in to change notification settings - Fork 14
Push 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.
As mentioned in Push to Revit basics section, Revit element types are name matched BHoM object properties. Therefore, the only property that is relevant for Construction
of BHoM walls and floors as well as Property
of BHoM framing elements is their name - all others will be simply ignored on Push.
The scripts below show how to push a primitive building to Revit. To make that happen, family types with names used in the script need to be loaded to the model. PushType
is set to CreateOnly
, which means that the attempt to update the existing elements will not be made.
In order to create a Revit element with predefined values of parameters or to update it, the user first needs to set parameter value using SetRevitParameter
or SetRevitParameters
method. First allows to set only one parameter at a time, while the second can take lists of parameter names and values. The example below shows how to push a grid of columns with predefined parameters, either by setting the parameters one by one or in batch.
When pushing framing elements to Revit, they get created exactly in the physical location of the BHoM object regardless the values of parameters, i.e. if the pushed beam is meant to be adjusted to its top face, its final location in space will be exactly same as in BHoM, with vertical adjustment parameter set to Top (its driving curve will move up with regard to the driving curve of the framing in BHoM).
To match the driving curves of a BHoM framing with the adjusted Revit element, one first needs to push the element with the parameters unset, and then update only the parameters using RevitPushConfig.SetLocationOnUpdate == false
. Both scenarios are shown in the script below.
ModelInstances
can be used to push objects of types that are not natively supported by BHoM. A sample below shows how to apply this technique to mechanical ducts.
Similar approach can be used to drafting instances: the next script generates a line load representation of family Linear Loads and type Load Label 2mm in view named Load Plan Level 0.
If only the name is specified on definition of a model instance or drafting instance, it will be converted into a primitive (model line, detail line, filled region etc.):
Note: Update is currently in prototype stage and might not always work as expected.
Once the element is pulled from Revit, one can e.g. change one of its parameters (by using SetProperty
) and push back to Revit, as shown in the example below. To update the elements instead of creating new, PushType
needs to be set either to UpdateOnly
or DeleteThenCreate
.
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. Similarily, the warning on Push does not always need to mean that the push had not succeeded - it might happen that e.g. the update of location had not worked, but it was not meant to happen actually.
Not only elements can be manipulated. Update can be successfully applied to families or types as well, for example to batch rename or changing any other settings. It is worth noting that if the name parameter is left blank on family pull, all families in the model are being pulled in one go.
Revit element type can be updated in 2 ways, either by setting Type parameter to the desired type (or its name) or by setting the defining property of a BHoM object to the name of the desired type. All options are shown in the screenshot below.
As explained in Parameter mapping section, values stored in BHoM object's properties and Revit parameter wrappers attached to it can be mapped into parameters of a Revit element or its type under different names. The script below pushes a wall and copies over the name of the BHoM object to the wall's Mark parameter, plus it copies over a single value attached to the BHoM object to two parameters of the wall and its type.
-
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