private void buildUI() { var panel = _app.CreateRibbonPanel(Tab.AddIns, "Airflow" + Environment.NewLine + "Designer"); var save = new PushButtonData("AirflowDesigner", "Airflow" + Environment.NewLine + "Designer", System.Reflection.Assembly.GetExecutingAssembly().Location, "AirflowDesigner.Command"); save.ToolTip = "Analyze the model for airflow, help make decisions"; save.LongDescription = "Look at possible shaft locations"; save.LargeImage = getImage("AirflowDesigner.Icons.path_finder_32.png"); save.Image = getImage("AirflowDesigner.Icons.path_finder_16.png"); var load = new PushButtonData("LoadAirflowDesigner", "Load" + Environment.NewLine + "Results", System.Reflection.Assembly.GetExecutingAssembly().Location, "AirflowDesigner.LoadCommand"); load.ToolTip = "Load, Display and Generate"; load.LongDescription = "Load, display and generate layout based on Selected Options"; load.LargeImage = getImage("AirflowDesigner.Icons.document_32.png"); load.Image = getImage("AirflowDesigner.Icons.document_16.png"); panel.AddItem(save); panel.AddItem(load); panel.AddSlideOut(); var clear = new PushButtonData("ClearAirflow", "Clear", System.Reflection.Assembly.GetExecutingAssembly().Location, "AirflowDesigner.ClearCommand"); clear.ToolTip = "Clear any AVF geometry previews"; panel.AddItem(clear); }
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 Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application) { RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel"); //PushButtonData pbd = new PushButtonData("name", "text", @"C:\Users\einst\Desktop\Danqing\GitRepo\RevitLab\2.2 HelloWorld\bin\Debug\2.2 HelloWorld.dll", "HelloWorld"); PushButton pushBotton = ribbonPanel.AddItem(new PushButtonData("HelloWorld", "HelloWorld", @"C:\Users\einst\AppData\Roaming\Autodesk\Revit\Addins\2016\HelloWorld.dll", "_2._2_HelloWorld.HelloWorld")) as PushButton; Uri urlImage = new Uri(@"C:\Users\einst\Desktop\Danqing\UrlImage\01.jpg"); BitmapImage largeImage = new BitmapImage(urlImage); pushBotton.LargeImage = largeImage; return(Result.Succeeded); }
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")); }
/// <summary> /// Implement this method to implement the external application which should be called when /// Revit starts before a file or default template is actually loaded. /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> /// <returns>Return the status of the external application. /// A result of Succeeded means that the external application successfully started. /// /// Cancelled can be used to signify that the user cancelled the external operation at /// some point. /// /// If Failed is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference. /// /// This method also adds a ribbon panel and button to launch an IExternalCommand /// defined in UICommand.cs. It also registers a new IPerformanceAdviserRule-implementing class /// (m_FlippedDoorApiRule) with PerformanceAdviser. /// /// </returns> public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application) { #region Add command button RibbonPanel rp = application.CreateRibbonPanel("PerformanceAdviserControl"); string currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location; PushButton pb = rp.AddItem(new PushButtonData("Performance Adviser", "Performance Adviser", currentAssembly, "Revit.SDK.Samples.PerformanceAdviserControl.CS.UICommand")) as PushButton; Uri uriImage = new Uri(System.IO.Path.GetDirectoryName(currentAssembly) + "\\Button32.png"); BitmapImage largeImage = new BitmapImage(uriImage); pb.LargeImage = largeImage; #endregion #region Create and register new API rule (FlippedDoorCheck) m_FlippedDoorApiRule = new FlippedDoorCheck(); Autodesk.Revit.DB.PerformanceAdviser.GetPerformanceAdviser().AddRule(m_FlippedDoorApiRule.getRuleId(), m_FlippedDoorApiRule); #endregion return(Autodesk.Revit.UI.Result.Succeeded); }