Application: CreateShared
Revit Platform: All
Revit Version: 2009.0
First Released For: 8.0
Last Modified: 02/26/2008
Modified By: LL Autodesk
Programming Language: VB.NET
Skill Level: Beginning
Category: Create (parameter)
Type: ExternalCommand

Subject: Create and modify a shared parameter.
Summary: 
This sample shows how a shared parameter can be created via the API and how a shared parameter can be modified via the API.

Classes: 
Autodesk.Revit.IExternalCommand
Autodesk.Revit.Parameters.DefinitionFile
Autodesk.Revit.Parameters.DefinitionGroup
Autodesk.Revit.Parameters.Definition
Autodesk.Revit.CategorySet
Autodesk.Revit.Category
Autodesk.Revit.Parameters.InstanceBinding
Autodesk.Revit.ParameterSet
Autodesk.Revit.Symbol

Project Files: 
Command1.vb
It contains the class Command1 which implements interface IExternalCommand and shows how to add a a shared parameter via the API.

Command2.vb
It contains the class Command2 which implements interface IExternalCommand and shows how a shared parameter can be set value via the API.

Description: 
This sample adds two commands to Revit. The first shows how a shared parameter can be created via the API. Note that a shared parameter file named RevitParameters.txt must exist before running this sample. More details on how to create a shared parameter file please see the Revit help files. The second command shows how a shared parameter can be modified via the API.

This sample provides following functionality.
In Command1
-	Opens the RevitParameters.txt file and gets the DefinitionGroup(If not exist, creates one). Then gets the “APIParameter” definition from the group (If not exist, creates one).
-	Creates a new instance binding for the wall categories.
-	Adds the parameter binding of the definition and the instance binding to the project’s ParameterBindingsMap.

In Command2
-	Gets the “APIParameter” definition.
-	Loops the walls in the project. Then gets the “APIParameter” Parameter of each wall and sets its value to "Hello Revit".

Instructions: 
1.	Note that a shared parameter file named “RevitParameters.txt” must exist before running this sample.
2.	Open Revit.
3.	Execute the external Command1.
4.	Draw some walls.
5.	Execute the external Command2.