Application: BeamAndSlabNewParameter
Revit Platform: All
Revit Version: 2011.0
First Released For: 9.0
Programming Language: C#
Skill Level: Medium
Category: Parameters
Type: ExternalCommand

Subject: Shared parameter.
Summary: 
This sample demonstrates how to add a shared instance parameter to beams and slabs, and uses GUID as the parameter’s value. Users also can use the value of the parameter to find the special element.

Classes: 
Autodesk.Revit.UI.IExternalCommand 
Autodesk.Revit.DB.DefinitionFile 
Autodesk.Revit.DB.DefinitionGroups
Autodesk.Revit.DB.DefinitionGroup
Autodesk.Revit.DB.Definitions
Autodesk.Revit.DB.Definition 
Autodesk.Revit.DB.CategorySet 
Autodesk.Revit.DB.InstanceBinding
Autodesk.Revit.DB.Parameter
Autodesk.Revit.UI.Selection.SelElementSet

Project Files: 
BeamAndSlabNewParameter.cs
This is the main DLL source file. It contains the class Command which implements the interface IExternalCommand and implements adding shared parameter, storing GUID values and finding element functionality.

BeamAndSlabNewParameterForm.cs
This file contains a class BeamAndSlabNewParameterForm that provides the user alternant UI.

Description: 
-	The adding shared parameter functionality in this sample is corresponding to “Manage->Project Parameters...->Add->Shared parameter (Radio button) ->Select” in Revit main program. If you want more detailed information about Shared parameter please refer to “Setting up Shared Parameters” topic in Revit help document.
-	The shared parameter named Unique ID should be added to the Structural Framing and the Floor categories, so it can cover both beams and slabs. And then the Unique id should be set to a system generated UUID.
-	The shared parameter should reside in a file named MySharedParameters.txt and in a parameter group named MyParameters. If the file does not exist it should be created. If it does exist then it should be reused.
-	Display, in a list box, the value of the Unique ID parameter if present for all the selected elements. 
-	The element should be found by the GUID which was listed in the list box. And in this sample we add the found element into the SelElementSet (Document.Selection.Elements) to let it highlight.

Instructions: 
1.	Draw a beam and a slab in the Revit and then run the command.
2.	First click the Add button in this sample UI.
3.	After return to Revit select some beams and slabs.
4.	Then run this command again and click Display Value button.
5.	Select one item in left ListBox then click Find button. 
6.	Expected result: return to Revit main program. The corresponding element whose Unique ID is same to the selected item will be highlighted.