Application: ContentGeneratorWPF
REXSDK Version: 2018.0
First Released For: REXSDK 2012
Last Modified: 01/07/2016
Modified By: Autodesk
Programming Language: C#
Skill Level: Medium 

Subject: Read properties of the selected element (a column or a beam), examine it by REX.ContentGenerator and replace its type with the new type created by REX.ContentGenerator.

Summary: 
This sample demonstrates how to create an Extension module based on WPF technology. The module reads properties of the selected beam (or column) and presents them on the first layout. The second layout presents results of REX.ContentGenerator research and the third one allows user to select a new type which will be applied to the selected element.

REXSDK values: 
-	Create the REX extension module in WPF technology with a multi layout dialog.
-	Use the REXUnit system to present data formatted according Revit settings.
-	Use the REX Extension Progress.
-	Use the REXEditBox for unit dependent data.
-	Use the REXImageComboBox for image type selection.
-	Use the REX.ContentGenerator to examine an element.
-	Use the REX.ContentGenerator to create the new FamilySymbol.
-	Use the REX.ContentGeneraotor database browser.

Project Files: 

Generated by the wizard:

Extension.cs:
The main class generated by the wizard. It contains definition of the Extension class which is the main class in the REXExtension module. This class is a central point which allows user to manage and customize the module.

ExtensionRevit.cs:
This file contains an ExtensionRevit class. This class allows to separate general functionality (provided by the Extension class) from functionality characteristic for the Revit context e.g. setting layouts may be done in the Extension class but reading Revit elements should be carried out in the ExtensionRevit class (unless the specific layout is set only in the Revit context). In the current example the ExtensionRevit class: reads Revits selection, runs analysis of the selected element (by REX.ContentGenerator), creates the new type and applies it to the element.

Data.cs
This file contains a Data class which is a data container accessible from different places in the module. All common objects should be placed in this class.

Application.cs, DirectAccess.cs, Results.cs
These files were generated by the wizard but there is no need to make any changes in their content.

Added manually:

SelectedElementControl.xaml, SelectedElementControl.xaml.cs
These files contain a definition of the first layout which presents the properties of the selected element.

ContentGeneratorReadControl.xaml, ContentGeneratorReadControl.xaml.cs
These files contain a definition of the second layout which presents results of REX.ContentGenerator examination. 	

ContentGeneratorCreateControl.xaml, ContentGeneratorCreateControl.xaml.cs
These files contain a definition of the third layout which allows to define a new type for the selected element. 

UserControlView.xaml, UserControlView.xaml.cs
	These files contain a definition of the viewer 3D which presents selected elements geometry.

PolygonViewer.xaml, PolygonViewer.xaml.cs
	These files contain a definition of the viewer 2D which presents the section of the element.

PropertiesControl.xaml, PropertiesControl.xaml.cs
	These files contain a definition of the control which presents the set of properties.

PropertyControl.xaml, PropertyControl.xaml.cs
	These files contain a definition of the control which presents the specified property.

PropertyItem.cs
This file contains a PropertyItem class which represents the property of the specified name and the specified value. 

Triangle.cs
	This file contains a Triangle class which represents the geometry of the triangle.

Description: 
This sample examines the current selected element which has to be of column or beam type. 
On the first layout the characteristics of the Revit element are presented by:
-	The list of properties
-	The geometry of the element (on 3D viewer)

On the second layout characteristics of the element according REX.ContentGenerator are presented. There are two types of representation: parametric and database. The parametric description is represented by the section view, dimensions and the section type. The database description is represented by name, default database and the list of databases where the specified element can be found. The module informs also about certification of the element (whether the element type was created by REX.ContentGenerator).

On the third layout user is able to change the current type applied to the element for a new type created by REX.ContentGenerator. It is possible to generate two types of sections: parametric and database. There are three types of parametric sections available:
	Rectangular
	Angle
	I section
The user defines dimensions of the section. The preview of the section is presented in the upper part of the control and its characteristics (area and moment of inertia) are presented below. In case of database section the user has to launch the database browser (click the Select button) and choose the appropriate element.

The user confirms his changes by clicking the OK button on the main dialog.

Instructions: 
1.	Copy the module to the …Modules/Category directory
2.	Open Revit Structure.
3.	Define the beam.
4.	Select the beam.
5.	Run the Extension.
6.	Define the new parametric type.
7.	Click the OK button.
8.	Application will create a new FamilySymbol and apply it to the element.