Application: RebarFreeForm
Revit Platform: All
Revit Version: 2018.0
First Released For: 2018.0
Programming Language: C#
Skill Level: Advanced
Category: Structure
Type: ExternalCommand, ExternalApplication and IUpdater

Subject: Rebar Free Form
Summary: 
External command to create a Rebar FreeForm element and external application to implement the custom server used to regenerate the rebar geometry based on constraints

Classes: 
    RebarUpdateServer
    Application
    Command
TargetFace
CurveElementRegenUpdater
AddSharedParams

Project Files: 
Command.cs
It contains the class Command which inherits from interface IExternalCommand and implements the Execute method to create the custom rebar.
Application.cs
    It contains the class Application which inherits from interface IExternalApplication and implements the 
    OnStartup and OnShutdown methods to manage the custom IRebarUpdateServer.
RebarUpdateServer.cs
It contains the Class RebarUpdateServer which inherits from interface IRebarUpdateServer and         implements the functions needed to define and calculate a custom rebar.
CurveElementRegenUpdater.cs
It contains the class CurveElementRegenUpdater which inherits from interface IUpdater, and   
implements the notification of rebars connected to the curve elements  
AddSharedParams.cs
It contains the class Command which inherits from interface IExternalCommand and implements the creation and binding, of the two shared params used in the rebar regeneration

Description: 
This sample provides following functionalities.
-	Let user create a custom Rebar FreeForm by selecting 3 structural faces in the model. This generates a set of variable length bars between the intersections of 3 faces (face1 x face2 and face 1x face3 ) that automatically adjusts their length to the closest structural face. 
- 	Lets the user select a curve element form the model and use that curve to generate bar geometry in place of the curves resulting from the intersection
-   It implements the IRebarUpdateServer interface to define the bar’s behavior in the constraint framework. It defines the bar’s handles information, the generation of the bars based on the input faces.

Instructions: 
To create this type of rebar, open Revit application with the addon installed, and lunch “Add parameters” command. It will create the shared parameters and will bind them to rebar elements. Now lunch the “Create Rebar Free Form” command. It will create a rebar by selecting one face for each rebar handle (first, second, third handle). The first bar will be calculated at the intersection of the first and second faces. If the layout is not single, the last bar will be at the intersection of the first and third face. The rest of the bars in the set will be distributed evenly between the first and last bar. If the selected faces are not planar, and if the resulting intersection is not a straight line, the bar will issue a Can’t solve rebar shape warning.
Select a Curve Element (model lines, arcs, etc) to have its geometry used as bar geometry (optional).
The rebar’s constraints can be changed by selecting the bar and entering the Edit Constraints mode.