Application: AllViews
Revit Platform: All
Revit Version: 2011.0
First Released For: 9.0
Programming Language: C#
Skill Level: Medium
Category: Views
Type: ExternalCommand

Subject: Generate a new sheet that includes all the selected views and edit properties of a selected viewport in a sheet.
Summary: 
This sample demonstrates how to generate a new sheet that includes all the selected views. It also demonstrates how to access the properties of a viewport such as LabelLineOffset, LabelLength and Orientation. 

Classes: 
Autodesk.Revit.DB.View
Autodesk.Revit.DB.ViewSet
Autodesk.Revit.Creation.Document.NewViewSheet

Project Files:
AllViews.cs
It contains two classes:
-	The class Command which implements interface IExternalCommand, it is the entry of this external command.
-	The class ViewsMgr is responsible for generating a new sheet that has all the selected views placed and for getting and setting properties of a selected view.

AllViewsForm.cs
It contains the class AllViewsForm which is a dialog. This dialog is a twofold-based UI: “Create new Sheet and Viewports” and “Viewport Properties”.
Following are the contents for the “Create new Sheet and Viewports” part:
-	A tree view represents all the views which can be placed in sheet.
-	A list of all title blocks that users can select one to create sheet.
-	A text box for users to input the name of the sheet to be created.
Following are the contents for the “Viewport Properties” part:
-	A “Select Viewport” Group Box to select a viewport based on its sheet name and its associated view name. This applies to any viewport even if it was not created by “Generate Sheet” OK button.
-	A set of Group Boxes (Rotation, Label Offset and Label Line Length) to set corresponding properties of the selected viewport.
-	A set of Group Boxes to show the actual properties of the selected viewport.

Description: 
This sample demonstrates the following functionalities:
-	Finds all the views and title blocks in the current project and display the names in a tree view. The user can select several views. When OK button is clicked, a new sheet is generated that has all the selected views placed in.
-	The most important class is ViewsMgr. It shows how to get all views from document, and how to generate a new sheet via RevitAPI. It shows also how to access and set a viewport properties.

Instructions:
A.	Use case “Create new Sheet and Viewports”:
1)	Run this external command.
2)	Select the title block for the sheet being generated.
3)	Select views you want to place in the new sheet.
4)	Click OK button to generate new sheet.

B.	Use case “Viewport Properties”:
1)	Run this external command.
2)	Identify and select a viewport using the name of the sheet it is contained in and its associated view name.
3)	All its properties will be updated in the UI.
4)	Change its rotation, label offset or label line length using the corresponding Controls and Apply buttons.
5)	The changes will be applied in the document and all the viewport properties will be updated in the UI.

C.	Mixed Use case:
1)	Create a sheet and its viewports (use case A)
2)	Update and get properties of a selected viewport (use case B)