Application: CurtainSystem
Revit Platform: All
Revit Version: 2009.0
First Released For: 2009.0
Last Modified: 02/26/2008
Modified By: CZ Autodesk
Programming Language: C#
Skill Level: Medium
Category: Create
Type: ExternalCommand

Subject: Create curtain systems.
Summary: 
 This sample demonstrates 4 main features:
1.	How to create curtain systems on specified faces.
2.	How to delete curtain systems.
3.	How to add curtain grids to curtain systems.
4.	How to remove curtain grids from curtain systems.

Classes: 
Autodesk.Revit.IExternalCommand
Autodesk.Revit.Document
Autodesk.Revit.Creation.Document
Autodesk.Revit.Elements.CurtainSystem

Project Files: 
Command.cs
This file contains the class “Command” which inherits from “IExternalCommand” interface and implements the “Execute” method.

Data\Document.cs
This file contains the class “Document” which manages all the data used in this sample.

CurtainSystem\MassChecker.cs
	This file contains the class “MassChecker” used to check whether user has selected a parallelepiped mass.

CurtainSystem\SystemData.cs
	This file contains the class “SystemData” used to store all the curtain systems created in the sample and manage their behaviors.

Utility\MathTools.cs
It contains a class “Vector4” used to manage the mathematic computations.

Description: 
Functionalities:
-	Create curtain systems with specified faces.
-	Delete the selected curtain systems.
-	Add curtain grids to uncovered faces.
-	Remove curtain grids from curtain systems.

Implementations:
-	Create CurtainSystem via Autodesk.Revit.Creation.Document.NewCurtainSystem(Revit.Geometry.ReferenceArray faces, Revit.Symbols.CurtainSystemType symbol) method or Autodesk.Revit.Creation.Document.NewCurtainSystem(Revit.Geometry.FaceArray faces, Revit.Symbols.CurtainSystemType symbol) method. “faces” should be faces of a mass created by GUI.
-	Add/ remove Curtain Grids via 
void AddCurtainGrid(Revit::Geometry::Reference^ face)
void RemoveCurtainGrid(Revit::Geometry::Reference^ face)

Instructions: 
1.	Prepare your Revit project.
Open or new a Revit project and make sure it contains a mass in the shape of parallelepiped. A sample project file CurtainSystem.rvt is available in the sample’s folder;
2.	Select the mass in the document;
3.	Run this command, the main dialog pops up;

4.	Click “Create Curtain System” button, a new dialog will pop up, this dialog is used for users to create curtain systems;

5.	Select some faces by checking items from the list box or the buttons at the right side;
6.	: let users choose the way to create curtain system: if it’s checked, the curtain system will be created by face array in internal code, and users can’t add curtain grids/remove curtain grids from this kind of curtain system after creation; if it’s unchecked, the curtain system will be created by references of the faces, and users can add/remove curtain grids later;
7.	Click “Create Curtain System” button to create the curtain system, and then this dialog will be closed and the main dialog will pop up again;
8.	Select a curtain system, its curtain grid information will be displayed in the list at the right side;
9.	If the curtain system is created by face array, the “Add>>” and “<<Remove” buttons are disabled; if it’s by references of the faces, they’re enabled;
10.	Select a curtain system by references, check some uncovered faces and click “Add>>” button, these faces will be covered with curtain grids;
11.	Select a curtain system by references, check some curtain grids and click “<<Remove” button, these curtain grids will be removed from the faces;
12.	Select some curtain systems and make them checked, click “Delete Curtain System” button to delete these curtain systems;
13.	Click “Exit” to quit the dialog.