Skip to content

Revit Push examples


  • 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.

Pushing elements

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.

Push elements in Grasshopper

Pushing elements with parameters

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.

Push elements with parameters

Pushing framing elements

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.

Push framing elements

ModelInstances and DraftingInstances

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.

Push model instances in Grasshopper

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.

Push detail items in Grasshopper

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.):

Push detail lines in Grasshopper


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.

Update parameter in Grasshopper

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.

Update family names in Grasshopper

Type update

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.

Type update

Mapping parameters on Push

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.

Mapping parameters on Push