-
Notifications
You must be signed in to change notification settings - Fork 14
Push to Revit details
This chapter explains in detail the Push action - it is recommended to read Revit Adapter details section first for the information about mechanics of the adapter itself.
As explained in Push to Revit basics, there are three action-specific inputs that drive Push:
-
Objects, an
IEnumerable<IBHoMObject>
to be pushed to Revit -
Push type of type
BH.oM.Adapter.PushType
explained in more detail in a dedicated section -
Action config of type
RevitPushConfig
They are specified as arguments of the Push
method of RevitAdapter
. Depending on the thread on which the Push
method is executed, they will be either sent via Sockets as a data package (if Push
is executed outside of Revit thread) or passed directly to RevitUIAdapter
(if everything is run on a single Revit thread).
Next, RevitUIAdapter
triggers Push action, which, depending on PushType
, points to a combination of Delete
, Create
and Update
CRUD methods, as explained below.
-
If
PushType
includes deleting Revit elements,Push
method collects ElementIds of Revit elements that are linked to relevant BHoM objects and deletes them by calling Delete CRUD method. -
If
PushType
includes creating Revit elements,Push
method creates new Revit elements based on BHoM objects by calling Create CRUD method. Conversion is driven byBH.Revit.Engine.Core.Convert.IToRevit
dispatcher method. To avoid converting any of the objects more than once, identifier of each object that has been converted in a given adapter action is being stored inrefObjects
dictionary together with the output of the convert. -
If
PushType
includes updating Revit elements,Push
method collects ElementIds of Revit elements that are linked to relevant BHoM objects and updates them by calling Update CRUD method. Two methods are required to explicitly update a Revit element of given type:- type-specific
BH.Revit.Engine.Core.Modify.Update
that handles properties and parameters - type-specific
BH.Revit.Engine.Core.Modify.SetLocation
that handles geometry of the element
The above are being dispatched by
BH.Revit.Engine.Core.Modify.IUpdate
andBH.Revit.Engine.Core.Modify.ISetLocation
respectively. If type-specificUpdate
method does not exist, only the parameter values will be copied over to the Revit element, as explained here. - type-specific
Finally, the successfully pushed BHoM objects are returned to RevitAdapter
(using a Sockets bypass if RevitAdapter
and RevitUIAdapter
do not run on the same thread).
The diagram below maps out the above workflow - it should be read as an action-specific variation of the Adapter action stage of the general Adapter flowchart.
-
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