Application: ViewTemplateCreation
Revit Platform: All
Revit Version: 2020.0
First Released For: 2020.0
Programming Language: C#
Skill Level: Medium
Category: Parameters, Views
Type: ExternalCommand

Subject: Create and configure new view template
Summary: 
In this sample is showed a process of new view template creation from a regular view and view template settings configuration.

Classes:
Autodesk.Revit.UI.IExternalCommand;
Autodesk.Revit.UI.Result;

Autodesk.Revit.DB.Transaction;
Autodesk.Revit.DB.Document;
Autodesk.Revit.DB.FilteredElementCollector;
Autodesk.Revit.DB.BuiltInCategory;
Autodesk.Revit.DB.View;
Autodesk.Revit.DB.ViewDetailLevel;
Autodesk.Revit.DB.ElementId;
Autodesk.Revit.DB.BuiltInParameter;
Autodesk.Revit.DB.Color;
Autodesk.Revit.DB.FillPatternElement;
Autodesk.Revit.DB.FillPatternTarget;
Autodesk.Revit.DB.OverrideGraphicSettings;

Project Files: 
Command.cs
Contains class Command which inherits from interface IExternalCommand and implements the Execute method. It creates and shows View Template Creation form.
Utils.cs
Contains several functions for showing message boxes and a constant string with the name of the sample.

ViewTemplateCreationForm.cs
Declares the View Template Creation form. In this form, user can select a view for template creation, set include setting of “Parts Visibility” parameter, set value of “Detail Level” parameter. After user presses “Apply” button new view template will be created based on the selected view, parameter settings will be applied to parameters, V/G Overrides Model cut patterns settings will be changed for the following categories: Columns, Doors, Walls, Windows.
V/G Model cut patterns settings will be changed in the following way: “Foreground Pattern” will be set to “Solid fill”, “Background color” will be set to “Black”. 
At the end, the newly created template will be assigned to the selected view.

Description: 
This sample provides the following functionalities:
-	Create new view template based on the selected view
-	Set include setting of “Parts Visibility” parameter
-	Set the value of “Detail Level” parameter
-	Change some Visibility/Graphics Overrides for a few model categories

Instructions: 
Launch Revit application, create a new project from the Architectural template.
1.	Execute the command.
Expected result: View template creation form appears.
2.	Select a view for view template creation.
3.	Select include setting of “Parts Visibility” parameter.
4.	Select value of “Detail Level” parameter.
5.	Press “Apply” button.
Expected result: new view template is created based on the selected view, parameter settings are applied to parameters, V/G Overrides Model cut patterns settings are changed for following categories: Columns, Doors, Walls, Windows.
V/G Model cut patterns settings are changed in the following way: “Foreground Pattern” is set to “Solid fill”, “Background color” is set to “Black”. 
The newly created view template is assigned to the selected view.
.