public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
using ( Transaction t = new Transaction( doc ) )
{
t.Start( "Create Shared Parameter" );
Category cat;
int i = 0;
// create instance parameters:
foreach ( BuiltInCategory target in targets )
{
cat = GetCategory( doc, target );
if ( null != cat )
{
CreateSharedParameter( doc, cat, ++i, false );
}
}
// create a type parameter:
cat = GetCategory( doc, BuiltInCategory.OST_Walls );
CreateSharedParameter( doc, cat, ++i, true );
t.Commit();
}
return Result.Succeeded;
}