Application: Openings
Revit Platform: All
Revit Version: 2011.0
First Released For: 9.1
Programming Language: C#
Skill Level: High
Category: Elements
Type: ExternalCommand

Subject: Display Opening informations.
Summary: 
Shows how to get geometry profile and properties of an opening and how to add x model lines to opening bounding box.

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.DB.Opening
Autodesk.Revit.DB.Document

Project Files: 
Command.cs
This file defines a Command class which inherits from IExternalCommand. The class implements the Execute method. The main functionality of the class is to get all openings in the project and gain information from it.

OpeningInfo.cs
This file defines an OpeningInfo class to store information of openings in active document.

OpeningProperty.cs
This file defines an OpeningProperty class which contains the properties. And the properties will be displayed in PropertyGrid of Form.

OpeningForm.cs
This file defines an OpeningForm class which consists of a PictureBox and a PropertyGrid controls. The picture box displays the profile of the selected opening and the PropertyGrid control shows the properties of the selected opening.

CreateModelLineOptionsForm.cs
This file defines a CreateModelLineOptionsForm class which inherits from Form. The functionality of this class is creating ModelLine for opening bounding box.

Description: 
This sample retrieves all openings in active document and displays the profile and properties of the selected opening. The openings can be retrieved by iterating the document’s elements. And then the profile will be shown in a PictureBox control and the properties will be shown in a PropertyGrid control. The ModelLine can be created by NewModelCurve method of Document.

Instructions: 
1.	Open or new a Revit project and make sure some Openings are placed. A sample project file Openings.rvt is available in the sample’s folder.
2.	Run the command, a form will pop up.
3.	To review the profile and properties of one Opening, select it from the ComboBox control.
4.	Click “Add X Model Line” button to add x model lines for opening bounding box.