{
#region IExternalApplication Members
IExternalApplication.Result IExternalApplication.OnShutdown(ControlledApplication application)
{
return IExternalApplication.Result.Succeeded;
}
IExternalApplication.Result IExternalApplication.OnStartup(ControlledApplication application)
{
//Add RibbonPanel
RibbonPanel ribPannel = application.CreateRibbonPanel("MyTool");
//Add Push Button
PushButton pshButton = ribPannel.AddPushButton("MyTool", "My Tool", "D:\\Samples\\REVIT\\Application\\RoomDetails\\RoomDetails\\bin\\Debug\\RoomDetails.dll", "RoomDetails.ExternalCommand");
return IExternalApplication.Result.Succeeded;
}
#endregion
}
External Command For The External Application Button Click
class ExternalCommand : IExternalCommand
{
#region IExternalCommand Members
///
/// Default startup method for Adding commands in
/// RevitAPI
///
///
///
///
///
public IExternalCommand.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//Create object for Document
Document document = commandData.Application.ActiveDocument;
//Create object for Selection
Selection selection = document.Selection;
//Iterate Selected Elements
foreach (Element element in selection.Elements.OfType
{
MessageBox.Show("Wall ID = " + element.Id.Value);
}
return IExternalCommand.Result.Succeeded;
}
#endregion
}
how to get the PushButton name in ExternalCommand ?
ReplyDelete