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

Subject: Windows Wizard
Summary: This sample will demonstrate how to create a window family via wizard.

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.UI.IExternalApplication
Autodesk.Revit.UI.UIDocument 
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.FamilyManager
Autodesk.Revit.DB.ParameterSet
Autodesk.Revit.DB.GeometryElement

Project Files: 
Command.cs
This file contains a class Command which implements IExternalCommand interface. The function of the class is to create an instance of WindowWizard and call the method Run to execute.

WindowWizard.cs
This file contains a class WindowWizard which stores ExternalCommandData, creates DoubleHungWinCreation instance, and also has method to create WizardForm instance. 
	
WindowParameter.cs
This file contains three classes: one is WizardParameter which stores the wizard parameters. The other is WindowParameter which store the common window parameters. Another is DoubleHungWinPara which inherits from WindowParameter stores the parameters of double hung window.

ValidateWindowParameter.cs
This file contains a class ValidateWindowParameter which validates the window parameters.

WindowCreation.cs
This file contains an abstract class WindowCreation which has abstract method to create the window family step by step.

DoubleHungWinCreation.cs
This file contains a class DoubleHungWinCreation which implements WindowCreation and creates a double hung window family step by step.	

CreateExtrusion.cs
This file contains a class CreateExtrusion which has methods to create CurveArray and solid extrusion.

CreateDimension.cs
This file contains a class CreateDimension which has methods to add dimension between ReferencePlanes, Faces, or a face and a ReferencePlane.

CreateReferencePlane.cs
This file contains a class CreateRefPlane which creates ReferencePlane according to a host ReferencePlane and a double offset.

CreateAlignment.cs
This file contains a class CreateAlignment which adds an alignment dimension between two faces.

Utility.cs
This file contains a class Utility which has static methods to allow getting common element.

GeoHelper.cs
This file contains a class GeoHelper which helps locating with geometry data.

WizardUI.cs
This file contains a window form which allows user to do UI input and selection.

Description: 
The sample implements IExternalCommand interface and allows user to create window family via wizard. User should create a family with window family template, and then user can input dimensions for window parameters, specify the materials, and save family file locally. 
-	To create Extrusion, use the method NewExtrusion of FamilyItemFactory.
-	To create Alignment, use the method NewAlignment of FamilyItemFactory.
-	To create Dimension, use the method NewDimension of FamilyItemFactory.
-	To create ReferencePlane, use the method NewReferencePlane of FamilyItemFactory.
-	To create family type, use the method NewType of FamilyItemFactory
-	To get the materials, use the property Settings.Materials of document.
-	To get the Categories, use the property Settings.Categories of document.

Instructions: 
1.	Update your Revit.ini by following lines: 
[ExternalCommands] 
ECCount      = 1 
ECName1=WindowWizard
ECClassName1=Revit.SDK.Samples.WindowWizard.CS
ECAssembly1  = <your path>\WindowWizard.dll 
2.	Start Revit.
3.	In order to use the wizard, users should manually create a family document with window template(like Window.rft). If the template is not right, the command will fail.
4.	Launch WindowWizard via the external command menu.
5.	Input the window dimensions including type name, Height, Width, Inset and Sill Height. You can click the new or duplicate button to create a new family type and input its dimensions; User can also select the family type and modify corresponding dimensions. Click Next button.
6.	Select Material for Glass Pane and Sash. Click back button to modify dimensions or next button to next step.
7.	View all window types created before, you can go back do further modification on these types. Click the file button then choose a path to store the family file. Click Finish button, Revit will create one window family automatically for you.