Application: Selections
Revit Platform: ALL
Revit Version: 2011.0
First Released For: 2011.0
Programming Language: C#
Skill Level: Beginning
Category: Selection
Type: ExternalCommand

Subject: Selections
Summary: This sample will demonstrate how to perform selection operations.

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.DB.Document
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Reference
Autodesk.Revit.UI.Selection.Selection
Autodesk.Revit.UI.Selection.ObjectType
Autodesk.Revit.UI.Selection.ISelectionFilter
Autodesk.Revit.UI.Selection.ObjectSnapTypes
Autodesk.Revit.Exceptions.OperationCanceledException

Project Files: 
Command.cs
This file contains four classes which implement IExternalCommand interface. 
The PickforDeletion command allows picking some elements, and then deleting from document.
The PlaceAtPointOnWallFace command allows picking a point on wall face, and then place a window with Fixed 36" x 48" type to it.
The PlaceAtPickedFaceWorkplane command allows to pick a face, set the work plane on it, and then pick a point on the work plane as center to create a circle.
The SelectionDialog command allows picking an element and a point from dialog. After picking the point, the element will be moved to the picked point.

SelectionFilters.cs
This file contains three classes which implement ISelectionFilter interface. 
The DefaultElementsFilter is a filter that allows all objects to be picked.
The WallFaceFilter is a filter that allows only wall faces to be picked.
The PlanarFaceFilter is a filter that allows only planar face to be picked.
	
SelectionManager.cs
This file contains two classes.
The SelectionType is for choosing specific selection type from dialog.
The SelectionManager performs object selection and storage for the dialog.

SelectionForm.cs
This file contains a class SelectionForm which provides a dialog to select objects.

Description: 
The sample utilizes the method PickObject and PickObjects of Selection class to pick one and multi objects. It also utilizes the PickPoint of Selection class to pick point.
Elements and object references are filtered by implementing the interface ISelectionFilter and used in selection methods.

Instructions: 
1.	Start Revit.
2.	In order to use the commands, user should open “SelectionsSample.rvt “ in the folder, or manually create a project document with 36" x 48" window type loaded. If the opened document does not contains the specific type of window, the PlaceAtPointOnWallFace command will fail.
3.	Launch “Pick for Deletion” via the external command menu. Pick some elements in the document and these selected elements will be deleted.
4.	Launch “Place At Point On Wall Face” via the external command menu. Pick a point on the wall face, and then a 36" x 48" window will be placed at the location picked.
5.	Launch “Place At Picked Face Work plane” via the external command menu. Pick a face of column; a new work plane will be created on the picked face and then pick a point on it, a circle with the point as center will be created.
6.	Launch “Selection Dialog” via the external command menu. A dialog name “Select” shows. Click “Pick Element” button. Pick one element from document. The dialog shows again. Click “Move To” button. Pick a point in the document, the element previously picked will be moved to the location picked.