Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public UI.Result OnStartup(UI.UIControlledApplication app)
 {
     app.CreateRibbonTab("External Application Template");
     return(UI.Result.Succeeded);
 }