/// <summary> /// This method is similar to the previous one in that it creates a set of buttons on a specified tab and panel, but this one /// adds a separator to the end of the buttons. /// </summary> /// <param name="revApp">UIControlledApplication from an IExternalApplication StartUp method</param> /// <param name="tabName">The name of the tab that you want to add a button to. This must either be 'Add-Ins' or a non-standard tab.</param> /// <param name="panelName">The name of the panel that you want to add a button to.</param> /// <param name="buttons">One or more buttons to add to the panel.</param> /// <param name="addSeparators">Add a separator AFTER the buttons are created. This should only be True when you know additional buttons will be added</param> /// <returns>True if successful, False if it failed to add a button to the Ribbon.</returns> public static bool AddToRibbon(UIControlledApplication revApp, string tabName, string panelName, List <PushButtonData> buttons, bool addSeparators) { RibbonPanel panel = GetRibbonPanel(revApp, tabName, panelName, out bool existingPanel); // Add the button(s) to the panel if (panel != null) { if (addSeparators && existingPanel) { panel.AddSeparator(); } foreach (PushButtonData pbd in buttons) { panel.AddItem(pbd); } if (addSeparators) { panel.AddSeparator(); } return(true); } else { System.Text.StringBuilder sb = new System.Text.StringBuilder(); foreach (PushButtonData pbd in buttons) { sb.AppendLine(pbd.Text); } TaskDialog.Show("Error", "Could not add split button to the Revit ribbon for:\n" + sb.ToString()); return(false); } }
Result IExternalApplication.OnStartup(UIControlledApplication application) { RibbonPanel panel = application.CreateRibbonPanel("Shared parameters"); PushButtonData data = new PushButtonData("BindSP", "Bind Shared\nParameters", this.GetType().Assembly.Location, typeof(BindNewReadonlySharedParametersToDocument).FullName); panel.AddItem(data); panel.AddSeparator(); PushButtonData data1 = new PushButtonData("SetIds1", "Set ids: GUID", this.GetType().Assembly.Location, typeof(SetReadonlyId1).FullName); PushButtonData data2 = new PushButtonData("SetIds2", "Set ids: short", this.GetType().Assembly.Location, typeof(SetReadonlyId2).FullName); panel.AddStackedItems(data1, data2); panel.AddSeparator(); data1 = new PushButtonData("SetCosts1", "Set cost: random", this.GetType().Assembly.Location, typeof(SetReadonlyCost1).FullName); data2 = new PushButtonData("SetCosts2", "Set cost: sequence", this.GetType().Assembly.Location, typeof(SetReadonlyCost2).FullName); panel.AddStackedItems(data1, data2); return(Result.Succeeded); }
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { string bintab = "唐僧工具箱"; application.CreateRibbonTab(bintab); var asmpath = Assembly.GetExecutingAssembly().Location; Type extendwireT = typeof(Cmd_ExtendWire); Type Cmd_HideSplitWireT = typeof(Cmd_HideSplitWire); Type Cmd_HideSplitWiretestT = typeof(Cmd_HideSplitWiretest); //PushButtonData button1 = new PushButtonData("binbox", "resetbox", @"C:\ProgramData\Autodesk\Revit\Addins\2015\bincropbox.dll", "bincropbox.CropBoxQuickSet"); //PushButtonData button2 = new PushButtonData("changeplane", "changeplane", @"C:\ProgramData\Autodesk\Revit\Addins\2015\changeplane.dll", "changeplane.binchangeplane"); RibbonPanel m_projectPanel = application.CreateRibbonPanel(bintab, "电气"); // Add the buttons to the panel List <RibbonItem> binButtons = new List <RibbonItem>(); PushButtonData extendwirebuttonData = new PushButtonData("延长导线", "延长导线", asmpath, extendwireT.FullName); PushButtonData Cmd_HideSplitWireTButtonData = new PushButtonData("导线断线", "导线断线", asmpath, Cmd_HideSplitWireT.FullName); PushButtonData Cmd_HideSplitWiretestTButtonData = new PushButtonData("手动断线", "手动断线", asmpath, Cmd_HideSplitWiretestT.FullName); m_projectPanel.AddItem(extendwirebuttonData); m_projectPanel.AddSeparator(); m_projectPanel.AddItem(Cmd_HideSplitWireTButtonData); m_projectPanel.AddSeparator(); m_projectPanel.AddItem(Cmd_HideSplitWiretestTButtonData); //binButtons.AddRange(m_projectPanel.AddStackedItems(extendwirebuttonData)); // add new ribbon panel //RibbonPanel ribbonPanel1 = application.CreateRibbonPanel("binpanel1"); ////create a push button inthe bibbon panel "newbibbonpanel" ////the add=in applintion "helloworld"willbe triggered when button is pushed //PushButton pushButton1_1 = ribbonPanel1.AddItem(new PushButtonData("helloworld", "helloworld", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //PushButton pushButton1_2 = ribbonPanel1.AddItem(new PushButtonData("bin", "bin", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //PushButton pushButton1_3 = ribbonPanel1.AddItem(new PushButtonData("bin1", "bin1", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //ribbonPanel1.AddSeparator(); //RibbonPanel ribbonPanel2 = application.CreateRibbonPanel("binpanel2"); //PushButton pushbutton2_1 = ribbonPanel2.AddItem(new PushButtonData("binst1", "pipe", @"D:\RevitDebug\bin\postcommand.dll", "BinPostCommand.binpostcommand")) as PushButton; //PushButton pushbutton2_2 = ribbonPanel2.AddItem(new PushButtonData("binst2", "resetbox", @"C:\ProgramData\Autodesk\Revit\Addins\2015\bincropbox.dll", "bincropbox.CropBoxQuickSet")) as PushButton; //PushButton pushbutton2_3 = ribbonPanel2.AddItem(new PushButtonData("binst3", "binst3", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //ribbonPanel2.AddSeparator(); //RibbonPanel ribbonPanel3 = application.CreateRibbonPanel("binpanel3"); //PushButton pushbutton3_1 = ribbonPanel3.AddItem(new PushButtonData("binst4","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //PushButton pushbutton3_2 = ribbonPanel3.AddItem(new PushButtonData("binst5","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //PushButton pushbutton3_3 = ribbonPanel3.AddItem(new PushButtonData("binst6","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton; //ribbonPanel3.AddSeparator(); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication a) { RibbonPanel p = GetRibbonPanel(a, "LACMA", "LACMA Section"); string createStartClassName = "SOM.RevitTools.Sections.CommandCreateStart"; string createEndClassName = "SOM.RevitTools.Sections.CommandCreateEnd"; string createPerpendicularClassName = "SOM.RevitTools.Sections.CommandCreatePerpendicular"; string updateClassName = "SOM.RevitTools.Sections.CommandUpdate"; string imageUP = "SectionUP.png"; string imageDN = "SectionDN.png"; string imagePR = "SectionPR.png"; string imageNW = "SectionNW.png"; PushButtonData btn1 = pushButton_Setting(p, createStartClassName, imageUP, "Create From Start Section", "CREATE AT START"); PushButtonData btn2 = pushButton_Setting(p, createEndClassName, imageDN, "Create From End Section", "CREATE AT END"); PushButtonData btn3 = pushButton_Setting(p, createPerpendicularClassName, imagePR, "Create From Perpendicular Section", "CREATE AT PER"); PushButtonData btn4 = pushButton_Setting(p, updateClassName, imageNW, "Update Section", "UPDATE SECTION"); p.AddItem(btn1); p.AddSeparator(); p.AddItem(btn2); p.AddSeparator(); p.AddItem(btn3); p.AddSeparator(); p.AddItem(btn4); a.ApplicationClosing += a_ApplicationClosing; //Set Application to Idling a.Idling += a_Idling; return(Result.Succeeded); }
// define a method that will create our tab and button static void AddRibbonPanel(UIControlledApplication application) { String tabName = "MRGT_TOOL's"; // создание вкладки application.CreateRibbonTab(tabName); // Add a new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Надстройки МРГТ v.0.1"); //подпись под кнопками // Get dll assembly path string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; // create push button for CurveTotalLength //namespace и класс PushButtonData b1Data = new PushButtonData("cmdCurveTotalLength", "Длина" + Environment.NewLine + " Линий детализаций ", thisAssemblyPath, "TotalLength.CurveTotalLength"); PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton; pb1.ToolTip = "Выбор линий для подсчета длинны"; BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/totalLength.png")); pb1.LargeImage = pb1Image; //попробуем создать еще одну кнопку ribbonPanel.AddSeparator(); //разделитель между кнопками // Get dll assembly path //string thisAssemblyPath2 = Assembly.GetExecutingAssembly().Location; // create push button for CurveTotalLength PushButtonData b1Data2 = new PushButtonData("cmdDbElement", "Инфо Элемента ", thisAssemblyPath, "GrimshawRibbon2.DbElement"); PushButton pb2 = ribbonPanel.AddItem(b1Data2) as PushButton; pb2.ToolTip = "Информация о выбраннм объекте"; BitmapImage pb2Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/totalLength.png")); pb2.LargeImage = pb2Image; //попробуем создать еще одну кнопку ribbonPanel.AddSeparator(); //разделитель между кнопками // create push button for Section PushButtonData b1Data3 = new PushButtonData("cmdCreateSection", "Разрез по стене", thisAssemblyPath, "GrimshawRibbon3.CreateSection"); PushButton pb3 = ribbonPanel.AddItem(b1Data3) as PushButton; pb3.ToolTip = "Разрезы"; BitmapImage pb3Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/favicon.png")); pb3.LargeImage = pb3Image; }
/// <summary> /// The implementation of IExternalApplication.OnStartup() /// </summary> /// <param name="application">The Revit application.</param> /// <returns>Result.Succeeded</returns> public Result OnStartup(UIControlledApplication application) { try { // Register point cloud engines for the sample. // Predefined engine (non-randomized) IPointCloudEngine engine = new BasicPointCloudEngine(PointCloudEngineType.Predefined); PointCloudEngineRegistry.RegisterPointCloudEngine("apipc", engine, false); // Predefined engine with randomized points at the cell borders engine = new BasicPointCloudEngine(PointCloudEngineType.RandomizedPoints); PointCloudEngineRegistry.RegisterPointCloudEngine("apipcr", engine, false); // XML-based point cloud definition engine = new BasicPointCloudEngine(PointCloudEngineType.FileBased); PointCloudEngineRegistry.RegisterPointCloudEngine("xml", engine, true); // Create user interface for accessing predefined point clouds RibbonPanel panel = application.CreateRibbonPanel("Point cloud testing"); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); panel.AddItem(new PushButtonData("AddPredefinedInstance", "Add predefined instance", assembly.Location, "Revit.SDK.Samples.CS.PointCloudEngine.AddPredefinedInstanceCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("AddRandomizedInstance", "Add randomized instance", assembly.Location, "Revit.SDK.Samples.CS.PointCloudEngine.AddRandomizedInstanceCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("AddTransformedInstance", "Add randomized instance\nat transform", assembly.Location, "Revit.SDK.Samples.CS.PointCloudEngine.AddTransformedInstanceCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("SerializePointCloud", "Serialize point cloud (utility)", assembly.Location, "Revit.SDK.Samples.CS.PointCloudEngine.SerializePredefinedPointCloud")); } catch (Exception e) { TaskDialog.Show("Exception from OnStartup", e.ToString()); } return(Result.Succeeded); }
/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { try { // Create user interface for ExportPDFSettings manipulation RibbonPanel panel = application.CreateRibbonPanel("ExportPDFSettings testing"); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); panel.AddItem(new PushButtonData("CreateExportPDFSettingsInstance", "Create ExportPDFSettings Instance", assembly.Location, "Revit.SDK.Samples.ExportPDFSettingsSample.CS.CreateExportPDFSettingsCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("ModifyExportPDFSettingsInstance", "Modify ExportPDFSettings Instance", assembly.Location, "Revit.SDK.Samples.ExportPDFSettingsSample.CS.ModifyExportPDFSettingsCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("AddNamingRule", "Add Naming Rule", assembly.Location, "Revit.SDK.Samples.ExportPDFSettingsSample.CS.AddNamingRuleCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("ModifyNamingRule", "Mofidy Naming Rule", assembly.Location, "Revit.SDK.Samples.ExportPDFSettingsSample.CS.MofidyNamingRuleCommand")); panel.AddSeparator(); panel.AddItem(new PushButtonData("DeleteNamingRule", "Delete Naming Rule", assembly.Location, "Revit.SDK.Samples.ExportPDFSettingsSample.CS.DeleteNamingRuleCommand")); } catch (Exception e) { TaskDialog.Show("Exception from OnStartup", e.ToString()); } return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { PublicVariables.UpperValue = 10000; PublicVariables.LowerValue = 0; application.CreateRibbonTab("Updater Tool"); string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string dllPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020\UpdaterTool.dll"); string appFolderPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020"); RibbonPanel ribbonPanel = application.CreateRibbonPanel("Updater Tool", "Updater"); TextBoxData textBoxData1 = new TextBoxData("textBox1"); TextBox textBox1 = ribbonPanel.AddItem(textBoxData1) as TextBox; textBox1.PromptText = "Enter a Reference Value"; textBox1.EnterPressed += TextBoxEnterClicked; ribbonPanel.AddSeparator(); RadioButtonGroupData radioButtonGroupData1 = new RadioButtonGroupData("radioButtonGroup1"); RadioButtonGroup radioButtonGroup1 = ribbonPanel.AddItem(radioButtonGroupData1) as RadioButtonGroup; ToggleButtonData toggleButton1 = new ToggleButtonData("toggleButton1", "Deactivate", dllPath, "UpdaterTool.Deactivated"); BitmapImage img1 = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Stop.png"))); toggleButton1.LargeImage = img1; ToggleButtonData toggleButton2 = new ToggleButtonData("toggleButton2", "Activate", dllPath, "UpdaterTool.Activated"); BitmapImage img2 = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Check.png"))); toggleButton2.LargeImage = img2; radioButtonGroup1.AddItem(toggleButton1); radioButtonGroup1.AddItem(toggleButton2); return(Result.Succeeded); }
private void CreateRibbonSamplePanel(UIControlledApplication application) { //RibbonPanel显示一个大按钮,图标为第一个按钮的图标 string firstPanelName = "Ribbon 实例";//面板底部文字提示 RibbonPanel ribbonSamplePanel = application.CreateRibbonPanel(firstPanelName); #region 创建墙和结构墙 //RibbonPanel(面板)->SplitButton(按钮组)->PushButton(按钮) SplitButtonData splitButtonData = new SplitButtonData("NewWallSplit", "创建墙"); //按钮数据,按钮组显示的文字为第一个按钮的文字 SplitButton splitButton = ribbonSamplePanel.AddItem(splitButtonData) as SplitButton; //添加到面板 //PushButton pushButton = splitButton.AddPushButton(new PushButtonData("WallPush", "普通墙", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateWall")); //最后一个参数是执行按钮事件的响应类名 PushButtonData pushButtonDataWall = new PushButtonData("WallPush", "普通墙", AddInPath, "HY.CreateWall"); PushButton pushButton = splitButton.AddPushButton(pushButtonDataWall); //大图标,小图标 pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWall-S.png"), UriKind.Absolute)); //提示文字,提示图片 pushButton.ToolTip = "Creates a partition wall in the building model."; pushButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CreateWallTooltip.bmp"), UriKind.Absolute)); //按钮组里第二个按钮 pushButton = splitButton.AddPushButton(new PushButtonData("StrWallPush", "结构墙", AddInPath, "HY.CreateStructureWall")); pushButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall.png"), UriKind.Absolute)); pushButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "StrcturalWall-S.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); }
public void Initialize(RibbonPanel panel, int addinNum, string buttonName) { PushButton button = panel.AddItem(new PushButtonData($"Lab {addinNum}", buttonName, typeof(Lab1Button).Assembly.Location, $"RevitLab.Lab{addinNum}Button")) as PushButton; AddImageToButton(button, $@"D:\Workspace\RevitLab\Resources\Lab{addinNum}Button.png"); panel.AddSeparator(); }
public Result OnStartup(UIControlledApplication application) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) this.m_MyForm = null; string text = "Hot Gear"; try { application.CreateRibbonTab(text); } catch { } RibbonPanel val = application.CreateRibbonPanel(text, "Parameter Explorer"); ContextualHelp contextualHelp = new ContextualHelp(2, "https://hotgearproject.wordpress.com/hot-gear-project-2/"); PushButton val2 = val.AddItem(new PushButtonData("HotGear_IPE", "Instance", HotGearPackage.AddInPath, "InstanceParameterCollector")) as PushButton; val2.set_ToolTip("Collect Project Instance Elements Data"); val2.set_LargeImage(HotGearPackage.RetriveImage("HotGearAllInOne.Resources.Instance.png")); val2.set_Image(HotGearPackage.RetriveImage("HotGearAllInOne.Resources.Instance_s.png")); val2.SetContextualHelp(contextualHelp); val.AddSeparator(); PushButton val3 = val.AddItem(new PushButtonData("HotGear_TPE", "Type", HotGearPackage.AddInPath, "TypeParameterCollector")) as PushButton; val3.set_ToolTip("Collect Project Type Elements Data"); val3.set_LargeImage(HotGearPackage.RetriveImage("HotGearAllInOne.Resources.Type.png")); val3.set_Image(HotGearPackage.RetriveImage("HotGearAllInOne.Resources.Type_s.png")); val3.SetContextualHelp(contextualHelp); return(0); }
/// <summary> /// Create our own ribbon panel with verious buttons /// for our exercise. We re-use commands defined in the /// Revit Intro Labs here. Cf. Section 3.8 (pp 46) of /// the Developers Guide. /// </summary> public void AddRibbonSampler(UIControlledApplication app) { // (1) create a ribbon tab and ribbon panel app.CreateRibbonTab("Ribbon Sampler"); RibbonPanel panel = app.CreateRibbonPanel("Ribbon Sampler", "Ribbon Sampler"); // Below are samplers of ribbon items. Uncomment // functions of your interest to see how it looks like // (2.1) add a simple push button for Hello World AddPushButton(panel); panel.AddSeparator(); // (2.2) add split buttons for "Command Data", "DB Element" and "Element Filtering" AddSplitButton(panel); //// (2.3) add pulldown buttons for "Command Data", "DB Element" and "Element Filtering" AddPulldownButton(panel); //// (2.4) add radio/toggle buttons for "Command Data", "DB Element" and "Element Filtering" //// we put it on the slide-out below. ////AddRadioButton(panel); //// //// (2.5) add text box - TBD: this is used with the conjunction with event. Probably too complex for day one training. //// for now, without event. //// we put it on the slide-out below. ////AddTextBox(panel); ////panel.AddSeparator(); //// (2.6) combo box - TBD: this is used with the conjunction with event. Probably too complex for day one training. //// For now, without event. show two groups: Element Bascis (3 push buttons) and Modification/Creation (2 push button) //AddComboBox(panel); //// (2.7) stacked items - 1. hello world push button, 2. pulldown element bscis (command data, DB element, element filtering) //// 3. pulldown modification/creation(element modification, model creation). //AddStackedButtons_Complex(panel); //// (2.8) slide out - if you don't have enough space, you can add additional space below the panel. //// anything which comes after this will be on the slide out. //panel.AddSlideOut(); //// (2.4) radio button - what it is //AddRadioButton(panel); //// (2.5) text box - what it is //AddTextBox(panel); }
public Result OnStartup(UIControlledApplication application) { RibbonPanel panel = application.CreateRibbonPanel("Revit App"); PushButton button = panel.AddItem(new PushButtonData($"Lab 1", "Inspect Selected Element", @"RevitApp.dll", $"RevitApp.InspectSelectedElementCommand")) as PushButton; panel.AddSeparator(); return(Result.Succeeded); }
public void AddRibbonSampler(UIControlledApplication app) { app.CreateRibbonTab("Dissertation Add-in"); RibbonPanel panel = app.CreateRibbonPanel("Dissertation Add-in", "Server Status"); AddStartServerButton(panel); AddStopServerButton(panel); panel.AddSeparator(); AddStackedButtons_Simple(panel); panel.AddSeparator(); AddStackedButtons_TCPServer(panel); }
private void InitRibbonButtons(RibbonPanel ribbonPanel) { CreatePushButton(ribbonPanel, "Select Category", "Select\nCategory", _path, "Walter.SelectCommand", "Korisnik ima mogućnost da izabere više prikazanih kategorija, te prilikom klika na dugme „Accept & Export“ , program će izvršiti pribavljanje svih odabranih kategorija (instanci) iz Revitovog modela i ispisati u txt fajl na Desktopu.", true, _resorce + @"select.png"); ribbonPanel.AddSeparator(); SplitButton splitButton = ribbonPanel.AddItem(new SplitButtonData("Auto Room Num", "Auto\nNumbering")) as SplitButton; splitButton.ToolTip = "Alat kojim se automatizuje dodjela broja sobe. Korisniku omogućiti da unese od kog broja kreću brojevi soba."; splitButton.LargeImage = new BitmapImage(new Uri(_resorce + @"numbering.png")); PushButton pushButtonInput = splitButton.AddPushButton(new PushButtonData("Auto Room Num", "Auto\nNumbering", _path, "Walter.NumberingRoomCommand")); pushButtonInput.LargeImage = new BitmapImage(new Uri(_resorce + @"numbering.png")); pushButtonInput.ToolTip = "Alat kojim se automatizuje dodjela broja sobe. Korisniku omogućuje da unese od kog broja kreću brojevi soba."; pushButtonInput.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "https://www.naviate.com/")); PushButton pushButtonAuto = splitButton.AddPushButton(new PushButtonData("Auto Room Num with start", "Auto Numbering\nFrom 100", _path, "Walter.AutoNumberingRoomCommand")); pushButtonAuto.LargeImage = new BitmapImage(new Uri(_resorce + @"autoNumbering.png")); pushButtonAuto.ToolTip = "Alat kojim se automatizuje dodjela broja sobe koje postoje u modelu pocevsi od 100."; pushButtonAuto.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "https://www.naviate.com/")); ribbonPanel.AddSeparator(); CreatePushButton(ribbonPanel, "Show Furniture", "Show\nFurniture", _path, "Walter.FurnitureCommand", "Alat kojim se prikazuje namještaj na spratu.", true, _resorce + @"furniture.png"); ribbonPanel.AddSeparator(); PushButton edit = CreatePushButton(ribbonPanel, "Edit Element", "Edit\nElement", _path, "Walter.EditElementCommand", "Alat omogućuje korisniku da za selektovani element budu prikazani svi parametri izabranog elementa. Korisnik ima mogućnost da unese novu vrijednost parametra i klikom na dugme „Ok“ svi elementi tog tipa koji se nalaze unutar projekta dobiće novu unesenu vrijednost", true, _resorce + @"edit.png"); edit.Enabled = false; ribbonPanel.AddSeparator(); CreatePushButton(ribbonPanel, "Insert Section", "Insert\nSection", _path, "Walter.InsertSectionCommand", "Alat omogucuje korisniku za selektovana vrata da se kreira section", true, _resorce + @"section.png"); ribbonPanel.AddSeparator(); CreatePushButton(ribbonPanel, "Insert Elevation", "Insert\nElevation", _path, "Walter.InsertElevationCommand", "Alat omogucuje korisniku za selektovanu sobu da se kreira elevation za svaku stranu", true, _resorce + @"elevation.png"); ribbonPanel.AddSeparator(); }
/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="application"></param> /// <returns>Indicates if the application completes its work successfully.</returns> public Result OnStartup(UIControlledApplication application) { assemblyPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); assemblyName = Assembly.GetExecutingAssembly().GetName().Name + ".dll"; imageFolder = GetProjectDirectory() + "/Resources/"; //add a panel to go on the Add-In tab RibbonPanel panel = application.CreateRibbonPanel("ArrayPrismsOnASineCurve"); //add panel with text fields for user input for period, amplitude and cycles of sine curve AddCurvePropertiesTextFields(panel); //add panel with text field for user input for number of partitions along the curve AddPartitionsTextField(panel); panel.AddSeparator(); //add drop down menu for type of prism selection AddPrismComboBox(panel); panel.AddSeparator(); //add RUN button AddRunButton(panel); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication a) { a.CreateRibbonTab("Familien Browser"); //Familien Browser Families Browser RibbonPanel G17 = a.CreateRibbonPanel("Familien Browser", "Familien Browser"); string path = Assembly.GetExecutingAssembly().Location; SingleInstallEvent handler = new SingleInstallEvent(); ExternalEvent exEvent = ExternalEvent.Create(handler); DockPanel dockPanel = new DockPanel(exEvent, handler); DockablePaneId dpID = new DockablePaneId(new Guid("FA0C04E6-F9E7-413A-9D33-CFE32622E7B8")); a.RegisterDockablePane(dpID, "Familien Browser", (IDockablePaneProvider)dockPanel); PushButtonData btnShow = new PushButtonData("ShowPanel", "Panel\nanzeigen", path, "zRevitFamilyBrowser.Revit_Classes.ShowPanel"); //Panel anzeigen ShowPanel btnShow.LargeImage = Tools.GetImage(Resources.IconShowPanel.GetHbitmap()); RibbonItem ri1 = G17.AddItem(btnShow); PushButtonData btnFolder = new PushButtonData("OpenFolder", "Verzeichnis\nöffnen", path, "zRevitFamilyBrowser.Revit_Classes.FolderSelect"); //Verzeichnis öffnen btnFolder.LargeImage = Tools.GetImage(Resources.OpenFolder.GetHbitmap()); RibbonItem ri2 = G17.AddItem(btnFolder); PushButtonData btnSpace = new PushButtonData("Space", "Grid Elements\nInstall", path, "zRevitFamilyBrowser.Revit_Classes.Space"); btnSpace.LargeImage = Tools.GetImage(Resources.Grid.GetHbitmap()); btnSpace.ToolTip = "1. Select item form browser.\n2. Pick room in project\n3. Adjust item position and quantity."; RibbonItem ri3 = G17.AddItem(btnSpace); G17.AddSeparator(); PushButtonData btnSettings = new PushButtonData("Settings", "Settings", path, "zRevitFamilyBrowser.Revit_Classes.Settings"); btnSettings.LargeImage = Tools.GetImage(Resources.settings.GetHbitmap()); RibbonItem ri4 = G17.AddItem(btnSettings); // a.ControlledApplication.DocumentChanged += OnDocChanged; a.ControlledApplication.DocumentOpened += OnDocOpened; a.ViewActivated += OnViewActivated; if (File.Exists(Properties.Settings.Default.SettingPath)) { Properties.Settings.Default.RootFolder = File.ReadAllText(Properties.Settings.Default.SettingPath); Properties.Settings.Default.Save(); } return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { application.CreateRibbonTab("UCD场地工具"); RibbonPanel panel1 = application.CreateRibbonPanel("UCD场地工具", "欢迎页"); PushButtonData pbd = new PushButtonData("UCD场地工具", "欢迎使用", @"D:\Studay\CSharp\Work\Revit\HelloRevit\bin\Debug\HelloRevit.dll", "HelloRevit.Class1"); PushButton pb = panel1.AddItem(pbd) as PushButton; RibbonPanel panel2 = application.CreateRibbonPanel("UCD场地工具", "工具"); SplitButtonData splitData = new SplitButtonData("我的集合", "创建工具"); SplitButton sb = panel2.AddItem(splitData) as SplitButton; PushButtonData spd = new PushButtonData("UCD场地工具", "创建", @"D:\Studay\CSharp\Work\Revit\Create2\bin\Debug\Create2.dll", "Create2.CreateBox") { LargeImage = new BitmapImage(new Uri(@"D:\Studay\CSharp\Work\Revit\Ribbon1\img\sign_road.png")) }; sb.AddPushButton(spd); panel2.AddSeparator(); PulldownButtonData pdbd = new PulldownButtonData("UCD场地工具", "检查"); PushButtonData pushbtn = new PushButtonData("UCD场地工具", "碰撞检查", @"D:\Studay\CSharp\Work\Revit\Collision\bin\Debug\Collision.dll", "Collision.Class1"); PulldownButton btn = panel2.AddItem(pushbtn) as PulldownButton; btn.LongDescription = "检查当前物体是否碰撞"; btn.AddPushButton(pushbtn); RibbonPanel panel3 = application.CreateRibbonPanel("UCD场地工具", "文件"); ComboBoxData cbd = new ComboBoxData("选项"); ComboBox cBox = panel3.AddItem(cbd) as ComboBox; if (cBox != null) { cBox.ItemText = "选择操作"; cBox.ToolTip = "请选择想要进行的操作"; cBox.LongDescription = "选择一直接关闭,选择二关闭并修改"; ComboBoxMemberData cbmd = new ComboBoxMemberData("A", "关闭"); ComboBoxMemberData cbmd2 = new ComboBoxMemberData("B", "关闭并修改"); cbmd.GroupName = "编辑操作"; cBox.AddItem(cbmd); cBox.AddItem(cbmd2); } cBox.CurrentChanged += Change; cBox.CurrentChanged += Closed; return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { application.ControlledApplication.DocumentOpened += new EventHandler <DocumentOpenedEventArgs>(Application_DocumentOpened); RibbonPanel rpanel = application.CreateRibbonPanel("B1902 HELPER"); string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; PushButtonData bndataAppconfig = new PushButtonData("cmdConfig", "全局设置", thisAssemblyPath, "BH02.Config_Command"); PushButtonData bndataFamilyNameManager = new PushButtonData("cmdFamilyNameManager", "族名管理", thisAssemblyPath, "BH02.ICommand_Document_FamilyNameManager"); bndataAppconfig.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.sv32.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); bndataFamilyNameManager.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.config32.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); rpanel.AddItem(bndataAppconfig); rpanel.AddSeparator(); rpanel.AddItem(bndataFamilyNameManager); return(Result.Succeeded); }
private void buttonFactory(RibbonPanel ribbon, string executableLocation, ButtonInfo button) { if (button.Name == null && button.Command == null) { ribbon.AddSeparator(); } else if (button.StackedList != null) { AddStackButton(ribbon, executableLocation, button); } else if (button.PulldownList != null) { AddPulldownButton(ribbon, executableLocation, button); } else { AddButton(ribbon, executableLocation, button); } }
private void AddRibbonPanel(UIControlledApplication app) { RibbonPanel panel = app.CreateRibbonPanel("NWC View Exporter"); PushButtonData pbd_Options = new PushButtonData("Export Options", "Export Options", assyPath, "NWCViewExporter.Options"); PushButtonData pbd_Sub = new PushButtonData("Subscribe", "Auto NWC ON", assyPath, "NWCViewExporter.SubscribeToEvent"); pbd_Sub.LargeImage = NewBitmapImage("sub.png"); pbd_Sub.ToolTip = "Turn ON Automatic NWC file creation after each save."; pbd_Sub.LongDescription = "Automatically creates an NWC Navisworks file after each time the project is saved. The selected view in the options dialog is used as the exported view. The NWC file is saved in the directory specified in the options dialog."; PushButtonData pbd_Unsub = new PushButtonData("Unsubscribe", "Auto NWC OFF", assyPath, "NWCViewExporter.UnsubscribeFromEvent"); pbd_Unsub.LargeImage = NewBitmapImage("unsub.png"); pbd_Unsub.ToolTip = "Turn OFF Automatic NWC file creation."; pbd_Unsub.LongDescription = "Turns off the automatic NWC file creator."; PushButton pb_Options = panel.AddItem(pbd_Options) as PushButton; //pb_Options.LargeImage = NewBitmapImage("options.png"); pb_Options.LargeImage = GetEmbeddedImage("NWCViewExporter.options.png"); pb_Options.ToolTip = "Set Options for Automatic NWC Creation"; pb_Options.LongDescription = "Sets the view to use for Automatic NWC creation on each save as well as the destination folder to save the NWC file."; panel.AddSeparator(); IList <RibbonItem> stacked = panel.AddStackedItems(pbd_Sub, pbd_Unsub); //Context help ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.ChmFile, dir + "/Resources/help.htm"); pb_Options.SetContextualHelp(contextHelp); foreach (RibbonItem ri in stacked) { ri.SetContextualHelp(contextHelp); //set contextHelp for stacked items; if (ri.Name == "Subscribe") { ri.Enabled = true; } else { ri.Enabled = false; } } }
public Result OnStartup(UIControlledApplication a) { a.CreateRibbonTab("Visibility"); string path = Assembly.GetExecutingAssembly().Location; PushButtonData pushButtonHideLinkedModel = new PushButtonData("Button1", "Linked Model", path, "VisibilityButtons.HideUnhideLinkedModel"); RibbonPanel panel1 = a.CreateRibbonPanel("Visibility", "Hide/Unhide"); pushButtonHideLinkedModel.ToolTip = "Click to Hide or Unhide Linked Models in the active view."; PushButtonData pushButtonHideImport = new PushButtonData("Button2", "Import Instance", path, "VisibilityButtons.HideUnhideImport"); pushButtonHideImport.ToolTip = "Click to Hide or Unhide Import Instances in the active view."; panel1.AddItem(pushButtonHideLinkedModel); panel1.AddSeparator(); panel1.AddItem(pushButtonHideImport); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication app) { RibbonPanel panelBrowser = null; try { List <RibbonPanel> panelesExistentes = app.GetRibbonPanels(tabName: "ULMA"); panelBrowser = panelesExistentes.FirstOrDefault <RibbonPanel>(x => x.Name.Equals("Browser")); } catch (Exception) { app.CreateRibbonTab("ULMA"); } try { if (panelBrowser == null) { panelBrowser = app.CreateRibbonPanel(panelName: "Browser", tabName: "ULMA"); } else { panelBrowser.AddSeparator(); } PushButton btnUCFamilyProcessor = (PushButton)panelBrowser.AddItem(new PushButtonData(name: "UCFamilyProcessor", text: "family\nprocessor", assemblyName: System.Reflection.Assembly.GetExecutingAssembly().Location, className: "UCFamilyProcessor.UCFamilyProcessor")); btnUCFamilyProcessor.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + System.IO.Path.DirectorySeparatorChar + "UCFamilyProcessor.png")); return(Result.Succeeded); } catch (Exception ex) { TaskDialog mensajero = new TaskDialog(title: "UCFamilyProcessor.Main.OnStartup"); mensajero.CommonButtons = TaskDialogCommonButtons.Ok; mensajero.MainContent = ex.ToString() + Environment.NewLine + ex.StackTrace; mensajero.Show(); return(Result.Failed); } }
private void CreateRebarRibbon(UIControlledApplication uiApp, string tabName) { RibbonPanel panel = uiApp.CreateRibbonPanel(tabName, "Армирование"); SplitButton areaRebarSplitButton = panel .AddItem(new SplitButtonData("AreaRebarSplitButton", "Фоновое")) as SplitButton; areaRebarSplitButton.AddPushButton(CreateButtonData("RevitAreaReinforcement", "CommandCreateAreaRebar")); areaRebarSplitButton.AddPushButton(CreateButtonData("RevitAreaReinforcement", "CommandCreateFloorRebar")); areaRebarSplitButton.AddSeparator(); areaRebarSplitButton.AddPushButton(CreateButtonData("RevitAreaReinforcement", "CommandRestoreRebarArea")); panel.AddSeparator(); panel.AddItem(CreateButtonData("RebarVisibility", "Command")); PushButtonData dataAreaMark = CreateButtonData("AreaRebarMark", "CommandManualStart"); PushButtonData dataHideRebars = CreateButtonData("RebarPresentation", "Command"); PushButtonData dataExplodeRebars = CreateButtonData("ExplodeRebarSet", "CommandExplode"); panel.AddStackedItems(dataAreaMark, dataHideRebars, dataExplodeRebars); }
/// <summary> /// Add UI for registering, showing, and hiding dockable panes. /// </summary> public Result OnStartup(UIControlledApplication application) { thisApp = this; m_APIUtility = new APIUtility(); application.CreateRibbonTab(Globals.DiagnosticsTabName); RibbonPanel panel = application.CreateRibbonPanel(Globals.DiagnosticsTabName, Globals.DiagnosticsPanelName); panel.AddSeparator(); PushButtonData pushButtonRegisterPageData = new PushButtonData(Globals.RegisterPage, Globals.RegisterPage, FileUtility.GetAssemblyFullName(), typeof(ExternalCommandRegisterPage).FullName); pushButtonRegisterPageData.LargeImage = new BitmapImage(new Uri(FileUtility.GetApplicationResourcesPath() + "Register.png")); PushButton pushButtonRegisterPage = panel.AddItem(pushButtonRegisterPageData) as PushButton; pushButtonRegisterPage.AvailabilityClassName = typeof(ExternalCommandRegisterPage).FullName; PushButtonData pushButtonShowPageData = new PushButtonData(Globals.ShowPage, Globals.ShowPage, FileUtility.GetAssemblyFullName(), typeof(ExternalCommandShowPage).FullName); pushButtonShowPageData.LargeImage = new BitmapImage(new Uri(FileUtility.GetApplicationResourcesPath() + "Show.png")); PushButton pushButtonShowPage = panel.AddItem(pushButtonShowPageData) as PushButton; pushButtonShowPage.AvailabilityClassName = typeof(ExternalCommandShowPage).FullName; PushButtonData pushButtonHidePageData = new PushButtonData(Globals.HidePage, Globals.HidePage, FileUtility.GetAssemblyFullName(), typeof(ExternalCommandHidePage).FullName); pushButtonHidePageData.LargeImage = new BitmapImage(new Uri(FileUtility.GetApplicationResourcesPath() + "Hide.png")); PushButton pushButtonHidePage = panel.AddItem(pushButtonHidePageData) as PushButton; pushButtonHidePage.AvailabilityClassName = typeof(ExternalCommandHidePage).FullName; return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { instance = this; application.CreateRibbonTab(MtGlobals.DiagnosticTabName); RibbonPanel modelDectionPanel = application.CreateRibbonPanel(MtGlobals.DiagnosticTabName, MtGlobals.DiagnosticPanelName); modelDectionPanel.AddSeparator(); string assemblyPath = Path.Combine(AssemblyDirectory, "ModelDetectionPlugin.dll"); PushButtonData pushButtonData = new PushButtonData(MtGlobals.ModelDetection, MtGlobals.ModelDetection, assemblyPath, "ModelDetectionPlugin.MtModelDectection"); PushButton setCarportNum = modelDectionPanel.AddItem(pushButtonData) as PushButton; string m_mainPageGUID = "9202DA7D-2BFA-4445-A621-904EDB479DD8"; m_modelDetectionPanel = new MainPanel(); Guid guid = new Guid(m_mainPageGUID); DockablePaneId dockablePaneId = new DockablePaneId(guid); application.RegisterDockablePane(dockablePaneId, MtGlobals.ApplicationName, m_modelDetectionPanel as IDockablePaneProvider); return(Result.Succeeded); }
/// <summary> /// Add a pushbutton to a panel /// </summary> /// <param name="rPanel"></param> /// <param name="buttonName"></param> /// <param name="buttonText"></param> /// <param name="imagePath16"></param> /// <param name="imagePath32"></param> /// <param name="dllPath"></param> /// <param name="dllClass"></param> /// <param name="toolTip"></param> /// <param name="pbAvail"></param> /// <param name="separatorBeforeButton"></param> private void AddButton(RibbonPanel rPanel, string buttonName, string buttonText, string imagePath16, string imagePath32, string dllPath, string dllClass, string toolTip, string pbAvail, bool separatorBeforeButton) { //File path must exist if (!File.Exists(dllPath)) { return; } //Separator?? if (separatorBeforeButton) { rPanel.AddSeparator(); } try { //Create the pbData PushButtonData m_mPushButtonData = new PushButtonData( buttonName, buttonText, dllPath, dllClass); if (!string.IsNullOrEmpty(imagePath16)) { try { m_mPushButtonData.Image = LoadPngImageSource(imagePath16); } catch (Exception m_e) { throw new Exception(m_e.Message); } } if (!string.IsNullOrEmpty(imagePath32)) { try { m_mPushButtonData.LargeImage = LoadPngImageSource(imagePath32); } catch (Exception m_e) { throw new Exception(m_e.Message); } } m_mPushButtonData.ToolTip = toolTip; //Availability? if (!string.IsNullOrEmpty(pbAvail)) { m_mPushButtonData.AvailabilityClassName = pbAvail; } //Add button to the ribbon rPanel.AddItem(m_mPushButtonData); ContextualHelp help = new ContextualHelp(ContextualHelpType.ChmFile, _path + "/help.htm"); m_mPushButtonData.SetContextualHelp(help); } catch (Exception m_e) { throw new Exception(m_e.Message); } }
void CreateRibbonItems(UIControlledApplication a) { // get the path of our dll string addInPath = GetType().Assembly.Location; string imgDir = FindFolderInParents(Path.GetDirectoryName(addInPath), "Images"); const string panelName = "Lab 6 Panel"; const string cmd1 = "XtraCs.Lab1_1_HelloWorld"; const string name1 = "HelloWorld"; const string text1 = "Hello World"; const string tooltip1 = "Run Lab1_1_HelloWorld command"; const string img1 = "ImgHelloWorld.png"; const string img31 = "ImgHelloWorldSmall.png"; const string cmd2 = "XtraCs.Lab1_2_CommandArguments"; const string name2 = "CommandArguments"; const string text2 = "Command Arguments"; const string tooltip2 = "Run Lab1_2_CommandArguments command"; const string img2 = "ImgCommandArguments.png"; const string img32 = "ImgCommandArgumentsSmall.png"; const string name3 = "Lab1Commands"; const string text3 = "Lab 1 Commands"; const string tooltip3 = "Run a Lab 1 command"; const string img33 = "ImgCommandSmall.png"; // create a Ribbon Panel RibbonPanel panel = a.CreateRibbonPanel(panelName); // add a button for Lab1's Hello World command PushButtonData pbd = new PushButtonData(name1, text1, addInPath, cmd1); PushButton pb1 = panel.AddItem(pbd) as PushButton; pb1.ToolTip = tooltip1; pb1.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img1))); // add a vertical separation line in the panel panel.AddSeparator(); // prepare data for creating stackable buttons PushButtonData pbd1 = new PushButtonData(name1 + " 2", text1, addInPath, cmd1); pbd1.ToolTip = tooltip1; pbd1.Image = new BitmapImage(new Uri(Path.Combine(imgDir, img31))); PushButtonData pbd2 = new PushButtonData(name2, text2, addInPath, cmd2); pbd2.ToolTip = tooltip2; pbd2.Image = new BitmapImage(new Uri(Path.Combine(imgDir, img32))); PulldownButtonData pbd3 = new PulldownButtonData(name3, text3); pbd3.ToolTip = tooltip3; pbd3.Image = new BitmapImage(new Uri(Path.Combine(imgDir, img33))); // add stackable buttons IList <RibbonItem> ribbonItems = panel.AddStackedItems(pbd1, pbd2, pbd3); // add two push buttons as sub-items of the Lab 1 commands PulldownButton pb3 = ribbonItems[2] as PulldownButton; pbd = new PushButtonData(name1, text1, addInPath, cmd1); PushButton pb3_1 = pb3.AddPushButton(pbd); pb3_1.ToolTip = tooltip1; pb3_1.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img1))); pbd = new PushButtonData(name2, text2, addInPath, cmd2); PushButton pb3_2 = pb3.AddPushButton(pbd); pb3_2.ToolTip = tooltip2; pb3_2.LargeImage = new BitmapImage(new Uri(Path.Combine(imgDir, img2))); }
public void AddElec_WTA_ELEC_Ribbon(UIControlledApplication a) { string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location; string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; // create ribbon tab String thisNewTabName = "WTA-ELEC"; try { a.CreateRibbonTab(thisNewTabName); } catch (Autodesk.Revit.Exceptions.ArgumentException) { // Assume error generated is due to "WTA" already existing } // Add ribbon panels. String thisNewPanelBe = "Be This"; RibbonPanel thisNewRibbonPanelBe = a.CreateRibbonPanel(thisNewTabName, thisNewPanelBe); String thisNewPanelNamLFixt = "Light Fixtures"; RibbonPanel thisNewRibbonPanelLFixt = a.CreateRibbonPanel(thisNewTabName, thisNewPanelNamLFixt); String thisNewPanelNameAim = "Aiming Lights"; RibbonPanel thisNewRibbonPanelAim = a.CreateRibbonPanel(thisNewTabName, thisNewPanelNameAim); //System.Windows.MessageBox.Show(a.GetRibbonPanels(thisNewTabName).Count.ToString()); // Create push buttons PushButtonData pbTwoPickTagLight = new PushButtonData("TwoPickLightingTag", "Two Pick\nLighting Tag", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickLightingTag"); PushButtonData pbTwoPickTagSwitch = new PushButtonData("TwoPickSwitchTag", "Two Pick\nDevice Tag", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickSwitchTag"); PushButtonData pbTwoPickAimLight = new PushButtonData("AimLight", " Aim ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickLightRot"); PushButtonData pbAimManyLights = new PushButtonData("AimManyLights", " Aim Many", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdAimManyLights"); PushButtonData pbBeLighting = new PushButtonData("BeLighting", "Lighting", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBeLightingWorkSet"); PushButtonData pbBePower = new PushButtonData("BePower", "Power", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBePowerWorkSet"); PushButtonData pbBeAuxiliary = new PushButtonData("BeAuxiliary", "Auxiliary", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBeAuxiliaryWorkSet"); PushButtonData pbSelOnlyLights = new PushButtonData("SelOnlyLightFix", "Only Fixtures", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPickOnlyLights"); PushButtonData pbSelOnlyDevices = new PushButtonData("SelOnlyDevices", "Only Devices", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPickOnlyDevices"); PushButtonData pbLightingReporter = new PushButtonData("LRPT", "Room Picker", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdRoomLightingReporter"); PushButtonData pbLightingTotReport = new PushButtonData("LRPTOT", "LPD Totalizer", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdRoomsLightPwrDensityReport"); PushButtonData pbOCCDetTool = new PushButtonData("OCCDetTool", "OCC Det Tool", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceOCCSensorToolInstance"); pbOCCDetTool.ToolTip = "Places Occupancy sensor detection tool."; string lDescOCCDetTool = "Requires a linked ceiling pick to set the sensor detection family tool's parameter. The tool adjusts the detection pattern " + "according to the ceiling height from the ceiling pick. Without a ceiling, place otherwise and manually change the instance parameter as needed. " + "Use the family's type selector to get the detection pattern you are interested in. " + "The tool is placed on a diagnostic workset that will be created if needed."; pbOCCDetTool.LongDescription = lDescOCCDetTool; pbOCCDetTool.ToolTipImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SENSDETLG.PNG"); pbOCCDetTool.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SENSDETSM.PNG"); // Set the large image shown on button //Note that the full image name is namespace_prefix + "." + the actual imageName); pbTwoPickTagLight.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TwoPickTag.png"); pbTwoPickTagSwitch.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TwoPickTagSwitch.png"); // add button tips (when data, must be defined prior to adding button.) pbTwoPickTagLight.ToolTip = "Places lighting tag in two or less picks."; pbTwoPickTagSwitch.ToolTip = "Places device tag in two or less picks."; pbTwoPickAimLight.ToolTip = "2D Aims a non hosted light."; pbAimManyLights.ToolTip = "2D Aims a selection of non hosted lights."; pbBeLighting.ToolTip = "Switch to Lighting Workset."; pbBePower.ToolTip = "Switch to Power Workset."; pbBeAuxiliary.ToolTip = "Switch to Auxiliary Workset."; pbSelOnlyLights.ToolTip = "Selecting only lighting fixtures."; pbSelOnlyDevices.ToolTip = "Selecting only lighting devices."; pbLightingReporter.ToolTip = "Reports on all lighting in a room."; string lDescpbTwoPickTagLight = "Places the lighting tag in two picks.\nThe first pick selects the light fixture.\nThe second pick is the tag location."; string lDescpbTwoPickAimLight = "Pick a light.\nThen pick where it is supposed to aim."; string lDescpbAimManyLights = "Select a bunch of lights.\nThen pick the one spot where they all should aim towards."; string lDescpb3DAim = "The special element has to be a Sprinkler category family instance."; string lDescSelOnlyLights = "Swipe over anything. Only lighting fixtures are selected."; string lDescSelOnlyDevices = "Swipe over anything. Only lighting devices are selected."; string lDescBeLighting = "If you can't beat'm, join'm. Become Elec Lighting workset."; string lDescBePower = "If you can't beat'm, join'm. Become Elec Power workset."; string lDescBeAuxiliary = "If you can't beat'm, join'm. Become Elec Auxiliary workset."; pbTwoPickTagLight.LongDescription = lDescpbTwoPickTagLight; pbTwoPickAimLight.LongDescription = lDescpbTwoPickAimLight; pbAimManyLights.LongDescription = lDescpbAimManyLights; pbSelOnlyLights.LongDescription = lDescSelOnlyLights; pbSelOnlyDevices.LongDescription = lDescSelOnlyDevices; pbBeLighting.LongDescription = lDescBeLighting; pbBePower.LongDescription = lDescBePower; pbBeAuxiliary.LongDescription = lDescBeAuxiliary; // add to ribbon panelA List <RibbonItem> projectButtonsA = new List <RibbonItem>(); projectButtonsA.AddRange(thisNewRibbonPanelBe.AddStackedItems(pbBeLighting, pbBePower, pbBeAuxiliary)); // add to ribbon panelB thisNewRibbonPanelLFixt.AddItem(pbTwoPickTagLight); thisNewRibbonPanelLFixt.AddItem(pbTwoPickTagSwitch); thisNewRibbonPanelLFixt.AddSeparator(); List <RibbonItem> projectButtonsB = new List <RibbonItem>(); projectButtonsB.AddRange(thisNewRibbonPanelLFixt.AddStackedItems(pbSelOnlyLights, pbSelOnlyDevices)); thisNewRibbonPanelLFixt.AddSeparator(); List <RibbonItem> projectButtonsBB = new List <RibbonItem>(); projectButtonsBB.AddRange(thisNewRibbonPanelLFixt.AddStackedItems(pbLightingReporter, pbOCCDetTool, pbLightingTotReport)); // add to ribbon panelC List <RibbonItem> projectButtonsC = new List <RibbonItem>(); projectButtonsC.AddRange(thisNewRibbonPanelAim.AddStackedItems(pbTwoPickAimLight, pbAimManyLights)); //projectButtons.AddRange(thisNewRibbonPanel.AddStackedItems(pbData2DN, pbData4DN, pbDataAPN)); thisNewRibbonPanelBe.AddSlideOut(); PushButtonData bInfo = new PushButtonData("Info", "Info", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdOpenDocFolder"); bInfo.ToolTip = "See the help document regarding this."; bInfo.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".InfoLg.png"); thisNewRibbonPanelBe.AddItem(bInfo); thisNewRibbonPanelLFixt.AddSlideOut(); thisNewRibbonPanelLFixt.AddItem(bInfo); } // AddMech_WTA_Elec_Ribbon
//-- /// <summary> /// Create separator on the panel /// </summary> /// <returns></returns> public Panel CreateSeparator() { _panel.AddSeparator(); return(this); }