private void DrawingIssusance() { Autodesk.Revit.UI.RibbonPanel m_panelIssueData = GetRibbonPanelByTabName(CTabName, "Drawing Issuance"); string m_sheetIndexPath = Path.Combine(_path, "SheetIndex.dll"); if (File.Exists(m_sheetIndexPath)) { m_panelIssueData.AddItem(GetPushButtonData("SheetIndex", "Import \nConsultants Sheets", m_sheetIndexPath, "SheetIndex.Command", "KirkseyAppsRibbon.Icons.SheetIndex16.png", "KirkseyAppsRibbon.Icons.SheetIndex32.png", "Load Consultants Sheet Data to Sheet Index", "")); } string m_revisionNarrativePath = Path.Combine(_path, "RevisionNarrative.dll"); if (File.Exists(m_revisionNarrativePath)) { m_panelIssueData.AddItem(GetPushButtonData("RevisionNarrative", "Generate \nRevision Narrative", m_revisionNarrativePath, "RevisionNarrative.Command", "KirkseyAppsRibbon.Icons.RevisionNarrative16.png", "KirkseyAppsRibbon.Icons.RevisionNarrative32.png", "Export Revision Data to Word Document for Revision Narrative", "")); } }
private static object TheInternalDoingPart(UIControlledApplication CApp, string TabName, string PanelName) { IList ERPs = null; ERPs = CApp.GetRibbonPanels(TabName); Autodesk.Revit.UI.RibbonPanel NewOrExtgRevitPanel = null; foreach (Autodesk.Revit.UI.RibbonPanel Pan in ERPs) { if (Pan.Name == PanelName) { NewOrExtgRevitPanel = Pan; goto FoundSoJumpPastNew; } } Autodesk.Revit.UI.RibbonPanel NewRevitPanel = null; NewRevitPanel = CApp.CreateRibbonPanel(TabName, PanelName); NewOrExtgRevitPanel = NewRevitPanel; FoundSoJumpPastNew: return(NewOrExtgRevitPanel); }
// Define a method that will create our tab and button static void AddRibbonPanel(UIControlledApplication application) { // Create a custom ribbon tab String tabName = "designtech.io"; application.CreateRibbonTab(tabName); Autodesk.Revit.UI.RibbonPanel aboutPanel = application.CreateRibbonPanel(tabName, "About"); Autodesk.Revit.UI.RibbonPanel managePanel = application.CreateRibbonPanel(tabName, "Manage"); Autodesk.Revit.UI.RibbonPanel toolsPanel = application.CreateRibbonPanel(tabName, "Tools"); Autodesk.Revit.UI.RibbonPanel excelPanel = application.CreateRibbonPanel(tabName, "Excel"); //info CreateInfoButton(application, tabName, aboutPanel); //Manage CreateRemoveViewTemplatesButton(application, tabName, managePanel); CreateRemoveFiltersButton(application, tabName, managePanel); //Tools CreatePinUnpinButton(application, tabName, toolsPanel); CreateSplineRenumberButton(application, tabName, toolsPanel); CreateMatchFireRatingButton(application, tabName, toolsPanel); CreateLegendPlacerButton(application, tabName, toolsPanel); //Excel CreateExcelSheetButton(application, tabName, excelPanel); }
/// <summary> /// Adds the push button set. /// </summary> /// <param name="pnl"></param> /// <param name="pbds"></param> public static void AddPushButtons(this RibbonPanel pnl, Dictionary <PulldownButtonData, List <PushButtonData> > pbds) { foreach (var pbd in pbds) { pnl.AddPushButton(pbd.Key, pbd.Value); } }
private void LoadBackPocket(string computerName, string Currentuser) { // Template Creator List <string> vaildUser = new List <string>(); vaildUser.Add("michaelr"); vaildUser.Add("clays"); vaildUser.Add("russellw"); foreach (String user in vaildUser) { if (user == Currentuser.ToLower()) { string m_publishTemplatePath = Path.Combine(_path, "PublishTemplate1.dll"); if (File.Exists(m_publishTemplatePath)) { Autodesk.Revit.UI.RibbonPanel m_panelKeynote = GetRibbonPanelByTabName(CTabName, "Template Tool"); AddButton(m_panelKeynote, "PublishTemplate", "Publish\nTemplate", m_publishTemplatePath, "PublishTemplate.Command", "KirkseyAppsRibbon.Icons.PublishTemplate16.png", "KirkseyAppsRibbon.Icons.PublishTemplate32.png", "Back Pocket BIM Tools", ""); } } } // Keynote Edit - Large Button if (computerName == mikesComputer) { string m_backPocketPath = Path.Combine(_path, "ReplaceAssemblyCode.dll"); if (File.Exists(m_backPocketPath)) { Autodesk.Revit.UI.RibbonPanel m_panelKeynote = GetRibbonPanelByTabName(CTabName, "Back Pocket"); AddButton(m_panelKeynote, "BackPocket", "Back\nPocket", m_backPocketPath, "ReplaceAssemblyCode.Command", "KirkseyAppsRibbon.Icons.BackPocket16.png", "KirkseyAppsRibbon.Icons.BackPocket32.png", "Back Pocket BIM Tools", ""); } } }
private void AddMenu(UIControlledApplication app) { Autodesk.Revit.UI.RibbonPanel pannel = app.CreateRibbonPanel("UniBIM Tablas 1.5"); //IMPORTANT NOTE: las imagenes de los botones deben tener su propiedad "Build Action" como Resource. string pathResource = "pack://application:,,,/UniBimTablas;component/Resources/"; // Botones PushButtonData button1 = new PushButtonData("ubTablas01", "Exportar Tablas", ExecutingAssemblyPath, "UniBimTablas.ExportarTablas"); button1.LargeImage = new BitmapImage(new Uri(pathResource + "Excel32.png")); PushButtonData button2 = new PushButtonData("ubTablas02", "Crear Tablas", ExecutingAssemblyPath, "UniBimTablas.CrearTablas"); button2.LargeImage = new BitmapImage(new Uri(pathResource + "table32.png")); PushButtonData button3 = new PushButtonData("dbTablas03", "Sincronizar Ids", ExecutingAssemblyPath, "UniBimTablas.SincronizarId"); button3.LargeImage = new BitmapImage(new Uri(pathResource + "tag.png")); // PullDown Buttons pannel.AddItem(button2); pannel.AddItem(button1); pannel.AddItem(button3); }
private void LoadDWGTool() { // Keynote Edit - Large Button Autodesk.Revit.UI.RibbonPanel m_panelUtilities = null; string m_DWGPath = Path.Combine(_path, "ConvertDWGtoLines.dll"); if (File.Exists(m_DWGPath)) { if (m_panelUtilities == null) { m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Drawing Utilities"); } AddButton(m_panelUtilities, "EZDWG", "EZ DWG \nConverter", m_DWGPath, "ConvertDWGtoLines.Command", "KirkseyAppsRibbon.Icons.EZDWGConverter16.png", "KirkseyAppsRibbon.Icons.EZDWGConverter32.png", "Convert a selected DWG to detail lines.", ""); } m_DWGPath = Path.Combine(_path, "InteriorHelper.dll"); if (File.Exists(m_DWGPath)) { if (m_panelUtilities == null) { m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Drawing Utilities"); } AddButton(m_panelUtilities, "Interior Converter", "Arch to Interior \nConverter", m_DWGPath, "InteriorHelper.Command", "KirkseyAppsRibbon.Icons.AtoI16.png", "KirkseyAppsRibbon.Icons.AtoI32.png", "Convert Architectural Views and Sheets to Interior Views and Sheets.", ""); } m_DWGPath = Path.Combine(_path, "SVG Decode.dll"); if (File.Exists(m_DWGPath)) { if (m_panelUtilities == null) { m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Drawing Utilities"); } AddButton(m_panelUtilities, "PDF Importer", "PDF \nImporter", m_DWGPath, "SVG_Decode.Command", "KirkseyAppsRibbon.Icons.PDFImport16.png", "KirkseyAppsRibbon.Icons.PDFImport32.png", "Vector and Raster import of PDF files.", ""); } }
private Autodesk.Revit.UI.RibbonPanel GetRibbonPanelByTabName(string tabName, string panelName) { Autodesk.Revit.UI.RibbonPanel m_panel = null; bool exists = false; try { // Does it exist already? foreach (Autodesk.Revit.UI.RibbonPanel x in _uiApp.GetRibbonPanels(tabName)) { if (x.Title.ToLower() == panelName.ToLower()) { exists = true; } } } catch { } if (exists == false) { try { // Add the Panel m_panel = _uiApp.CreateRibbonPanel(tabName, panelName); } catch { m_panel = null; } } return(m_panel); }
/// <summary> /// Adds the push button. /// </summary> /// <param name="pnl"></param> /// <param name="pbd"></param> /// <param name="pbds"></param> /// <returns></returns> public static void AddPushButton(this RibbonPanel pnl, PulldownButtonData pbd, List <PushButtonData> pbds) { if (!(pnl.AddItem(pbd) is PulldownButton pdbtn)) { return; } pdbtn.ToolTip = pbd.ToolTip; pdbtn.LongDescription = pbd.LongDescription; pdbtn.LargeImage = pbd.LargeImage; foreach (var pbdl in pbds) { var btn = pdbtn.AddPushButton(pbdl); if (btn == null) { continue; } btn.ToolTip = pbdl.ToolTip; btn.LongDescription = pbdl.LongDescription; btn.LargeImage = pbdl.LargeImage; } }
/// <summary> /// Implements the OnStartup event /// </summary> /// <param name="uiConApp"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication uiConApp) { thisApp = this; // static access to this application instance string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; string bitmapFolder = Path.GetDirectoryName(thisAssemblyPath) + "\\icons"; // Create New Ribbon Tab - SOM // If exists, throw Exception try { uiConApp.CreateRibbonTab(SystemPanelId); } catch { //MessageBox.Show(e.ToString()); } try { Autodesk.Revit.UI.RibbonPanel Edit_RibbonPanel = uiConApp.CreateRibbonPanel(SystemPanelId, "Edit"); // Create Buttons for Ribbon Panel PushButtonData IntersectButtonData = new PushButtonData("Intersect", "Intersect\n Elements ", thisAssemblyPath, "EditElements.IntersectDialog"); // Bind Buttons to Ribbon Panel PushButton IntersectButton = Edit_RibbonPanel.AddItem(IntersectButtonData) as PushButton; IntersectButton.ToolTip = "Intersect Elements."; IntersectButton.Image = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute)); IntersectButton.LargeImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute)); IntersectButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute)); Edit_RibbonPanel.AddSeparator(); // Create Buttons for Ribbon Panel PushButtonData SplitButtonData = new PushButtonData("Split", "Split\n Elements ", thisAssemblyPath, "EditElements.SplitDialog"); // Bind Buttons to Ribbon Panel PushButton SplitButton = Edit_RibbonPanel.AddItem(SplitButtonData) as PushButton; SplitButton.ToolTip = "Split Elements by cutting elements."; SplitButton.Image = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute)); SplitButton.LargeImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute)); SplitButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute)); // Subscribe to the "ApplicationInitialized" event // then continue from there once it is fired. // This is to ensure that the ribbon is fully // populated before we mess with it. uiConApp.ControlledApplication.ApplicationInitialized += OnApplicationInitialized; return(Result.Succeeded); } catch (Exception e) { MessageBox.Show(e.ToString()); } return(Result.Succeeded); }
internal static Autodesk.Revit.UI.RibbonPanel AddPanel(UIControlledApplication uiControlledApplication, RibbonTab ribbonTab, string panelName) { //Setup Autodesk.Revit.UI.RibbonPanel _panel = uiControlledApplication.CreateRibbonPanel(ribbonTab.Name, panelName); DirectoryInfo _thisAssemblyDirectoryInfo = new DirectoryInfo(Assembly.GetExecutingAssembly().Location); //About Button PushButtonData _aboutButtonData = new PushButtonData( "BIM365_About", "About", _thisAssemblyDirectoryInfo.FullName, typeof(AboutCommand).FullName); ImageSource _aboutImage = Helpers.GetPngImageSource(nameof(Properties.Resources.About_16x16)); if (_aboutImage != null) { _aboutButtonData.Image = _aboutImage; } ImageSource _aboutLargeImage = Helpers.GetPngImageSource(nameof(Properties.Resources.About_32x32)); if (_aboutLargeImage != null) { _aboutButtonData.LargeImage = _aboutLargeImage; } _aboutButtonData.ToolTip = "Visit BIM365.tech!"; _panel.AddItem(_aboutButtonData); //Help button PushButtonData _helpButtonData = new PushButtonData( "BIM365_Help", "Help", _thisAssemblyDirectoryInfo.FullName, typeof(HelpCommand).FullName); ImageSource _helpImage = Helpers.GetPngImageSource(nameof(Properties.Resources.Help_16x16)); if (_aboutImage != null) { _helpButtonData.Image = _helpImage; } ImageSource _helpLargeImage = Helpers.GetPngImageSource(nameof(Properties.Resources.Help_32x32)); if (_aboutLargeImage != null) { _helpButtonData.LargeImage = _helpLargeImage; } _helpButtonData.ToolTip = "Learn more about this add-in!"; _panel.AddItem(_helpButtonData); return(_panel); }
public static void AddItems(Autodesk.Revit.UI.RibbonPanel panelToUse, string[] dynPaths, bool forceLargeIcon = false) { var totalFiles = dynPaths.Length; List <PushButtonData> pushButtonDatas = new List <PushButtonData>(); foreach (var file in dynPaths) { FileInfo fInfo = new FileInfo(file); string buttonName = $"relay{fInfo.Name.Replace(" ", "")}"; PushButtonData newButtonData = new PushButtonData(buttonName, fInfo.Name.GenerateButtonText(), Path.Combine(Globals.ExecutingPath, "Relay.dll"), "Relay.Run") { ToolTip = fInfo.FullName }; //set the images, if there are none, use default string icon32 = fInfo.FullName.Replace(".dyn", "_32.png"); newButtonData.LargeImage = File.Exists(icon32) ? new BitmapImage(new Uri(icon32)) : new BitmapImage(new Uri(Path.Combine(Globals.RelayGraphs, "Dynamo_32.png"))); string icon16 = fInfo.FullName.Replace(".dyn", "_16.png"); newButtonData.Image = File.Exists(icon16) ? new BitmapImage(new Uri(icon16)) : new BitmapImage(new Uri(Path.Combine(Globals.RelayGraphs, "Dynamo_16.png"))); pushButtonDatas.Add(newButtonData); } if (forceLargeIcon) { foreach (var pushButton in pushButtonDatas) { panelToUse.AddItem(pushButton); } return; } var splitButtons = SplitList(pushButtonDatas, 2); foreach (var buttonGroup in splitButtons) { switch (buttonGroup.Count) { case 2: panelToUse.AddStackedItems(buttonGroup[0], buttonGroup[1]); break; case 1: panelToUse.AddItem(buttonGroup[0]); break; } } }
private void LoadKeynotes() { // Keynote Edit - Large Button string m_keynotePath = Path.Combine(_path, "KeynoteData.dll"); if (File.Exists(m_keynotePath)) { Autodesk.Revit.UI.RibbonPanel m_panelKeynote = GetRibbonPanelByTabName(CTabName, "Keynote Managment"); AddButton(m_panelKeynote, "KeynoteData", "Manage \nKeynotes", m_keynotePath, "KeynoteData.Command", "KirkseyAppsRibbon.Icons.Keynote16.png", "KirkseyAppsRibbon.Icons.Keynote32.png", "Edit and Reload Keynote definitions", ""); } }
/// <summary> /// Adds the button. /// </summary> /// <param name="pnl"></param> /// <param name="info"></param> /// <returns></returns> public static void AddButton <T>(this RibbonPanel pnl, ButtonInfo <T> info) where T : IExternalCommand { if (!(pnl.AddItem(info.CreatePbd()) is PushButton btn)) { return; } btn.ToolTip = info.ToolTip; btn.LongDescription = info.LongDescription; btn.LargeImage = info.LargeImage; }
private void LoadAutomationTools() { //List<string> vaildUser = new List<string>(); //vaildUser.Add("michaelr"); //vaildUser.Add("clays"); //vaildUser.Add("russellw"); //vaildUser.Add("garthw"); //vaildUser.Add("craigp"); //vaildUser.Add("amandam"); //foreach (String user in vaildUser) //{ //if (user == Currentuser.ToLower()) //{ string m_detailPath = Path.Combine(_path, "DetailBuilder.dll"); if (File.Exists(m_detailPath)) { Autodesk.Revit.UI.RibbonPanel m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Automation Tools"); PushButtonData m_pbData = GetPushButtonData("Detail Builder", "Detail \nBuilder", m_detailPath, "DetailBuilder.Command", "KirkseyAppsRibbon.Icons.DetailBuilder16.png", "KirkseyAppsRibbon.Icons.DetailBuilder32.png", "Formerly Project Seagul. *M*A*G*I*C*", ""); var button1 = m_panelUtilities.AddItem(m_pbData); var tempPath = Path.Combine(Path.GetTempPath(), "Magic.swf"); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("KirkseyAppsRibbon.Magic.swf")) { var buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); using (FileStream fs = new FileStream( tempPath, FileMode.Create, FileAccess.Write)) { fs.Write(buffer, 0, buffer.Length); } } RibbonToolTip toolTip1 = new RibbonToolTip() { Title = "Detail Builder", Content = "Import standard details based on model componets", ExpandedContent = "Formerly Project Seagul. *M*A*G*I*C*", ExpandedVideo = new Uri(tempPath), HelpSource = new Uri("https://www.youtube.com/watch?v=U9t-slLl30E"), IsHelpEnabled = true, IsProgressive = true }; SetRibbonItemToolTip(button1, toolTip1); } //} //} }
/// <summary> /// Adds the button. /// </summary> /// <param name="pnl"></param> /// <param name="pbd"></param> /// <returns></returns> public static void AddButton(this RibbonPanel pnl, PushButtonData pbd) { if (!(pnl.AddItem(pbd) is PushButton btn)) { return; } btn.ToolTip = pbd.ToolTip; btn.LongDescription = pbd.LongDescription; btn.LargeImage = pbd.LargeImage; }
/// <summary> /// A method that allows you to create a Push Button with greater ease /// </summary> /// <param name="ribbonPanel"></param> /// <param name="name"></param> /// <param name="path"></param> /// <param name="command"></param> /// <param name="tooltip"></param> /// <param name="icon"></param> private static void CreatePushButton(Autodesk.Revit.UI.RibbonPanel ribbonPanel, string name, string path, string command, string tooltip, string icon) { PushButtonData pbData = new PushButtonData( name, name, path, command); PushButton pb = ribbonPanel.AddItem(pbData) as PushButton; pb.ToolTip = tooltip; BitmapImage pb2Image = new BitmapImage(new Uri(String.Format("pack://application:,,,/DesignTechRibbonPaid;component/Resources/{0}", icon))); pb.LargeImage = pb2Image; }
private void AddMenu(UIControlledApplication app) { Autodesk.Revit.UI.RibbonPanel rvtRibbonPanel = app.CreateRibbonPanel("Revit Lookup"); PulldownButtonData data = new PulldownButtonData("Options", "Revit Lookup"); RibbonItem item = rvtRibbonPanel.AddItem(data); PulldownButton optionsBtn = item as PulldownButton; optionsBtn.AddPushButton(new PushButtonData("HelloWorld", "Hello World...", ExecutingAssemblyPath, "RevitLookup.HelloWorld")); optionsBtn.AddPushButton(new PushButtonData("Snoop Db..", "Snoop DB...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopDb")); optionsBtn.AddPushButton(new PushButtonData("Snoop Current Selection...", "Snoop Current Selection...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScope")); optionsBtn.AddPushButton(new PushButtonData("Snoop Application...", "Snoop Application...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopApp")); optionsBtn.AddPushButton(new PushButtonData("Test Framework...", "Test Framework...", ExecutingAssemblyPath, "RevitLookup.CmdTestShell")); optionsBtn.AddPushButton(new PushButtonData("Events...", "Events...", ExecutingAssemblyPath, "RevitLookup.CmdEvents")); }
public Result OnStartup(UIControlledApplication application) { string tabName = "IFC"; RibbonControl myRibbon = ComponentManager.Ribbon; RibbonTab ggTab = null; foreach (RibbonTab tab in myRibbon.Tabs) { if (string.Compare(tab.Id, tabName, true) == 0) { ggTab = tab; break; } } if (ggTab == null) { application.CreateRibbonTab(tabName); } Autodesk.Revit.UI.RibbonPanel rp = application.CreateRibbonPanel(tabName, "Browser"); PushButtonData pbd = new PushButtonData("propBrowser", "Ifc Property Browser", Assembly.GetExecutingAssembly().Location, "RevitIfcPropertyBrowser.ShowBrowser"); pbd.ToolTip = "Show Property Browser"; rp.AddItem(pbd); DockablePaneProviderData data = new DockablePaneProviderData(); Browser browser = new Browser(); data.FrameworkElement = browser as System.Windows.FrameworkElement; data.InitialState = new DockablePaneState(); data.InitialState.DockPosition = DockPosition.Tabbed; mPropertyPanel = new DockablePaneId(new Guid("{C7C70722-1B9B-4454-A054-DFD142F23580}")); application.RegisterDockablePane(mPropertyPanel, "IFC Properties", browser); foreach (RibbonTab tab in ComponentManager.Ribbon.Tabs) { if (tab.Id == "Modify") { tab.PropertyChanged += PanelEvent; break; } } RequestHandler handler = new RequestHandler(browser); mExEvent = ExternalEvent.Create(handler); application.ControlledApplication.DocumentChanged += handler.ControlledApplication_DocumentChanged; 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")); }
private void AddSplitButton(Autodesk.Revit.UI.RibbonPanel panel, string m_masterSchedulePath, string m_ExcelImportPath) { PushButtonData buttonOne = new PushButtonData("ButtonOne", "Image Based Import", m_masterSchedulePath, "ManageMasterSchedule.Command"); buttonOne.LargeImage = LoadPngImgSource("KirkseyAppsRibbon.Icons.MasterScheduleUpdateImage32.png"); PushButtonData buttonTwo = new PushButtonData("ButtonTwon", "Text/Schedule Based Import", m_ExcelImportPath, "ExcelImport.Command"); buttonTwo.LargeImage = LoadPngImgSource("KirkseyAppsRibbon.Icons.MasterScheduleUpdateText32.png"); SplitButtonData sb1 = new SplitButtonData("splitButton1", "Split"); SplitButton sb = panel.AddItem(sb1) as SplitButton; sb.AddPushButton(buttonOne); sb.AddPushButton(buttonTwo); }
private void RibbonTabStuff() { string _revitReady = Path.Combine(_path, _assembly); var ribbon = Autodesk.Windows.ComponentManager.Ribbon; var tab = ribbon.FindTab("Kirksey"); if (tab == null) { //create a tab _uiApp.CreateRibbonTab("Kirksey"); } if (File.Exists(_revitReady)) { Autodesk.Revit.UI.RibbonPanel _rRRibbonPanel = GetRibbonPanelByTabName("Kirksey", "Revit Ready"); AddButton(_rRRibbonPanel, "Revit Ready", "Show/Hide \nVideo Browser", _revitReady, "RevitReady.Command", "RevitReady.Images.RevitReady16.png", "RevitReady.Images.RevitReady32.png", "Show and Hide the Revit Ready Video Browser", ""); } }
//Manage Tab Buttons static void CreateInfoButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp) { // Create a push button to trigger a command add it to the ribbon panel. string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; PushButtonData buttonData = new PushButtonData("cmdInfo", "Info", thisAssemblyPath, "EssentialTools.Info"); //Make sure this class exists PushButton pushButton = rp.AddItem(buttonData) as PushButton; pushButton.ToolTip = "Licence Information"; Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbonPaid;component/Resources/EssentialTools/about.png")); // Apply image to bitmap BitmapImage largeImage = new BitmapImage(uriImage); // Apply image to button pushButton.LargeImage = largeImage; }
// define a method that will create our tab and button static void AddRibbonPanel(UIControlledApplication application) { String tabName = "Island"; String panelName = "Tools"; try { // Create a custom ribbon tab application.CreateRibbonTab(tabName); } catch { } try { // Add a new ribbon panel Autodesk.Revit.UI.RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, panelName); } catch { } Autodesk.Revit.UI.RibbonPanel panel = application.GetRibbonPanels(tabName).FirstOrDefault(n => n.Name.Equals(panelName, StringComparison.InvariantCulture)); // Get dll assembly path string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; // create push button for CurveTotalLength PushButtonData b1Data = new PushButtonData( "cmdPart_Library", "Part Library", thisAssemblyPath, "Part_Library.Command"); PushButton pb1 = panel.AddItem(b1Data) as PushButton; pb1.ToolTip = "Part Library"; Image img = Resource.pLibraryico; ImageSource imgSrc = GetImageSource(img); pb1.LargeImage = imgSrc; }
public static void CreateCommand(Autodesk.Revit.UI.RibbonPanel panel, ToolbarPanel toolPanel, string name, string title, string path, string com, Bitmap bitmap, string tooltip, Bitmap bitmapHelp, string longDesc, ContextualHelp contextHelp) { try { PushButton button = panel.AddItem(new PushButtonData(name, title, path, com)) as PushButton; button.LargeImage = ConvertBitmap(bitmap); button.ToolTip = tooltip; if (null != bitmapHelp) { button.ToolTipImage = ConvertBitmap(bitmapHelp); } button.LongDescription = longDesc; button.SetContextualHelp(contextHelp); toolPanel.Commands.Add(new ToolbarCommand(name, button)); } catch (Exception ex) { Metrics.AppendLog("Exception creating button: " + name + "\r\n" + ex.Message); } }
public static Autodesk.Revit.UI.RibbonPanel CreateRibbonPanel(UIControlledApplication application, string ribbonPanelName, string ribbonTabName = null) { /// <summary> /// This metthod is used to create a new Ribbon panel. /// Add a ribbonTabName if you need to include this panel inside on Existing Tab. /// <param name="application">An object that is passed to the external application /// </summary> Autodesk.Revit.UI.RibbonPanel panel = application.GetRibbonPanels(ribbonTabName) .FirstOrDefault(n => n.Name.Equals(ribbonTabName, StringComparison.InvariantCulture)); if (panel != null) { return(panel); } else { panel = application.CreateRibbonPanel(ribbonTabName, ribbonPanelName); return(panel); } }
public Result OnStartup(UIControlledApplication application) { m_AssemblyPath = typeof(App).Assembly.Location; m_ribbonPath = Path.GetDirectoryName(m_AssemblyPath) + "\\Icons"; try { application.CreateRibbonTab(tabName); return(Result.Succeeded); } catch (Exception ex) { return(Result.Succeeded); } finally { Autodesk.Revit.UI.RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, strPanelChinese); PushButtonData familyParameterEdit = new PushButtonData("familyParameterEdit", strProductNameChinese, m_AssemblyPath, typeof(Addin).FullName); familyParameterEdit.LargeImage = new BitmapImage(new Uri(m_ribbonPath + "\\familyParameterEdit.png")); familyParameterEdit.ToolTip = "Domain Manager tool"; ribbonPanel.AddItem(familyParameterEdit); } }
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; }
//Tools Buttons static void CreatePinUnpinButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp) { // Autodesk.Revit.UI.RibbonPanel newPanel = a.CreateRibbonPanel(tabname, "Manage"); // Create a push button to trigger a command add it to the ribbon panel. string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; PushButtonData buttonData = new PushButtonData("cmdPin/UnpinFromList", "Pin/Unpin", thisAssemblyPath, "EssentialTools.PinAndUnpinList"); //Make sure this class exists PushButton pushButton = rp.AddItem(buttonData) as PushButton; pushButton.ToolTip = @"Choose to pin/unpin levels, grids and links in bulk from a custom UI interface."; Uri uriImage2 = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/pin_unpin.png")); // Apply image to bitmap BitmapImage largeImage = new BitmapImage(uriImage2); // Apply image to button pushButton.LargeImage = largeImage; }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; Document doc = uidoc.Document; var relayTab = RibbonUtils.GetTab("Relay"); //create the panels for the sub directories foreach (var directory in Directory.GetDirectories(Globals.RelayGraphs)) { DirectoryInfo dInfo = new DirectoryInfo(directory); Autodesk.Revit.UI.RibbonPanel panelToUse = null; try { panelToUse = uiapp.CreateRibbonPanel("Relay", dInfo.Name); } catch (Exception) { panelToUse = uiapp.GetRibbonPanels("Relay").First(p => p.Name.Equals(dInfo.Name)); } var toCreate = Directory.GetFiles(directory, "*.dyn") .Where(f => RibbonUtils.GetButton("Relay", dInfo.Name, $"relay{new FileInfo(f).Name.Replace(" ", "")}") == null).ToArray(); RibbonUtils.AddItems(panelToUse, toCreate); } //subscribe to the events of the button to associate the current DYN Autodesk.Windows.ComponentManager.UIElementActivated -= ComponentManagerOnUIElementActivated; Autodesk.Windows.ComponentManager.UIElementActivated += ComponentManagerOnUIElementActivated; return(Result.Succeeded); }