Application: VisibilityControl
Revit Platform: All
Revit Version: 2010.0
First Released For: 2008.0
Last Modified: 02/26/2008
Modified By: PP Autodesk
Programming Language: C#
Skill Level: Medium
Category: Views
Type: ExternalCommand

Subject: Control visibility by category.
Summary: 
This sample demonstrates how to control visibility by category, and how the API supports the options to pick a single element or pick multiple elements.

Classes: 
Autodesk.Revit.Elements.View
Autodesk.Revit.Document
Autodesk.Revit.Selection
Autodesk.Revit.Settings
Autodesk.Revit.Categories

Project Files:                                
Command.cs
It contains the class Command which implements interface IExternalCommand; it is the entry of this external command.
VisibilityCtrl.cs
It contains the class VisibilityCtrl which is responsible for controlling visibility by category.
And an enumerate type IsolateMode listing the types of element select mode.

Description: 
Functionalities:
-	Control the visibility of elements in active view by category. A checked list box will allow user to choose the categories to be visible. After that, the active view will display elements belong to the checked categories, and elements belong to the unchecked categories will be invisible.
-	The user can select one element or multiple elements, and then the elements which belong to same category(s) of selected element(s) will be isolated in active view.
Implements:
-	The Document.Settings property provides access to general application settings of the Revit application, such as Categories. And its property Categories retrieves an object that provides access to all the categories within the Revit application and project.
-	The method setVisibility of View object can set the visibility of specified category.
-	The Selection’s method ‘PickOne’ selects at most one element. One more element will be added to modscope if user selects an element which differs from the elements in modscope before user's pick one operation.
-	The Selection’s method ‘WindowSelect’ selects elements by window. Elements will be added to modscope if possible.

Instructions: 
1.	Run Revit 2009.
2.	Run this external command.
3.	You can get and change the visibility of all categories in the active view.
4.	You can choose PickOne or WindowSelect mode to isolate element(s).