internal RibbonPanelPopup(RibbonPanel panel) { DoubleBuffered = true; _sensor = new RibbonMouseSensor(this, panel.Owner, panel.Items); _sensor.PanelLimit = panel; _panel = panel; _panel.PopUp = this; panel.Owner.SuspendSensor(); using (Graphics g = CreateGraphics()) { panel.overflowBoundsBuffer = panel.Bounds; Size s = panel.SwitchToSize(this, g, GetSizeMode(panel)); s.Width += 100; s.Height += 100; Size = s; } foreach (RibbonItem item in panel.Items) { item.SetCanvas(this); } }
public void addVRCommandButtons(RibbonPanel panel) { string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; ////Set globel directory var globePathOn = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Onbtn.gif"); var globePathOff = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Offbtn.gif"); //Large image button on Uri uriImageOn = new Uri(globePathOn); BitmapImage largeimageOn = new BitmapImage(uriImageOn); //Large image button off Uri uriImageOff = new Uri(globePathOff); BitmapImage largeimageOff = new BitmapImage(uriImageOff); //Create toggle buttons for radio button group. //Image setup for buttons ToggleButtonData toggleButtonDataON = new ToggleButtonData("ViewCellAlignON", "ON\nAlign Cell", thisAssemblyPath, "SOM.RevitTools.AlignViewToSheetCell.UIDynamicUpdateOn"); ToggleButtonData toggleButtonDataOFF = new ToggleButtonData("ViewCellAlignOFF", "OFF\nAlign Cell", thisAssemblyPath, "SOM.RevitTools.AlignViewToSheetCell.UIDynamicUpdateOff"); toggleButtonDataON.LargeImage = largeimageOn; toggleButtonDataOFF.LargeImage = largeimageOff; //Make dyn update on/off radio button group RadioButtonGroupData radioBtnGroupData = new RadioButtonGroupData("Sheet View Organization"); RadioButtonGroup radioBtnGroup = panel.AddItem(radioBtnGroupData) as RadioButtonGroup; radioBtnGroup.AddItem(toggleButtonDataON); radioBtnGroup.AddItem(toggleButtonDataOFF); }
static RibbonPanel AddOnePanel() { RibbonButton plotThisButton; RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "Plotting"; RibbonPanel rp = new RibbonPanel(); rp.Source = rps; //Create a Command Item that the Dialog Launcher can use, // for this test it is just a place holder. RibbonButton rci = new RibbonButton(); //rci.Name = "TestCommand"; //assign the Command Item to the DialgLauncher which auto-enables // the little button at the lower right of a Panel rps.DialogLauncher = rci; plotThisButton = new RibbonButton(); plotThisButton.Name = "Plot"; plotThisButton.ShowText = true; plotThisButton.Text = "Plot"; plotThisButton.CommandHandler = new MyRibbonCommandHandler(); plotThisButton.CommandParameter = "HelloWorld "; //Add the Button to the Tab rps.Items.Add(plotThisButton); return rp; }
public RibbonElementSizeMode GetSizeMode(RibbonPanel pnl) { if (pnl.FlowsTo == RibbonPanelFlowDirection.Right) { return RibbonElementSizeMode.Medium; } return RibbonElementSizeMode.Large; }
private void AddPushButton(RibbonPanel panel) { PushButton pushButton = panel.AddItem(new PushButtonData("Export", "Export to Boldarc", this.AssemblyFullName, "BoldarcRevitPlugin.Activate")) as PushButton; pushButton.ToolTip = "Export to Boldarc"; ContextualHelp contextualHelp = new ContextualHelp(0, "Boldarc support info goes here."); pushButton.SetContextualHelp(contextualHelp); //pushButton.set_LargeImage(Imaging.CreateBitmapSourceFromHBitmap(Resources.LogoBig.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())); //pushButton.set_Image(Imaging.CreateBitmapSourceFromHBitmap(Resources.LogoSmall.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())); }
public static void AddPanel(RibbonTab ribbonTab, RibbonPanel ribbonPanel) { if (ribbonTab.IsNull() || ribbonPanel.IsNull()) { throw new ArgumentNullException(); } ribbonTab.Panels.Add(ribbonPanel); }
public void CreateView(RibbonPanel panel) { //This where we setup the command it's using in this case the HelloWorld.CS PushButtonData pushButtondataHello = new PushButtonData("CreateView", "Update View Data", assemblyloca, "Application.ProjectSetup"); // This is how we add the button to our Panel PushButton pushButtonHello = panel.AddItem(pushButtondataHello) as PushButton; //This is how we add an Icon //Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace. pushButtonHello.LargeImage = new BitmapImage(new Uri(@"C:\Users\jay.dunn\AppData\Roaming\Autodesk\Revit\Addins\2014\Images\bulb.png")); //Add a tooltip pushButtonHello.ToolTip = "This tool Creates Views for all Levels in a Project"; }
//Control buttons for the dynamic model update public void addVRCommandButtons(RibbonPanel panel) { string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; ////Set globel directory var globePathOn = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Onbtn.gif"); var globePathOff = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Offbtn.gif"); var globePathToolTipOn = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "VRPreviewON.JPG"); var globePathToolTipOff = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "VRPreviewOff.JPG"); //Large image button on Uri uriImageOn = new Uri(globePathOn); BitmapImage largeimageOn = new BitmapImage(uriImageOn); //Large image button off Uri uriImageOff = new Uri(globePathOff); BitmapImage largeimageOff = new BitmapImage(uriImageOff); //Large image tool tip Uri uriImageToolTipOn = new Uri(globePathToolTipOn); BitmapImage largeimageToolTipOn = new BitmapImage(uriImageToolTipOn); Uri uriImageToolTipOff = new Uri(globePathToolTipOff); BitmapImage largeimageToolTipOff = new BitmapImage(uriImageToolTipOff); //Create toggle buttons for radio button group. //Image setup for buttons ToggleButtonData toggleButtonDataON = new ToggleButtonData("ViewportRenameON", "ON\nRename View", thisAssemblyPath, "SOM.RevitTools.ViewportRename.UIDynamicModelUpdateOn"); ToggleButtonData toggleButtonDataOFF = new ToggleButtonData("ViewportRenameOFF", "OFF\nRename View", thisAssemblyPath, "SOM.RevitTools.ViewportRename.UIDynamicModelUpdateOff"); toggleButtonDataON.LargeImage = largeimageOn; toggleButtonDataOFF.LargeImage = largeimageOff; //Tooltip image setup toggleButtonDataON.ToolTip = "Enable project organization by: \nSheet Number-Detail Number-Title on Sheet."; toggleButtonDataON.ToolTipImage = largeimageToolTipOn; toggleButtonDataOFF.ToolTip = "Disable or temporarily turn off View Rename add-in."; toggleButtonDataOFF.ToolTipImage = largeimageToolTipOff; //toggleButtonDataON.LongDescription = "<p>Hello,</p><p>I am RadioButtonGroup #1.</p><p>Regards,</p>"; //toggleButtonDataOFF.LongDescription = "<p>Hello,</p><p>I am RadioButtonGroup #1.</p><p>Regards,</p>"; //Make dyn update on/off radio button group RadioButtonGroupData radioBtnGroupData = new RadioButtonGroupData("Project View Organization"); RadioButtonGroup radioBtnGroup = panel.AddItem(radioBtnGroupData) as RadioButtonGroup; radioBtnGroup.AddItem(toggleButtonDataON); radioBtnGroup.AddItem(toggleButtonDataOFF); }
public void PullDown(RibbonPanel panel) { //creates a Push button for the get selection command PushButtonData bgetselect = new PushButtonData("getselec", "Get Selection", assemblyloca, "Application.getSelection"); //creates a Push button for the get Collection command PushButtonData bgetCollect = new PushButtonData("getcoll", "Get Collection", assemblyloca, "Application.getCollection"); //creates a pull down menu PulldownButtonData pdb1 = new PulldownButtonData("WallsSelection","Wall Selector"); //assigns the pulldown menu to our panel PulldownButton pdb = panel.AddItem(pdb1) as PulldownButton; //adds the buttons above to the pulldown menu pdb.AddPushButton(bgetselect); pdb.AddPushButton(bgetCollect); }
public void updateDoor(RibbonPanel panel) { //This where we setup the command it's using in this case the HelloWorld.CS PushButtonData pushButtondataHello = new PushButtonData("updateDoor", "Update Door Data", assemblyloca, "Application.updateDoor"); // This is how we add the button to our Panel PushButton pushButtonHello = panel.AddItem(pushButtondataHello) as PushButton; //This is how we add an Icon //Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace. pushButtonHello.LargeImage = new BitmapImage(new Uri(@"C:\Users\Gytaco\AppData\Roaming\Autodesk\Revit\Addins\2014\Images\image.png")); //Add a tooltip pushButtonHello.ToolTip = "This tool updates the doors to contain ToRoom data in the comments parameter"; PushButtonData importTextbutton = new PushButtonData("importData", "Import Comments for Walls", assemblyloca, "Application.importData"); PushButton importText = panel.AddItem(importTextbutton) as PushButton; }
public void ProcessRibbonBarButtons(RibbonBarContentItem item, RibbonPanel panel) { if (item == null) return; RibbonBarBuilder builder = new RibbonBarBuilder(this); item.AddRibbonBarButtons(builder); Builders.Add(item, builder); foreach (RibbonBar obj in builder.RibbonBars) { var group = ProcessGroup(obj); panel.Controls.Add(group); } }
/// <summary> /// Add buttons for our three commands /// to the ribbon panel. /// </summary> void PopulatePanel( RibbonPanel p ) { string path = Assembly.GetExecutingAssembly() .Location; RibbonItemData i1 = new PushButtonData( "RvtVa3c_Command", "Va3c \r\n Export", path, "RvtVa3c.Command" ); i1.ToolTip = "Export three.js JSON scene " + "for va3c AEC viewer"; //p.AddStackedItems( i1, i2, i3 ); p.AddItem( i1 ); }
internal RibbonPanelPopup(RibbonPanel panel) { DoubleBuffered = true; Sensor = new RibbonSensor(this, panel.Owner, panel.OwnerTab) {PanelLimit = panel}; Panel = panel; Panel.PopUp = this; using (var g = CreateGraphics()) { var s = panel.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g, GetSizeMode(panel))); Size = s; panel.SetBounds(new Rectangle(0, 0, Size.Width, Size.Height)); panel.UpdateItemsRegions(g, GetSizeMode(panel)); } foreach (var item in panel.Items) { item.SetCanvas(this); } }
public Result OnStartup(UIControlledApplication application) { // add new ribbon panel application.CreateRibbonTab("Národní BIM knihovna"); _panel = application.CreateRibbonPanel("Národní BIM knihovna", "Nástroje"); _panel.Enabled = true; //get assembly of this class to set the right path to other objects in this assembly var assembly = Assembly.GetAssembly(this.GetType()); var assemblyPath = assembly.Location; var dirPath = Path.GetDirectoryName(assemblyPath); //-----------------------------BUTTONS FOR COMMANDS ---------------------------- var btnSettings = _panel.AddItem(new PushButtonData( "GetObject", "Vyhledávání", assemblyPath, "BimLibraryAddin.AddIns.ProductSearchAddIn" )) as PushButton; btnSettings.LargeImage = new BitmapImage(new Uri("pack://*****:*****@"Vyhledané objekty je možné importovat do aktuálního projektu a okamžitě použít."; application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(ControlledApplication_DocumentOpened); application.ControlledApplication.DocumentCreated += new EventHandler<DocumentCreatedEventArgs>(ControlledApplication_DocumentCreating); application.ControlledApplication.DocumentClosing += new EventHandler<DocumentClosingEventArgs>(ControlledApplication_DocumentClosing); application.ControlledApplication.DocumentOpening += new EventHandler<DocumentOpeningEventArgs>(ControlledApplication_DocumentOpening); //application.ControlledApplication.DocumentChanged += new EventHandler<DocumentChangedEventArgs>(); //register failures Failures.RegisterFailures(); return Result.Succeeded; }
/// <summary> /// Adds the button to a specified ribbon panel. /// </summary> /// <param name="ribbonPanel">The ribbon panel.</param> public void AddTo(RibbonPanel ribbonPanel) { AddTo(ribbonPanel, targetControlName: string.Empty, insertBeforeTargetControl: false); }
protected virtual void InitCommands(RibbonPanel panel) { RibbonSeparator separator = new RibbonSeparator(); panel.Items.Add(separator); }
/// <summary> /// Add buttons for the commands we define in this labs. /// Here we stack 2 x 2-push buttons and repeat it as we get more. /// TBD: still thinking which version is better ... /// </summary> public void AddUILabsCommandButtons_v2(RibbonPanel panel) { // Get the location of this dll. string assembly = GetType().Assembly.Location; // Create push buttons to stack up // #1 PushButtonData pushButtonData1 = new PushButtonData("UILabsSelection", "Pick Sampler", assembly, _uiLabName + ".UISelection"); pushButtonData1.Image = NewBitmapImage("basics.ico"); // #2 PushButtonData pushButtonData2 = new PushButtonData("UILabsCreateHouseUI", "Create House Pick", assembly, _uiLabName + ".CreateHouseUI"); pushButtonData2.Image = NewBitmapImage("basics.ico"); // #3 PushButtonData pushButtonData3 = new PushButtonData("UILabsTaskDialog", "Dialog Sampler", assembly, _uiLabName + ".UITaskDialog"); pushButtonData3.Image = NewBitmapImage("basics.ico"); // #4 PushButtonData pushButtonData4 = new PushButtonData("UILabsCreateHouseDialog", "Create House Dialog", assembly, _uiLabName + ".CreateHouseDialog"); pushButtonData4.Image = NewBitmapImage("basics.ico"); // Create 2 x 2-item stack. IList<RibbonItem> stackedItems1 = panel.AddStackedItems(pushButtonData1, pushButtonData2); IList<RibbonItem> stackedItems2 = panel.AddStackedItems(pushButtonData3, pushButtonData4); }
public static void CreateUI(RibbonPanel ribbonPanel) { const string CommandName = "Rhino"; string CommandId = $"CustomCtrl_%CustomCtrl_%Add-Ins%{ribbonPanel.Name}%{typeof(CommandRhinoInside).Name}"; const string Shortcuts = "R#Ctrl+R"; var buttonData = NewPushButtonData <CommandRhinoInside, AllwaysAvailable>(CommandName); if (ribbonPanel.AddItem(buttonData) is PushButton pushButton) { Button = pushButton; if (Addin.RhinoVersionInfo == null) { pushButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "https://www.rhino3d.com/download/rhino/wip")); pushButton.Image = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.Rhino-logo.png", true); pushButton.LargeImage = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.Rhino-logo.png"); } else { pushButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, "https://www.rhino3d.com/inside")); using (var icon = System.Drawing.Icon.ExtractAssociatedIcon(Addin.RhinoExePath)) { pushButton.Image = icon.ToBitmapSource(true); pushButton.LargeImage = icon.ToBitmapSource(); } try { var versionInfo = Addin.RhinoVersionInfo; pushButton.ToolTip = $"Loads {versionInfo.ProductName} inside this Revit session"; pushButton.LongDescription = $"{versionInfo.FileDescription} ({versionInfo.ProductVersion})\n{versionInfo.LegalCopyright}"; } catch (Exception) { } } // Register keyboard shortcut { string keyboardShortcutsPath = Path.Combine(Revit.CurrentUsersDataFolderPath, "KeyboardShortcuts.xml"); if (!Revit.KeyboardShortcuts.LoadFrom(keyboardShortcutsPath, out var shortcuts)) { shortcuts = new Revit.KeyboardShortcuts.Shortcuts(); } try { var shortcutItem = shortcuts.Where(x => x.CommandId == CommandId).First(); if (shortcutItem.Shortcuts == null) { shortcutItem.Shortcuts = Shortcuts; Rhinoceros.ModalScope.Exit += ModalScope_Exit; } } catch (InvalidOperationException) { var shortcutItem = new Revit.KeyboardShortcuts.ShortcutItem() { CommandName = CommandName, CommandId = CommandId, Shortcuts = Shortcuts, Paths = $"Add-Ins>{ribbonPanel.Name}" }; shortcuts.Add(shortcutItem); Rhinoceros.ModalScope.Exit += ModalScope_Exit; } Revit.KeyboardShortcuts.SaveAs(shortcuts, keyboardShortcutsPath); } } }
public static void RoomsPanel(RibbonPanel panel) { // Add PRSPKT Rename Apart Rooms Button var apartRoomsButtonText = "Переименовать \n помещения"; var apartRoomsData = new PushButtonData("cmdRenameApartRooms", apartRoomsButtonText, DllPath, "RenameApartRooms.RenameApartRooms") { ToolTip = Tools.GetResourceManager("apartRoomRename_toolTip"), LargeImage = new BitmapImage( new Uri("pack://application:,,,/PRSPKT_Apps;component/Resources/renameApartRooms.png")) }; panel.AddItem(apartRoomsData); // Add PRSPKT Rename Apart Rooms Button var doRmButtonText = "Rm Сергею ОВ"; var doRMdata = new PushButtonData("cmdDoRM", doRmButtonText, DllPath, "Do_Rm.DoRmSergei") { ToolTip = "Проставить Rm_Этаж для Сергея ОВ", LargeImage = new BitmapImage(new Uri("pack://application:,,,/PRSPKT_Apps;component/Resources/DoRM.png")) }; panel.AddItem(doRMdata); // Add PRSPKT ApartmentCalc Button New var apartCalcPButtonText = "Квартирография"; var apartCalcPData = new PushButtonData("cmdApartCalc_P", apartCalcPButtonText, DllPath, "ApartmentCalc_P.ApartmentCalc_P") { ToolTip = Tools.GetResourceManager("apartCalc_toolTip"), LargeImage = new BitmapImage(new Uri("pack://application:,,,/PRSPKT_Apps;component/Resources/apartCalc_new.png")) }; panel.AddItem(apartCalcPData); // Add PRSPKT FloorFinish button var floorFinishButtonText = Tools.GetResourceManager("floorfinish_button_name"); var floorFinishData = new PushButtonData("cmdFloorsFinish", floorFinishButtonText, DllPath, "RoomsFinishes.FloorsFinishesClass") { ToolTip = Tools.LangResMan.GetString("floorfinish_toolTip", Tools.Cult), LargeImage = new BitmapImage(new Uri("pack://application:,,,/PRSPKT_Apps;component/Resources/floorFinish.png")) }; // Add PRSPKT RoomFinish button var roomFinishesButtonText = Tools.GetResourceManager("roomFinishes_button_name"); var roomsFinishesData = new PushButtonData("cmdRoomFinish", roomFinishesButtonText, DllPath, "RoomsFinishes.RoomFinishesClass") { ToolTip = Tools.LangResMan.GetString("roomFinishes_toolTip", Tools.Cult), LargeImage = new BitmapImage(new Uri("pack://application:,,,/PRSPKT_Apps;component/Resources/roomFinish.png")) }; // Group RoomsFinishes button var sbRoomData = new SplitButtonData("room", "PRSPKT_Apps"); if (!(panel.AddItem(sbRoomData) is SplitButton sbRoom)) { return; } sbRoom.AddPushButton(floorFinishData); sbRoom.AddPushButton(roomsFinishesData); }
protected override void InitViewCommands(RibbonPanel panel) { RibbonButton btnMaximizeNotes = new RibbonButton("Maximize Notes View"); panel.Items.Add(btnMaximizeNotes); btnMaximizeNotes.Image = Properties.Resources.MaximizeNotes; btnMaximizeNotes.SmallImage = Properties.Resources.MaximizeNotes; btnMaximizeNotes.Click += new EventHandler(OnMaximizeNotes_Clicked); btnMaximizeNotes.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; RibbonButton btnNotesSeparateWindow = new RibbonButton("Open Notes in Window"); panel.Items.Add(btnNotesSeparateWindow); btnNotesSeparateWindow.Image = Properties.Resources.NotesSeparateWindow; btnNotesSeparateWindow.SmallImage = Properties.Resources.NotesSeparateWindow; btnNotesSeparateWindow.Click += new EventHandler(OnNotesSeparateWindow_Clicked); btnNotesSeparateWindow.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; _btnToggleNotesBottom = new RibbonButton("Notes at Bottom"); panel.Items.Add(_btnToggleNotesBottom); _btnToggleNotesBottom.Image = Properties.Resources.notes_down; _btnToggleNotesBottom.SmallImage = Properties.Resources.notes_down; _btnToggleNotesBottom.Click += new EventHandler(OnToggleNotesBottom_Clicked); _btnToggleNotesBottom.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; RibbonButton btnResetView = new RibbonButton("Reset View"); panel.Items.Add(btnResetView); btnResetView.Image = Properties.Resources.ResetView; btnResetView.SmallImage = Properties.Resources.ResetView; btnResetView.Click += new EventHandler(OnResetView_Clicked); btnResetView.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; panel.Items.Add(new RibbonSeparator()); _btnLayout1 = new RibbonButton("Layout 1"); panel.Items.Add(_btnLayout1); _btnLayout1.Image = Properties.Resources.ResetView; _btnLayout1.SmallImage = Properties.Resources.ResetView; _btnLayout1.Click += new EventHandler(OnLayout1_Clicked); _btnLayout1.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; _btnLayout2 = new RibbonButton("Layout 2"); panel.Items.Add(_btnLayout2); _btnLayout2.Image = Properties.Resources.ResetView; _btnLayout2.SmallImage = Properties.Resources.ResetView; _btnLayout2.Click += new EventHandler(OnLayout2_Clicked); _btnLayout2.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; panel.Items.Add(new RibbonSeparator()); RibbonButton btnSnomedct = new RibbonButton("Snomedct"); panel.Items.Add(btnSnomedct); btnSnomedct.Image = Properties.Resources.View; btnSnomedct.SmallImage = Properties.Resources.View; btnSnomedct.Click += btnSnomedct_Click; btnSnomedct.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; panel.Items.Add(new RibbonSeparator()); RibbonButton btnHelp = new RibbonButton("RegExp Help"); panel.Items.Add(btnHelp); btnHelp.Image = Properties.Resources.HelpIcon; btnHelp.SmallImage = Properties.Resources.HelpIcon; btnHelp.Click += btnHelp_Click; btnHelp.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; /////////////////////////////////////////////////////////////////////////////// /*RibbonButton btnPerformance = new RibbonButton("TEST UPDATE"); * _panel.Items.Add(btnPerformance); * btnPerformance.Click += (sender, args) => { new Forms.Performance(_views).ShowDialog(); }; * btnPerformance.MouseEnter += _views.MainForm.RibbonButton_MouseEnter;*/ }
public Result OnStartup(UIControlledApplication application) { #region Events //application.ControlledApplication.DocumentOpened += docOpenedHandler; //application.ControlledApplication.DocumentClosing += docClosingHandler; #endregion #region Create Ribbon Panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(Tab.AddIns, PANEL_NAME); #endregion #region Push Buttons PushButton pbSplitter = ribbonPanel .AddItem(new PushButtonData ("Splitter", "Splitter", ASSEMBLY_PATH, "TektaRevitPlugins.SplitterCmd")) as PushButton; pbSplitter.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.axe_32x32.png"); pbSplitter.Image = BmpImageSource("TektaRevitPlugins.Resources.axe_16x16.png"); PushButton pbFontReplacer = ribbonPanel.AddItem( new PushButtonData("Font Replacer", "Font Replacer", ASSEMBLY_PATH, "TektaRevitPlugins.FontReplacerCmd")) as PushButton; pbFontReplacer.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.replacer_32x32.png"); pbFontReplacer.Image = BmpImageSource("TektaRevitPlugins.Resources.replacer_16x16.png"); PushButton pbParametersHandler = ribbonPanel.AddItem( new PushButtonData("Parameter Handler", "Parameter Handler", ASSEMBLY_PATH, "TektaRevitPlugins.SpHandlerCmd")) as PushButton; pbParametersHandler.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.export_32x32.png"); pbParametersHandler.Image = BmpImageSource("TektaRevitPlugins.Resources.export_16x16.png"); #endregion #region Split Buttons PushButtonData pbdRebarCollector = new PushButtonData("Rebar Collector", "Rebar Collector", ASSEMBLY_PATH, "TektaRevitPlugins.RebarCollectorCmd"); pbdRebarCollector.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.rebar_32x32.png"); pbdRebarCollector.Image = BmpImageSource("TektaRevitPlugins.Resources.rebar_16x16.png"); PushButtonData pbdRebarMarker = new PushButtonData("Rebar Marker", "Rebar Marker", ASSEMBLY_PATH, "TektaRevitPlugins.RebarMarkerCmd"); pbdRebarMarker.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.tag_32x32.png"); pbdRebarMarker.Image = BmpImageSource("TektaRevitPlugins.Resources.tag_16x16.png"); PushButtonData pbdScheduleGenerator = new PushButtonData("Schedule Generator", "Schedule Generator", ASSEMBLY_PATH, "TektaRevitPlugins.Multischedule.CmdConstructMultischedule"); pbdScheduleGenerator.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.schedule_32x32.png"); pbdScheduleGenerator.Image = BmpImageSource("TektaRevitPlugins.Resources.schedule_16x16.png"); PushButtonData pbdUpdateRepository = new PushButtonData("Generate/Update Repository", "Generate/Update Repository", ASSEMBLY_PATH, "TektaRevitPlugins.UpdateRepository"); pbdUpdateRepository.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.sync_32x32.png"); pbdUpdateRepository.Image = BmpImageSource("TektaRevitPlugins.Resources.sync_16x16.png"); SplitButton sbRebarCmds = ribbonPanel.AddItem(new SplitButtonData( "Rebar Commands", "Reinfrocement")) as SplitButton; sbRebarCmds.AddPushButton(pbdRebarCollector); sbRebarCmds.AddPushButton(pbdRebarMarker); sbRebarCmds.AddPushButton(pbdScheduleGenerator); sbRebarCmds.AddPushButton(pbdUpdateRepository); PushButtonData pbdExcelExporter = new PushButtonData ("Excel Exporter", "Excel Exporter", ASSEMBLY_PATH, "TektaRevitPlugins.ExcelExporterCmd"); pbdExcelExporter.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.excel_32x32.png"); pbdExcelExporter.Image = BmpImageSource("TektaRevitPlugins.Resources.excel_16x16.png"); PushButtonData pbdSheetSelector = new PushButtonData ("PDF Printer", "PDF Printer", ASSEMBLY_PATH, "TektaRevitPlugins.SheetSelectorCmd"); pbdSheetSelector.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.pdf_32x32.png"); pbdSheetSelector.Image = BmpImageSource("TektaRevitPlugins.Resources.pdf_16x16.png"); SplitButton sbExportCmds = ribbonPanel.AddItem(new SplitButtonData( "Export Commands", "Export Commands")) as SplitButton; sbExportCmds.AddPushButton(pbdExcelExporter); sbExportCmds.AddPushButton(pbdSheetSelector); PushButtonData pbdRoomNamer = new PushButtonData("Room Namer", "Room Namer", ASSEMBLY_PATH, "TektaRevitPlugins.RoomNamerCmd"); pbdRoomNamer.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.reroom_32x32.png"); pbdRoomNamer.Image = BmpImageSource("TektaRevitPlugins.Resources.reroom_16x16.png"); PushButtonData pbdHeightsMarker = new PushButtonData("Heights Marker", "Heights Marker", ASSEMBLY_PATH, "TektaRevitPlugins.MarkHeightsCmd"); pbdHeightsMarker.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.height_32x32.png"); pbdHeightsMarker.Image = BmpImageSource("TektaRevitPlugins.Resources.height_16x16.png"); PushButtonData pdCalculateFlatArea = new PushButtonData("Flat Area Calculator", "Flat Area Calculator", ASSEMBLY_PATH, "TektaRevitPlugins.CalculateFlatAreaCmd"); pdCalculateFlatArea.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.calculator_32x32.png"); pdCalculateFlatArea.Image = BmpImageSource("TektaRevitPlugins.Resources.calculator_16x16.png"); PushButtonData pdMhbkFlatHandler = new PushButtonData("MHBK Flat Handler", "MHBK Flat Handler", ASSEMBLY_PATH, "TektaRevitPlugins.RoomAreasHandlerCmd"); pdMhbkFlatHandler.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.calculator_32x32.png"); pdMhbkFlatHandler.Image = BmpImageSource("TektaRevitPlugins.Resources.calculator_16x16.png"); pdMhbkFlatHandler.AvailabilityClassName = "TektaRevitPlugins.FlatHandlerAvailability"; PushButtonData pbdTagElements = new PushButtonData("Tag Elements", "Tag Elements", ASSEMBLY_PATH, "TektaRevitPlugins.TagElemsCmd"); pbdTagElements.LargeImage = BmpImageSource("TektaRevitPlugins.Resources.tag_32x32.png"); pdCalculateFlatArea.Image = BmpImageSource("TektaRevitPlugins.Resources.tag_16x16.png"); PushButtonData pbdDoorSwingDirection = SpecifyPushButtonData("Swing Direction", "Swing Direction", ASSEMBLY_PATH, "TektaRevitPlugins.Commands.DoorSwingDetectorCmd", "TektaRevitPlugins.Resources.door_swing_32x32.png", "TektaRevitPlugins.Resources.door_swing_16x16.png"); PushButtonData pbdCopyValues = SpecifyPushButtonData("Copy Values", "Copy Values", ASSEMBLY_PATH, "TektaRevitPlugins.CpValuesCmd", "TektaRevitPlugins.Resources.copy_32x32.png", "TektaRevitPlugins.Resources.copy_16x16.png"); PushButtonData pbdBlkLvlId = SpecifyPushButtonData("Room Data", "Room Data", ASSEMBLY_PATH, "TektaRevitPlugins.Commands.BlockLevelIdentifierCmd", "TektaRevitPlugins.Resources.calculator_32x32.png", "TektaRevitPlugins.Resources.calculator_16x16.png"); PushButtonData pbdBEnumValues = SpecifyPushButtonData("Enumerate Values", "Enumerate Values", ASSEMBLY_PATH, "TektaRevitPlugins.Commands.EnumValuesCmd", "TektaRevitPlugins.Resources.numbers_32x32.png", "TektaRevitPlugins.Resources.numbers_16x16.png"); // Split Buttons SplitButton sbArchCmds = ribbonPanel.AddItem(new SplitButtonData( "Arch Commands", "Arch Commands")) as SplitButton; sbArchCmds.AddPushButton(pbdRoomNamer); sbArchCmds.AddPushButton(pbdHeightsMarker); sbArchCmds.AddPushButton(pdCalculateFlatArea); sbArchCmds.AddPushButton(pdMhbkFlatHandler); sbArchCmds.AddPushButton(pbdTagElements); sbArchCmds.AddPushButton(pbdDoorSwingDirection); sbArchCmds.AddPushButton(pbdCopyValues); sbArchCmds.AddPushButton(pbdBlkLvlId); sbArchCmds.AddPushButton(pbdBEnumValues); #endregion #region Register Updaters #endregion return(Result.Succeeded); }
private void InitPane() { var panel = new RibbonPanel("Default"); var btnCopyToRight = new RibbonButton("Copy to right"); panel.Items.Add(btnCopyToRight); btnCopyToRight.Click += btnCopyToRight_Click; btnCopyToRight.Image = Properties.Resources.right_normal; btnCopyToRight.SmallImage = Properties.Resources.right_normal; var btnCopyToLeft = new RibbonButton("Copy to left"); panel.Items.Add(btnCopyToLeft); btnCopyToLeft.Click += btnCopyToLeft_Click; btnCopyToLeft.Image = Properties.Resources.left_normal; btnCopyToLeft.SmallImage = Properties.Resources.left_normal; var delimiter1 = new RibbonSeparator(); panel.Items.Add(delimiter1); btnSaveLeft = new RibbonButton("Save left"); panel.Items.Add(btnSaveLeft); btnSaveLeft.Click += btnSaveLeft_Click; btnSaveLeft.Image = Properties.Resources.Save; btnSaveLeft.SmallImage = Properties.Resources.Save; btnSaveLeft.Enabled = false; btnSaveRight = new RibbonButton("Save right"); panel.Items.Add(btnSaveRight); btnSaveRight.Click += btnSaveRight_Click; btnSaveRight.Image = Properties.Resources.Save; btnSaveRight.SmallImage = Properties.Resources.Save; btnSaveRight.Enabled = false; btnSaveAll = new RibbonButton("Save all"); panel.Items.Add(btnSaveAll); btnSaveAll.Click += btnSaveAll_Click; btnSaveAll.Image = Properties.Resources.SaveAll; btnSaveAll.SmallImage = Properties.Resources.SaveAll; btnSaveAll.Enabled = false; var delimiter = new RibbonSeparator(); panel.Items.Add(delimiter); var btnRecalculate = new RibbonButton("Re-calculate"); panel.Items.Add(btnRecalculate); btnRecalculate.Click += btnRecalculate_Click; btnRecalculate.Image = Properties.Resources.CalcScores; btnRecalculate.SmallImage = Properties.Resources.CalcScores; this.ribbonTabMain.Panels.Add(panel); this.splitContainer.SplitterDistance = this.Width / 2; }
public void CreateCivil3DRibbon() { Autodesk.Windows.RibbonTab rbnTab = new Autodesk.Windows.RibbonTab(); rbnTab.Title = "Beca"; rbnTab.Id = "Civil3d"; Autodesk.Windows.RibbonPanelSource panlSourceAus = new Autodesk.Windows.RibbonPanelSource(); panlSourceAus.Title = "Australia"; Autodesk.Windows.RibbonButton rbnSignAus = new Autodesk.Windows.RibbonButton(); //rbnSignAus.Text = "Signs"; rbnSignAus.ShowText = true; rbnSignAus.ShowImage = true; rbnSignAus.Image = Images.getBitmap(Properties.Resources.Signs); rbnSignAus.LargeImage = Images.getBitmap(Properties.Resources.Signs); rbnSignAus.Size = RibbonItemSize.Large; rbnSignAus.CommandHandler = new AusSignCommandHandler(); rbnSignAus.CommandParameter = "AusSign"; rbnSignAus.Orientation = System.Windows.Controls.Orientation.Horizontal; rbnSignAus.Width = 500; panlSourceAus.Items.Add(rbnSignAus); Autodesk.Windows.RibbonRowBreak rowBreak = new RibbonRowBreak(); panlSourceAus.Items.Add(rowBreak); Autodesk.Windows.RibbonButton rbnRoadSignAus = new Autodesk.Windows.RibbonButton(); //rbnRoadSignAus.Text = "Road Markings"; rbnRoadSignAus.ShowText = true; rbnRoadSignAus.ShowImage = true; rbnRoadSignAus.Image = Images.getBitmap(Properties.Resources.Road_Markings); rbnRoadSignAus.LargeImage = Images.getBitmap(Properties.Resources.Road_Markings); rbnRoadSignAus.Size = RibbonItemSize.Large; rbnRoadSignAus.CommandParameter = "AusRoadSign"; rbnRoadSignAus.CommandHandler = new AusSignCommandHandler(); rbnRoadSignAus.Orientation = System.Windows.Controls.Orientation.Horizontal; rbnRoadSignAus.Width = 500; panlSourceAus.Items.Add(rbnRoadSignAus); Autodesk.Windows.RibbonPanel rbnPanelAus = new RibbonPanel(); rbnPanelAus.Source = panlSourceAus; rbnTab.Panels.Add(rbnPanelAus); Autodesk.Windows.RibbonPanelSource panlSourceNZ = new Autodesk.Windows.RibbonPanelSource(); panlSourceNZ.Title = "Newzeland"; Autodesk.Windows.RibbonButton rbnSignNZ = new Autodesk.Windows.RibbonButton(); //rbnSignNZ.Text = "Signs"; rbnSignNZ.ShowText = true; rbnSignNZ.ShowImage = true; rbnSignNZ.Image = Images.getBitmap(Properties.Resources.Signs); rbnSignNZ.LargeImage = Images.getBitmap(Properties.Resources.Signs); rbnSignNZ.Size = RibbonItemSize.Large; rbnSignNZ.CommandParameter = "NZSign"; rbnSignNZ.CommandHandler = new AusSignCommandHandler(); rbnSignNZ.Orientation = System.Windows.Controls.Orientation.Horizontal; rbnSignNZ.Width = 500; panlSourceNZ.Items.Add(rbnSignNZ); Autodesk.Windows.RibbonRowBreak rowBreakNZ = new RibbonRowBreak(); panlSourceNZ.Items.Add(rowBreakNZ); Autodesk.Windows.RibbonButton rbnRoadSignNZ = new Autodesk.Windows.RibbonButton(); //rbnRoadSignNZ.Text = "Road Markings"; rbnRoadSignNZ.ShowText = true; rbnRoadSignNZ.ShowImage = true; rbnRoadSignNZ.Image = Images.getBitmap(Properties.Resources.Road_Markings); rbnRoadSignNZ.LargeImage = Images.getBitmap(Properties.Resources.Road_Markings); rbnRoadSignNZ.Size = RibbonItemSize.Large; rbnRoadSignNZ.CommandParameter = "NZRoadSign"; rbnRoadSignNZ.CommandHandler = new AusSignCommandHandler(); rbnRoadSignNZ.Orientation = System.Windows.Controls.Orientation.Horizontal; rbnRoadSignNZ.Width = 500; panlSourceNZ.Items.Add(rbnRoadSignNZ); Autodesk.Windows.RibbonPanel rbnPanelNZ = new RibbonPanel(); rbnPanelNZ.Source = panlSourceNZ; rbnTab.Panels.Add(rbnPanelNZ); rbnTab.IsActive = true; Autodesk.Windows.ComponentManager.Ribbon.Tabs.Add(rbnTab); }
public void AddTCOMDrops_WTA_TCOM_Ribbon(UIControlledApplication a) { string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location; string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; // create ribbon tab String thisNewTabName = "WTA-TCOM"; try { a.CreateRibbonTab(thisNewTabName); } catch (Autodesk.Revit.Exceptions.ArgumentException) { // Assume error generated is due to "WTA" already existing } // Create a push button in the ribbon panel //PushButtonData pbData = new PushButtonData("QVis", " QVis ", ExecutingAssemblyPath, ExecutingAssemblyName + ".QVisCommand"); // Add new ribbon panel. String thisNewPanelName = "TCOM Drops"; RibbonPanel thisNewRibbonPanelTCOM = a.CreateRibbonPanel(thisNewTabName, thisNewPanelName); // add button to ribbon panel //PushButton pushButton = thisNewRibbonPanel.AddItem(pbData) as PushButton; // Set the large image shown on button //Note that the full image name is namespace_prefix + "." + the actual imageName); //pushButton.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".QVis.png"); // provide button tips //pushButton.ToolTip = "Floats a form with buttons to toggle visibilities."; //pushButton.LongDescription = "On this form, the way the buttons look indicate the current visibility status."; // Create push button in this ribbon panel PushButtonData pbData2DH = new PushButtonData("2D H", "2D H", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop2DHInstance"); PushButtonData pbData4DH = new PushButtonData("4D H", "4D H", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop4DHInstance"); PushButtonData pbDataAPH = new PushButtonData("AP H", "AP H", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDropAPHInstance"); PushButtonData pbData2DN = new PushButtonData(" 2D F ", " 2D F ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop2DNHInstance"); PushButtonData pbData4DN = new PushButtonData(" 4D F ", " 4D F ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDrop4DNHInstance"); PushButtonData pbDataAPN = new PushButtonData(" AP F ", " AP F ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceTComDropAPNHInstance"); PushButtonData pbData2PTTAG = new PushButtonData(" 2PT\nTag ", " 2PT\nTag ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickTag"); PushButtonData pbDataMtchTAG = new PushButtonData(" Match\nTag ", " Match\nTag ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdMatchParamterForTCOMDropTag"); // Set the large image shown on button //Note that the full image name is namespace_prefix + "." + the actual imageName); pbData2PTTAG.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDrop.png"); pbDataMtchTAG.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".MtchTagDrop.png"); pbData2DN.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDrop2Dsmall.png"); pbData2DH.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDrop2Dsmall.png"); pbData4DN.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDrop4Dsmall.png"); pbData4DH.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDrop4Dsmall.png"); pbDataAPN.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDropAPsmall.png"); pbDataAPH.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TagDropAPsmall.png"); // add button tips (when data, must be defined prior to adding button.) pbData2DH.ToolTip = "2D Hosted Drop"; pbData4DH.ToolTip = "4D Hosted Drop"; pbDataAPH.ToolTip = "AP Hosted Drop"; pbData2DN.ToolTip = "2D Non Hosted (Free) Drop"; pbData4DN.ToolTip = "4D Non Hosted (Free) Drop"; pbDataAPN.ToolTip = "AP Non Hosted (Free) Drop"; pbData2PTTAG.ToolTip = "Tag a drop with two picks."; pbDataMtchTAG.ToolTip = "Match one tag value to another."; string lDesc = " => Places a drop of the INSTANCE value indicated and then prompts for the TAG location.\n\n\u00A7Workset will be TCOM."; string lDesc2PTTAG = " => Tags an existing drop with two picks.\nFirst pick selects drop.\nSecond pick is tag location.\nPress ESC to exit the command."; string lDescMtchTAG = " => Matches the drop instance tag value by first picking the example tag and then picking the target drop instances.\nPress ESC to exit the command."; pbData2DH.LongDescription = pbData2DH.ToolTip + lDesc; pbData4DH.LongDescription = pbData4DH.ToolTip + lDesc; pbDataAPH.LongDescription = pbDataAPH.ToolTip + lDesc; pbData2DN.LongDescription = pbData2DN.ToolTip + lDesc; pbData4DN.LongDescription = pbData4DN.ToolTip + lDesc; pbDataAPN.LongDescription = pbDataAPN.ToolTip + lDesc; pbData2PTTAG.LongDescription = lDesc2PTTAG; pbDataMtchTAG.LongDescription = lDescMtchTAG; // add button to ribbon panel thisNewRibbonPanelTCOM.AddItem(pbData2PTTAG); List <RibbonItem> projectButtons = new List <RibbonItem>(); projectButtons.AddRange(thisNewRibbonPanelTCOM.AddStackedItems(pbData2DH, pbData4DH, pbDataAPH)); projectButtons.AddRange(thisNewRibbonPanelTCOM.AddStackedItems(pbData2DN, pbData4DN, pbDataAPN)); thisNewRibbonPanelTCOM.AddItem(pbDataMtchTAG); /// Once there is a slideout, all new items go in it. /// It is not possbile to get back to the panel panel. thisNewRibbonPanelTCOM.AddSlideOut(); #region TCOM Info PushButtonData bInfoTCOM = new PushButtonData("Info", "Info", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdOpenDocFolder"); bInfoTCOM.ToolTip = "See the TCOM help document."; bInfoTCOM.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".InfoSm.png"); #endregion #region pbTCOMSettings PushButtonData pbTCOMSettings = new PushButtonData("TCOMSet", "TCOM Settings", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTCOMSettings"); pbTCOMSettings.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".WTATabs.png"); pbTCOMSettings.ToolTip = "Set TCOM Settings - like Tags in the companion view."; #endregion List <RibbonItem> slideOutPanelButtons = new List <RibbonItem>(); slideOutPanelButtons.AddRange(thisNewRibbonPanelTCOM.AddStackedItems(bInfoTCOM, pbTCOMSettings)); } // AddTCOMDrops_WTA-TCOM_Ribbon
public void CreateTab(UIControlledApplication application) { OATools.App oatoolsApp = new OATools.App(); string oaToolsAssembly = oatoolsApp.returnAssembly(); OATools.ViewFilters.Command viewFiltersApp = new OATools.ViewFilters.Command(); string viewFiltersAssembly = viewFiltersApp.returnAssembly(); OATools.ParameterTools.Command parameterToolsApp = new OATools.ParameterTools.Command(); string parameterToolsAssembly = parameterToolsApp.returnAssembly(); //OAToolsUpdater.App updaterApp = new OAToolsUpdater.App(); //string updaterAssembly = updaterApp.returnAssembly(); //Try to build the ribbon tab and load all resources try { //return the assembly System.Reflection.Assembly exe; exe = System.Reflection.Assembly.GetExecutingAssembly(); //Create a ribbon Tab String tabName = "O/A Tools"; application.CreateRibbonTab(tabName); //-------------- // Add the A ribbon panel RibbonPanel ribbonPanelA = application.CreateRibbonPanel(tabName, "Common Tools"); // Create push button to trigger a command PushButtonData A1 = new PushButtonData("Text 2 Upper", "Text 2 Upper", oaToolsAssembly, "OATools.ConvertTextNotes.cmdConvertTextNotes"); A1.ToolTip = "Load the table family and " + "place table instances"; A1.Image = NewBitmapImage(exe, "icon-text.ico"); // Create push button to trigger a command PushButtonData A2 = new PushButtonData("Project Parameters", "Project Parameters", viewFiltersAssembly, "BuildingCoder.CmdProjectParameterGuids"); A2.ToolTip = "Load the table family and " + "place table instances"; A2.Image = NewBitmapImage(exe, "icon-grid.ico"); // Create push button to trigger a command PushButtonData A3 = new PushButtonData("View Filters2", "View Filters2", viewFiltersAssembly, "OATools.ViewFilters.Command"); A3.ToolTip = "Load the table family and " + "place table instances"; A3.Image = NewBitmapImage(exe, "icon-grid.ico"); // Add the buttons to the panel List <RibbonItem> projectButtonsA = new List <RibbonItem>(); projectButtonsA.AddRange(ribbonPanelA.AddStackedItems(A1, A2, A3)); //-------------- //-------------- // Add the B ribbon panel RibbonPanel ribbonPanelB = application.CreateRibbonPanel(tabName, "Parameter Tools"); // Create push button to trigger a command PushButtonData B1 = new PushButtonData("P Cast", "P Cast", parameterToolsAssembly, "OATools.ParameterTools.cmdPCast"); B1.ToolTip = "Load the table family and " + "place table instances"; B1.LargeImage = NewBitmapImage(exe, "icon-text.ico"); //Add the button to ribbon PushButton pushButtondB1 = ribbonPanelB.AddItem(B1) as PushButton; //// Create push button to trigger a command //PushButtonData B1 = new PushButtonData("Project Parameters", "Project Parameters", viewFiltersAssembly, "OATools.ViewFilters.cmdProjectParameters"); //B1.ToolTip = "Load the table family and " + "place table instances"; //B1.Image = NewBitmapImage(exe, "icon-text.ico"); // Create push button to trigger a command //PushButtonData B2 = new PushButtonData("SelectedElement", "SelectedElement", viewFiltersAssembly, "OATools.ViewFilters.cmdSelectedElementParameters"); //B2.ToolTip = "Load the table family and " + "place table instances"; //B2.Image = NewBitmapImage(exe, "icon-grid.ico"); //// Create push button to trigger a command //PushButtonData B3 = new PushButtonData("none3", "none3", viewFiltersAssembly, "OATools.ViewFilters.Command3"); //B3.ToolTip = "Load the table family and " + "place table instances"; //B3.Image = NewBitmapImage(exe, "icon-grid.ico"); //// Add the buttons to the panel //List<RibbonItem> projectButtonsB = new List<RibbonItem>(); //projectButtonsA.AddRange(ribbonPanelB.AddStackedItems(B1, B2)); //-------------- //-------------- // Add the C ribbon panel RibbonPanel ribbonPanelC = application.CreateRibbonPanel(tabName, "Sheet Tools"); // Create push button to trigger a command PushButtonData C1 = new PushButtonData("Sheets From Views", "Sheets From Views", oaToolsAssembly, "OATools.Sheet_Tools.cmdSheetsFromViews"); C1.ToolTip = "Load the table family and " + "place table instances"; C1.Image = NewBitmapImage(exe, "icon-text.ico"); // Create push button to trigger a command PushButtonData C2 = new PushButtonData("SelectedElement", "SelectedElement", oaToolsAssembly, "OATools.Sheet_Tools.cmdCreateSheetsFromViews"); C2.ToolTip = "Load the table family and " + "place table instances"; C2.Image = NewBitmapImage(exe, "icon-grid.ico"); //// Create push button to trigger a command //PushButtonData B3 = new PushButtonData("none3", "none3", viewFiltersAssembly, "OATools.ViewFilters.Command3"); //B3.ToolTip = "Load the table family and " + "place table instances"; //B3.Image = NewBitmapImage(exe, "icon-grid.ico"); // Add the buttons to the panel List <RibbonItem> projectButtonsC = new List <RibbonItem>(); projectButtonsC.AddRange(ribbonPanelC.AddStackedItems(C1, C2)); //-------------- // Add the D ribbon panel RibbonPanel ribbonPanelD = application.CreateRibbonPanel(tabName, "DNotes"); // Create push button to trigger a command PushButtonData D1 = new PushButtonData("cmdDNoteLoadPlace", "Create DNote", oaToolsAssembly, "OATools.DNotes.cmdDNoteLoadPlace"); D1.ToolTip = "Load the DNote family and " + "place DNote instances"; D1.Image = NewBitmapImage(exe, "dnote_icon.ico"); //Add the button to ribbon //PushButton pushButtonD1 = ribbonPanelD.AddItem(D1) as PushButton; // Create push button to trigger a command PushButtonData D2 = new PushButtonData("CmdCreateDNoteLegend", "DNote Legend", oaToolsAssembly, "OATools.DNotes.CmdCreateDNoteLegend"); D2.ToolTip = "Load the DNote family and " + "place DNote instances"; D2.Image = NewBitmapImage(exe, "dnote_icon.ico"); //Add the button to ribbon //PushButton pushButtonD2 = ribbonPanelD.AddItem(D2) as PushButton; // Add the buttons to the panel List <RibbonItem> projectButtonsD = new List <RibbonItem>(); projectButtonsD.AddRange(ribbonPanelD.AddStackedItems(D1, D2)); //-------------- //// Add the E ribbon panel //RibbonPanel ribbonPanelE = application.CreateRibbonPanel(tabName, "Sheet Tools"); //// Create push button to trigger a command //PushButtonData E1 = new PushButtonData("cmdChangeSheet", "Change Sheet", oaToolsAssembly, "OATools.Sheet_Tools.cmdChangeSheet"); //E1.ToolTip = "Load the DNote family and " + "place DNote instances"; //E1.LargeImage = NewBitmapImage(exe, "icon-grid.ico"); ////Add the button to ribbon ////PushButton pushButtonE1 = ribbonPanelE.AddItem(E1) as PushButton; //// Create push button to trigger a command //PushButtonData E2 = new PushButtonData("cmdChangeTB", "Change TitleBlocks", oaToolsAssembly, "OATools.Sheet_Tools.cmdChangeTB"); //E2.ToolTip = "Load the DNote family and " + "place DNote instances"; //E2.LargeImage = NewBitmapImage(exe, "icon-grid.ico"); ////Add the button to ribbon ////PushButton pushButtonE2 = ribbonPanelE.AddItem(E2) as PushButton; //// Add the buttons to the panel //List<RibbonItem> projectButtonsE = new List<RibbonItem>(); //projectButtonsE.AddRange(ribbonPanelE.AddStackedItems(E1, E2)); //-------------- //// Add the F ribbon panel //RibbonPanel ribbonPanelF = application.CreateRibbonPanel(tabName, "Electrical Tools"); //// Create push button to trigger a command //PushButtonData F1 = new PushButtonData("Emergency Circut", "Emergency Circut", oaToolsAssembly, "OATools.Electrical.cmdEmergencyCircut"); //F1.ToolTip = "Load the DNote family and " + "place DNote instances"; //F1.Image = NewBitmapImage(exe, "drafting_icon.ico"); //// Create push button to trigger a command //PushButtonData F2 = new PushButtonData("Unswitched Circut", "Unswitched Circut", oaToolsAssembly, "OATools.Commands.cmdElementOveride"); //F2.ToolTip = "Load the DNote family and " + "place DNote instances"; //F2.Image = NewBitmapImage(exe, "drafting_icon.ico"); //// Add the buttons to the panel //List<RibbonItem> projectButtonsF = new List<RibbonItem>(); //projectButtonsF.AddRange(ribbonPanelF.AddStackedItems(F1, F2)); //------------------- // Add the G ribbon panel RibbonPanel ribbonPanelG = application.CreateRibbonPanel(tabName, "Revitize"); // Create push button to trigger a command PushButtonData G1 = new PushButtonData("DWG to Drafting View", "DWG to Drafting View", oaToolsAssembly, "OATools.Revitize.cmdDWG2DrafingView"); G1.ToolTip = "Load the DNote family and " + "place DNote instances"; G1.Image = NewBitmapImage(exe, "drafting_icon.ico"); // Create push button to trigger a command PushButtonData G2 = new PushButtonData("Import Details", "Import", oaToolsAssembly, "OATools.Revitize.CmdViewImport"); G2.ToolTip = "Load the DNote family and " + "place DNote instances"; G2.Image = NewBitmapImage(exe, "drafting_icon.ico"); // Add the buttons to the panel List <RibbonItem> projectButtonsG = new List <RibbonItem>(); projectButtonsG.AddRange(ribbonPanelG.AddStackedItems(G1, G2)); //------------------ // Add the 5th ribbon panel RibbonPanel ribbonPanel4 = application.CreateRibbonPanel(tabName, "Settings"); // Create push button to trigger a command PushButtonData d1 = new PushButtonData("Initilize", "Initilize", oaToolsAssembly, "OATools.Utilities.Initilize"); d1.ToolTip = "Initialize O/A Tools"; d1.LargeImage = NewBitmapImage(exe, "icon-initialize.ico"); //Add the button to ribbon PushButton pushButtond1 = ribbonPanel4.AddItem(d1) as PushButton; // Create push button to trigger a command PushButtonData d2 = new PushButtonData("Check For Updates", "Check for Updates", oaToolsAssembly, "OATools.Settings.cmdCheckForUpdates"); d2.ToolTip = "Update O/A Tools"; d2.LargeImage = NewBitmapImage(exe, "icon-initialize.ico"); //Add the button to ribbon PushButton pushButtond2 = ribbonPanel4.AddItem(d2) as PushButton; } catch { //show errer if anything fails TaskDialog.Show("Error", "Error Building the O/A Tools ribbon or accessing resources123!"); } }
private void CreateONBOXRibbon(UIControlledApplication application) { string dll = System.Reflection.Assembly.GetExecutingAssembly().Location; string ribbonONBOX = "Onbox App"; application.CreateRibbonTab(ribbonONBOX); IList <RibbonPanel> allProjectPanels = new List <RibbonPanel>(); IList <RibbonPanel> allFreePanels = new List <RibbonPanel>(); RibbonPanel panelRenumber = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.RenumberElements_Title); RibbonPanel panelStructuralMembers = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.StructuralElements_Title); RibbonPanel panelModifyElem = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.ModifyElements_Title); RibbonPanel panelTopo = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.Topography_Title); RibbonPanel panelManage = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.Manage_Title); RibbonPanel panelAbout = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.MoreInfo_Title); RibbonPanel panelNotifications = null; allProjectPanels.Add(panelRenumber); allProjectPanels.Add(panelStructuralMembers); allProjectPanels.Add(panelModifyElem); allProjectPanels.Add(panelTopo); allProjectPanels.Add(panelManage); allFreePanels.Add(panelAbout); allFreePanels.Add(panelNotifications); PushButton btnRenumberGrids = panelRenumber.AddItem(new PushButtonData(Properties.RibbonLanguage.RenumberElements_Grids, Properties.RibbonLanguage.RenumberElements_Grids.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberGridsAdvanced")) as PushButton; btnRenumberGrids.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberGrids)); SplitButton sptRenumberParking = panelRenumber.AddItem(new SplitButtonData(Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces, Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces)) as SplitButton; sptRenumberParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptRenumberParking)); PushButton btnRenumberBeams = panelRenumber.AddItem(new PushButtonData(Properties.RibbonLanguage.RenumberElements_RenumberBeams, Properties.RibbonLanguage.RenumberElements_RenumberBeams.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberBeams")) as PushButton; btnRenumberBeams.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberBeams)); SplitButton sptRenumberColumns = panelRenumber.AddItem(new SplitButtonData(Properties.RibbonLanguage.RenumberElements_RenumberColumns, Properties.RibbonLanguage.RenumberElements_RenumberColumns)) as SplitButton; sptRenumberColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptRenumberColumns)); SplitButton sptJoinElements = panelModifyElem.AddItem(new SplitButtonData(Properties.RibbonLanguage.ModifyElements_JoinMultipleElements, Properties.RibbonLanguage.ModifyElements_JoinMultipleElements)) as SplitButton; sptJoinElements.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptJoinElements)); PushButton btnCreateBeamsFromBuilding = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsForBuilding, Properties.RibbonLanguage.StructuralElements_BeamsForBuilding.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromEntireBuilding")) as PushButton; btnCreateBeamsFromBuilding.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeamsFromBuilding)); PushButton btnCreateBeam = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsFromWalls, Properties.RibbonLanguage.StructuralElements_BeamsFromWalls.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromWalls")) as PushButton; btnCreateBeam.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeam)); PushButton btnCreateBeamsFromColumns = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsFromColumns, Properties.RibbonLanguage.StructuralElements_BeamsFromColumns.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromColumns")) as PushButton; btnCreateBeamsFromColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeamsFromColumns)); PushButton btnCreateColumnsFromDwg = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD, Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD.Replace("\\n", "\n"), dll, "ONBOXAppl.ColumnsFromDwg")) as PushButton; btnCreateColumnsFromDwg.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateColumnsFromDwg)); //PushButton btnCreateBeamsUpdate = panelModifyElem.AddItem(new PushButtonData(" Atualizar \n vigas ", " Atualizar \n vigas ", dll, "ONBOXAppl.BeamUpdate")) as PushButton; PushButton btnElementsCopyLevel = panelModifyElem.AddItem(new PushButtonData(Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels, Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementsCopyToLevels")) as PushButton; btnElementsCopyLevel.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElementsCopyLevel)); PushButton btnElmentsJoin = sptJoinElements.AddPushButton(new PushButtonData(Properties.RibbonLanguage.ModifyElements_JoinElements, Properties.RibbonLanguage.ModifyElements_JoinElements.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementsJoinAdvanced")) as PushButton; btnElmentsJoin.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElmentsJoin)); PushButton btnElmentsSelectJoin = sptJoinElements.AddPushButton(new PushButtonData(Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin, Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementJoinSelect")) as PushButton; btnElmentsSelectJoin.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElmentsSelectJoin)); PushButton btnCreateTopoFromPointCloud = panelTopo.AddItem(new PushButtonData(Properties.RibbonLanguage.Topography_SurfaceByPointCloud, Properties.RibbonLanguage.Topography_SurfaceByPointCloud.Replace("\\n", "\n"), dll, "ONBOXAppl.TopoFromPointCloudAdvanced")) as PushButton; btnCreateTopoFromPointCloud.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateTopoFromPointCloud)); //PushButton btnCreateTopoFromDwgMarks = panelTopo.AddItem(new PushButtonData(" Topografia por CAD planimétrico ", " Topografia por \n planimetria ", dll, "ONBOXAppl.TopoFromDwgMarks")) as PushButton; PushButton btnTopoSlope = panelTopo.AddItem(new PushButtonData(Properties.RibbonLanguage.Topography_SlopeByPads, Properties.RibbonLanguage.Topography_SlopeByPads.Replace("\\n", "\n"), dll, "ONBOXAppl.TopoSlopes")) as PushButton; btnTopoSlope.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnTopoSlope)); PushButton btnRevitZip = panelManage.AddItem(new PushButtonData(Properties.RibbonLanguage.Manage_PackageProject, Properties.RibbonLanguage.Manage_PackageProject.Replace("\\n", "\n"), dll, "ONBOXAppl.RevitZip")) as PushButton; btnRevitZip.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRevitZip)); PushButton btnONBOXSite = panelAbout.AddItem(new PushButtonData(" Onbox ", " Onbox ", dll, "ONBOXAppl.SiteONBOX")) as PushButton; //PushButton btnProjectExamplesFolder = panelAbout.AddItem(new PushButtonData(Properties.RibbonLanguage.About_SampleProjects, Properties.RibbonLanguage.About_SampleProjects.Replace("\\n", "\n"), dll, "ONBOXAppl.ProjectFolder")) as PushButton; PushButton btnInfo = panelAbout.AddItem(new PushButtonData(Properties.RibbonLanguage.About_Title, Properties.RibbonLanguage.About_Title, dll, "ONBOXAppl.AboutONBOXApp")) as PushButton; //SplitButtons for Parking PushButton btnRenumberParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_ParkingSpaces, Properties.RibbonLanguage.RenumberElements_ParkingSpaces.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberParking")) as PushButton; btnRenumberParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberParking)); PushButton btnRenumberBlockParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_NearestSpaces, Properties.RibbonLanguage.RenumberElements_NearestSpaces.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberBlockParking")) as PushButton; btnRenumberBlockParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberBlockParking)); PushButton btnRenumberClearParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering, Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberCleaner")) as PushButton; btnRenumberClearParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberClearParking)); //SplitButtons for Columns PushButton btnRenumberColumns = sptRenumberColumns.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_Columns, Properties.RibbonLanguage.RenumberElements_Columns.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberColumns")) as PushButton; btnRenumberColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberColumns)); PushButton btnRenumberColumnsSelect = sptRenumberColumns.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_SelectColumns, Properties.RibbonLanguage.RenumberElements_SelectColumns.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberColumnsSelection")) as PushButton; btnRenumberColumnsSelect.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberColumnsSelect)); BitmapImage grid32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberGrid32.png", UriKind.Absolute)); BitmapImage grid16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberGrid16.png", UriKind.Absolute)); BitmapImage parking32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberParking32.png", UriKind.Absolute)); BitmapImage parking16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberParking16.png", UriKind.Absolute)); BitmapImage parkingDelete16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberDeleteParking16.png", UriKind.Absolute)); BitmapImage parkingDelete32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberDeleteParking32.png", UriKind.Absolute)); BitmapImage parkingBlock16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBlockParking16.png", UriKind.Absolute)); BitmapImage parkingBlock32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBlockParking32.png", UriKind.Absolute)); BitmapImage beams32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBeams32.png", UriKind.Absolute)); BitmapImage beams16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBeams16.png", UriKind.Absolute)); BitmapImage Column16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberColumns16.png", UriKind.Absolute)); BitmapImage Column32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns32.png", UriKind.Absolute)); BitmapImage Column16Select = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns16.png", UriKind.Absolute)); BitmapImage Column32Select = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns32Select.png", UriKind.Absolute)); BitmapImage BeamsFromBuilding16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsFromBuilding16.png", UriKind.Absolute)); BitmapImage BeamsFromBuilding32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsFromBuilding32.png", UriKind.Absolute)); BitmapImage createBeam16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeams16.png", UriKind.Absolute)); BitmapImage createBeam32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeamsCreate32.png", UriKind.Absolute)); BitmapImage createUpdate32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeamsUpdate32.png", UriKind.Absolute)); BitmapImage createBeamsFromColumns16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsToBeams16.png", UriKind.Absolute)); BitmapImage createBeamsFromColumns32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsToBeams32.png", UriKind.Absolute)); BitmapImage ColumnsFromDwg16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsFromDWG16.png", UriKind.Absolute)); BitmapImage ColumnsFromDwg32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsFromDWG32.png", UriKind.Absolute)); BitmapImage ElementsCopy16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsCopyLevels16.png", UriKind.Absolute)); BitmapImage ElementsCopy32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsCopyLevels.png", UriKind.Absolute)); BitmapImage ElementsJoin16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinMultiple16.png", UriKind.Absolute)); BitmapImage ElementsJoin32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinMultiple.png", UriKind.Absolute)); BitmapImage ElementsSelectJoin16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinSelectMultiple16.png", UriKind.Absolute)); BitmapImage ElementsSelectJoin32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinSelectMultiple.png", UriKind.Absolute)); BitmapImage TopoFromPointCloud16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromPointCloud16.png", UriKind.Absolute)); BitmapImage TopoFromPointCloud32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromPointCloud32.png", UriKind.Absolute)); BitmapImage TopoFromDWG16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromDWG16.png", UriKind.Absolute)); BitmapImage TopoFromDWG32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromDWG.png", UriKind.Absolute)); BitmapImage TopoSlope16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoSlope16.png", UriKind.Absolute)); BitmapImage TopoSlope32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoSlope.png", UriKind.Absolute)); BitmapImage ONBOX32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/onBox32.png", UriKind.Absolute)); BitmapImage ONBOX16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/onBox16.png", UriKind.Absolute)); BitmapImage INFO32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnInfo32.png", UriKind.Absolute)); BitmapImage INFO16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnInfo16.png", UriKind.Absolute)); //BitmapImage ProjectExamples16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnProjectExamplesFolder16.png", UriKind.Absolute)); //BitmapImage ProjectExamples32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnProjectExamplesFolder.png", UriKind.Absolute)); BitmapImage Package16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnPackage16.png", UriKind.Absolute)); BitmapImage Package32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnPackage32.png", UriKind.Absolute)); btnRenumberGrids.LargeImage = grid32; btnRenumberGrids.Image = grid16; btnRenumberGrids.ToolTip = Properties.RibbonLanguage.RenumberElements_Grids_ToolTip; btnRenumberGrids.LongDescription = Properties.RibbonLanguage.RenumberElements_Grids_Descrip; //sptRenumberParking.LongDescription = "Comando para renumerar vagas de estacionamento automaticamente."; btnRenumberBeams.LargeImage = beams32; btnRenumberBeams.Image = beams16; btnRenumberBeams.ToolTip = Properties.RibbonLanguage.RenumberElements_RenumberBeams_ToolTip; btnRenumberBeams.LongDescription = Properties.RibbonLanguage.RenumberElements_RenumberBeams_Descrip; btnRenumberColumns.LargeImage = Column32; btnRenumberColumns.Image = Column16; btnRenumberColumns.ToolTip = Properties.RibbonLanguage.RenumberElements_Columns_ToolTip; btnRenumberColumns.LongDescription = Properties.RibbonLanguage.RenumberElements_Columns_Descrip; btnRenumberColumnsSelect.LargeImage = Column32Select; btnRenumberColumnsSelect.Image = Column16Select; btnRenumberColumnsSelect.ToolTip = Properties.RibbonLanguage.RenumberElements_SelectColumns_ToolTip; btnRenumberColumnsSelect.LongDescription = Properties.RibbonLanguage.RenumberElements_SelectColumns_Descrip; btnCreateBeamsFromBuilding.Image = BeamsFromBuilding16; btnCreateBeamsFromBuilding.LargeImage = BeamsFromBuilding32; btnCreateBeamsFromBuilding.ToolTip = Properties.RibbonLanguage.StructuralElements_BeamsForBuilding_ToolTip; btnCreateBeamsFromBuilding.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsForBuilding_Descrip; btnCreateBeam.Image = createBeam16; btnCreateBeam.LargeImage = createBeam32; btnCreateBeam.ToolTip = Properties.RibbonLanguage.StructuralElements_BeamsFromWalls_ToolTip; btnCreateBeam.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsFromWalls_Descrip; //btnCreateBeamsUpdate.LargeImage = createUpdate32; //btnCreateBeamsUpdate.ToolTip = "Atualizar vigas estruturais"; //btnCreateBeamsUpdate.LongDescription = "Comando para atualizar vigas estruturais, o comando cria tipos automaticamente, é possivel também pré-dimensionar a altura da viga dentre outras opções."; btnCreateColumnsFromDwg.Image = ColumnsFromDwg16; btnCreateColumnsFromDwg.LargeImage = ColumnsFromDwg32; btnCreateColumnsFromDwg.ToolTip = Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD_ToolTip; btnCreateColumnsFromDwg.LongDescription = Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD_Descrip; btnElementsCopyLevel.Image = ElementsCopy16; btnElementsCopyLevel.LargeImage = ElementsCopy32; btnElementsCopyLevel.ToolTip = Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels_ToolTip; btnElementsCopyLevel.LongDescription = Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels_Descrip; btnElmentsJoin.Image = ElementsJoin16; btnElmentsJoin.LargeImage = ElementsJoin32; btnElmentsJoin.ToolTip = Properties.RibbonLanguage.ModifyElements_JoinElements_ToolTip; btnElmentsJoin.LongDescription = Properties.RibbonLanguage.ModifyElements_JoinElements_Descrip; btnElmentsSelectJoin.Image = ElementsSelectJoin16; btnElmentsSelectJoin.LargeImage = ElementsSelectJoin32; btnElmentsSelectJoin.ToolTip = Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin_ToolTip; btnElmentsSelectJoin.LongDescription = Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin_Descrip; btnCreateTopoFromPointCloud.Image = TopoFromPointCloud16; btnCreateTopoFromPointCloud.LargeImage = TopoFromPointCloud32; btnCreateTopoFromPointCloud.ToolTip = Properties.RibbonLanguage.Topography_SurfaceByPointCloud_ToolTip; btnCreateTopoFromPointCloud.LongDescription = Properties.RibbonLanguage.Topography_SurfaceByPointCloud_Descrip; btnCreateBeamsFromColumns.ToolTip = Properties.RibbonLanguage.StructuralElements_BeamsFromColumns_ToolTip; btnCreateBeamsFromColumns.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsFromColumns_Descrip; btnCreateBeamsFromColumns.Image = createBeamsFromColumns16; btnCreateBeamsFromColumns.LargeImage = createBeamsFromColumns32; //btnCreateTopoFromDwgMarks.ToolTip = "Criar topografia a partir de arquivos de CAD planimétricos"; //btnCreateTopoFromDwgMarks.LongDescription = "Comando para criar topografia a partir de arquivos CAD não altimétricos, ou seja, o arquivo de não contém cota Z, o comando lê o arquivo de texto mais próximo que contém informação de altura do ponto."; //btnCreateTopoFromDwgMarks.Image = TopoFromDWG16; //btnCreateTopoFromDwgMarks.LargeImage = TopoFromDWG32; btnTopoSlope.ToolTip = Properties.RibbonLanguage.Topography_SlopeByPads_ToolTip; btnTopoSlope.LongDescription = Properties.RibbonLanguage.Topography_SlopeByPads_Descrip; btnTopoSlope.Image = TopoSlope16; btnTopoSlope.LargeImage = TopoSlope32; btnONBOXSite.LargeImage = ONBOX32; btnONBOXSite.Image = ONBOX16; btnONBOXSite.ToolTip = Properties.RibbonLanguage.About_Site_ToolTip; btnONBOXSite.LongDescription = Properties.RibbonLanguage.About_Site_Descrip; btnInfo.LargeImage = INFO32; btnInfo.Image = INFO16; btnInfo.ToolTip = Properties.RibbonLanguage.About_Onbox_ToolTip; btnInfo.ToolTip = Properties.RibbonLanguage.About_Onbox_Descrip; //btnProjectExamplesFolder.Image = ProjectExamples16; //btnProjectExamplesFolder.LargeImage = ProjectExamples32; //btnProjectExamplesFolder.ToolTip = Properties.RibbonLanguage.About_SampleProjects_ToolTip; //btnProjectExamplesFolder.LongDescription = Properties.RibbonLanguage.About_SampleProjects_Descrip; btnRevitZip.Image = Package16; btnRevitZip.LargeImage = Package32; btnRevitZip.ToolTip = Properties.RibbonLanguage.Manage_PackageProject_ToolTip; btnRevitZip.LongDescription = Properties.RibbonLanguage.Manage_PackageProject_Descrip; //SplitButtons btnRenumberParking.LargeImage = parking32; btnRenumberParking.Image = parking16; btnRenumberParking.ToolTip = Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces_ToolTip; btnRenumberParking.LongDescription = Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces_Descrip; btnRenumberBlockParking.LargeImage = parkingBlock32; btnRenumberBlockParking.Image = parkingBlock16; btnRenumberBlockParking.ToolTip = Properties.RibbonLanguage.RenumberElements_NearestSpaces_ToolTip; btnRenumberBlockParking.LongDescription = Properties.RibbonLanguage.RenumberElements_NearestSpaces_Descrip; btnRenumberClearParking.LargeImage = parkingDelete32; btnRenumberClearParking.Image = parkingDelete16; btnRenumberClearParking.ToolTip = Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering_ToolTip; btnRenumberClearParking.LongDescription = Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering_Descrip; foreach (RibbonPanel currentRibbonPanel in allProjectPanels) { if (currentRibbonPanel != null) { foreach (RibbonItem currentItem in currentRibbonPanel.GetItems()) { if (currentItem is PushButton) { PushButton currentPushButton = currentItem as PushButton; currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableOnProjectEnv"; } if (currentItem is SplitButton) { SplitButton currentSplitButton = currentItem as SplitButton; foreach (PushButton currentPushButton in currentSplitButton.GetItems()) { currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableOnProjectEnv"; } } } } } foreach (RibbonPanel currentRibbonPanel in allFreePanels) { if (currentRibbonPanel != null) { foreach (RibbonItem currentItem in currentRibbonPanel.GetItems()) { if (currentItem is PushButton) { PushButton currentPushButton = currentItem as PushButton; currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableAlways"; } if (currentItem is SplitButton) { SplitButton currentSplitButton = currentItem as SplitButton; foreach (PushButton currentPushButton in currentSplitButton.GetItems()) { currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableAlways"; } } } } } }
/// <summary> /// Startup /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnStartup(UIControlledApplication application) { try { // Version if (!application.ControlledApplication.VersionName.Contains("2014") && !application.ControlledApplication.VersionName.Contains("2015") && !application.ControlledApplication.VersionName.Contains("2016")) { using (TaskDialog td = new TaskDialog("Cannot Continue")) { td.TitleAutoPrefix = false; td.MainInstruction = "Incompatible Revit Version"; td.MainContent = "This Add-In was built for Revit 2014, 2015 and 2016, please contact CASE for assistance."; td.Show(); } return(Result.Cancelled); } // Master Tab const string c_tabName = "CASE"; try { // Create the Tab application.CreateRibbonTab(c_tabName); } catch { } /* * // Assembly Paths * string m_issuetracker = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "ARUP.IssueTracker.dll"); * * // Check that File Exists * if (!File.Exists(m_issuetracker)) * { * using (TaskDialog td = new TaskDialog("Cannot Continue")) * { * td.TitleAutoPrefix = false; * td.MainInstruction = "Required Issue Tracker Library Not Found"; * td.MainContent = m_issuetracker; * td.Show(); * } * return Result.Cancelled; * } * * // Load Assemblies * Assembly.LoadFrom(m_issuetracker); */ string m_issuetracker = "ARUP.IssueTracker.dll"; // Tab RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Arup Issue Tracker"); // Button Data PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker", "Issue Tracker", Path.Combine(_path, "ARUP.IssueTracker.Revit.dll"), "ARUP.IssueTracker.Revit.Entry.CmdMain")) as PushButton; // Images and Tooltip if (m_pushButton != null) { m_pushButton.Image = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon16x16.png", m_issuetracker); m_pushButton.LargeImage = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon32x32.png", m_issuetracker); m_pushButton.ToolTip = "Arup Issue Manager"; } // Initiate RestSharp first to avoid the conflict with Dynamo // string restSharpDllPath = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "RestSharp.dll"); // Assembly.LoadFrom(restSharpDllPath); } catch (Exception ex1) { MessageBox.Show("exception: " + ex1); return(Result.Failed); } return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication uiConApp) { // Method to add Tab and Panel RibbonPanel structure_Panel = null; RibbonPanel achitecture_Panel = null; RibbonPanel other_Panel = null; //Get all ribbonPanel in the tab List <RibbonPanel> myAllRibPanel = getRibbonPanels(uiConApp); foreach (RibbonPanel myRibPanel in myAllRibPanel) { if (myRibPanel.Name == "Achitecture") { achitecture_Panel = myRibPanel; } if (myRibPanel.Name == "Structure") { structure_Panel = myRibPanel; } if (myRibPanel.Name == "Other") { other_Panel = myRibPanel; } } //Location string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; //Add my Commands to Panel //Other //Command 1.1 (name: Increase Value Of parameter) PushButtonData increaseParaForm_Button_Data_01 = new PushButtonData("increaseParaForm_Button_Data_01", "(-)Para(+)", thisAssemblyPath, "MyAppV1.IncreaseParameter"); increaseParaForm_Button_Data_01.ToolTip = "Tăng hoặc giảm dần giá trị parameter ..."; increaseParaForm_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Increase_Parameter.Size16.png"); increaseParaForm_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Increase_Parameter.Size32.png"); //add //other_Panel.AddItem(increaseParaForm_Button_Data_01); //Command 1.2 (name: Show Element By Value Parameter) PushButtonData showElementForm_Button_Data_01 = new PushButtonData("showElementForm_Button_Data_01", "Show by\n Parameter", thisAssemblyPath, "MyAppV1.ShowElementByValueParaAutoCom"); showElementForm_Button_Data_01.ToolTip = "Show element bằng giá trị parameter..."; showElementForm_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Show_Element.Show-Size-16.png"); showElementForm_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Show_Element.Show-Size-32.png"); //add //other_Panel.AddItem(showElementForm_Button_Data_01); //Command 1.3 (name: Show Element By Value Parameter) PushButtonData selectElementByParaValueForm_Button_Data_01 = new PushButtonData("selectElementByParaValueForm_Button_Data_01", "Select by\n Parameter", thisAssemblyPath, "MyAppV1.SelectByValueParameter"); selectElementByParaValueForm_Button_Data_01.ToolTip = "Select các element bằng giá trị parameter..."; selectElementByParaValueForm_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Select_Element.Select-Size-16.png"); selectElementByParaValueForm_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Select_Element.Select-Size-32.png"); //add //other_Panel.AddItem(selectElementByParaValueForm_Button_Data_01); SplitButtonData sb1 = new SplitButtonData("Parameter Tool", "Para Tool"); SplitButton sb_1 = other_Panel.AddItem(sb1) as SplitButton; sb_1.AddPushButton(increaseParaForm_Button_Data_01); sb_1.AddPushButton(showElementForm_Button_Data_01); sb_1.AddPushButton(selectElementByParaValueForm_Button_Data_01); //Add separator other_Panel.AddSeparator(); //Command 2.1 (name: Show Element By Value Parameter) PushButtonData quickDimGridOrLevel_Button_Data_01 = new PushButtonData("quickDimGridOrLevel_Button_Data_01", "Quick Dim \n Grids/Level", thisAssemblyPath, "MyAppV1.QuickDimLevelOrGrid"); quickDimGridOrLevel_Button_Data_01.ToolTip = "Dim nhanh lưới mặt bằng và cao độ"; quickDimGridOrLevel_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Dimensions.QuickDimGrid-Size-32.png"); quickDimGridOrLevel_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Dimensions.QuickDimGrid-Size-32.png"); //add //other_Panel.AddItem(quickDimGridOrLevel_Button_Data_01); //Command 2.1 (name: Show Element By Value Parameter) PushButtonData quickDimGeneral_Button_Data_01 = new PushButtonData("quickDimGeneral_Button_Data_01", "Quick Dim\nby Catergory", thisAssemblyPath, "MyAppV1.QuickDimGeneral"); quickDimGeneral_Button_Data_01.ToolTip = "Dim nhanh bằng cách chọn các đường vuông góc với Views"; quickDimGeneral_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Dimensions.Quick-Dim-Size-16.png"); quickDimGeneral_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Dimensions.Quick-Dim-Size-32.png"); //add //other_Panel.AddItem(quickDimGeneral_Button_Data_01); //Command 2.2 (name: LocateColumn) PushButtonData quickLocateColumn_Button_Data_01 = new PushButtonData("quickLocateColumn_Button_Data_01", "Locate\nColumn", thisAssemblyPath, "MyAppV1.LocateColumnOnPlan"); quickLocateColumn_Button_Data_01.ToolTip = "Định vị cột X,Y trên mặt bằng (Dim theo phương X, Y và các lưới) "; quickLocateColumn_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Dimensions.Dim-Columns-Size-32.png"); quickLocateColumn_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Dimensions.Dim-Columns-Size-32.png"); //add //other_Panel.AddItem(quickLocateColumn_Button_Data_01); SplitButtonData sb2 = new SplitButtonData("splitButtonDim", "Quick Dim Tool"); SplitButton sb_2 = other_Panel.AddItem(sb2) as SplitButton; sb_2.AddPushButton(quickDimGridOrLevel_Button_Data_01); sb_2.AddPushButton(quickDimGeneral_Button_Data_01); sb_2.AddPushButton(quickLocateColumn_Button_Data_01); //Command 2.3 (name: Dim setting Form) PushButtonData dimettingForm_Button_Data_01 = new PushButtonData("dimettingForm_Button_Data_01", "Dim setting", thisAssemblyPath, "MyAppV1.DimenisonGroupSettingForm"); dimettingForm_Button_Data_01.ToolTip = "Chỉnh sửa thông số của dimension tools "; dimettingForm_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Dimensions.Dim-Setting-Form-32.png"); dimettingForm_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Dimensions.Dim-Setting-Form-32.png"); //add other_Panel.AddItem(dimettingForm_Button_Data_01); //Command 2.4 (name: Edit dimension Value Form) PushButtonData editDimValue_Button_Data_01 = new PushButtonData("editDimValue_Button_Data_01", "Edit/Reset \n Dimensions", thisAssemblyPath, "MyAppV1.EditDimensionValue"); editDimValue_Button_Data_01.ToolTip = "Chỉnh sửa giá trị hiển thị của Dimension, AngularDimension"; editDimValue_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Dimensions.Edit-Dim-Size-32.png"); editDimValue_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Dimensions.Edit-Dim-Size-32.png"); //add other_Panel.AddItem(editDimValue_Button_Data_01); //Add separator other_Panel.AddSeparator(); //Command 3.1 (name: Logo Link) PushButtonData logoLink_Button_Data_01 = new PushButtonData("logoLink_Button_Data_01", @"INAECJSC", thisAssemblyPath, "MyAppV1.GotoWebSite"); logoLink_Button_Data_01.ToolTip = "Go to INAECJSC.VN"; logoLink_Button_Data_01.Image = PngImageSource("MyAppV1.Resources.Logo_INAEC.logo-Size-16.png"); logoLink_Button_Data_01.LargeImage = PngImageSource("MyAppV1.Resources.Logo_INAEC.logo-Size-32.png"); //add other_Panel.AddItem(logoLink_Button_Data_01); //App uiConApp.ApplicationClosing += a_ApplicationClosing; //Set Application to Idling uiConApp.Idling += a_Idling; return(Result.Succeeded); }
/// <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 false is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference.</returns> public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { m_application = application; Autodesk.Revit.UI.Result rc = Autodesk.Revit.UI.Result.Failed; string[] lines = null; int n = 0; int k = 0; try { // Check whether the file contains samples' list exists // If not, return failure string filename = m_fileNameStem; if (!GetFilepath(ref filename)) { ErrorMsg(m_fileNameStem + " not found."); return(rc); } // Read all lines from the file lines = ReadAllLinesWithInclude(filename); // Remove comments lines = RemoveComments(lines); // Add default pulldown menus of samples to Revit m_panelRvtSamples = application.CreateRibbonPanel("RvtSamples"); int i = 0; List <PulldownButtonData> pdData = new List <PulldownButtonData>(3); foreach (string category in Enum.GetNames(typeof(DefaultPulldownMenus))) { if ((i + 1) % 3 == 1) { pdData.Clear(); } // // Prepare PulldownButtonData for add stacked buttons operation // string displayName = GetDisplayNameByEnumName(category); List <SampleItem> sampleItems = new List <SampleItem>(); m_defaultMenus.Add(category, sampleItems); PulldownButtonData data = new PulldownButtonData(displayName, displayName); pdData.Add(data); // // Add stacked buttons to RvtSamples panel and set their display names and images // if ((i + 1) % 3 == 0) { IList <RibbonItem> addedButtons = m_panelRvtSamples.AddStackedItems(pdData[0], pdData[1], pdData[2]); foreach (RibbonItem item in addedButtons) { String name = item.ItemText; string enumName = GetEnumNameByDisplayName(name); PulldownButton button = item as PulldownButton; button.Image = new BitmapImage( new Uri(Path.Combine(s_assemblyDirectory, "Icons\\" + enumName + ".ico"), UriKind.Absolute)); button.ToolTip = Properties.Resource.ResourceManager.GetString(enumName); m_pulldownButtons.Add(name, button); } } i++; } // // Add sample items to the pulldown buttons // n = lines.GetLength(0); k = 0; while (k < n) { AddSample(lines, n, ref k); } AddSamplesToDefaultPulldownMenus(); AddCustomizedPulldownMenus(); rc = Autodesk.Revit.UI.Result.Succeeded; } catch (Exception e) { string s = string.Format("{0}: n = {1}, k = {2}, lines[k] = {3}", e.Message, n, k, (k < n ? lines[k] : "eof")); ErrorMsg(s); } return(rc); }
private void HitOn(int x, int y) { if (Ribbon.Tabs.Count == 0 || Ribbon.ActiveTab == null) { SelectRibbon(); return; } if (Ribbon != null) { if (Ribbon.TabHitTest(x, y)) { SelectedElement = Ribbon.ActiveTab; } else { #region Tab ScrollTest if (Ribbon.ActiveTab.TabContentBounds.Contains(x, y)) { if (Ribbon.ActiveTab.ScrollLeftBounds.Contains(x, y) && Ribbon.ActiveTab.ScrollLeftVisible) { Ribbon.ActiveTab.ScrollLeft(); SelectedElement = Ribbon.ActiveTab; return; } if (Ribbon.ActiveTab.ScrollRightBounds.Contains(x, y) && Ribbon.ActiveTab.ScrollRightVisible) { Ribbon.ActiveTab.ScrollRight(); SelectedElement = Ribbon.ActiveTab; return; } } #endregion //Check Panel if (Ribbon.ActiveTab.TabContentBounds.Contains(x, y)) { RibbonPanel hittedPanel = null; foreach (var panel in Ribbon.ActiveTab.Panels) { if (panel.Bounds.Contains(x, y)) { hittedPanel = panel; break; } } if (hittedPanel != null) { //Check item RibbonItem hittedItem = null; foreach (var item in hittedPanel.Items) { if (item.Bounds.Contains(x, y)) { hittedItem = item; break; } } if (hittedItem != null && hittedItem is IContainsSelectableRibbonItems) { //Check subitem RibbonItem hittedSubItem = null; foreach (var subItem in (hittedItem as IContainsSelectableRibbonItems).GetItems()) { if (subItem.Bounds.Contains(x, y)) { hittedSubItem = subItem; break; } } if (hittedSubItem != null) { SelectedElement = hittedSubItem; } else { SelectedElement = hittedItem; } } else if (hittedItem != null) { SelectedElement = hittedItem; } else { SelectedElement = hittedPanel; } } else { SelectedElement = Ribbon.ActiveTab; } } else if (Ribbon.QuickAcessToolbar.SuperBounds.Contains(x, y)) { var itemHitted = false; foreach (var item in Ribbon.QuickAcessToolbar.Items) { if (item.Bounds.Contains(x, y)) { itemHitted = true; SelectedElement = item; break; } } if (!itemHitted) { SelectedElement = Ribbon.QuickAcessToolbar; } } else if (Ribbon.OrbBounds.Contains(x, y)) { Ribbon.OrbMouseDown(); } else { SelectRibbon(); Ribbon.ForceOrbMenu = false; if (Ribbon.OrbDropDown.Visible) { Ribbon.OrbDropDown.Close(); } } } } }
public Result OnStartup(UIControlledApplication application) { // Create a custom ribbon tab string tabName = "CRM Tools"; application.CreateRibbonTab(tabName); string REVIT_VERSION = "v2018"; string commandsPath = ""; commandsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\Commands\"; string iconsPath = ""; iconsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\RevitIcons\"; #region CreateRevitSheets // Create a push button PushButtonData btnCreateRevitSheets = new PushButtonData("cmdCreateRevitSheets", " Create \nSheets", commandsPath + "CreateRevitSheets.dll", "CreateRevitSheets.Class1"); btnCreateRevitSheets.ToolTip = "Create multiple Sheets at once. Assign Views to Sheets."; btnCreateRevitSheets.LongDescription = "Manually create Sheets or load them from a (.csv) file. " + "CSV files can be created with Microsoft Excel. The Sheet Number must be in Column A and the Sheet Name must be in Column B. Each Sheet should have its own Row. " + "Sheet 1 in Row 1, Sheet 2 in Row 2, etc."; // create bitmap image for button Uri uriLargeImage_CreateRevitSheets = new Uri(iconsPath + @"32x32\cmdRevitSheetsImage_32x32.bmp"); BitmapImage largeImage_CreateRevitSheets = new BitmapImage(uriLargeImage_CreateRevitSheets); // create bitmap image for button Uri uriSmallImage_CreateRevitSheets = new Uri(iconsPath + @"16x16\cmdRevitSheetsImage_16x16.bmp"); BitmapImage smallImage_CreateRevitSheets = new BitmapImage(uriSmallImage_CreateRevitSheets); btnCreateRevitSheets.LargeImage = largeImage_CreateRevitSheets; btnCreateRevitSheets.Image = smallImage_CreateRevitSheets; #endregion #region SharedParameterCreator // Create a push button PushButtonData btnSharedParameterCreator = new PushButtonData("cmdSharedParameterCreator", "Shared \nParameter Creator", commandsPath + "SharedParameterCreator.dll", "SharedParameterCreator.Class1"); btnSharedParameterCreator.ToolTip = "Create a Shared Parameter file from a CSV (Comma delimited) (.csv) file list"; btnSharedParameterCreator.LongDescription = "Create large numbers of Shared Parameters. To use this program, first a file with the .csv extension must be created, which can be stored anywhere. " + "CSV files can be created with Microsoft Excel.\n\n" + "Column A: Category (e.g. Mechanical Equipment)\n" + "Column B: Shared Parameter Group (User Determined)\n" + "Column C: Data Type (e.g. Number, Integer, Text, YesNo)\n" + "Column D: Binding Type (e.g. Instance, Type)\n" + "Column E: Parameter Name (User Determined)\n\n" + "Parameters are grouped under Data in Properties if Insert into Project Parameters is selected"; // create bitmap image for button Uri uriLargeImage_SharedParameterCreator = new Uri(iconsPath + @"32x32\cmdSharedParameterCreator_32x32.bmp"); BitmapImage largeImage_SharedParameterCreator = new BitmapImage(uriLargeImage_SharedParameterCreator); // create bitmap image for button Uri uriSmallImage_SharedParameterCreator = new Uri(iconsPath + @"16x16\cmdSharedParameterCreator_16x16.bmp"); BitmapImage smallImage_SharedParameterCreator = new BitmapImage(uriSmallImage_SharedParameterCreator); btnSharedParameterCreator.LargeImage = largeImage_SharedParameterCreator; btnSharedParameterCreator.Image = smallImage_SharedParameterCreator; #endregion #region SheetRenamer PushButtonData btnSheetRenamer = new PushButtonData("cmdSheetRenamer", "Sheet \nRenamer", commandsPath + "SheetRenamer.dll", "SheetRenamer.Class1"); btnSheetRenamer.ToolTip = "Renames all PDF files in a directory to the following naming convention: Project Number-Sheet Number_Current Revision"; btnSheetRenamer.LongDescription = "Create a sheet set within Revit and assign the sheets you want to print. Once the sheets are printed, browse to the directory where they are saved. " + "Select the sheet set that you used to print and click OK.\n\n" + "NOTE: Ensure that the Project Number is set within Project Information for proper file naming."; // create bitmap image for button Uri uriLargeImage_SheetRenamer = new Uri(iconsPath + @"32x32\cmdSheetRenamer_32x32.bmp"); BitmapImage largeImage_SheetRenamer = new BitmapImage(uriLargeImage_SheetRenamer); // create bitmap image for button Uri uriSmallImage_SheetRenamer = new Uri(iconsPath + @"16x16\cmdSheetRenamer_16x16.bmp"); BitmapImage smallImage_SheetRenamer = new BitmapImage(uriSmallImage_SheetRenamer); btnSheetRenamer.LargeImage = largeImage_SheetRenamer; btnSheetRenamer.Image = smallImage_SheetRenamer; #endregion #region ProjectParameters PushButtonData btnProjectParameters = new PushButtonData("cmdProjectParameters", "Insert into \nProject Parameters", commandsPath + "ProjectParameters.dll", "ProjectParameters.Class1"); btnProjectParameters.ToolTip = "Insert Shared Parameters into Project Parameters"; btnProjectParameters.LongDescription = "1) Make sure a Shared Parameter file is loaded in Manage->Shared Parameters\n" + "2) Click Load to fill the view with the Shared Parameters from the file\n" + "3) Right click to set the Binding type (e.g. Instance or Type). This value must be set before selecting a Category.\n" + "4) Right click to set the element Category (e.g. Mechanical Equipment, Walls, etc.)\n" + "5) Right click to set the Properties Group. This is the category it will be grouped under in the Properties window.\n" + "6) Click Insert to insert the Shared Parameters into Project Parameters"; // create bitmap image for button Uri uriLargeImage_ProjectParameters = new Uri(iconsPath + @"32x32\cmdProjectParameters_32x32.bmp"); BitmapImage largeImage_ProjectParameters = new BitmapImage(uriLargeImage_ProjectParameters); // create bitmap image for button Uri uriSmallImage_ProjectParameters = new Uri(iconsPath + @"16x16\cmdProjectParameters_16x16.bmp"); BitmapImage smallImage_ProjectParameters = new BitmapImage(uriSmallImage_ProjectParameters); btnProjectParameters.LargeImage = largeImage_ProjectParameters; btnProjectParameters.Image = smallImage_ProjectParameters; #endregion #region ProductionPanelItems // Create a ribbon panel RibbonPanel pnlProductionPanel = application.CreateRibbonPanel(tabName, "Production"); // Add the buttons to the panel List <RibbonItem> productionButtons = new List <RibbonItem>(); // Add the buttons to the panel productionButtons.Add(pnlProductionPanel.AddItem(btnCreateRevitSheets)); productionButtons.Add(pnlProductionPanel.AddItem(btnSharedParameterCreator)); productionButtons.Add(pnlProductionPanel.AddItem(btnSheetRenamer)); productionButtons.Add(pnlProductionPanel.AddItem(btnProjectParameters)); #endregion return(Result.Succeeded); }
/// <summary> /// Pulldown button for "Command Data", "DB Element" and "Element Filtering" /// </summary> public void AddPulldownButton(RibbonPanel panel) { // Create three push buttons for pulldown button drop down // #1 PushButtonData pushButtonData1 = new PushButtonData("PulldownCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData"); pushButtonData1.LargeImage = NewBitmapImage("Basics.ico"); // #2 PushButtonData pushButtonData2 = new PushButtonData("PulldownDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement"); pushButtonData2.LargeImage = NewBitmapImage("Basics.ico"); // #3 PushButtonData pushButtonData3 = new PushButtonData("PulldownElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering"); pushButtonData3.LargeImage = NewBitmapImage("Basics.ico"); // Make a pulldown button now PulldownButtonData pulldownBtnData = new PulldownButtonData("PulldownButton", "Pulldown"); PulldownButton pulldownBtn = panel.AddItem(pulldownBtnData) as PulldownButton; pulldownBtn.AddPushButton(pushButtonData1); pulldownBtn.AddPushButton(pushButtonData2); pulldownBtn.AddPushButton(pushButtonData3); }
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))); }
/// <summary> /// Text box /// Text box used in conjunction with event. We'll come to this later. /// For now, just shows how to make a text box. /// </summary> public void AddTextBox(RibbonPanel panel) { // Fill the text box information TextBoxData txtBoxData = new TextBoxData("TextBox"); txtBoxData.Image = NewBitmapImage("Basics.ico"); txtBoxData.Name = "Text Box"; txtBoxData.ToolTip = "Enter text here"; txtBoxData.LongDescription = "<p>This is Revit UI Labs.</p><p>Ribbon Lab</p>"; txtBoxData.ToolTipImage = NewBitmapImage("ImgHelloWorld.png"); // Create the text box item on the panel TextBox txtBox = panel.AddItem(txtBoxData) as TextBox; txtBox.PromptText = "Enter a comment"; txtBox.ShowImageAsButton = true; txtBox.EnterPressed += new EventHandler<Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(txtBox_EnterPressed); txtBox.Width = 180; }
//添加面板选项卡 public static void MyRibbon() { if (UI.Global.isOpen == false) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("请先打开一个工程!"); return; } Autodesk.Windows.RibbonControl ribbonControl = Autodesk.Windows.ComponentManager.Ribbon; RibbonTab Tab = new RibbonTab(); //for (int i = 0; i < ribbonControl.Tabs.Count; i++) //{ // if(ribbonControl.Tabs[i].Id == "RibbonSample_TAB_ID") // { // isOpen = true; // } //} if (isOpen == false) { ribbonControl.Tabs.Add(Tab); Tab.Title = " 煤矿工程 "; Tab.Id = "RibbonSample_TAB_ID"; Autodesk.Windows.RibbonPanelSource panel1Panel = new RibbonPanelSource(); panel1Panel.Title = "手工绘制"; RibbonPanel Panel1 = new RibbonPanel(); Panel1.Source = panel1Panel; Tab.Panels.Add(Panel1); RibbonButton pan1button1 = new RibbonButton(); pan1button1.Text = "绘制方形"; pan1button1.ShowText = true; //pan1button1.ShowImage = true; //pan1button1.Image = Images.getBitmap(Forms.Resources.Small); //pan1button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan1button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan1button1.Size = RibbonItemSize.Standard; pan1button1.CommandHandler = new RibbonCommandHandler(); pan1button1.CommandParameter = "SqTunnel "; panel1Panel.Items.Add(pan1button1); RibbonButton pan1button2 = new RibbonButton(); pan1button2.Text = "绘制圆形"; pan1button2.ShowText = true; //pan1button2.ShowImage = true; //pan1button2.Image = Images.getBitmap(Forms.Resources.Small); //pan1button2.LargeImage = Images.getBitmap(Forms.Resources.large); pan1button2.Orientation = System.Windows.Controls.Orientation.Vertical; pan1button2.Size = RibbonItemSize.Standard; pan1button2.CommandHandler = new RibbonCommandHandler(); pan1button2.CommandParameter = "CylTunnel "; panel1Panel.Items.Add(pan1button2); RibbonButton pan1button3 = new RibbonButton(); pan1button3.Text = "绘制梯形"; pan1button3.ShowText = true; //pan1button3.ShowImage = true; //pan1button3.Image = Images.getBitmap(Forms.Resources.Small); //pan1button3.LargeImage = Images.getBitmap(Forms.Resources.large); pan1button3.Orientation = System.Windows.Controls.Orientation.Vertical; pan1button3.Size = RibbonItemSize.Standard; pan1button3.CommandHandler = new RibbonCommandHandler(); pan1button3.CommandParameter = "TrTunnel "; panel1Panel.Items.Add(pan1button3); RibbonPanelSource panel2Panel = new RibbonPanelSource(); panel2Panel.Title = "视图窗口"; RibbonPanel panel2 = new RibbonPanel(); panel2.Source = panel2Panel; Tab.Panels.Add(panel2); RibbonButton pan2button1 = new RibbonButton(); pan2button1.Text = "菜单列表"; pan2button1.ShowText = true; //pan2button1.ShowImage = true; //pan2button1.Image = Images.getBitmap(Forms.Resources.Small); //pan2button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan2button1.Size = RibbonItemSize.Standard; pan2button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan2button1.CommandHandler = new RibbonCommandHandler(); pan2button1.CommandParameter = "openTreeControl "; panel2Panel.Items.Add(pan2button1); RibbonButton pan3button1 = new RibbonButton(); pan3button1.Text = "坐标列表"; pan3button1.ShowText = true; //pan3button1.ShowImage = true; //pan3button1.Image = Images.getBitmap(Forms.Resources.Small); //pan3button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan3button1.Size = RibbonItemSize.Standard; pan3button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan3button1.CommandHandler = new RibbonCommandHandler(); pan3button1.CommandParameter = "openGridControl "; panel2Panel.Items.Add(pan3button1); RibbonPanelSource panel4Panel = new RibbonPanelSource(); panel4Panel.Title = "显示模式"; RibbonPanel panel4 = new RibbonPanel(); panel4.Source = panel4Panel; Tab.Panels.Add(panel4); RibbonButton pan4button1 = new RibbonButton(); pan4button1.Text = "切换模式"; pan4button1.ShowText = true; //pan4button1.ShowImage = true; //pan4button1.Image = Images.getBitmap(Forms.Resources.Small); //pan4button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan4button1.Size = RibbonItemSize.Standard; pan4button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan4button1.CommandHandler = new RibbonCommandHandler(); pan4button1.CommandParameter = "DisplayMode "; panel4Panel.Items.Add(pan4button1); RibbonButton pan5button1 = new RibbonButton(); pan5button1.Text = "演示动画"; pan5button1.ShowText = true; //pan5button1.ShowImage = true; //pan5button1.Image = Images.getBitmap(Forms.Resources.Small); //pan5button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan5button1.Size = RibbonItemSize.Standard; pan5button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan5button1.CommandHandler = new RibbonCommandHandler(); pan5button1.CommandParameter = "animate "; panel4Panel.Items.Add(pan5button1); RibbonButton pan6button1 = new RibbonButton(); pan6button1.Text = "特性面板"; pan6button1.ShowText = true; //pan6button1.ShowImage = true; //pan6button1.Image = Images.getBitmap(Forms.Resources.Small); //pan6button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan6button1.Size = RibbonItemSize.Standard; pan6button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan6button1.CommandHandler = new RibbonCommandHandler(); pan6button1.CommandParameter = "openPropertyControl "; panel2Panel.Items.Add(pan6button1); RibbonPanelSource panel7Panel = new RibbonPanelSource(); panel7Panel.Title = "数据传输"; RibbonPanel panel7 = new RibbonPanel(); panel7.Source = panel7Panel; Tab.Panels.Add(panel7); RibbonButton pan7button1 = new RibbonButton(); pan7button1.Text = "导出信息"; pan7button1.ShowText = true; //pan7button1.ShowImage = true; //pan7button1.Image = Images.getBitmap(Forms.Resources.Small); //pan7button1.LargeImage = Images.getBitmap(Forms.Resources.large); pan7button1.Size = RibbonItemSize.Standard; pan7button1.Orientation = System.Windows.Controls.Orientation.Vertical; pan7button1.CommandHandler = new RibbonCommandHandler(); pan7button1.CommandParameter = "OutGeoData "; panel7Panel.Items.Add(pan7button1); Tab.IsActive = true; } }
/// <summary> /// Stacked Buttons - combination of: push button, dropdown button, combo box and text box. /// (no radio button group, split buttons). /// Here we stack three push buttons for "Command Data", "DB Element" and "Element Filtering". /// </summary> public void AddStackedButtons_Simple(RibbonPanel panel) { // Create three push buttons to stack up // #1 PushButtonData pushButtonData1 = new PushButtonData("StackSimpleCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData"); pushButtonData1.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // #2 PushButtonData pushButtonData2 = new PushButtonData("StackSimpleDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement"); pushButtonData2.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // #3 PushButtonData pushButtonData3 = new PushButtonData("StackSimpleElementFiltering", "Element Filtering", _introLabPath, _introLabName + ".ElementFiltering"); pushButtonData3.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // Put them on stack IList<RibbonItem> stackedButtons = panel.AddStackedItems(pushButtonData1, pushButtonData2, pushButtonData3); }
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime) { try { //the Activate method is called by Inventor when it loads the addin //the AddInSiteObject provides access to the Inventor Application object //the FirstTime flag indicates if the addin is loaded for the first time //initialize AddIn members m_inventorApplication = addInSiteObject.Application; Button.InventorApplication = m_inventorApplication; //initialize event delegates m_userInterfaceEvents = m_inventorApplication.UserInterfaceManager.UserInterfaceEvents; UserInterfaceEventsSink_OnResetCommandBarsEventDelegate = new UserInterfaceEventsSink_OnResetCommandBarsEventHandler(UserInterfaceEvents_OnResetCommandBars); m_userInterfaceEvents.OnResetCommandBars += UserInterfaceEventsSink_OnResetCommandBarsEventDelegate; UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate = new UserInterfaceEventsSink_OnResetEnvironmentsEventHandler(UserInterfaceEvents_OnResetEnvironments); m_userInterfaceEvents.OnResetEnvironments += UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate; UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate = new UserInterfaceEventsSink_OnResetRibbonInterfaceEventHandler(UserInterfaceEvents_OnResetRibbonInterface); m_userInterfaceEvents.OnResetRibbonInterface += UserInterfaceEventsSink_OnResetRibbonInterfaceEventDelegate; //load image icons for UI items Icon addSlotOptionIcon = new Icon(this.GetType(), "AddSlotOption.ico"); Icon drawSlotIcon = new Icon(this.GetType(), "DrawSlot.ico"); Icon toggleSlotStateIcon = new Icon(this.GetType(), "ToggleSlotState.ico"); //retrieve the GUID for this class GuidAttribute addInCLSID; addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(AddInServer), typeof(GuidAttribute)); string addInCLSIDString; addInCLSIDString = "{" + addInCLSID.Value + "}"; //create the comboboxes m_slotWidthComboBoxDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Width", "Autodesk:SimpleAddIn:SlotWidthCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot width", "Slot width", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode); m_slotHeightComboBoxDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddComboBoxDefinition("Slot Height", "Autodesk:SimpleAddIn:SlotHeightCboBox", CommandTypesEnum.kShapeEditCmdType, 100, addInCLSIDString, "Slot height", "Slot height", Type.Missing, Type.Missing, ButtonDisplayEnum.kDisplayTextInLearningMode); //add some initial items to the comboboxes m_slotWidthComboBoxDefinition.AddItem("1 cm", 0); m_slotWidthComboBoxDefinition.AddItem("2 cm", 0); m_slotWidthComboBoxDefinition.AddItem("3 cm", 0); m_slotWidthComboBoxDefinition.AddItem("4 cm", 0); m_slotWidthComboBoxDefinition.AddItem("5 cm", 0); m_slotWidthComboBoxDefinition.ListIndex = 1; m_slotWidthComboBoxDefinition.ToolTipText = m_slotWidthComboBoxDefinition.Text; m_slotWidthComboBoxDefinition.DescriptionText = "Slot width: " + m_slotWidthComboBoxDefinition.Text; SlotWidthComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotWidthComboBox_OnSelect); m_slotWidthComboBoxDefinition.OnSelect += SlotWidthComboBox_OnSelectEventDelegate; m_slotHeightComboBoxDefinition.AddItem("1 cm", 0); m_slotHeightComboBoxDefinition.AddItem("2 cm", 0); m_slotHeightComboBoxDefinition.AddItem("3 cm", 0); m_slotHeightComboBoxDefinition.AddItem("4 cm", 0); m_slotHeightComboBoxDefinition.AddItem("5 cm", 0); m_slotHeightComboBoxDefinition.ListIndex = 1; m_slotHeightComboBoxDefinition.ToolTipText = m_slotHeightComboBoxDefinition.Text; m_slotHeightComboBoxDefinition.DescriptionText = "Slot height: " + m_slotHeightComboBoxDefinition.Text; SlotHeightComboBox_OnSelectEventDelegate = new ComboBoxDefinitionSink_OnSelectEventHandler(SlotHeightComboBox_OnSelect); m_slotHeightComboBoxDefinition.OnSelect += SlotHeightComboBox_OnSelectEventDelegate; //create buttons m_addSlotOptionButton = new AddSlotOptionButton( "Add Slot width/height", "Autodesk:SimpleAddIn:AddSlotOptionCmdBtn", CommandTypesEnum.kShapeEditCmdType, addInCLSIDString, "Adds option for slot width/height", "Add slot option", addSlotOptionIcon, addSlotOptionIcon, ButtonDisplayEnum.kDisplayTextInLearningMode); m_drawSlotButton = new DrawSlotButton( "Draw Slot", "Autodesk:SimpleAddIn:DrawSlotCmdBtn", CommandTypesEnum.kShapeEditCmdType, addInCLSIDString, "Create slot sketch graphics", "Draw Slot", drawSlotIcon, drawSlotIcon, ButtonDisplayEnum.kDisplayTextInLearningMode); m_toggleSlotStateButton = new ToggleSlotStateButton( "Toggle Slot State", "Autodesk:SimpleAddIn:ToggleSlotStateCmdBtn", CommandTypesEnum.kShapeEditCmdType, addInCLSIDString, "Enables/Disables state of slot command", "Toggle Slot State", toggleSlotStateIcon, toggleSlotStateIcon, ButtonDisplayEnum.kDisplayTextInLearningMode); //create the command category CommandCategory slotCmdCategory = m_inventorApplication.CommandManager.CommandCategories.Add("Slot", "Autodesk:SimpleAddIn:SlotCmdCat", addInCLSIDString); slotCmdCategory.Add(m_slotWidthComboBoxDefinition); slotCmdCategory.Add(m_slotHeightComboBoxDefinition); slotCmdCategory.Add(m_addSlotOptionButton.ButtonDefinition); slotCmdCategory.Add(m_drawSlotButton.ButtonDefinition); slotCmdCategory.Add(m_toggleSlotStateButton.ButtonDefinition); if (firstTime == true) { //access user interface manager UserInterfaceManager userInterfaceManager; userInterfaceManager = m_inventorApplication.UserInterfaceManager; InterfaceStyleEnum interfaceStyle; interfaceStyle = userInterfaceManager.InterfaceStyle; //create the UI for classic interface if (interfaceStyle == InterfaceStyleEnum.kClassicInterface) { //create toolbar CommandBar slotCommandBar; slotCommandBar = userInterfaceManager.CommandBars.Add("Slot", "Autodesk:SimpleAddIn:SlotToolbar", CommandBarTypeEnum.kRegularCommandBar, addInCLSIDString); //add comboboxes to toolbar slotCommandBar.Controls.AddComboBox(m_slotWidthComboBoxDefinition, 0); slotCommandBar.Controls.AddComboBox(m_slotHeightComboBoxDefinition, 0); //add buttons to toolbar slotCommandBar.Controls.AddButton(m_addSlotOptionButton.ButtonDefinition, 0); slotCommandBar.Controls.AddButton(m_drawSlotButton.ButtonDefinition, 0); slotCommandBar.Controls.AddButton(m_toggleSlotStateButton.ButtonDefinition, 0); //Get the 2d sketch environment base object Inventor.Environment partSketchEnvironment; partSketchEnvironment = userInterfaceManager.Environments["PMxPartSketchEnvironment"]; //make this command bar accessible in the panel menu for the 2d sketch environment. partSketchEnvironment.PanelBar.CommandBarList.Add(slotCommandBar); } //create the UI for ribbon interface else { //get the ribbon associated with part document Inventor.Ribbons ribbons; ribbons = userInterfaceManager.Ribbons; Inventor.Ribbon partRibbon; partRibbon = ribbons["Part"]; //get the tabls associated with part ribbon RibbonTabs ribbonTabs; ribbonTabs = partRibbon.RibbonTabs; RibbonTab partSketchRibbonTab; partSketchRibbonTab = ribbonTabs["id_TabSketch"]; //create a new panel with the tab RibbonPanels ribbonPanels; ribbonPanels = partSketchRibbonTab.RibbonPanels; m_partSketchSlotRibbonPanel = ribbonPanels.Add("Slot", "Autodesk:SimpleAddIn:SlotRibbonPanel", "{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}", "", false); //add controls to the slot panel CommandControls partSketchSlotRibbonPanelCtrls; partSketchSlotRibbonPanelCtrls = m_partSketchSlotRibbonPanel.CommandControls; //add the combo boxes to the ribbon panel CommandControl slotWidthCmdCboBoxCmdCtrl; slotWidthCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotWidthComboBoxDefinition, "", false); CommandControl slotHeightCmdCboBoxCmdCtrl; slotHeightCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotHeightComboBoxDefinition, "", false); //add the buttons to the ribbon panel CommandControl drawSlotCmdBtnCmdCtrl; drawSlotCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_drawSlotButton.ButtonDefinition, false, true, "", false); CommandControl slotOptionCmdBtnCmdCtrl; slotOptionCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_addSlotOptionButton.ButtonDefinition, false, true, "", false); CommandControl toggleSlotStateCmdBtnCmdCtrl; toggleSlotStateCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_toggleSlotStateButton.ButtonDefinition, false, true, "", false); } } MessageBox.Show("To access the commands of the sample addin, activate a 2d sketch of a part \n document and select the \"AddInSlot\" toolbar within the panel menu"); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
/// <summary> /// Add buttons for the commands we define in this labs. /// Here we stack three push buttons and repeat it as we get more. /// This is a template to use during the Ribbon lab exercise prior to going to following labs. /// </summary> public void AddUILabsCommandButtons_Template(RibbonPanel panel) { // Get the location of this dll. string assembly = GetType().Assembly.Location; // Create three push buttons to stack up // #1 PushButtonData pushButtonData1 = new PushButtonData("UILabsCommand1", "Command1", assembly, _uiLabName + ".Command1"); pushButtonData1.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // #2 PushButtonData pushButtonData2 = new PushButtonData("UILabsCommand2", "Command2", assembly, _uiLabName + ".Command2"); pushButtonData2.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // #3 PushButtonData pushButtonData3 = new PushButtonData("UILabsCommand3", "Command3", assembly, _uiLabName + ".Command3"); pushButtonData3.Image = NewBitmapImage("ImgHelloWorldSmall.png"); // Put them on stack IList<RibbonItem> stackedButtons = panel.AddStackedItems(pushButtonData1, pushButtonData2, pushButtonData3); }
public Result OnStartup(UIControlledApplication application) { //检测是否安装Excel及其版本 string excelNum = new Tool.ExcelTool().ExcelVarsion; //动态链接库路径 string dllPath = typeof(Tab).Assembly.Location; //Tab名称 string tabName = "Test"; //创建Tab application.CreateRibbonTab(tabName); //创建Panel RibbonPanel mainPanel = application.CreateRibbonPanel(tabName, "Excel Tool"); //创建按钮 PushButtonData PBD_createExcel = new PushButtonData("CreateExcel", "导出数据", dllPath, "CalcTest.Command.CreateExcelFile"); PushButton PB_createExcel = mainPanel.AddItem(PBD_createExcel) as PushButton; //PushButtonData PBD_linkExcel = new PushButtonData("LinkExcel", "创建实时连接", dllPath, "CalcTest.Command.LinkExcelFile"); //PushButton PB_linkExcel = mainPanel.AddItem(PBD_linkExcel) as PushButton; //PB_linkExcel.AvailabilityClassName = "CalcTest.LinkExcelEnable"; RadioButtonGroupData RBGD_linkExcel = new RadioButtonGroupData("Link_test"); RadioButtonGroup RBG_linkExcel = mainPanel.AddItem(RBGD_linkExcel) as RadioButtonGroup; ToggleButton TB_linkExcel = RBG_linkExcel.AddItem(new ToggleButtonData("link_enable", "创建实时连接", dllPath, "CalcTest.Command.test_linkExcel")); ToggleButton TB_dislinkExcel = RBG_linkExcel.AddItem(new ToggleButtonData("link_disable", "关闭实时连接")); TB_dislinkExcel.Visible = false; RBG_linkExcel.Current = TB_dislinkExcel; TB_linkExcel.AvailabilityClassName = "CalcTest.LinkExcelEnable"; //判断本机是否安装Excel if (excelNum != "") { //Excel名称及路径 //string fileName = "pipeCalc"; string fullName = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\test\PlumbingCalc.xlsx"; //Sheet1名称 string sheetName = "给排水工程量"; //更新器 Updater.PipeParameterUpdater ppu = new Updater.PipeParameterUpdater(application.ActiveAddInId, fullName, sheetName); UpdaterId updaterId = ppu.GetUpdaterId(); //注册更新器 if (!UpdaterRegistry.IsUpdaterRegistered(updaterId)) { UpdaterRegistry.RegisterUpdater(ppu); } //默认关闭 UpdaterRegistry.DisableUpdater(updaterId); //过滤器 //FilteredElementCollector plumbingCollector = new FilteredElementCollector(doc); ElementIsElementTypeFilter filter1 = new ElementIsElementTypeFilter(true); List <ElementFilter> filterSet = new List <ElementFilter>(); filterSet.Add(new ElementCategoryFilter(BuiltInCategory.OST_PipeCurves)); filterSet.Add(new ElementCategoryFilter(BuiltInCategory.OST_PipeAccessory)); LogicalOrFilter orFilter = new LogicalOrFilter(filterSet); LogicalAndFilter andFilter = new LogicalAndFilter(filter1, orFilter); //订阅事件 //标高参数改变 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_START_LEVEL_PARAM))); //系统类型参数改变 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM))); //尺寸参数改变 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.RBS_CALCULATED_SIZE))); //长度参数改变 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.CURVE_ELEM_LENGTH))); //元素添加 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeElementAddition()); //元素删除 UpdaterRegistry.AddTrigger(updaterId, andFilter, Element.GetChangeTypeElementDeletion()); } return(Result.Succeeded); }
public PaneCommands(ViewsManager views, RibbonPanel panel) { _views = views; InitCommands(panel); }
/// <summary> /// Split button for "Command Data", "DB Element" and "Element Filtering" /// </summary> public void AddSplitButton(RibbonPanel panel) { // Create three push buttons for split button drop down // #1 PushButtonData pushButtonData1 = new PushButtonData("SplitCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData"); pushButtonData1.LargeImage = NewBitmapImage("ImgHelloWorld.png"); // #2 PushButtonData pushButtonData2 = new PushButtonData("SplitDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement"); pushButtonData2.LargeImage = NewBitmapImage("ImgHelloWorld.png"); // #3 PushButtonData pushButtonData3 = new PushButtonData("SplitElementFiltering", "ElementFiltering", _introLabPath, _introLabName + ".ElementFiltering"); pushButtonData3.LargeImage = NewBitmapImage("ImgHelloWorld.png"); // Make a split button now SplitButtonData splitBtnData = new SplitButtonData("SplitButton", "Split Button"); SplitButton splitBtn = panel.AddItem(splitBtnData) as SplitButton; splitBtn.AddPushButton(pushButtonData1); splitBtn.AddPushButton(pushButtonData2); splitBtn.AddPushButton(pushButtonData3); }
public Result OnStartup(UIControlledApplication application) { //创建功能区选项卡 如、文件、建筑 application.CreateRibbonTab("_revitApi_ tools"); //创建功能区选项卡上的功能区 RibbonPanel rp_main = application.CreateRibbonPanel("_revitApi_ tools", "Test Tools"); //单个功能按钮,可设定图标 PushButton pb_TemperSensor_new = rp_main.AddItem(new PushButtonData("TemperSensor_new", "SensorDataSynTest", projectAssemblyFullPath("MQTT_Revit\\MQTT_Revit_wpf.dll"), "MQTT_Revit_wpf.CMD")) as PushButton; pb_TemperSensor_new.LargeImage = new BitmapImage(new Uri(iconFullPath("TemperatureSensor_96.png"))); //堆叠功能按钮,文字列表显示 //PushButtonData pbd_site_family_edit = new PushButtonData("SitePlanFamilyEditor", "体块编辑", projectAssemblyFullPath("SitePlanFamilyEditor.dll"), "SitePlanFamilyEditor.CMD"); //PushButtonData pbd_site_family_select = new PushButtonData("SitePlanBuildingBlockSelector", "体块选择", projectAssemblyFullPath("SitePlanBuildingBlockSelector.dll"), "SitePlanBuildingBlockSelector.CMD"); //PushButtonData pbd_color_pallete = new PushButtonData("FastColorPalette", "调色板增强", projectAssemblyFullPath("FastColorPalette.dll"), "FastColorPalette.CMD"); //rp_sitePlan.AddStackedItems( // pbd_site_family_edit, // pbd_site_family_select, // pbd_color_pallete); //application.CreateRibbonTab("goa tools 模型"); //application.CreateRibbonTab("goa tools 制图"); //application.CreateRibbonTab("goa tools 模块"); /* #region model tab * //SITE PLANNING panel * RibbonPanel rp_sitePlan = application.CreateRibbonPanel("goa tools 模型", "总图规划"); * //ANLS_SOLA * PushButton pb_anls_sola = rp_sitePlan.AddItem(new PushButtonData("ANLS_SOLA", "日照分析", projectAssemblyFullPath("ANLS_SOLA.dll"), "ANLS_SOLA.CMD")) as PushButton; * pb_anls_sola.LargeImage = new BitmapImage(new Uri(iconFullPath("ANLS_SOLA_96.png"))); * //Stack items * PushButtonData pbd_site_family_edit = new PushButtonData("SitePlanFamilyEditor", "体块编辑", projectAssemblyFullPath("SitePlanFamilyEditor.dll"), "SitePlanFamilyEditor.CMD"); * PushButtonData pbd_site_family_select = new PushButtonData("SitePlanBuildingBlockSelector", "体块选择", projectAssemblyFullPath("SitePlanBuildingBlockSelector.dll"), "SitePlanBuildingBlockSelector.CMD"); * PushButtonData pbd_color_pallete = new PushButtonData("FastColorPalette", "调色板增强", projectAssemblyFullPath("FastColorPalette.dll"), "FastColorPalette.CMD"); * rp_sitePlan.AddStackedItems( * pbd_site_family_edit, * pbd_site_family_select, * pbd_color_pallete); * * //ANLS panel * RibbonPanel rp_anls = application.CreateRibbonPanel("goa tools 模型", "设计分析"); * //Surface Area * PushButtonData pbd_surfaceAreaSingle = new PushButtonData("surfaceAreaSingle", "单个表面", projectAssemblyFullPath("GeometricSurfaceArea.dll"), "GeometricSurfaceArea.CMD"); * PushButtonData pbd_surfaceAreaMultiple = new PushButtonData("surfaceAreaMultiple", "多个表面", projectAssemblyFullPath("GeometricSurfacesArea.dll"), "GeometricSurfacesArea.CMD"); * PulldownButtonData pdbd_surfaceArea = new PulldownButtonData("surfaceArea", "表面面积"); * PulldownButton pdb_surfaceArea = rp_anls.AddItem(pdbd_surfaceArea) as PulldownButton; * pdb_surfaceArea.AddPushButton(pbd_surfaceAreaSingle); * pdb_surfaceArea.AddPushButton(pbd_surfaceAreaMultiple); * pdb_surfaceArea.LargeImage = new BitmapImage(new Uri(iconFullPath("FACE_AREA_96.png"))); * * //COMP panel * RibbonPanel rp_comp = application.CreateRibbonPanel("goa tools 模型", "构件管理"); * //COMP_MANG button * PushButton pb_comp_mang = rp_comp.AddItem(new PushButtonData("COMP_MANG", "组件管理", projectAssemblyFullPath("COMP_MANG.dll"), "COMP_MANG.CMD")) as PushButton; * pb_comp_mang.LargeImage = new BitmapImage(new Uri(iconFullPath("COMP_MANG_96.png"))); * //FAMI_REPL button * PushButton pb_fami_repl = rp_comp.AddItem(new PushButtonData("FAMI_REPL", "族库替换", projectAssemblyFullPath("FAMI_REPL.dll"), "FAMI_REPL.CMD")) as PushButton; * pb_fami_repl.LargeImage = new BitmapImage(new Uri(iconFullPath("FAMI_REPL_96.png"))); * //PARA_COPY * PushButton pb_para_copy = rp_comp.AddItem(new PushButtonData("PARA_COPY", "参数复制", projectAssemblyFullPath("PARA_COPY.dll"), "PARA_COPY.CMD")) as PushButton; * pb_para_copy.LargeImage = new BitmapImage(new Uri(iconFullPath("PARA_COPY_96.png"))); * //TransGroupParas * PushButton pb_trans_groupParas = rp_comp.AddItem(new PushButtonData("TransGroupParas", "组内族参数传递", projectAssemblyFullPath("TransGroupParas.dll"), "TransGroupParas.CMD")) as PushButton; * pb_trans_groupParas.LargeImage = new BitmapImage(new Uri(iconFullPath("TransGroupParas_96.png"))); * * //MODELLING panel * RibbonPanel rp_model = application.CreateRibbonPanel("goa tools 模型", "建模工具"); * //stacked items group 1 * var pbd_selc_dependents = new PushButtonData("SELC_DPNT", "选择附属图元", projectAssemblyFullPath("SELC_DPNT.dll"), "SELC_DPNT.CMD"); * var pbd_selc_group_of_same_level = new PushButtonData("selectAllGroup", "选择同层模型组", projectAssemblyFullPath("selectAllGroup.dll"), "selectAllGroup.CMD"); * var pbd_join_mult = new PushButtonData("JOIN_MULT", "批量连接", projectAssemblyFullPath("JOIN_MULT.dll"), "JOIN_MULT.CMD"); * rp_model.AddStackedItems( * pbd_selc_dependents, * pbd_selc_group_of_same_level, * pbd_join_mult); * //stacked items group 2 * var pbd_wall_miter = new PushButtonData("wallMiterConnect", "墙批量改斜接", projectAssemblyFullPath("wallMiterConnect.dll"), "wallMiterConnect.CMD"); * var pbd_comment_mgr = new PushButtonData("commentMgr", "注释管理", projectAssemblyFullPath("CommentMgr.dll"), "CommentMgr.CMD"); * var pbd_arry_tool = new PushButtonData("arryTool", "沿路径阵列", projectAssemblyFullPath("ARRY_TOOL.dll"), "ARRY_TOOL.CMD"); * rp_model.AddStackedItems( * pbd_wall_miter, * pbd_comment_mgr, * pbd_arry_tool); * //stacked items group 3 * var pbd_move_3d = new PushButtonData("pointToPoint3DMove", "三维移动", projectAssemblyFullPath("pointToPoint3DMove.dll"), "pointToPoint3DMove.CMD"); * var pbd_cut_geometry = new PushButtonData("CutGeometry", "切割形体", projectAssemblyFullPath("CutGeometry.dll"), "CutGeometry.CMD"); * * rp_model.AddStackedItems( * pbd_move_3d, * pbd_cut_geometry); * * //stacked items group 4 * var pbd_super_mirror = new PushButtonData("superMirror", "超级镜像", projectAssemblyFullPath("GROUP_CREATE.dll"), "GROUP_CREATE.Mirror_Pick"); * var pbd_fractionChecker = new PushButtonData("fractionChecker", "碎数检查", projectAssemblyFullPath("FractionNumberChecker.dll"), "FractionNumberChecker.CMD"); * * rp_model.AddStackedItems( * pbd_super_mirror, * pbd_fractionChecker); * * //FAM_CVTR * PushButton pb_fam_cvtr = rp_comp.AddItem(new PushButtonData("familyConvertor", "族转换", projectAssemblyFullPath("FAMI_CVTR.dll"), "FAMI_CVTR.CMD")) as PushButton; * //need icon? * * //LEVL_EDIT * PushButton pb_levl_edit = rp_model.AddItem(new PushButtonData("LEVL_EDIT", "修改层高", projectAssemblyFullPath("LEVL_EDIT.dll"), "LEVL_EDIT.CMD")) as PushButton; * pb_levl_edit.LargeImage = new BitmapImage(new Uri(iconFullPath("LEVL_EDIT_96.png"))); * //PLAN_EDIT * PushButton pb_smart_stretch = rp_model.AddItem(new PushButtonData("SmartStretch", "智能拉伸", projectAssemblyFullPath("SmartStretch.dll"), "SmartStretch.CMD")) as PushButton; * pb_smart_stretch.LargeImage = new BitmapImage(new Uri(iconFullPath("SmartStretch_96.png"))); * * //Layout Parking Effcient * RibbonPanel rp_ParkingLayout = application.CreateRibbonPanel("goa tools 模型", "地库强排"); * PushButton Parking_Layout = rp_ParkingLayout.AddItem(new PushButtonData("ParkingLayoutEfficientNewStructual", "地库强排", projectAssemblyFullPath("ParkingLayoutEfficientNewStructual.dll"), "ParkingLayoutEfficientNewStructual.CMD")) as PushButton; * Parking_Layout.LargeImage = new BitmapImage(new Uri(iconFullPath("LayoutParking_96.png"))); * * //basement design toolset * var pbd_bsmt_buildingBlocks = new PushButtonData("BSMT_BuildingBlocks", "地上楼栋", projectAssemblyFullPath("BSMT_BuildingBlocks.dll"), "BSMT_BuildingBlocks.CMD"); * var pbd_bsmt_excavation = new PushButtonData("BSMT_Excavation", "土方估算", projectAssemblyFullPath("BSMT_Excavation.dll"), "BSMT_Excavation.CMD"); * var pbd_bsmt_regions = new PushButtonData("BSMT_Regions", "分区面积", projectAssemblyFullPath("BSMT_Regions.dll"), "BSMT_Regions.CMD"); * rp_ParkingLayout.AddStackedItems( * pbd_bsmt_buildingBlocks, * pbd_bsmt_excavation, * pbd_bsmt_regions); * * //Dwelling_Assembly * RibbonPanel rp_Dwellinglayout = application.CreateRibbonPanel("goa tools 模型", "户型库"); * PushButton Dwelling_Assembly = rp_Dwellinglayout.AddItem(new PushButtonData("Dwelling_Assembly", "户型库", projectAssemblyFullPath("Dwelling_Assembly.dll"), "Dwelling_Assembly.CMD")) as PushButton; * * //user assistant panel * RibbonPanel rp_userAssistant = application.CreateRibbonPanel("goa tools 模型", "智能助手"); * PushButton pb_userAssistant = rp_userAssistant.AddItem(new PushButtonData("userAssistant", "设置", projectAssemblyFullPath("UserAssistant.dll"), "UserAssistant.CMD")) as PushButton; * * //building modeling panel * RibbonPanel rp_highrise = application.CreateRibbonPanel("goa tools 模型", "楼栋建模"); * //PLAN_DSGN_TOOLS * PushButton pb_plan_tools = rp_highrise.AddItem(new PushButtonData("PLAN_DSGN_TOOLS", "户型工具", projectAssemblyFullPath("PLAN_DSGN_TOOLS.dll"), "PLAN_DSGN_TOOLS.CMD")) as PushButton; * pb_plan_tools.LargeImage = new BitmapImage(new Uri(iconFullPath("PLAN_EDIT_96.png"))); * //FACD_DSGN_TOOLS * PushButton pb_facd_tools = rp_highrise.AddItem(new PushButtonData("FACD_DSGN_TOOLS", "造型工具", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD")) as PushButton; * pb_facd_tools.LargeImage = new BitmapImage(new Uri(iconFullPath("PROF_EDIT_96.png"))); * * //FACD_DSGN_TOOLS_RibbonButtons * RibbonPanel rp_facade_hotKeys = application.CreateRibbonPanel("goa tools 模型", "造型工具快捷键"); * var pbd_facade_dyMoStartEnd = new PushButtonData("dyMoStartEnd", "动态模块", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_DymoSessionStartEnd"); * var pbd_facade_dyMoDispose = new PushButtonData("dyMoDispose", "放弃模块", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_DymoSessionDispose"); * rp_facade_hotKeys.AddStackedItems( * pbd_facade_dyMoStartEnd, * pbd_facade_dyMoDispose); * * var pbd_facade_dyMoMode1 = new PushButtonData("dymoMode1", "模式P", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_DymoMode_1"); * var pbd_facade_dyMoMode2 = new PushButtonData("dymoMode2", "模式E", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_DymoMode_2"); * var pbd_facade_dyMoMode3 = new PushButtonData("dymoMode3", "模式M", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_DymoMode_3"); * rp_facade_hotKeys.AddStackedItems( * pbd_facade_dyMoMode1, * pbd_facade_dyMoMode2, * pbd_facade_dyMoMode3); * * var pbd_autoSwitchEnd = new PushButtonData("autoSwitchEnd", "端头切换", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_AutoSwitchEnd"); * var pbd_facade_switchTransparency = new PushButtonData("switchTransparency", "切换透明", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_switchTransparency"); * var pbd_facade_pushFace = new PushButtonData("pushFace", "推拉形体", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_pushFace"); * rp_facade_hotKeys.AddStackedItems( * pbd_autoSwitchEnd, * pbd_facade_switchTransparency, * pbd_facade_pushFace); * * var pbd_facade_trimExt = new PushButtonData("facade_trimExt", "修剪/延伸", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_trimExt"); * var pbd_facade_trimCorner = new PushButtonData("facade_trimCorner", "修剪为角", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_trimCorner"); * var pbd_facade_split = new PushButtonData("facade_split", "截断", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_split"); * rp_facade_hotKeys.AddStackedItems( * pbd_facade_trimExt, * pbd_facade_trimCorner, * pbd_facade_split); * * var pbd_facade_alignMove = new PushButtonData("facade_alignMove", "对齐移动", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_alignMove"); * var pbd_facade_alignCopy = new PushButtonData("facade_alignCopy", "对齐复制", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_alignCopy"); * rp_facade_hotKeys.AddStackedItems( * pbd_facade_alignMove, * pbd_facade_alignCopy); * * var pbd_facade_selectCompsFiltered = new PushButtonData("facade_selectCompsFiltered", "选择/过滤", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_selectCompsFiltered"); * var pbd_facade_mirrorComps = new PushButtonData("facade_mirrorComps", "镜像", projectAssemblyFullPath("FACD_DSGN_TOOLS.dll"), "FACD_DSGN_TOOLS.CMD_callFromRibbon_mirrorComps"); * rp_facade_hotKeys.AddStackedItems( * pbd_facade_selectCompsFiltered, * pbd_facade_mirrorComps); #endregion model tab * #region drafting tab * //GRID panel * RibbonPanel rp_grid = application.CreateRibbonPanel("goa tools 制图", "轴网工具"); * //GRID_IDEN button * PushButton pb_grid_iden = rp_grid.AddItem(new PushButtonData("GRID_IDEN", "标头线", projectAssemblyFullPath("GRID_IDEN.dll"), "GRID_IDEN.CMD")) as PushButton; * pb_grid_iden.LargeImage = new BitmapImage(new Uri(iconFullPath("GRID_IDEN_96.png"))); * //DATM_ON_OFF button * PushButton pb_datm_onoff = rp_grid.AddItem(new PushButtonData("DATM_ON_OFF", "开/关", projectAssemblyFullPath("DATM_ON_OFF.dll"), "DATM_ON_OFF.CMD")) as PushButton; * pb_datm_onoff.LargeImage = new BitmapImage(new Uri(iconFullPath("DATM_ON_OFF_96.png"))); * //GRID_RNAM button * PushButtonData pdb_grid_rnam_true = new PushButtonData("GRID_Number", "真轴号", projectAssemblyFullPath("GRID_Number.dll"), "GRID_Number.CMD"); * PushButtonData pdb_grid_rnam_falseC = new PushButtonData("FakeGRID_NumberCreat", "假轴号创建", projectAssemblyFullPath("FakeGRID_NumberCreat.dll"), "FakeGRID_NumberCreat.CMD"); * PushButtonData pdb_grid_rnam_falseR = new PushButtonData("replaeFakeGridNum", "假轴号替换", projectAssemblyFullPath("replaeFakeGridNum.dll"), "replaeFakeGridNum.CMD"); * PulldownButtonData pdbd_grid_rnam = new PulldownButtonData("GridNumber", "重命名"); * PulldownButton pdb_GridName = rp_grid.AddItem(pdbd_grid_rnam) as PulldownButton; * pdb_GridName.AddPushButton(pdb_grid_rnam_true); * pdb_GridName.AddPushButton(pdb_grid_rnam_falseC); * pdb_GridName.AddPushButton(pdb_grid_rnam_falseR); * pdb_GridName.LargeImage = new BitmapImage(new Uri(iconFullPath("GRID_RNAM_96.png"))); * * //ANNO panel * RibbonPanel rp_anno = application.CreateRibbonPanel("goa tools 制图", "快捷标注"); * //ANNO_AREA button * PushButton pb_anno_area = rp_anno.AddItem(new PushButtonData("ANNO_AREA", "分区面积", projectAssemblyFullPath("ANNO_AREA.dll"), "ANNO_AREA.CMD")) as PushButton; * pb_anno_area.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_AREA_96.png"))); * //ANNO_DIST button * PushButton pb_anno_dist = rp_anno.AddItem(new PushButtonData("ANNO_DIST", "疏散距离", projectAssemblyFullPath("ANNO_DIST.dll"), "ANNO_DIST.CMD")) as PushButton; * pb_anno_dist.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_DIST_96.png"))); * //ANNO_ELEV button * PushButton pb_anno_elev = rp_anno.AddItem(new PushButtonData("ANNO_ELEV", "降板标高", projectAssemblyFullPath("ANNO_ELEV.dll"), "ANNO_ELEV.CMD")) as PushButton; * pb_anno_elev.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_ELEV_96.png"))); * //ANNO_ELEV_ABSL button * PushButton pb_anno_elev_absl = rp_anno.AddItem(new PushButtonData("ANNO_ELEV_ABSL", "绝对标高", projectAssemblyFullPath("ANNO_ELEV_ABSL.dll"), "ANNO_ELEV_ABSL.CMD")) as PushButton; * pb_anno_elev_absl.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_ELEV_ABSL_96.png"))); * //ANNO_AVOD button * PushButton pb_anno_avod = rp_anno.AddItem(new PushButtonData("ANNO_AVOD", "尺寸避让", projectAssemblyFullPath("ANNO_AVOD.dll"), "ANNO_AVOD.CMD")) as PushButton; * pb_anno_avod.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_AVOD_96.png"))); * //ANNO_ELEV_MULT button * PushButton pb_anno_elev_mult = rp_anno.AddItem(new PushButtonData("ANNO_ELEV_MULT", "多重标高", projectAssemblyFullPath("ANNO_ELEV_MULT.dll"), "ANNO_ELEV_MULT.CMD")) as PushButton; * pb_anno_elev_mult.LargeImage = new BitmapImage(new Uri(iconFullPath("ANNO_ELEV_MULT_96.png"))); * PushButton pb_anno_openingElevation = rp_anno.AddItem(new PushButtonData("ANNO_OPEN_ELEV", "窗高标高", projectAssemblyFullPath("SportDimensionDemo.dll"), "SportDimensionDemo.WindowsAndDoors")) as PushButton; * //need icon? * //stack items 1 * PushButtonData pbd_fakeElev_Refresh = new PushButtonData("FakeElev_Refresh", "假标高计算", projectAssemblyFullPath("FakeElev_Refresh.dll"), "FakeElev_Refresh.CMD"); * PushButtonData pbd_autoFillUpElevations = new PushButtonData("AutoFillUpLevelHeightAnnotation", "填写多重标高", projectAssemblyFullPath("AutoFillUpLevelHeightAnnotation.dll"), "AutoFillUpLevelHeightAnnotation.CMD"); * rp_anno.AddStackedItems * (pbd_fakeElev_Refresh, * pbd_autoFillUpElevations); * * * * //DRAW panel * RibbonPanel rp_draw = application.CreateRibbonPanel("goa tools 制图", "制图工具"); * //DRAW_PATT * PushButton pb_draw_patt = rp_draw.AddItem(new PushButtonData("DRAW_PATT", "截面填充", projectAssemblyFullPath("DRAW_PATT.dll"), "DRAW_PATT.CMD")) as PushButton; * pb_draw_patt.LargeImage = new BitmapImage(new Uri(iconFullPath("DRAW_PATT_96.png"))); * //FAKE_DIMS * PushButton pb_fake_dims = rp_draw.AddItem(new PushButtonData("FAKE_DIMS", "尺寸标注", projectAssemblyFullPath("FAKE_DIMS.dll"), "FAKE_DIMS.CMD")) as PushButton; * pb_fake_dims.LargeImage = new BitmapImage(new Uri(iconFullPath("FAKE_DIMS_96.png"))); * //LINE_ROAD * PushButton pd_line_road = rp_draw.AddItem(new PushButtonData("LINE_ROAD", "单线变路", projectAssemblyFullPath("LINE_ROAD.dll"), "LINE_ROAD.CMD")) as PushButton; * pd_line_road.LargeImage = new BitmapImage(new Uri(iconFullPath("LINE_ROAD_96.png"))); * //COLR_SWIT * PushButton pb_colr_swit = rp_draw.AddItem(new PushButtonData("COLR_SWIT", "颜色切换", projectAssemblyFullPath("COLR_SWIT.dll"), "COLR_SWIT.CMD")) as PushButton; * pb_colr_swit.LargeImage = new BitmapImage(new Uri(iconFullPath("COLR_SWIT_96.png"))); * //WIND_NUMB * PushButton pb_wind_numb = rp_draw.AddItem(new PushButtonData("WIND_NUMB_new", "门窗编号", projectAssemblyFullPath("WIND_NUMB_new.dll"), "WIND_NUMB_new.CMD")) as PushButton; * pb_wind_numb.LargeImage = new BitmapImage(new Uri(iconFullPath("WIND_NUMB_96.png"))); * * //VIEW panel * RibbonPanel rp_view = application.CreateRibbonPanel("goa tools 制图", "视图工具"); * //VIEW_INTF button * PushButton pb_view_intf = rp_view.AddItem(new PushButtonData("VIEW_INTF", "提资视图", projectAssemblyFullPath("VIEW_INTF.dll"), "VIEW_INTF.CMD")) as PushButton; * pb_view_intf.LargeImage = new BitmapImage(new Uri(iconFullPath("VIEW_INTF_96.png"))); * PushButton pb_type_on_off = rp_view.AddItem(new PushButtonData("TYPE_ON_OFF", "类型开关", projectAssemblyFullPath("TYPE_ON_OFF.dll"), "TYPE_ON_OFF.CMD")) as PushButton; * pb_type_on_off.LargeImage = new BitmapImage(new Uri(iconFullPath("TYPE_ON_OFF_96.png"))); * PushButton pb_west_on_off = rp_view.AddItem(new PushButtonData("WSET_ON_OFF", "工作集开关", projectAssemblyFullPath("WSET_ON_OFF.dll"), "WSET_ON_OFF.CMD")) as PushButton; * pb_west_on_off.LargeImage = new BitmapImage(new Uri(iconFullPath("WSET_ON_OFF_96.png"))); * //stacked items 1 * PushButtonData pbd_view_duplicate = new PushButtonData("VIEW_Duplicate", "视图复制", projectAssemblyFullPath("VIEW_Duplicate.dll"), "VIEW_Duplicate.CMD"); * PushButtonData pbd_detailGroupVisibility = new PushButtonData("DetailGroupVisibility", "详图组可见", projectAssemblyFullPath("DetailGroupVisibility.dll"), "DetailGroupVisibility.CMD"); * PushButtonData pbd_checkShareAnnotation = new PushButtonData("CheckShareAnnotation", "检查问题尺寸", projectAssemblyFullPath("CheckShareAnnotation.dll"), "CheckShareAnnotation.CMD"); * rp_view.AddStackedItems(pbd_view_duplicate, pbd_detailGroupVisibility, pbd_checkShareAnnotation); * * //SHET panel * RibbonPanel rp_shet = application.CreateRibbonPanel("goa tools 制图", "布图工具"); * //SHET_LOCA button * PushButton pb_shet_loca = rp_shet.AddItem(new PushButtonData("SHET_LOCA", "区位图", projectAssemblyFullPath("SHET_LOCA.dll"), "SHET_LOCA.CMD")) as PushButton; * pb_shet_loca.LargeImage = new BitmapImage(new Uri(iconFullPath("SHET_LOCA_96.png"))); * //SHET_INFO button * PushButton pb_shet_info = rp_shet.AddItem(new PushButtonData("SHET_INFO", "图签信息", projectAssemblyFullPath("SHET_INFO.dll"), "SHET_INFO.CMD")) as PushButton; * pb_shet_info.LargeImage = new BitmapImage(new Uri(iconFullPath("SHET_INFO_96.png"))); * //SHET_NEW button * PushButton pb_shet_new = rp_shet.AddItem(new PushButtonData("SHET_NEW", "创建图纸", projectAssemblyFullPath("SHET_NEW.dll"), "SHET_NEW.CMD")) as PushButton; * pb_shet_new.LargeImage = new BitmapImage(new Uri(iconFullPath("SHET_NEW_96.png"))); * * //SHET_Size_SerialNo button * PushButton pb_shet_size_serialNo = rp_shet.AddItem(new PushButtonData("SHET_Size_SerialNo", "图序图幅", projectAssemblyFullPath("SHET_Size_SerialNo.dll"), "SHET_Size_SerialNo.CMD")) as PushButton; * //pb_shet_size_serialNo.LargeImage = new BitmapImage(new Uri(iconFullPath("SHET_Size_SerialNo_96.png"))); * * //Excel panel * RibbonPanel rp_excel = application.CreateRibbonPanel("goa tools 制图", "Excel"); * PushButtonData pbd_excel_fast_paste = new PushButtonData("Excel_Fast_Paste", "粘贴", projectAssemblyFullPath("Excel_Fast_Paste.dll"), "Excel_Fast_Paste.FastPaste"); * PushButtonData pbd_excel_fast_reload = new PushButtonData("Excel_Fast_Reload", "重载", projectAssemblyFullPath("Excel_Fast_Paste.dll"), "Excel_Fast_Paste.FastReload"); * rp_excel.AddStackedItems( * pbd_excel_fast_paste, * pbd_excel_fast_reload); #endregion drafting tab * #region module tab * #region 基本操作 * //BASIC OPERTATION panel * RibbonPanel rp_group_basic = application.CreateRibbonPanel("goa tools 模块", "基本操作"); * * //GROUP_CREATE * PushButton pb_group_create = rp_group_basic.AddItem(new PushButtonData("MODULE_CREATE", "新建(GN)", projectAssemblyFullPath("Module.dll"), "Module.CreateCMD")) as PushButton; * pb_group_create.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_CREATE_96.png"))); * //GROUP_SELECT * PushButton pb_group_select = rp_group_basic.AddItem(new PushButtonData("MODULE_SELECT", "选择(GS)", projectAssemblyFullPath("Module.dll"), "Module.CMD")) as PushButton; * pb_group_select.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_SELECT_96.png"))); * //GROUP_ISOLATE * //PushButton pb_group_isolate = rp_group_basic.AddItem(new PushButtonData("MODULE_ISOLATE", "隔离选中模块", projectAssemblyFullPath("Module.dll"), "Module.Isolate_CMD")) as PushButton; * //pb_group_isolate.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_ISOLATE_96.png"))); * //GROUP_DELETEMODULE * PushButton pb_module_delete = rp_group_basic.AddItem(new PushButtonData("MODULE_DELETE", "删除(GA)", projectAssemblyFullPath("Module.dll"), "Module.DeleteModule_CMD")) as PushButton; * pb_module_delete.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_DELETE_MODULE_96.png"))); * * //GROUP_UNGROUP * PushButton pb_group_explode = rp_group_basic.AddItem(new PushButtonData("MODULE_EXPLODE", "炸开(GX)", projectAssemblyFullPath("Module.dll"), "Module.Explode_CMD")) as PushButton; * pb_group_explode.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_EXPLODE_96.png"))); * * //rename module * //PushButton pb_group_rename = rp_group_basic.AddItem(new PushButtonData("MODULE_RENAME", "由当前创建新类型", projectAssemblyFullPath("Module.dll"), "Module.Rename_CMD")) as PushButton; * //pb_group_rename.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_RENAME_96.jpg"))); * //GROUP_MODIFY * * var pb_group_manage = new PushButtonData("MODULE_MANAGE", "模块管理", projectAssemblyFullPath("Module.dll"), "Module.Manage_CMD"); * var pb_group_isolate = new PushButtonData("MODULE_ISOLATE", "隔离模块", projectAssemblyFullPath("Module.dll"), "Module.Isolate_CMD"); * rp_group_basic.AddStackedItems( * pb_group_manage, * pb_group_isolate); #endregion * #region 模块编辑 * //GROUP EDIT panel * RibbonPanel rp_group_edit = application.CreateRibbonPanel("goa tools 模块", "模块编辑"); * * //GROUP_MODIFY * PushButton pb_group_modify = rp_group_edit.AddItem(new PushButtonData("MODULE_MODIFY", "编辑模块", projectAssemblyFullPath("Module.dll"), "Module.Edit_CMD")) as PushButton; * pb_group_modify.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_MODIFY_96.png"))); * * var pb_module_rename = new PushButtonData("MODULE_RENAME", "由当前创建新类型", projectAssemblyFullPath("Module.dll"), "Module.Rename_CMD"); * var pbd_module_changeType = new PushButtonData("MODULE_CHANGE_TYPE", "改变模块类型", projectAssemblyFullPath("Module.dll"), "Module.ChangeType_CMD"); * rp_group_edit.AddStackedItems( * pb_module_rename, * pbd_module_changeType); * * var pbd_module_oneClickSync = new PushButtonData("MODULE_ONECLICK_SYNC", "一键同步", projectAssemblyFullPath("Module.dll"), "Module.OneClickSync_CMD"); * var pbd_module_forceSync = new PushButtonData("MODULE_FORCE_SYNC", "强制同步", projectAssemblyFullPath("Module.dll"), "Module.ForceSync_CMD"); * * rp_group_edit.AddStackedItems( * pbd_module_oneClickSync, * pbd_module_forceSync); * #endregion * #region 模块操作 * //GROUP OPERATION panel * RibbonPanel rp_group_operate = application.CreateRibbonPanel("goa tools 模块", "模块操作"); * //GROUP_MIRROR * PushButton pb_group_mirror_draw = rp_group_operate.AddItem(new PushButtonData("MODULE_MIRROR_DRAW", "画线镜像", projectAssemblyFullPath("Module.dll"), "Module.MirrorDraw_CMD")) as PushButton; * pb_group_mirror_draw.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_MIRROR_DRAWN_96.png"))); * //GROUP_MIRROR_PICK * PushButton pb_group_mirror_pick = rp_group_operate.AddItem(new PushButtonData("MODULE_MIRROR_PICK", "拾取镜像", projectAssemblyFullPath("Module.dll"), "Module.MirrorPick_CMD")) as PushButton; * pb_group_mirror_pick.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_MIRROR_PICK_96.png"))); * * //GROUP_COPY_TOLEVEL * PushButton pb_group_copyToLevel = rp_group_operate.AddItem(new PushButtonData("MODULE_COPY_TOLEVEL", "复制到标高", projectAssemblyFullPath("Module.dll"), "Module.Lv_CMD")) as PushButton; * pb_group_copyToLevel.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_COPY_TOLEVEL_96.png"))); * * PushButton pb_module_copyPaste = rp_group_operate.AddItem(new PushButtonData("MODULE_COPY_PASTE", "其他复制", projectAssemblyFullPath("Module.dll"), "Module.CopyPaste_CMD")) as PushButton; * pb_module_copyPaste.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_COPY_SAMELEVEL_96.png"))); * * //不常用(复制、移动、旋转) * //stacked items * var pbd_module_copySameLevel = new PushButtonData("MODULE_COPY_SAMELEVEL", "同层复制", projectAssemblyFullPath("Module.dll"), "Module.Copy_CMD"); * var pbd_module_move = new PushButtonData("MODULE_MOVE", "移动模块", projectAssemblyFullPath("Module.dll"), "Module.Move_CMD"); * var pbd_module_rotate = new PushButtonData("MODULE_ROTATE", "旋转模块", projectAssemblyFullPath("Module.dll"), "Module.Rotate_CMD"); * rp_group_operate.AddStackedItems( * pbd_module_copySameLevel, * pbd_module_move, * pbd_module_rotate); * #endregion * #region 跨模型操作 * //doc panel * RibbonPanel rp_module_doc = application.CreateRibbonPanel("goa tools 模块", "跨模型工具"); * * * PushButton pbd_module_syncDoc = rp_module_doc.AddItem(new PushButtonData("MODULE_DOC_SYNC", "跨模型同步", projectAssemblyFullPath("Module.dll"), "Module.DocSync_CMD")) as PushButton; * pbd_module_syncDoc.LargeImage = new BitmapImage(new Uri(iconFullPath("GROUP_SYNC_DOC_96.png"))); #endregion * #region 附加操作 * //attach operation panel * RibbonPanel rp_group_attach = application.CreateRibbonPanel("goa tools 模块", "附加操作"); * * var pb_module_convert = new PushButtonData("CONVERT_ALL", "全部组转模块", projectAssemblyFullPath("Module.dll"), "Module.Convert_CMD"); * var pb_module_pickConvert = new PushButtonData("CONVERT_PICK", "点选组转模块", projectAssemblyFullPath("Module.dll"), "Module.PickConvert_CMD"); * rp_group_attach.AddStackedItems( * pb_module_convert, * pb_module_pickConvert); * * //stacked items * var pbd_module_deleteMark = new PushButtonData("MODULE_DELETE_MARK", "清除图元标记", projectAssemblyFullPath("Module.dll"), "Module.DeleteMarkOnElems"); * var pbd_module_offset = new PushButtonData("MODULE_OFFSET", "垂直移动", projectAssemblyFullPath("Module.dll"), "Module.Offset_CMD"); * * rp_group_attach.AddStackedItems( * pbd_module_deleteMark, * pbd_module_offset); #endregion * #region 选择工具 * //select panel * RibbonPanel rp_group_select = application.CreateRibbonPanel("goa tools 模块", "选择工具"); * //stacked items group 1 * var pbd_sel_module_all = new PushButtonData("SEL_ALL_MODULE", "选中同类型模块", projectAssemblyFullPath("Module.dll"), "Module.selectAllSameTypeModule"); * var pbd_sel_module_sameLevel = new PushButtonData("SEL_LEVEL_MODULE", "选中同层模块", projectAssemblyFullPath("Module.dll"), "Module.selectSameLvModule"); * var pbd_sel_module_pick = new PushButtonData("SEL_PICK_MODULE", "选中当前模块", projectAssemblyFullPath("Module.dll"), "Module.selectModuleByPick"); * var pbd_sel_module_shift = new PushButtonData("SEL_SHIFT_MODULE", "减选模块", projectAssemblyFullPath("Module.dll"), "Module.shiftSelect"); * * rp_group_select.AddStackedItems( * pbd_sel_module_sameLevel, * pbd_sel_module_pick); * rp_group_select.AddStackedItems( * pbd_sel_module_all, * pbd_sel_module_shift); #endregion * * //其他同步方法 * RibbonPanel rp_group_sync = application.CreateRibbonPanel("goa tools 模块", "修复工具"); * PushButtonData pbd_module_resetView = new PushButtonData("MODULE_RESETVIEW", "重置视图", projectAssemblyFullPath("Module.dll"), "Module.ResetStorageFiLocation"); * var pbd_module_color = new PushButtonData("DEL_COLOR_OVERRIDE", "颜色复原", projectAssemblyFullPath("Module.dll"), "Module.CleanOverrideColor"); * var pbd_module_window = new PushButtonData("MODULE_CLOSEWINDOW", "关闭窗口", projectAssemblyFullPath("Module.dll"), "Module.CloseWindow"); * * rp_group_sync.AddStackedItems( * pbd_module_resetView, * pbd_module_color, * pbd_module_window); * * RibbonPanel rp_group_developer = application.CreateRibbonPanel("goa tools 模块", "开发工具"); * PushButtonData pbd_module_developer = new PushButtonData("MODULE_DEVELOPER", "读取模块信息", projectAssemblyFullPath("Module.dll"), "Module.DeveloperTool"); * PushButtonData pbd_debug_showBoundingBox = new PushButtonData("debug_showBoundingBox", "显示范围框", projectAssemblyFullPath("goa.Common.dll"), "goa.Common.CMD_debug_showBoundingBox"); * rp_group_developer.AddStackedItems * (pbd_module_developer, * pbd_debug_showBoundingBox); #endregion module tab */ return(Result.Succeeded); }
/// <summary> /// Radio/toggle button for "Command Data", "DB Element" and "Element Filtering" /// </summary> public void AddRadioButton(RibbonPanel panel) { // Create three toggle buttons for radio button group // #1 ToggleButtonData toggleButtonData1 = new ToggleButtonData("RadioCommandData", "Command" + "\n Data", _introLabPath, _introLabName + ".CommandData"); toggleButtonData1.LargeImage = NewBitmapImage("Basics.ico"); // #2 ToggleButtonData toggleButtonData2 = new ToggleButtonData("RadioDbElement", "DB" + "\n Element", _introLabPath, _introLabName + ".DBElement"); toggleButtonData2.LargeImage = NewBitmapImage("Basics.ico"); // #3 ToggleButtonData toggleButtonData3 = new ToggleButtonData("RadioElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering"); toggleButtonData3.LargeImage = NewBitmapImage("Basics.ico"); // Make a radio button group now RadioButtonGroupData radioBtnGroupData = new RadioButtonGroupData("RadioButton"); RadioButtonGroup radioBtnGroup = panel.AddItem(radioBtnGroupData) as RadioButtonGroup; radioBtnGroup.AddItem(toggleButtonData1); radioBtnGroup.AddItem(toggleButtonData2); radioBtnGroup.AddItem(toggleButtonData3); }
/// <summary> /// This method will be executed when Autodesk Revit /// will be started. /// /// WARNING /// Don't use the RevitDevTools.dll features directly /// in this method. You are to call other methods which /// do it instead of. /// </summary> /// <param name="uic_app">A handle to the application /// being started.</param> /// <returns>Indicates if the external application /// completes its work successfully.</returns> Result IExternalApplication.OnStartup( UIControlledApplication uic_app) { Result result = Result.Succeeded; string tabName = "Filter Lab"; string panelName = "Filter Tools"; string panelName2 = "Settings"; string buttonfiltername = "Selection Filter"; string buttonfilternametype = "Selection" + Environment.NewLine + "Filter"; string buttonfilternamehelp = "This tool is used to Filter selected elements."; string buttonfiltername2 = "Pre-Selection Filter"; string buttonfiltername2type = "Pre-Selection" + Environment.NewLine + "Filter"; string buttonfilternamehelp2 = "This tool is used to Filter elements before selecting."; string button2Name = "Sheets"; string button3Name = "Strand"; string buttonsplitName = "Extra Tools"; try { List <RibbonPanel> panels = uic_app.GetRibbonPanels( tabName); } catch { uic_app.CreateRibbonTab(tabName); } RibbonPanel panelViewExport = uic_app.CreateRibbonPanel( tabName, panelName); panelViewExport.Name = panelName; panelViewExport.Title = panelName; PushButtonData buttonfilter = new PushButtonData( buttonfiltername, buttonfilternametype, Assembly.GetExecutingAssembly().Location, typeof(SelectedCommand).FullName); buttonfilter.ToolTip = buttonfilternamehelp; ImageSource iconfilter = GetIconSource(Resources.Button_image_17); buttonfilter.LargeImage = iconfilter; buttonfilter.Image = Thumbnail(iconfilter); panelViewExport.AddItem(buttonfilter); panelViewExport.AddSeparator(); PushButtonData buttonfilter2 = new PushButtonData( buttonfiltername2, buttonfiltername2type, Assembly.GetExecutingAssembly().Location, typeof(PreSelectionCommand).FullName); buttonfilter2.ToolTip = buttonfilternamehelp2; ImageSource iconfilter2 = GetIconSource(Resources.Button_image_24); buttonfilter2.LargeImage = iconfilter2; buttonfilter2.Image = Thumbnail(iconfilter2); panelViewExport.AddItem(buttonfilter2); panelViewExport.AddSeparator(); PushButtonData button2 = new PushButtonData( button2Name, button2Name, Assembly.GetExecutingAssembly().Location, typeof(FilterCommand).FullName); button2.ToolTip = button2Name; ImageSource icon2 = GetIconSource(Resources.Button_image_20); button2.LargeImage = icon2; button2.Image = Thumbnail(icon2); PushButtonData button3 = new PushButtonData( button3Name, button3Name, Assembly.GetExecutingAssembly().Location, typeof(FilterCommand).FullName); button3.ToolTip = button3Name; ImageSource icon3 = GetIconSource(Resources.Button_image_18); button3.LargeImage = icon3; button3.Image = Thumbnail(icon3); SplitButtonData sb1 = new SplitButtonData(buttonsplitName, buttonsplitName); SplitButton sb = panelViewExport.AddItem(sb1) as SplitButton; sb.AddPushButton(button2); sb.AddPushButton(button3); RibbonPanel panelViewExport2 = uic_app.CreateRibbonPanel( tabName, panelName2); panelViewExport2.Name = panelName2; panelViewExport2.Title = panelName2; PushButtonData buttonsettings = new PushButtonData( "Settings", "Settings", Assembly.GetExecutingAssembly().Location, typeof(SettingsCommand).FullName); buttonsettings.ToolTip = "To change settings for Filters."; ImageSource iconsettings = GetIconSource(Resources.Button_image_13); buttonsettings.LargeImage = iconsettings; buttonsettings.Image = Thumbnail(iconsettings); panelViewExport2.AddItem(buttonsettings); panelViewExport2.AddSeparator(); PushButtonData buttonweb = new PushButtonData( "Web Help", "Web Help", Assembly.GetExecutingAssembly().Location, typeof(WebHelp).FullName); buttonweb.ToolTip = "Why not Google It!!!!"; ImageSource iconweb = GetIconSource(Resources.Button_image_21); buttonweb.LargeImage = iconweb; buttonweb.Image = Thumbnail(iconweb); panelViewExport2.AddItem(buttonweb); panelViewExport2.AddSeparator(); PushButtonData buttonabout = new PushButtonData( "About", "About", Assembly.GetExecutingAssembly().Location, typeof(AboutCommand).FullName); buttonabout.ToolTip = "Learn About Filter Labs"; ImageSource iconabout = GetIconSource(Resources.Button_image_23); buttonabout.LargeImage = iconabout; buttonabout.Image = Thumbnail(iconabout); panelViewExport2.AddItem(buttonabout); return(result); }
/// <summary> /// Combo box - 5 items in 2 groups. /// Combo box is used in conjunction with event. We'll come back later. /// For now, just demonstrates how to make a combo box. /// </summary> public void AddComboBox(RibbonPanel panel) { // Create five combo box members with two groups // #1 ComboBoxMemberData comboBoxMemberData1 = new ComboBoxMemberData("ComboCommandData", "Command Data"); comboBoxMemberData1.Image = NewBitmapImage("Basics.ico"); comboBoxMemberData1.GroupName = "DB Basics"; // #2 ComboBoxMemberData comboBoxMemberData2 = new ComboBoxMemberData("ComboDbElement", "DB Element"); comboBoxMemberData2.Image = NewBitmapImage("Basics.ico"); comboBoxMemberData2.GroupName = "DB Basics"; // #3 ComboBoxMemberData comboBoxMemberData3 = new ComboBoxMemberData("ComboElementFiltering", "Filtering"); comboBoxMemberData3.Image = NewBitmapImage("Basics.ico"); comboBoxMemberData3.GroupName = "DB Basics"; // #4 ComboBoxMemberData comboBoxMemberData4 = new ComboBoxMemberData("ComboElementModification", "Modify"); comboBoxMemberData4.Image = NewBitmapImage("Basics.ico"); comboBoxMemberData4.GroupName = "Modeling"; // #5 ComboBoxMemberData comboBoxMemberData5 = new ComboBoxMemberData("ComboModelCreation", "Create"); comboBoxMemberData5.Image = NewBitmapImage("Basics.ico"); comboBoxMemberData5.GroupName = "Modeling"; // Make a combo box now ComboBoxData comboBxData = new ComboBoxData("ComboBox"); ComboBox comboBx = panel.AddItem(comboBxData) as ComboBox; comboBx.ToolTip = "Select an Option"; comboBx.LongDescription = "select a command you want to run"; comboBx.AddItem(comboBoxMemberData1); comboBx.AddItem(comboBoxMemberData2); comboBx.AddItem(comboBoxMemberData3); comboBx.AddItem(comboBoxMemberData4); comboBx.AddItem(comboBoxMemberData5); comboBx.CurrentChanged += new EventHandler<Autodesk.Revit.UI.Events.ComboBoxCurrentChangedEventArgs>(comboBx_CurrentChanged); }
public Result OnStartup(UIControlledApplication application) { // Create a custom ribbon tab string tabName = "CRM Tools"; application.CreateRibbonTab(tabName); string REVIT_VERSION = "v2020"; string commandsPath = ""; commandsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\Commands\"; string iconsPath = ""; iconsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + REVIT_VERSION + @"\RevitIcons\"; #region CreateRevitSheets // Create a push button PushButtonData btnCreateRevitSheets = new PushButtonData("cmdCreateRevitSheets", " Create \nSheets", commandsPath + "CreateRevitSheets.dll", "CreateRevitSheets.Class1"); btnCreateRevitSheets.ToolTip = "Create multiple Sheets at once. Assign Views to Sheets."; btnCreateRevitSheets.LongDescription = "Manually create Sheets or load them from a (.csv) file. " + "CSV files can be created with Microsoft Excel. The Sheet Number must be in Column A and the Sheet Name must be in Column B. Each Sheet should have its own Row. " + "Sheet 1 in Row 1, Sheet 2 in Row 2, etc."; // create bitmap image for button Uri uriLargeImage_CreateRevitSheets = new Uri(iconsPath + @"32x32\cmdRevitSheetsImage_32x32.bmp"); BitmapImage largeImage_CreateRevitSheets = new BitmapImage(uriLargeImage_CreateRevitSheets); // create bitmap image for button Uri uriSmallImage_CreateRevitSheets = new Uri(iconsPath + @"16x16\cmdRevitSheetsImage_16x16.bmp"); BitmapImage smallImage_CreateRevitSheets = new BitmapImage(uriSmallImage_CreateRevitSheets); btnCreateRevitSheets.LargeImage = largeImage_CreateRevitSheets; btnCreateRevitSheets.Image = smallImage_CreateRevitSheets; #endregion #region SharedParameterCreator // Create a push button PushButtonData btnSharedParameterCreator = new PushButtonData("cmdSharedParameterCreator", "Shared \nParameter Creator", commandsPath + "SharedParameterCreator.dll", "SharedParameterCreator.Class1"); btnSharedParameterCreator.ToolTip = "Create a Shared Parameter file from a CSV (Comma delimited) (.csv) file list"; btnSharedParameterCreator.LongDescription = "Create large numbers of Shared Parameters. To use this program, first a file with the .csv extension must be created, which can be stored anywhere. " + "CSV files can be created with Microsoft Excel.\n\n" + "Column A: Category (e.g. Mechanical Equipment)\n" + "Column B: Shared Parameter Group (User Determined)\n" + "Column C: Data Type (e.g. Number, Integer, Text, YesNo)\n" + "Column D: Binding Type (e.g. Instance, Type)\n" + "Column E: Parameter Name (User Determined)\n\n" + "Parameters are grouped under Data in Properties if Insert into Project Parameters is selected"; // create bitmap image for button Uri uriLargeImage_SharedParameterCreator = new Uri(iconsPath + @"32x32\cmdSharedParameterCreator_32x32.bmp"); BitmapImage largeImage_SharedParameterCreator = new BitmapImage(uriLargeImage_SharedParameterCreator); // create bitmap image for button Uri uriSmallImage_SharedParameterCreator = new Uri(iconsPath + @"16x16\cmdSharedParameterCreator_16x16.bmp"); BitmapImage smallImage_SharedParameterCreator = new BitmapImage(uriSmallImage_SharedParameterCreator); btnSharedParameterCreator.LargeImage = largeImage_SharedParameterCreator; btnSharedParameterCreator.Image = smallImage_SharedParameterCreator; #endregion #region CreateSheetSet // Create a push button PushButtonData btnCreateSheetSet = new PushButtonData("cmdCreateSheetSet", "Create \nSheet Set", commandsPath + "CreateSheetSet.dll", "CreateSheetSet.Class1"); btnCreateSheetSet.ToolTip = "Create a Sheet Set based on revision properties"; btnCreateSheetSet.LongDescription = "Select between Revision Description, Revision Number, and Revision Date to create a Sheet Set containing all the drawings associated with that property"; // create bitmap image for button Uri uriLargeImage_CreateSheetSet = new Uri(iconsPath + @"32x32\cmdCreateSheetSet_32x32.bmp"); BitmapImage largeImage_CreateSheetSet = new BitmapImage(uriLargeImage_CreateSheetSet); // create bitmap image for button Uri uriSmallImage_CreateSheetSet = new Uri(iconsPath + @"16x16\cmdCreateSheetSet_16x16.bmp"); BitmapImage smallImage_CreateSheetSet = new BitmapImage(uriSmallImage_CreateSheetSet); btnCreateSheetSet.LargeImage = largeImage_CreateSheetSet; btnCreateSheetSet.Image = smallImage_CreateSheetSet; #endregion #region SheetRenamer PushButtonData btnSheetRenamer = new PushButtonData("cmdSheetRenamer", "Sheet \nRenamer", commandsPath + "SheetRenamer.dll", "SheetRenamer.Class1"); btnSheetRenamer.ToolTip = "Renames all PDF files in a directory to the following naming convention: Project Number-Sheet Number_Current Revision"; btnSheetRenamer.LongDescription = "Create a sheet set within Revit and assign the sheets you want to print. Once the sheets are printed, browse to the directory where they are saved. " + "Select the sheet set that you used to print and click OK.\n\n" + "NOTE: Ensure that the Project Number is set within Project Information for proper file naming."; // create bitmap image for button Uri uriLargeImage_SheetRenamer = new Uri(iconsPath + @"32x32\cmdSheetRenamer_32x32.bmp"); BitmapImage largeImage_SheetRenamer = new BitmapImage(uriLargeImage_SheetRenamer); // create bitmap image for button Uri uriSmallImage_SheetRenamer = new Uri(iconsPath + @"16x16\cmdSheetRenamer_16x16.bmp"); BitmapImage smallImage_SheetRenamer = new BitmapImage(uriSmallImage_SheetRenamer); btnSheetRenamer.LargeImage = largeImage_SheetRenamer; btnSheetRenamer.Image = smallImage_SheetRenamer; #endregion #region InsertParameters PushButtonData btnInsertParameters = new PushButtonData("cmdInsertParameters", "Insert \nParameters", commandsPath + "InsertParameters.dll", "InsertParameters.Class1"); btnInsertParameters.ToolTip = "Insert Shared Parameters into Project Parameters or Family Parameters"; btnInsertParameters.LongDescription = "1) Make sure a Shared Parameter file is loaded in Manage->Shared Parameters\n" + "2) Click Load to fill the view with the Shared Parameters from the file\n" + "3) Right click to set the Binding type (e.g. Instance or Type). This value must be set before selecting a Category.\n" + "4) Right click to set the element Category (e.g. Mechanical Equipment, Walls, etc.)\n" + "5) Right click to set the Properties Group. This is the category it will be grouped under in the Properties window.\n" + "6) Click Insert to insert the Shared Parameters into Project Parameters or Family Parameters"; // create bitmap image for button Uri uriLargeImage_InsertParameters = new Uri(iconsPath + @"32x32\cmdInsertParameters_32x32.bmp"); BitmapImage largeImage_InsertParameters = new BitmapImage(uriLargeImage_InsertParameters); // create bitmap image for button Uri uriSmallImage_InsertParameters = new Uri(iconsPath + @"16x16\cmdInsertParameters_16x16.bmp"); BitmapImage smallImage_InsertParameters = new BitmapImage(uriSmallImage_InsertParameters); btnInsertParameters.LargeImage = largeImage_InsertParameters; btnInsertParameters.Image = smallImage_InsertParameters; #endregion #region RevisionOnSheets // Create a push button PushButtonData btnRevisionOnSheets = new PushButtonData("cmdRevisionOnSheets", "Revision \nOn Sheets", commandsPath + "RevisionOnSheets.dll", "RevisionOnSheets.Class1"); btnRevisionOnSheets.ToolTip = "Apply or unapply a revision to multiple sheets at once"; btnRevisionOnSheets.LongDescription = "Select the revision sequence from the drop-down list that you want to apply or unapply from the list of sheets in the project"; // create bitmap image for button Uri uriLargeImage_RevisionOnSheets = new Uri(iconsPath + @"32x32\cmdRevisionOnSheets_32x32.bmp"); BitmapImage largeImage_RevisionOnSheets = new BitmapImage(uriLargeImage_RevisionOnSheets); // create bitmap image for button Uri uriSmallImage_RevisionOnSheets = new Uri(iconsPath + @"16x16\cmdRevisionOnSheets_16x16.bmp"); BitmapImage smallImage_RevisionOnSheets = new BitmapImage(uriSmallImage_RevisionOnSheets); btnRevisionOnSheets.LargeImage = largeImage_RevisionOnSheets; btnRevisionOnSheets.Image = smallImage_RevisionOnSheets; #endregion #region PurgeParameters // Create a push button PushButtonData btnPurgeParameters = new PushButtonData("cmdPurgeParameters", "Purge \nParameters", commandsPath + "PurgeParameters.dll", "PurgeParameters.Class1"); btnPurgeParameters.ToolTip = "Completely delete Shared Parameters from the active Revit Document."; btnPurgeParameters.LongDescription = "Select the BuiltInCategory from the dropdown list to load it's associated " + "Shared Parameters. Tick the checkbox next to the Shared Parameters that you " + "want to purge. NOTE: At least one family of the selected BuiltInCategory must " + "be loaded into the project to load it's associated parameters.\n\n" + "Purging a Shared Parameter will physically remove it from the Revit Project, " + "Tags, Schedules, and Families. To use this parameter again it will need to be " + "re-inserted in the Project and any Tags, Schedules, and Families."; // create bitmap image for button Uri uriLargeImage_PurgeParameters = new Uri(iconsPath + @"32x32\cmdPurgeParameters_32x32.bmp"); BitmapImage largeImage_PurgeParameters = new BitmapImage(uriLargeImage_PurgeParameters); // create bitmap image for button Uri uriSmallImage_PurgeParameters = new Uri(iconsPath + @"16x16\cmdPurgeParameters_16x16.bmp"); BitmapImage smallImage_PurgeParameters = new BitmapImage(uriSmallImage_PurgeParameters); btnPurgeParameters.LargeImage = largeImage_PurgeParameters; btnPurgeParameters.Image = smallImage_PurgeParameters; #endregion #region About // Create a push button PushButtonData btnAbout = new PushButtonData("cmdAbout", "About \nCRM Tools", commandsPath + "About.dll", "About.Class1"); btnAbout.ToolTip = "Release information"; // create bitmap image for button Uri uriLargeImage_About = new Uri(iconsPath + @"32x32\cmdAbout_32x32.bmp"); BitmapImage largeImage_About = new BitmapImage(uriLargeImage_About); // create bitmap image for button Uri uriSmallImage_About = new Uri(iconsPath + @"16x16\cmdAbout_16x16.bmp"); BitmapImage smallImage_About = new BitmapImage(uriSmallImage_About); btnAbout.LargeImage = largeImage_About; btnAbout.Image = smallImage_About; #endregion #region ProductionPanelItems // Create a ribbon panel RibbonPanel pnlProductionPanel = application.CreateRibbonPanel(tabName, "Production"); // Add the buttons to the panel List <RibbonItem> productionButtons = new List <RibbonItem>(); // Add the buttons to the panel productionButtons.Add(pnlProductionPanel.AddItem(btnCreateRevitSheets)); productionButtons.Add(pnlProductionPanel.AddItem(btnRevisionOnSheets)); productionButtons.Add(pnlProductionPanel.AddItem(btnCreateSheetSet)); productionButtons.Add(pnlProductionPanel.AddItem(btnSheetRenamer)); #endregion #region ManangePanelItems // Create a ribbon panel RibbonPanel pnlManagePanel = application.CreateRibbonPanel(tabName, "Manage"); // Add the buttons to the panel List <RibbonItem> manageButtons = new List <RibbonItem>(); // Add the buttons to the panel manageButtons.Add(pnlManagePanel.AddItem(btnSharedParameterCreator)); manageButtons.Add(pnlManagePanel.AddItem(btnInsertParameters)); manageButtons.Add(pnlManagePanel.AddItem(btnPurgeParameters)); #endregion #region About // Create a ribbon panel RibbonPanel pnlInfo = application.CreateRibbonPanel(tabName, "Info"); // Add the buttons to the panel List <RibbonItem> aboutButton = new List <RibbonItem>(); aboutButton.Add(pnlInfo.AddItem(btnAbout)); #endregion return(Result.Succeeded); }
/// <summary> /// Stacked Buttons - combination of: push button, dropdown button, combo box and text box. /// (no radio button group, split buttons). /// Here we define 6 buttons, make grouping of 1, 3, 2 items, and stack them in three layer: /// (1) simple push button with "Hello World" /// (2) pull down with 3 items: "Command Data", "DB Element" and "Element Filtering". /// (3) pull down with 2 items: "Element Modification" and "Model Creation" /// </summary> public void AddStackedButtons_Complex(RibbonPanel panel) { // Create six push buttons to group for pull down and stack up // #0 PushButtonData pushButtonData0 = new PushButtonData("StackComplexHelloWorld", "Hello World", _introLabPath, _introLabName + ".HelloWorld"); pushButtonData0.Image = NewBitmapImage("Basics.ico"); // #1 PushButtonData pushButtonData1 = new PushButtonData("StackComplexCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData"); pushButtonData1.Image = NewBitmapImage("Basics.ico"); // #2 PushButtonData pushButtonData2 = new PushButtonData("StackComplexDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement"); // #3 PushButtonData pushButtonData3 = new PushButtonData("StackComplexElementFiltering", "Filtering", _introLabPath, _introLabName + ".ElementFiltering"); // #4 PushButtonData pushButtonData4 = new PushButtonData("StackComplexElementModification", "Modify", _introLabPath, _introLabName + ".ElementModification"); // #5 PushButtonData pushButtonData5 = new PushButtonData("StackComplexModelCreation", "Create", _introLabPath, _introLabName + ".ModelCreation"); // Make two sets of pull down PulldownButtonData pulldownBtnData1 = new PulldownButtonData("StackComplePulldownButton1", "DB Basics"); PulldownButtonData pulldownBtnData2 = new PulldownButtonData("StackComplePulldownButton2", "Modeling"); // Create three item stack. IList<RibbonItem> stackedItems = panel.AddStackedItems(pushButtonData0, pulldownBtnData1, pulldownBtnData2); PulldownButton pulldownBtn2 = stackedItems[1] as PulldownButton; PulldownButton pulldownBtn3 = stackedItems[2] as PulldownButton; pulldownBtn2.Image = NewBitmapImage("Basics.ico"); pulldownBtn3.Image = NewBitmapImage("House.ico"); // Add each sub items PushButton button1 = pulldownBtn2.AddPushButton(pushButtonData1); PushButton button2 = pulldownBtn2.AddPushButton(pushButtonData2); PushButton button3 = pulldownBtn2.AddPushButton(pushButtonData3); PushButton button4 = pulldownBtn3.AddPushButton(pushButtonData4); PushButton button5 = pulldownBtn3.AddPushButton(pushButtonData5); // Note: we need to set the image later. if we do in button data, it won't show in the Ribbon. button1.Image = NewBitmapImage("Basics.ico"); button2.Image = NewBitmapImage("Basics.ico"); button3.Image = NewBitmapImage("Basics.ico"); button4.Image = NewBitmapImage("Basics.ico"); button5.Image = NewBitmapImage("Basics.ico"); }
// define a method that will create our tab and button public static void AddRibbonPanel(UIControlledApplication application) { RevitSelectionChangedEvent evtSelection = new RevitSelectionChangedEvent(); _SelectionChangedEvent = ExternalEvent.Create(evtSelection); RevitPeriodicEvent evtPeriodic = new RevitPeriodicEvent(); _PeriodicEvent = ExternalEvent.Create(evtPeriodic); RevitWindowsEvent evtWindowPeriodic = new RevitWindowsEvent(); _WindowsEvent = ExternalEvent.Create(evtWindowPeriodic); // Create a custom ribbon tab String tabName = "SmartBuilding"; application.CreateRibbonTab(tabName); // Get dll assembly path string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; string thisAssemblyDir = System.IO.Directory.GetParent(thisAssemblyPath).FullName; RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Connection"); PushButtonData bData = new PushButtonData( "Connection", "Connection", thisAssemblyPath, "RevitTestControl.Connection.Connection"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; PushButton Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Connect to SmartBuilding"; BitmapImage pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/Connect.ico")); Button.LargeImage = pbImage; Button.AvailabilityClassName = "RevitTestControl.AppsAvailability"; //Add a new Ribbon Panel for Ligh control ribbonPanel = application.CreateRibbonPanel(tabName, "Light Control"); bData = new PushButtonData( "SwitchOn", "Switch On", thisAssemblyPath, "RevitTestControl.LightControl.SwitchOn"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Switch On 100% selected element"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/LightOn.ico")); Button.LargeImage = pbImage; bData = new PushButtonData( "SwitchOff", "Switch Off", thisAssemblyPath, "RevitTestControl.LightControl.SwitchOff"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Switch On 0% selected element"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/LightOff.ico")); Button.LargeImage = pbImage; bData = new PushButtonData( "SetValue", "0", thisAssemblyPath, "RevitTestControl.LightControl.SetValue"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; _ButtonToChange = ribbonPanel.AddItem(bData) as PushButton; _ButtonToChange.ToolTip = "Set value of selected element"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/IconAmpoule.ico")); _ButtonToChange.LargeImage = pbImage; bData = new PushButtonData( "Consommation électrique", "Consommation électrique", thisAssemblyPath, "RevitTestControl.LightControl.LightEnergy"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; _ButtonToChange = ribbonPanel.AddItem(bData) as PushButton; _ButtonToChange.ToolTip = "Consommation électrique"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/energy.ico")); _ButtonToChange.LargeImage = pbImage; bData = new PushButtonData( "LightConfiguration", "Configuration", thisAssemblyPath, "RevitTestControl.LightControl.Configuration"); bData.AvailabilityClassName = "RevitTestControl.AppsAvailability"; Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Configure dynamic behaviour for selected element"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/Configuration.ico")); Button.LargeImage = pbImage; // Add a new ribbon panel for temperatures ribbonPanel = application.CreateRibbonPanel(tabName, "Temperatures"); bData = new PushButtonData( "TempButton", "Temperatures", thisAssemblyPath, "RevitTestControl.Temperatures.Temperature"); Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Get temperature for building"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/Temp.ico")); Button.LargeImage = pbImage; // Add a new ribbon panel for temperatures ribbonPanel = application.CreateRibbonPanel(tabName, "Windows"); bData = new PushButtonData( "TempWindow", "Windows", thisAssemblyPath, "RevitTestControl.Fenetres.Windows"); Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Get open state of windows"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/window.ico")); Button.LargeImage = pbImage; // Add a new ribbon panel for GTB ribbonPanel = application.CreateRibbonPanel(tabName, "GTB"); bData = new PushButtonData( "TempGtb", "VMC", thisAssemblyPath, "RevitTestControl.CVC.VMC"); Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "View VMC data"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/vmc.ico")); Button.LargeImage = pbImage; bData = new PushButtonData( "TempCC", "Chauffage climatisation", thisAssemblyPath, "RevitTestControl.CVC.CC"); Button = ribbonPanel.AddItem(bData) as PushButton; Button.ToolTip = "Chauffage climatisation"; pbImage = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/cc.ico")); Button.LargeImage = pbImage; // Add a new ribbon panel ribbonPanel = application.CreateRibbonPanel(tabName, "Information"); // create push button for CurveTotalLength PushButtonData b1Data = new PushButtonData( "LightControl", "Show Element Data", thisAssemblyPath, "RevitTestControl.TestControl"); //b1Data.cate PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton; pb1.ToolTip = "Get data rom selected element"; //BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/RevitTestControl;component/Resources/IconAmpoule.ico")); BitmapImage pb1Image = new BitmapImage(new Uri(thisAssemblyDir + "/Resources/Information.png")); pb1.LargeImage = pb1Image; }
/// <summary> /// Add buttons for the commands we define in this labs. /// Here we stack three push buttons and repeat it as we get more. /// </summary> public void AddUILabsCommandButtons(RibbonPanel panel) { // Get the location of this dll. string assembly = GetType().Assembly.Location; // Create three push buttons to stack up // #1 PushButtonData pushButtonData1 = new PushButtonData("UILabsSelection", "Pick Sampler", assembly, _uiLabName + ".UISelection"); pushButtonData1.Image = NewBitmapImage("basics.ico"); // #2 PushButtonData pushButtonData2 = new PushButtonData("UILabsCreateHouse", "Create House Pick", assembly, _uiLabName + ".UICreateHouse"); pushButtonData2.Image = NewBitmapImage("House.ico"); // #3 PushButtonData pushButtonData3 = new PushButtonData("UILabsTaskDialog", "Dialog Sampler", assembly, _uiLabName + ".UITaskDialog"); pushButtonData3.Image = NewBitmapImage("basics.ico"); // #4 PushButtonData pushButtonData4 = new PushButtonData("UILabsCreateHouseDialog", "Create House Dialog", assembly, _uiLabName + ".UICreateHouseDialog"); pushButtonData4.Image = NewBitmapImage("House.ico"); // #5 // Make three sets of pull down PulldownButtonData pulldownBtnData1 = new PulldownButtonData("UILabsPulldownButton1", "Selection"); PulldownButtonData pulldownBtnData2 = new PulldownButtonData("UILabsPulldownButton2", "Task Dialog"); // Create three item stack. IList<RibbonItem> stackedItems = panel.AddStackedItems(pulldownBtnData1, pulldownBtnData2); PulldownButton pulldownBtn1 = stackedItems[0] as PulldownButton; PulldownButton pulldownBtn2 = stackedItems[1] as PulldownButton; pulldownBtn1.Image = NewBitmapImage("Basics.ico"); pulldownBtn2.Image = NewBitmapImage("Basics.ico"); // Add each sub items PushButton button1 = pulldownBtn1.AddPushButton(pushButtonData1); PushButton button2 = pulldownBtn1.AddPushButton(pushButtonData2); PushButton button3 = pulldownBtn2.AddPushButton(pushButtonData3); PushButton button4 = pulldownBtn2.AddPushButton(pushButtonData4); // Note: we need to set the image later. if we do in button data, it won't show in the Ribbon. button1.Image = NewBitmapImage("Basics.ico"); button2.Image = NewBitmapImage("Basics.ico"); button3.Image = NewBitmapImage("Basics.ico"); button4.Image = NewBitmapImage("Basics.ico"); }
/// <summary> /// This method is used to create RibbonSample panel, and add wall related command buttons to it: /// 1. contains a SplitButton for user to create Non-Structural or Structural Wall; /// 2. contains a StackedBotton which is consisted with one PushButton and two Comboboxes, /// PushButon is used to reset all the RibbonItem, Comboboxes are use to select Level and WallShape /// 3. contains a RadioButtonGroup for user to select WallType. /// 4. Adds a Slide-Out Panel to existing panel with following functionalities: /// 5. a text box is added to set mark for new wall, mark is a instance parameter for wall, /// Eg: if user set text as "wall", then Mark for each new wall will be "wall1", "wall2", "wall3".... /// 6. a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) /// </summary> /// <param name="application">An object that is passed to the external application /// which contains the controlled application.</param> private void CreateRibbonSamplePanel(UIControlledApplication application) { // create a Ribbon panel which contains three stackable buttons and one single push button. string firstPanelName = "Ribbon Sample"; RibbonPanel ribbonSamplePanel = application.CreateRibbonPanel(firstPanelName); #region Create a SplitButton for user to create Non-Structural or Structural Wall SplitButtonData splitButtonData = new SplitButtonData("NewWallSplit", "Create Wall"); SplitButton splitButton = ribbonSamplePanel.AddItem(splitButtonData) as SplitButton; PushButton pushButton = splitButton.AddPushButton(new PushButtonData("WallPush", "Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.CreateWall")); 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", "Structure Wall", AddInPath, "Revit.SDK.Samples.Ribbon.CS.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(); #region Add a StackedButton which is consisted of one PushButton and two Comboboxes PushButtonData pushButtonData = new PushButtonData("Reset", "Reset", AddInPath, "Revit.SDK.Samples.Ribbon.CS.ResetSetting"); ComboBoxData comboBoxDataLevel = new ComboBoxData("LevelsSelector"); ComboBoxData comboBoxDataShape = new ComboBoxData("WallShapeComboBox"); IList <RibbonItem> ribbonItemsStacked = ribbonSamplePanel.AddStackedItems(pushButtonData, comboBoxDataLevel, comboBoxDataShape); ((PushButton)(ribbonItemsStacked[0])).Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Reset.png"), UriKind.Absolute)); //Add options to WallShapeComboBox Autodesk.Revit.UI.ComboBox comboboxWallShape = (Autodesk.Revit.UI.ComboBox)(ribbonItemsStacked[2]); ComboBoxMemberData comboBoxMemberData = new ComboBoxMemberData("RectangleWall", "RectangleWall"); ComboBoxMember comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "RectangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("CircleWall", "CircleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "CircleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("TriangleWall", "TriangleWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "TriangleWall.png"), UriKind.Absolute)); comboBoxMemberData = new ComboBoxMemberData("SquareWall", "SquareWall"); comboboxMember = comboboxWallShape.AddItem(comboBoxMemberData); comboboxMember.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "SquareWall.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); #region Add a RadioButtonGroup for user to select WallType RadioButtonGroupData radioButtonGroupData = new RadioButtonGroupData("WallTypeSelector"); RadioButtonGroup radioButtonGroup = (RadioButtonGroup)(ribbonSamplePanel.AddItem(radioButtonGroupData)); ToggleButton toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("Generic8", "Generic - 8\"", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "Generic8-S.png"), UriKind.Absolute)); toggleButton = radioButtonGroup.AddItem(new ToggleButtonData("ExteriorBrick", "Exterior - Brick", AddInPath, "Revit.SDK.Samples.Ribbon.CS.Dummy")); toggleButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick.png"), UriKind.Absolute)); toggleButton.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "ExteriorBrick-S.png"), UriKind.Absolute)); #endregion //slide-out panel: ribbonSamplePanel.AddSlideOut(); #region add a Text box to set the mark for new wall TextBoxData testBoxData = new TextBoxData("WallMark"); Autodesk.Revit.UI.TextBox textBox = (Autodesk.Revit.UI.TextBox)(ribbonSamplePanel.AddItem(testBoxData)); textBox.Value = "new wall"; //default wall mark textBox.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "WallMark.png"), UriKind.Absolute)); textBox.ToolTip = "Set the mark for new wall"; textBox.ShowImageAsButton = true; textBox.EnterPressed += new EventHandler <Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs>(SetTextBoxValue); #endregion ribbonSamplePanel.AddSeparator(); #region Create a StackedButton which consisted of a PushButton (delete all the walls) and a PulldownButton (move all the walls in X or Y direction) PushButtonData deleteWallsButtonData = new PushButtonData("deleteWalls", "Delete Walls", AddInPath, "Revit.SDK.Samples.Ribbon.CS.DeleteWalls"); deleteWallsButtonData.ToolTip = "Delete all the walls created by the Create Wall tool."; deleteWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "DeleteWalls.png"), UriKind.Absolute)); PulldownButtonData moveWallsButtonData = new PulldownButtonData("moveWalls", "Move Walls"); moveWallsButtonData.ToolTip = "Move all the walls in X or Y direction"; moveWallsButtonData.Image = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWalls.png"), UriKind.Absolute)); // create stackable buttons IList <RibbonItem> ribbonItems = ribbonSamplePanel.AddStackedItems(deleteWallsButtonData, moveWallsButtonData); // add two push buttons as sub-items of the moveWalls PulldownButton. PulldownButton moveWallItem = ribbonItems[1] as PulldownButton; PushButton moveX = moveWallItem.AddPushButton(new PushButtonData("XDirection", "X Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.XMoveWalls")); moveX.ToolTip = "move all walls 10 feet in X direction."; moveX.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsXLarge.png"), UriKind.Absolute)); PushButton moveY = moveWallItem.AddPushButton(new PushButtonData("YDirection", "Y Direction", AddInPath, "Revit.SDK.Samples.Ribbon.CS.YMoveWalls")); moveY.ToolTip = "move all walls 10 feet in Y direction."; moveY.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "MoveWallsYLarge.png"), UriKind.Absolute)); #endregion ribbonSamplePanel.AddSeparator(); application.ControlledApplication.DocumentCreated += new EventHandler <Autodesk.Revit.DB.Events.DocumentCreatedEventArgs>(DocumentCreated); }
/// <summary> /// Control buttons for Event and Dynamic Model Update /// </summary> public void AddUILabsCommandButtons2(RibbonPanel panel) { // Get the location of this dll. string assembly = GetType().Assembly.Location; // Create three toggle buttons for radio button group // #1 ToggleButtonData toggleButtonData1 = new ToggleButtonData("UILabsEventOn", "Event" + "\n Off", assembly, _uiLabName + ".UIEventOff"); toggleButtonData1.LargeImage = NewBitmapImage("Basics.ico"); // #2 ToggleButtonData toggleButtonData2 = new ToggleButtonData("UILabsEventOff", "Event" + "\n On", assembly, _uiLabName + ".UIEventOn"); toggleButtonData2.LargeImage = NewBitmapImage("Basics.ico"); // Create three toggle buttons for radio button group // #3 ToggleButtonData toggleButtonData3 = new ToggleButtonData("UILabsDynUpdateOn", "Center" + "\n Off", assembly, _uiLabName + ".UIDynamicModelUpdateOff"); toggleButtonData3.LargeImage = NewBitmapImage("Families.ico"); // #4 ToggleButtonData toggleButtonData4 = new ToggleButtonData("UILabsDynUpdateOff", "Center" + "\n On", assembly, _uiLabName + ".UIDynamicModelUpdateOn"); toggleButtonData4.LargeImage = NewBitmapImage("Families.ico"); // Make event pn/off radio button group RadioButtonGroupData radioBtnGroupData1 = new RadioButtonGroupData("EventNotification"); RadioButtonGroup radioBtnGroup1 = panel.AddItem(radioBtnGroupData1) as RadioButtonGroup; radioBtnGroup1.AddItem(toggleButtonData1); radioBtnGroup1.AddItem(toggleButtonData2); // Make dyn update on/off radio button group RadioButtonGroupData radioBtnGroupData2 = new RadioButtonGroupData("WindowDoorCenter"); RadioButtonGroup radioBtnGroup2 = panel.AddItem(radioBtnGroupData2) as RadioButtonGroup; radioBtnGroup2.AddItem(toggleButtonData3); radioBtnGroup2.AddItem(toggleButtonData4); }
public void showSysMenu() { int ritemCount = ribbonControl1.Items.Count - 1; for (int i = 0; i < ritemCount; i++) { ribbonControl1.Items.Remove(0); } for (int i = 0; i < modules.Count; i++) { #region 循环插入模块 DevComponents.DotNetBar.RibbonTabItem ribbonTabItemModule = new RibbonTabItem(); DevComponents.DotNetBar.RibbonPanel rPanel = new RibbonPanel(); ribbonTabItemModule.Panel = rPanel; //this.ribbonControl1.SuspendLayout(); rPanel.SuspendLayout(); rPanel.Dock = DockStyle.Fill; rPanel.Name = "panel" + modules[i].ModuleId.ToString(); rPanel.Style.CornerType = DevComponents.DotNetBar.eCornerType.Square; rPanel.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square; rPanel.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square; rPanel.Location = new Point(0, 0x3a); rPanel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); rPanel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 4); rPanel.Size = new Size(0x47a, 0x73); //ribbonTabItemModule.Checked = true; //ribbonTabItemModule.ItemAlignment = eItemAlignment.Near; ribbonTabItemModule.Name = "module" + modules[i].ModuleId.ToString(); ribbonTabItemModule.Text = modules[i].Name; ribbonTabItemModule.Tag = modules[i]; DevComponents.DotNetBar.RibbonBar rMenuClass = null; #region 增加子菜单 List<BaseMenu> _menus = menus.FindAll(x => (x.ModuleId == modules[i].ModuleId && x.PMenuId == -1)).OrderByDescending(x => x.SortId).ToList(); if (_menus.Count > 0) { //List<RibbonBar> listbar = new List<RibbonBar>(); for (int j = 0; j < _menus.Count; j++) { if (string.IsNullOrEmpty(_menus[j].DllName) && string.IsNullOrEmpty(_menus[j].UrlId)) { //为二级分类菜单 DevComponents.DotNetBar.RibbonBar menuClass = new RibbonBar(); menuClass.AutoOverflowEnabled = true; menuClass.Dock = System.Windows.Forms.DockStyle.Left; menuClass.ContainerControlProcessDialogKey = true; menuClass.Text = _menus[j].Name; //三级菜单 List<BaseMenu> mainMenu = menus.FindAll(x => x.PMenuId == _menus[j].MenuId).OrderByDescending(x => x.SortId).ToList(); foreach (BaseMenu menu in mainMenu) { DevComponents.DotNetBar.ButtonItem btnmenu = new ButtonItem(menu.MenuId.ToString(), menu.Name); // btnmenu.Image = global::EFWBaseLib.Properties.Resources.defaulttool; if (!string.IsNullOrEmpty(menu.Image)) { btnmenu.Image = new Bitmap(Image.FromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + menu.Image), 32, 32); } else { btnmenu.Image = new Bitmap(Image.FromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"images\defaultmenu.ico"), 32, 32); } // btnmenu.ImageListSizeSelection = DevComponents.DotNetBar.eButtonImageListSelection.Large; btnmenu.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top; btnmenu.Text = menu.Name; btnmenu.Tag = menu; btnmenu.Click += new EventHandler(btnmenu_Click); menuClass.Items.Add(btnmenu); } //listbar.Add(menuClass); rPanel.Controls.Add(menuClass); //rPanel.Refresh(); } else { //菜单没有二级分类菜单则创建默认二级分类菜单 if (rMenuClass == null) { rMenuClass = new RibbonBar(); rMenuClass.AutoOverflowEnabled = true; rMenuClass.Dock = System.Windows.Forms.DockStyle.Left; rMenuClass.Text = "操作功能"; rPanel.Controls.Add(rMenuClass); } DevComponents.DotNetBar.ButtonItem btnmenu = new ButtonItem(_menus[j].MenuId.ToString(), _menus[j].Name); //btnmenu.Image = global::EFWBaseLib.Properties.Resources.defaulttool; //btnmenu.ImageListSizeSelection = DevComponents.DotNetBar.eButtonImageListSelection.Large; if (!string.IsNullOrEmpty(_menus[j].Image)) { btnmenu.Image = Image.FromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + _menus[j].Image); btnmenu.Image = new Bitmap(Image.FromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + _menus[j].Image), 32, 32); } else { btnmenu.Image = Image.FromFile(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"images\defaultmenu.ico"); } btnmenu.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top; btnmenu.Text = _menus[j].Name; btnmenu.Tag = _menus[j]; btnmenu.Click += new EventHandler(btnmenu_Click); rMenuClass.Items.Add(btnmenu); } } } #endregion ribbonControl1.Items.Insert(ribbonControl1.Items.Count - 1, ribbonTabItemModule); ribbonControl1.Controls.Add(rPanel); rPanel.ResumeLayout(false); ribbonTabItemModule.Refresh(); #endregion } ribbonControl1.Show(); //ribbonTabItem1.Visible = false; //ribbonTabItem2.Visible = false; ribbonControl1.Refresh(); this.Refresh(); ribbonControl1.SelectFirstVisibleRibbonTab(); }
/// <summary> /// Adds the button to a specified ribbon panel. /// </summary> /// <param name="ribbonPanel">The ribbon panel.</param> /// <param name="targetControlName">The name of an existing control to position the button next to.</param> /// <param name="insertBeforeTargetControl">A value that indicates whether to position the button before or /// after the target control.</param> /// <exception cref="ArgumentNullException"><paramref name="ribbonPanel"/> or /// <paramref name="targetControlName"/> is <c>null</c>.</exception> public void AddTo(RibbonPanel ribbonPanel, string targetControlName, bool insertBeforeTargetControl) { if (ribbonPanel == null) throw new ArgumentNullException(nameof(ribbonPanel)); if (targetControlName == null) throw new ArgumentNullException(nameof(targetControlName)); ribbonPanel.CommandControls.AddButton( ButtonDefinition: _buttonDefinition, UseLargeIcon: true, ShowText: true, TargetControlInternalName: targetControlName, InsertBeforeTargetControl: insertBeforeTargetControl ); }
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; if (!(doc.ActiveView is ViewPlan viewPlan)) { TaskDialog.Show("Please select Plan view", "Select Plan view to change it's View Range"); return(Result.Succeeded); } PlanViewRange viewRange = viewPlan.GetViewRange(); double CCut = viewRange.GetOffset(PlanViewPlane.CutPlane); double CTop = viewRange.GetOffset(PlanViewPlane.TopClipPlane); RibbonPanel inputpanel = null; ComboBox inputbox = null; foreach (RibbonPanel panel in uiapp.GetRibbonPanels("Exp. Add-Ins")) { if (panel.Name == "View Tools") { inputpanel = panel; } } foreach (RibbonItem item in inputpanel.GetItems()) { if (item.Name == "ShiftRange") { inputbox = (ComboBox)item; } } List <Double> vrOpts = new List <Double> { StoreExp.vrOpt1, StoreExp.vrOpt2, StoreExp.vrOpt3, StoreExp.vrOpt4, StoreExp.vrOpt5, StoreExp.vrOpt6 }; double mod = vrOpts[Int32.Parse(inputbox.Current.Name)]; if (viewPlan.ViewType != ViewType.CeilingPlan) { viewRange.SetOffset(PlanViewPlane.CutPlane, CCut + mod); viewRange.SetOffset(PlanViewPlane.TopClipPlane, CCut + mod); } if (viewPlan.ViewType == ViewType.CeilingPlan) { viewRange.SetOffset(PlanViewPlane.TopClipPlane, CTop + mod); viewRange.SetOffset(PlanViewPlane.ViewDepthPlane, CTop + mod); } using (Transaction t = new Transaction(doc, "Set View Range")) { try { t.Start(); viewPlan.SetViewRange(viewRange); t.Commit(); } catch { TaskDialog.Show("Error", "Cannot shift ViewRange this way."); } } return(Result.Succeeded); }
public void PullDown(RibbonPanel panel) { //creates a Push button for the get selection command PushButtonData bgetselect = new PushButtonData("getselec", "Get Selection", assemblyloca, "Application.App"); }
public Result OnStartup(UIControlledApplication application) { try { m_startTime = DateTime.Now; Metrics.AppendLog("Launching Arcadis Main Application"); Metrics.AppendLog("Session Start: " + m_startTime.ToString()); //Language info //------------- CultureInfo ci = Thread.CurrentThread.CurrentCulture; var ri = new RegionInfo(ci.Name); Utils.k_systemCountry = ri.DisplayName; Utils.k_systemLanguage = ci.NativeName; Utils.k_revitLanguage = application.ControlledApplication.Language.ToString(); Metrics.AppendLog("System Language: " + Utils.k_systemLanguage); Metrics.AppendLog("System Country: " + Utils.k_systemCountry); Metrics.AppendLog("Revit language: " + Utils.k_revitLanguage); Metrics.AppendLog("\r\nChecking for new versions"); Utils.g_controlledUIApp = application; Assembly mainAssembly = Assembly.GetExecutingAssembly(); Utils.g_mainAssemblyPath = mainAssembly.Location; m_revitAddinPath = Path.GetDirectoryName(Utils.g_mainAssemblyPath); string locPath = Utils.g_mainAssemblyPath; string Revit = string.Empty; if (m_revitAddinPath.Contains("2018")) { Revit = "2018"; } else if (m_revitAddinPath.Contains("2019")) { Revit = "2019"; } else if (m_revitAddinPath.Contains("2020")) { Revit = "2020"; } else if (m_revitAddinPath.Contains("2021")) { Revit = "2021"; } Utils.k_revitVersion = Revit; Metrics.AppendLog("Revit Version: " + Utils.k_revitVersion); string arcadisRepository = Path.Combine(Utils.k_repository, Utils.k_revitVersion); Metrics.AppendLog("Repository : " + arcadisRepository); MainUserPreferences up = MainUserPreferences.GetUserPreferences(); IList <string> modules = up.ToolModules; foreach (string assemblyName in modules) { string repoPath = Path.Combine(arcadisRepository, assemblyName); string revitPath = Path.Combine(m_revitAddinPath, assemblyName); string revitVersion = string.Empty; string repoVersion = string.Empty; try { revitVersion = FileVersionInfo.GetVersionInfo(revitPath).ProductVersion; } catch { revitVersion = "Not Found"; } try { repoVersion = FileVersionInfo.GetVersionInfo(repoPath).ProductVersion; } catch { repoVersion = "Not Found"; } AssemblyVersion module = new AssemblyVersion(); module.AssemblyName = assemblyName; module.CurrentVersion = revitVersion; module.RepositoryVersion = repoVersion; Utils.s_assemblies.Add(module); if (repoVersion != revitVersion) { newAssemblies.Add(module); } } if (newAssemblies.Count > 0) { VersionsForm form = new VersionsForm(); form.NewAssemblies = newAssemblies; form.RevitAddInPath = m_revitAddinPath; form.RepositoryPath = arcadisRepository; form.ShowDialog(); } //Create Arcadis Tabs //------------------- application.CreateRibbonTab(Utils.k_arcadisMainTab); ToolbarTab mainTab = AddTabs(Utils.k_arcadisMainTab, true); application.CreateRibbonTab(Utils.k_arcadisToolsTab); ToolbarTab toolsTab = AddTabs(Utils.k_arcadisToolsTab, false); // About Arcadis Tools Panel //-------------------------- RibbonPanel panel = application.CreateRibbonPanel(Utils.k_arcadisMainTab, Utils.k_arcadisPanel); ToolbarPanel toolPanel = new ToolbarPanel(panel.Name, panel, "ArcadisMain.dll"); mainTab.Panels.Add(toolPanel); string strCommand = "ArcadisMain.About_Command"; Bitmap bitmap = Properties.Resources.Info; Bitmap bitmapHelp = Properties.Resources.AboutHelp; string helpURL = "https://www.arcadis.com/en/global/"; ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, helpURL); string longDesc = "Long help description for command button. Can include a long descriptive text with and an optional image."; Utils.CreateCommand(panel, toolPanel, "About Tools", "About Tools", locPath, strCommand, bitmap, "Information about Arcadis automation tools", bitmapHelp, longDesc, contextHelp); strCommand = "ArcadisMain.Settings_Command"; bitmap = Properties.Resources.settings; bitmapHelp = Properties.Resources.SettingsHelp; helpURL = "https://help.autodesk.com/view/RVT/2020/ENU/?guid=GUID-35DE66AB-6EF5-48C0-B477-F3B1B120F18A"; contextHelp = new ContextualHelp(ContextualHelpType.Url, helpURL); Utils.CreateCommand(panel, toolPanel, Utils.k_settings, Utils.k_settings, locPath, strCommand, bitmap, "Arcadis Toolbar Settings", bitmapHelp, longDesc, contextHelp); strCommand = "ArcadisMain.Ribbon_Command"; bitmap = Properties.Resources.Ribbon; bitmapHelp = Properties.Resources.MetricsHelp; Utils.CreateCommand(panel, toolPanel, "Ribbon Settings", "Ribbon Settings", locPath, strCommand, bitmap, "Select Tools for Ribbon", bitmapHelp, longDesc, contextHelp); strCommand = "ArcadisMain.Metrics_Command"; bitmap = Properties.Resources.BarChart2; bitmapHelp = Properties.Resources.MetricsHelp; Utils.CreateCommand(panel, toolPanel, "Metrics Tracker", "Metrics Tracker", locPath, strCommand, bitmap, "Display session Metrics Tracker Log", bitmapHelp, longDesc, contextHelp); foreach (string module in up.ToolModules) { //string addinPath = Path.Combine(Utils.g_mainAssemblyPath, module); //addinPath = m_revitAddinPath; string addinFile = Path.GetFileNameWithoutExtension(module) + ".addin"; string addinPath = Path.Combine(m_revitAddinPath, addinFile); try { Utils.LoadAddin(addinPath); } catch (Exception ex) { TaskDialog.Show("Exception MainApp L202", ex.Message); } } } catch (Exception ex) { Metrics.AppendLog("\r\nException: " + ex.Message); TaskDialog.Show("Exception", ex.Message); return(Result.Failed); } return(Result.Succeeded); }
private RibbonBar GetRibbonBar([NotNull] RibbonPanel ribbon, [Required] string bar) { return(ribbon.Controls.OfType <RibbonBar>().FirstOrDefault(x => bar.IsEqual(x.Text))); }
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime) { // This method is called by Inventor when it loads the addin. // The AddInSiteObject provides access to the Inventor Application object. // The FirstTime flag indicates if the addin is loaded for the first time. // Initialize AddIn members. m_inventorApplication = addInSiteObject.Application; // Create Icon ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions; Icon smallPush = InvAddIn.Properties.Resources.costEstimateIcon; Icon largePush = InvAddIn.Properties.Resources.costEstimateIcon; stdole.IPictureDisp smallCostIcon = PictureDispConverter.ToIPictureDisp(smallPush); stdole.IPictureDisp largCostIcon = PictureDispConverter.ToIPictureDisp(largePush); m_CostEstimator = controlDefs.AddButtonDefinition("Estimator", "Open Cost Estimator Window.", CommandTypesEnum.kFilePropertyEditCmdType, addInGUID, "Open Cost Estimator Window.", "Cost Estimator", smallCostIcon, largCostIcon); if (firstTime) { try { if (m_inventorApplication.UserInterfaceManager.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface) { // Assembly Button Ribbon assemblyRibbon = m_inventorApplication.UserInterfaceManager.Ribbons["Assembly"]; RibbonTab toolsTab = assemblyRibbon.RibbonTabs["id_TabTools"]; // Part Buttons Ribbon partRibbon = m_inventorApplication.UserInterfaceManager.Ribbons["Part"]; RibbonTab toolsPartTab = partRibbon.RibbonTabs["id_TabTools"]; try { // For ribbon interface // This is a new panel that can be made RibbonPanel panel = toolsTab.RibbonPanels.Add("Cost Estimator", "Autodesk:Cost Estimator:Panel1", addInGUID, "", false); CommandControl control1 = panel.CommandControls.AddButton(m_CostEstimator, true, true, "", false); RibbonPanel pane1_part = toolsPartTab.RibbonPanels.Add("Cost Estimator", "Autodesk:Cost Estimator:pane1_part", addInGUID, "", false); CommandControl control2 = pane1_part.CommandControls.AddButton(m_CostEstimator, true, true, "", false); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { // For classic interface, possibly incorrect code CommandBar oCommandBar = m_inventorApplication.UserInterfaceManager.CommandBars["AMxAssemblyPanelCmdBar"]; oCommandBar.Controls.AddButton(m_CostEstimator, 0); } } catch { // For classic interface, possibly incorrect code CommandBar oCommandBar = m_inventorApplication.UserInterfaceManager.CommandBars["AMxAssemblyPanelCmdBar"]; oCommandBar.Controls.AddButton(m_CostEstimator, 0); } } m_CostEstimator.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_CostEstimator_OnExecute); // TODO: Add ApplicationAddInServer.Activate implementation. // e.g. event initialization, command creation etc. }
public RibbonPanelRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonPanel panel, Control canvas) : base(owner, g, clip) { Panel = panel; Canvas = canvas; }
private void AddPushButtonData(string name, string text, string description, string className, RibbonPanel panel, Source.Source imageSource, bool avclass) { PushButtonData data = new PushButtonData(name, text, Assembly.GetExecutingAssembly().Location, className); PushButton button = panel.AddItem(data) as PushButton; button.ToolTip = description; if (avclass) { button.AvailabilityClassName = "BatchModelCheck.Availability.StaticAvailable"; } button.LongDescription = string.Format("Верстия: {0}\nСборка: {1}-{2}", ModuleData.Version, ModuleData.Build, ModuleData.Date); button.ItemText = text; button.LargeImage = new BitmapImage(new Uri(imageSource.Value)); }