Application: Units
Revit Platform: All
Revit Version: 2014.0
First Released For: 2014.0
Programming Language: C#
Skill Level: Beginning
Category: Data Exchange, Basics
Type: ExternalCommand

Subject: Units API
Summary: 
Add a command which lists all the units in the current project and displays their format information, users can set the format options of each unit type; Display the decimal symbol type, digit grouping symbol, digit grouping amount of current project’s units, users could set them.

Classes: 
Autodesk.Revit.UI.IExternalCommand 
Autodesk.Revit.DB.Units
Autodesk.Revit.DB.FormatOptions
Autodesk.Revit.DB.UnitUtils
Autodesk.Revit.DB.UnitFormatUtils

Project Files: 
Command.cs
The main entrance of the .dll file which contains the class Command which implements interface IExternalCommand. Get necessary data from Revit and show the Form. 

ProjectUnitData.cs
This file contains a class which prepares the project unit data.

ProjectUnitForm.cs
This file contains a form class which retrieves or changes the project unit setting by API, including the decimal symbol type, digit grouping symbol, digit grouping amount.

FormatForm.cs
This file contains a form class which retrieves or changes the format options of each unit type, including display unit type, unit symbol type and some other format information.

Description: 
This sample should provide the following functionality:
-	Display the decimal symbol type, digit grouping symbol, digit grouping amount of current project units and users can set them then get the displaying format sample.
-	List all the units in current project and display each unit’s format sample by unit group.
-	List all the available Unit Discipline of current project
-	Classify the project units by the Unit Discipline/unit group
-	When users select one Unit Discipline in the list box to display the corresponding project units name (such as Length or Area) and its format sample. 
-   Display the format options of each unit type and users can set it then get the displaying format sample.
-	When user click the format button then show the format dialog
-	The format information includes the display unit type (such as DUT_KIP_FEET_PER_DEGREE_PER_FOOT), the unit symbol type (such as UST_NONE), and the accuracy (such as 0.2). 

Instructions: 
1.	Open Revit.
2.	Invoke this command.
3.	The project unit form lists all the units in current project and displays each unit’s format sample.
4.	Users can select the decimal symbol type, digit grouping symbol, digit grouping amount of current project units
5.	Users can set the format options of each unit type by clicking the format button in the units list
6.	Click the OK button in sample’s main UI.
6.	Application will reset the units of current document.