public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { RibbonPanel myPanel = revit.Application.GetRibbonPanels()[0]; //reset wall type RadioButtonGroup radioGroupTypeSelector = GetRibbonItemByName(myPanel, "WallTypeSelector") as RadioButtonGroup; if (null == radioGroupTypeSelector) { throw new InvalidCastException("Cannot get Wall Type selector!"); } radioGroupTypeSelector.Current = radioGroupTypeSelector.GetItems()[0]; //reset level Autodesk.Revit.UI.ComboBox comboboxLevel = GetRibbonItemByName(myPanel, "LevelsSelector") as Autodesk.Revit.UI.ComboBox; if (null == comboboxLevel) { throw new InvalidCastException("Cannot get Level selector!"); } comboboxLevel.Current = comboboxLevel.GetItems()[0]; //reset wall shape Autodesk.Revit.UI.ComboBox comboboxWallShape = GetRibbonItemByName(myPanel, "WallShapeComboBox") as Autodesk.Revit.UI.ComboBox; if (null == comboboxLevel) { throw new InvalidCastException("Cannot get wall shape combo box!"); } comboboxWallShape.Current = comboboxWallShape.GetItems()[0]; //get wall mark Autodesk.Revit.UI.TextBox textBox = GetRibbonItemByName(myPanel, "WallMark") as Autodesk.Revit.UI.TextBox; if (null == textBox) { throw new InvalidCastException("Cannot get Wall Mark TextBox!"); } textBox.Value = "new wall"; return(Autodesk.Revit.UI.Result.Succeeded); }