internal void BuildButtons(Autodesk.Revit.UI.PulldownButton pulldownButton) { foreach (var button in Buttons) { pulldownButton.AddPushButton(button.Finish() as PushButtonData); } }
public PushButton AddButton(Autodesk.Revit.UI.PulldownButton pulldownButton, string name, string text, Action <CustomPushButton> action) { return(AddButton(pulldownButton, name, text, null, action)); }
internal void BuildButtons(Autodesk.Revit.UI.PulldownButton pulldownButton) { foreach (var item in Items) { ConvertToPushButton = pulldownButton.AddPushButton(item.GetItemData() as PushButtonData); } }
public PushButton AddButton <TExternalCommandClass>(Autodesk.Revit.UI.PulldownButton pulldownButton, string name, string text) where TExternalCommandClass : class, IExternalCommand { var commandClassType = typeof(TExternalCommandClass); return(AddButton(pulldownButton, name, text, commandClassType, null)); }
//Try add the "extension" method to add a separed button to the pulldown button public PushButton AddButton(Autodesk.Revit.UI.PulldownButton pulldownButton, string name, string text, Type externalCommandType, Action <CustomPushButton> action) { var button = new CustomPushButton(name, text, externalCommandType); action?.Invoke(button); return(pulldownButton.AddPushButton(button.GetItemData() as PushButtonData)); }
private void AddMenu(RevitUI.UIControlledApplication app) { RevitUI.RibbonPanel ribbon_panel = app.CreateRibbonPanel("数据接口"); RevitUI.PulldownButtonData data_pull = new RevitUI.PulldownButtonData("RevitTest", "测试功能"); RevitUI.PulldownButton btn_pull = ribbon_panel.AddItem(data_pull) as RevitUI.PulldownButton; btn_pull.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitEx.png")); btn_pull.AddPushButton(new RevitUI.PushButtonData("Test", "Hello World", appAssembly, "RevitEx.cmdTest")); btn_pull.AddPushButton(new RevitUI.PushButtonData("Journaling", "Objects Journaling.", appAssembly, "RevitEx.cmdJournaling")); btn_pull.AddPushButton(new RevitUI.PushButtonData("ShowObjects", "Objects Show", appAssembly, "RevitEx.cmdShowSteels")); RevitUI.PushButtonData data_push = new RevitUI.PushButtonData("RevitExcel", "导出Excel", appAssembly, "RevitEx.cmdExportExcel"); RevitUI.PushButton btn_push = ribbon_panel.AddItem(data_push) as RevitUI.PushButton; btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitExcel.png")); }
private void AddRibbon(RevitUI.UIControlledApplication app) { app.CreateRibbonTab("数据接口"); RevitUI.RibbonPanel ribbon_panel = app.CreateRibbonPanel("数据接口", "数据"); RevitUI.PulldownButtonData data_pull = new RevitUI.PulldownButtonData("RevitMethod", "功能"); RevitUI.PulldownButton btn_pull = ribbon_panel.AddItem(data_pull) as RevitUI.PulldownButton; btn_pull.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitEx.png")); btn_pull.AddPushButton(new RevitUI.PushButtonData("TestDlg", "Hello World", appAssembly, "RevitEx.cmdTest")); btn_pull.AddPushButton(new RevitUI.PushButtonData("Journaling", "Objects Journaling", appAssembly, "RevitEx.cmdJournaling")); btn_pull.AddPushButton(new RevitUI.PushButtonData("ShowObjects", "Objects Show", appAssembly, "RevitEx.cmdShowSteels")); ribbon_panel = app.CreateRibbonPanel("数据接口", "接口"); RevitUI.SplitButtonData data_split = new RevitUI.SplitButtonData("RevitExcel", "Excel接口"); RevitUI.SplitButton btn_split = ribbon_panel.AddItem(data_split) as RevitUI.SplitButton; btn_split.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitExcel.png")); RevitUI.PushButton btn_push = btn_split.AddPushButton(new RevitUI.PushButtonData("ExportExcel", "导出Excel", appAssembly, "RevitEx.cmdExportExcel")); btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\ExportExcel.png")); btn_push = btn_split.AddPushButton(new RevitUI.PushButtonData("ImportExcel", "导入Excel", appAssembly, "RevitEx.cmdImportExcel")); btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\ImportExcel.png")); //创建下拉组合框 ribbon_panel = app.CreateRibbonPanel("数据接口", "控件"); RevitUI.ComboBoxData data_combo = new RevitUI.ComboBoxData("选项"); RevitUI.ComboBox cbx = ribbon_panel.AddItem(data_combo) as RevitUI.ComboBox; if (cbx != null) { cbx.ItemText = "选择操作"; RevitUI.ComboBoxMemberData data_cbxm = new RevitUI.ComboBoxMemberData("Close", "关闭"); data_cbxm.GroupName = "编辑操作"; cbx.AddItem(data_cbxm); data_cbxm = new RevitUI.ComboBoxMemberData("Change", "修改"); cbx.AddItem(data_cbxm); } cbx.CurrentChanged += change; cbx.DropDownClosed += closed; }
public PushButton AddButton(Autodesk.Revit.UI.PulldownButton pulldownButton, string name, string text) { return(AddButton(pulldownButton, name, text, null, null)); }