Application: PlacementOptions
Revit Platform: All
Revit Version: 2017.0
First Released For: 2017.0
Programming Language: C#
Skill Level: Medium
Category: Basics, Families
Type: ExternalCommand

Subject: Interactive placement of family instance via options
Summary: 
This sample demonstrates how to place the family instance via options.

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.UI.UIDocument
Autodesk.Revit.UI.PromptForFamilyInstancePlacementOptions
Autodesk.Revit.UI.FaceBasedPlacementType
Autodesk.Revit.UI.SketchGalleryOptions
Autodesk.Revit.DB.FamilySymbol 
Autodesk.Revit.DB.FamilyInstance

Project Files: 
Command.cs
It contains the class Command which inherits from interface IExternalCommand and implements the Execute method. In the execute method, it shows the options dialog for user to choose the option of placing the family instance.

OptionsForm.cs
It is the dialog for choosing the face based family instance or sketch based family instance.

FacebasedForm.cs
    It is the dialog for setting the FaceBasedPlacementType option of the face based family instance.

SketchbasedForm.cs
    It is the dialog for setting the SketchGalleryOptions option of the face based family instance.

Description: 
This sample provides following functionalities.
   - Let user place face based family instance via the face, vertical face, or work plane option.
   - Let user place face sketch based family instance via the line, arc, and other sketching options.

Instructions: 
Open Revit application, open the PlacementOptionsSample.rvt,and then execute the command.
1.	Place a face based family instance.
a.	The dialog ‘Select facebased or sketchbase options’ will show for setting the type.
b.	Select the ‘FaceBasedPlacementType for face based family instance placement.’ Option and click OK button.
c.	It will show the dialog ‘Place facebased family instance’ for placing a face based family instance. Choose the option and click OK button.
Expected result: a face based family instance will be place on the location of cursor according to the option settings.

2.	Place a sketch based family instance.
d.	The dialog ‘Select facebased or sketchbase options’ will show for setting the type.
e.	Select the ‘SketchGalleryOptions for sketch family instance placement.’ Option and click OK button.
f.	It will show the dialog ‘Place sketch based family instance’. Choose the option and click OK button.
Expected result: a structural framing will be place on the location of cursor according to the option settings and the sketching.