예제 #1
0
        public Result OnStartup(UIControlledApplication application)
        {
            PublicVariables.UpperValue = 10000;
            PublicVariables.LowerValue = 0;
            application.CreateRibbonTab("Updater Tool");
            string appData       = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string dllPath       = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020\UpdaterTool.dll");
            string appFolderPath = Path.Combine(appData, @"Autodesk\REVIT\Addins\2020");

            RibbonPanel ribbonPanel = application.CreateRibbonPanel("Updater Tool", "Updater");

            TextBoxData textBoxData1 = new TextBoxData("textBox1");
            TextBox     textBox1     = ribbonPanel.AddItem(textBoxData1) as TextBox;

            textBox1.PromptText    = "Enter a Reference Value";
            textBox1.EnterPressed += TextBoxEnterClicked;
            ribbonPanel.AddSeparator();
            RadioButtonGroupData radioButtonGroupData1 = new RadioButtonGroupData("radioButtonGroup1");
            RadioButtonGroup     radioButtonGroup1     = ribbonPanel.AddItem(radioButtonGroupData1) as RadioButtonGroup;

            ToggleButtonData toggleButton1 = new ToggleButtonData("toggleButton1", "Deactivate", dllPath, "UpdaterTool.Deactivated");
            BitmapImage      img1          = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Stop.png")));

            toggleButton1.LargeImage = img1;

            ToggleButtonData toggleButton2 = new ToggleButtonData("toggleButton2", "Activate", dllPath, "UpdaterTool.Activated");
            BitmapImage      img2          = new BitmapImage(new Uri(Path.Combine(appFolderPath, "Check.png")));

            toggleButton2.LargeImage = img2;

            radioButtonGroup1.AddItem(toggleButton1);
            radioButtonGroup1.AddItem(toggleButton2);

            return(Result.Succeeded);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        public static void CreateUI(RadioButtonGroup radioButtonGroup)
        {
            var buttonData = NewToggleButtonData <CommandGrasshopperPreviewOff, Availability>("Off");

            if (radioButtonGroup.AddItem(buttonData) is ToggleButton pushButton)
            {
                pushButton.ToolTip    = "Don't draw any preview geometry";
                pushButton.Image      = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.GH.Toolbar.Preview_Off_24x24.png", true);
                pushButton.LargeImage = ImageBuilder.LoadBitmapImage("RhinoInside.Resources.GH.Toolbar.Preview_Off_24x24.png");
                pushButton.Visible    = PlugIn.PlugInExists(PluginId, out bool loaded, out bool loadProtected);
            }
        }
        private void AddRadioGroup(RibbonPanel panel)
        {
            RadioButtonGroupData radioData        = new RadioButtonGroupData("radioGroup");
            RadioButtonGroup     radioButtonGroup = panel.AddItem(radioData) as RadioButtonGroup;

            ToggleButtonData tb1 = new ToggleButtonData("toggleButton1", "Red");

            tb1.ToolTip    = "Red Option";
            tb1.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Red.bmp"));
            ToggleButtonData tb2 = new ToggleButtonData("toggleButton2", "Green");

            tb2.ToolTip    = "Green Option";
            tb2.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Green.bmp"));
            ToggleButtonData tb3 = new ToggleButtonData("toggleButton3", "Blue");

            tb3.ToolTip    = "Blue Option";
            tb3.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Blue.bmp"));

            radioButtonGroup.AddItem(tb1);
            radioButtonGroup.AddItem(tb2);
            radioButtonGroup.AddItem(tb3);
        }
예제 #6
0
        public static void CreateUI(RadioButtonGroup radioButtonGroup)
        {
            var buttonData = NewToggleButtonData <CommandGrasshopperPreviewShaded, Availability>(CommandName, "Ribbon.Grasshopper.Preview_Shaded.png", "Draw shaded preview geometry");

            if (radioButtonGroup.AddItem(buttonData) is ToggleButton pushButton)
            {
                pushButton.Visible = PlugIn.PlugInExists(PluginId, out bool _, out bool _);
                // set this toggle to active by default
                if (GH.PreviewServer.PreviewMode == GH_PreviewMode.Shaded)
                {
                    radioButtonGroup.Current = pushButton;
                }
            }
        }
예제 #7
0
        public static void CreateUI(RadioButtonGroup radioButtonGroup)
        {
            var buttonData = NewToggleButtonData <CommandGrasshopperPreviewWireframe, Availability>(CommandName, "Ribbon.Grasshopper.Preview_Wireframe.png", "Draw wireframe preview geometry");

            if (radioButtonGroup.AddItem(buttonData) is ToggleButton pushButton)
            {
                pushButton.Visible = PlugIn.PlugInExists(PluginId, out bool _, out bool _);
                // add spacing to title to get it to be a consistent width
                if (pushButton.GetAdwndRibbonButton() is Autodesk.Windows.RibbonButton ribbonButton)
                {
                    ribbonButton.Text = "  Wire   ";
                }

                if (GH.PreviewServer.PreviewMode == GH_PreviewMode.Wireframe)
                {
                    radioButtonGroup.Current = pushButton;
                }
            }
        }
예제 #8
0
        /// <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);
        }
예제 #9
0
        internal static void AddRibbonPanel(UIControlledApplication application)
        {
            //Tab Name that will display in Revit
            string TabName = "Torsion Tools";

            //Create the Ribbon Tab
            application.CreateRibbonTab(TabName);

            //Get the assembly path to execute commands
            string AssemblyPath = Assembly.GetExecutingAssembly().Location;

            //Create an Image to display on the buttons
            BitmapImage ButtonImage                              = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/Button100x100.png"));
            BitmapImage FindReplaceImage                         = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/FindReplace100x100.png"));
            BitmapImage SheetCapitalizeImage                     = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ToUpper100x100.png"));
            BitmapImage SheetSelectionImage                      = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SheetSelection100x100.png"));
            BitmapImage SheetTitleblockKeyPlanImage              = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SheetTitleblockKeyPlan100x100.png"));
            BitmapImage SheetViewRefSheetImage                   = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SheetViewRefSheet100x100.png"));
            BitmapImage ViewsViewLegendCopyImage                 = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ViewLegendCopy100x100.png"));
            BitmapImage ViewsViewScheduleCopyImage               = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ViewScheduleCopy100x100.png"));
            BitmapImage ViewsLinkedViewsImage                    = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/LinkedView100x100.png"));
            BitmapImage ViewsLinkedViewsUpdateImage              = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/LinkedViewUpdate100x100.png"));
            BitmapImage ViewsViewDeleteunplacedImage             = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ViewDeleteUnplaced100x100.png"));
            BitmapImage ToolsWarningsImage                       = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/Warning100x100.png"));
            BitmapImage ToolsElemOfCategoryImage                 = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ComponentInfo100x100.png"));
            BitmapImage ToolsSheetLegendMultipleImage            = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SheetLegendToMultiple100x100.png"));
            BitmapImage ToolsSheetScheduleMultipleImage          = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SheetScheduleToMultiple100x100.png"));
            BitmapImage ToolsFamilyMultipleSharedParametersImage = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/MultipleSharedParameters100x100.png"));
            BitmapImage SquareTImage                             = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/SquareT100x100.png"));
            BitmapImage ViewsChangeViewReferenceImage            = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/ChangeViewReference100x100.png"));
            BitmapImage MEPSpacesFromLinkedRoomsImage            = new BitmapImage(new Uri("pack://application:,,,/Torsion Tools;component/Resources/CreateSpaces100x100.png"));


            //Create a Panel within the Tab
            RibbonPanel RibbonPanelOne      = application.CreateRibbonPanel(TabName, "PANEL 1");
            RibbonPanel RibbonPanelSheets   = application.CreateRibbonPanel(TabName, "Sheets");
            RibbonPanel RibbonPanelViews    = application.CreateRibbonPanel(TabName, "Views");
            RibbonPanel RibbonPanelTools    = application.CreateRibbonPanel(TabName, "Tools");
            RibbonPanel RibbonPanelMEP      = application.CreateRibbonPanel(TabName, "MEP");
            RibbonPanel RibbonPanelSettings = application.CreateRibbonPanel(TabName, "Settings");

            //Create Push Button Data to create the Push button from
            PushButtonData pbdTestButton             = new PushButtonData("cmdTestButton", "Button Name", AssemblyPath, "TorsionTools.Commands.HelloWorld");
            PushButtonData pbdSheetSelection         = new PushButtonData("cmdSheetSelection", "Sheet\nSelector", AssemblyPath, "TorsionTools.Commands.SheetSelection");
            PushButtonData pbdSheetFindReplace       = new PushButtonData("cmdSheetFindReplace", "Sheets\nFind Replace", AssemblyPath, "TorsionTools.Commands.SheetFindReplace");
            PushButtonData pbdSheetNameCapitalize    = new PushButtonData("cmdSheetNameCapitalize", "Capitalize\nName", AssemblyPath, "TorsionTools.Commands.SheetNameCapitalize");
            PushButtonData pbdSheetTitleblockKeyPlan = new PushButtonData("cmdSheetTitleblockKeyPlan", "Key Plan\nVisibility", AssemblyPath, "TorsionTools.Commands.SheetTitleblockKeyPlan");
            PushButtonData pbdSheetLegendToMultiple  = new PushButtonData("cmdSheetLegendToMultiple", "Place\nLegends", AssemblyPath, "TorsionTools.Commands.SheetLegendToMultiple")
            {
                //Use the PushButtonData property to determine when the ribbon button is enabled. In this case only when the active view is a Sheet
                AvailabilityClassName = "TorsionTools.Ribbon.SheetCommandAvailability"
            };
            PushButtonData pbdSheetScheduleToMultiple = new PushButtonData("cmdSheetScheduleToMultiple", "Place\nSchedules", AssemblyPath, "TorsionTools.Commands.SheetScheduleToMultiple")
            {
                //Use the PushButtonData property to determine when the ribbon button is enabled. In this case only when the active view is a Sheet
                AvailabilityClassName = "TorsionTools.Ribbon.SheetCommandAvailability"
            };
            PushButtonData pbdSheetViewReferenceSheet = new PushButtonData("cmdSheetViewReferenceSheet", "Reference\nSheet", AssemblyPath, "TorsionTools.Commands.ViewReferenceSheet")
            {
                //Use the PushButtonData property to determine when the ribbon button is enabled. In this case only when the active view is a Sheet
                AvailabilityClassName = "TorsionTools.Ribbon.SheetCommandAvailability"
            };

            PushButtonData pbdViewsFindReplace         = new PushButtonData("cmdViewsFindReplace", "Views\nFind Replace", AssemblyPath, "TorsionTools.Commands.ViewFindReplace");
            PushButtonData pbdViewsViewLegendCopy      = new PushButtonData("cmdToolsViewLegendCopy", "Copy\nLegends", AssemblyPath, "TorsionTools.Commands.ViewLegendCopy");
            PushButtonData pbdViewsViewScheduleCopy    = new PushButtonData("cmdToolsViewScheduleCopy", "Copy\nSchedules", AssemblyPath, "TorsionTools.Commands.ViewScheduleCopy");
            PushButtonData pbdViewsLinkedViews         = new PushButtonData("cmdToolsLinkedViews", "Linked\nViews", AssemblyPath, "TorsionTools.Commands.LinkedViews");
            PushButtonData pbdViewsLinkedViewsUpdate   = new PushButtonData("cmdToolsLinkedViewsUpdate", "Update\nViews", AssemblyPath, "TorsionTools.Commands.LinkedViewUpdate");
            PushButtonData pbdViewsViewDeleteUnplaced  = new PushButtonData("cmdToolsViewDeleteUnplaced", "Delete\nUnplaced", AssemblyPath, "TorsionTools.Commands.ViewDeleteUnplacedViews");
            PushButtonData pbdViewsChangeViewReference = new PushButtonData("cmdViewsChangeViewReference", "Change\nReference", AssemblyPath, "TorsionTools.Commands.ViewChangeViewReference");
            PushButtonData pbdViewActiveToSheet        = new PushButtonData("cmdViewActiveToSheet", "Active View\nTo Sheet", AssemblyPath, "TorsionTools.Commands.ViewActiveToSheet")
            {
                AvailabilityClassName = "TorsionTools.Ribbon.ViewCommandAvailability"
            };

            PushButtonData pbdToolsWarnings       = new PushButtonData("cmdToolsWarnings", "Warnings", AssemblyPath, "TorsionTools.Commands.Warnings");
            PushButtonData pbdToolsElemOfCategory = new PushButtonData("cmdToolsElemOfCategory", "Family Instances\nof Category", AssemblyPath, "TorsionTools.Commands.ElementsOfCategory");
            PushButtonData pbdToolsFamilyMultipleSharedParameters = new PushButtonData("cmdToolsFamilyMultipleSharedParameters", "Shared\nParameters", AssemblyPath, "TorsionTools.Commands.FamilyMultipleSharedParameters");
            PushButtonData pbdToolsLinksReloadALl = new PushButtonData("cmdLinksReloadAll", "Reload\nLinks", AssemblyPath, "TorsionTools.Commands.LinksReloadAll");

            PushButtonData pbdMEPSpacesFromLinkedRooms = new PushButtonData("cmdMEPSpacesFromLinkedRooms", "Create\nSpaces", AssemblyPath, "TorsionTools.Commands.MEPSpacesFromRooms");

            //Create a Push Button from the Push Button Data
            PushButton pbTestButton = RibbonPanelOne.AddItem(pbdTestButton) as PushButton;

            PushButton pbSheetSelection          = RibbonPanelSheets.AddItem(pbdSheetSelection) as PushButton;
            PushButton pbSheetNameCapitalize     = RibbonPanelSheets.AddItem(pbdSheetNameCapitalize) as PushButton;
            PushButton pbSheetFindReplace        = RibbonPanelSheets.AddItem(pbdSheetFindReplace) as PushButton;
            PushButton pbSheetTitleblockKeyPlan  = RibbonPanelSheets.AddItem(pbdSheetTitleblockKeyPlan) as PushButton;
            PushButton pbSheetViewReferenceSheet = RibbonPanelSheets.AddItem(pbdSheetViewReferenceSheet) as PushButton;

            PushButton pbViewsFindReplace        = RibbonPanelViews.AddItem(pbdViewsFindReplace) as PushButton;
            PushButton pbViewsViewDeleteUnplaced = RibbonPanelViews.AddItem(pbdViewsViewDeleteUnplaced) as PushButton;
            PushButton pbViewActiveToSheet       = RibbonPanelViews.AddItem(pbdViewActiveToSheet) as PushButton;

            PushButton pbToolsWarnings       = RibbonPanelTools.AddItem(pbdToolsWarnings) as PushButton;
            PushButton pbToolsElemOfCategory = RibbonPanelTools.AddItem(pbdToolsElemOfCategory) as PushButton;
            PushButton pbToolsFamilyMultipleSharedParameters = RibbonPanelTools.AddItem(pbdToolsFamilyMultipleSharedParameters) as PushButton;
            PushButton pbToolsLinkReloadAll = RibbonPanelTools.AddItem(pbdToolsLinksReloadALl) as PushButton;

            PushButton pbMEPSpacesFromLinkedRooms = RibbonPanelMEP.AddItem(pbdMEPSpacesFromLinkedRooms) as PushButton;

            //If you are going to use PushButtonData objects for Pulldown or Split buttons, you have to set these properties BEFORE adding them
            pbdSheetLegendToMultiple.LargeImage   = ToolsSheetLegendMultipleImage;
            pbdSheetScheduleToMultiple.LargeImage = ToolsSheetScheduleMultipleImage;
            pbdSheetLegendToMultiple.ToolTip      = "Select a Legend Viewport to place on multiple sheets in the same location";
            pbdSheetScheduleToMultiple.ToolTip    = "Select a Schedule Instance to place on multiple sheets int he same location";

            pbdViewsLinkedViews.LargeImage           = ViewsLinkedViewsImage;
            pbdViewsLinkedViewsUpdate.LargeImage     = ViewsLinkedViewsUpdateImage;
            pbdViewsViewLegendCopy.LargeImage        = ViewsViewLegendCopyImage;
            pbdViewsViewScheduleCopy.LargeImage      = ViewsViewScheduleCopyImage;
            pbdViewsLinkedViews.ToolTip              = "Create Drafting Views based on Views in a Linked Model for reference";
            pbdViewsLinkedViewsUpdate.ToolTip        = "Update Linked View information referenced from a Linked Model";
            pbdViewsLinkedViews.LongDescription      = "Verify the current Revit Model has the following three parameters under Phasing paramter group and View category:\nLinked View - Yes/No\nLinked View GUID - Text\nLink Name - Text ";
            pbdViewsViewLegendCopy.ToolTip           = "Copy one or more Legend Views from a Linked Document";
            pbdViewsViewLegendCopy.LongDescription   = "Select the Linked Document from which you want to copy the Legend from. Then select from the available Legend views. Then press the Copy button to copy the Legends into the current Document.";
            pbdViewsViewScheduleCopy.ToolTip         = "Copy one or more Schedules form a Linked Document";
            pbdViewsViewScheduleCopy.LongDescription = "Select the Linked Document from which you want to copy the Schedule from. Then select from the available Schedules. Then press the Copy button to copy the Schedules into the current Document.";

            //Pull Down buttons allow you to stack similar or grouped buttons into a stack that you can expand down and select
            PulldownButtonData pdbdCopyLegendSchedule = new PulldownButtonData("pullDownCopyLegendSchedule", "Copy\nLegend");
            PulldownButton     pdbCopyLegendSchedule  = RibbonPanelViews.AddItem(pdbdCopyLegendSchedule) as PulldownButton;

            pdbCopyLegendSchedule.LargeImage = ViewsViewLegendCopyImage;
            pdbCopyLegendSchedule.AddPushButton(pbdViewsViewLegendCopy);
            pdbCopyLegendSchedule.AddPushButton(pbdViewsViewScheduleCopy);

            PulldownButtonData pdbdLinkedViews = new PulldownButtonData("pullDownLinkView", "Link\nViews");
            PulldownButton     pdbLinkedViews  = RibbonPanelViews.AddItem(pdbdLinkedViews) as PulldownButton;

            pdbLinkedViews.LargeImage = ViewsLinkedViewsImage;
            pdbLinkedViews.AddPushButton(pbdViewsLinkedViews);
            pdbLinkedViews.AddPushButton(pbdViewsLinkedViewsUpdate);

            PushButton pbViewsChangeViewReference = RibbonPanelViews.AddItem(pbdViewsChangeViewReference) as PushButton;

            PulldownButtonData pdbdPlaceMultipleLegendSchedule = new PulldownButtonData("pulldownPlaceMultipleLegendSchedule", "Place\nLegends");
            PulldownButton     pdbPlaceMultipleLegendSchedule  = RibbonPanelSheets.AddItem(pdbdPlaceMultipleLegendSchedule) as PulldownButton;

            pdbPlaceMultipleLegendSchedule.LargeImage = ToolsSheetLegendMultipleImage;
            pdbPlaceMultipleLegendSchedule.AddPushButton(pbdSheetLegendToMultiple);
            pdbPlaceMultipleLegendSchedule.AddPushButton(pbdSheetScheduleToMultiple);

            RadioButtonGroupData rbgdUpdaters  = new RadioButtonGroupData("UpdaterSettings");
            RadioButtonGroup     rdoBtnGroup   = RibbonPanelSettings.AddItem(rbgdUpdaters) as RadioButtonGroup;
            ToggleButtonData     tbdUpdaterOn  = new ToggleButtonData("cmdUpdaterOn", "Turn On\nDynamic\nUpdaters", AssemblyPath, "TorsionTools.Settings.UpdatersOn");
            ToggleButtonData     tbdUpdaterOff = new ToggleButtonData("cmdUpdaterOff", "Turn Off\nDynamic\nUpdaters", AssemblyPath, "TorsionTools.Settings.UpdatersOff");

            tbdUpdaterOn.ToolTip  = "Turn all Dynamic Model Updaters On";
            tbdUpdaterOff.ToolTip = "Turn all Dynamic Model Updaters Off";

            rdoBtnGroup.AddItem(tbdUpdaterOn);
            rdoBtnGroup.AddItem(tbdUpdaterOff);

            //Set Button Image
            pbTestButton.LargeImage = ButtonImage;

            pbSheetNameCapitalize.LargeImage     = SheetCapitalizeImage;
            pbSheetFindReplace.LargeImage        = FindReplaceImage;
            pbSheetSelection.LargeImage          = SheetSelectionImage;
            pbSheetTitleblockKeyPlan.LargeImage  = SheetTitleblockKeyPlanImage;
            pbSheetViewReferenceSheet.LargeImage = SheetViewRefSheetImage;

            pbViewsFindReplace.LargeImage         = FindReplaceImage;
            pbViewsViewDeleteUnplaced.LargeImage  = ViewsViewDeleteunplacedImage;
            pbViewActiveToSheet.LargeImage        = SquareTImage;
            pbViewsChangeViewReference.LargeImage = ViewsChangeViewReferenceImage;

            pbToolsWarnings.LargeImage       = ToolsWarningsImage;
            pbToolsElemOfCategory.LargeImage = ToolsElemOfCategoryImage;
            pbToolsFamilyMultipleSharedParameters.LargeImage = ToolsFamilyMultipleSharedParametersImage;
            pbToolsLinkReloadAll.LargeImage = SquareTImage;

            pbMEPSpacesFromLinkedRooms.LargeImage = MEPSpacesFromLinkedRoomsImage;

            //Set Button Tool Tips
            pbTestButton.ToolTip              = "Tell the user what your button does here";
            pbSheetSelection.ToolTip          = "Select from all of the Sheets in the Model";
            pbSheetFindReplace.ToolTip        = "Find and Replace values in Sheet Name or Number";
            pbSheetNameCapitalize.ToolTip     = "Capitalize the Name of all Sheets in the Model";
            pbSheetTitleblockKeyPlan.ToolTip  = "Set Yes / No parameters of a Titleblock type based on search criteria of the Sheet Name or Sheet Number";
            pbSheetViewReferenceSheet.ToolTip = "Select a Viewport on a sheet to open the Refering Sheet for the associated View";

            pbViewsFindReplace.ToolTip         = "Find and Replace values in View Name or Title on Sheet";
            pbViewsViewDeleteUnplaced.ToolTip  = "Delete Views, View Templates, Schedules, and Legends that are not used";
            pbViewsChangeViewReference.ToolTip = "Change the Reference for all views that currently reference a different View";
            pbViewActiveToSheet.ToolTip        = "Place the Active View on the selected Sheet";

            pbToolsWarnings.ToolTip       = "Display and isolate Warnings in the Document";
            pbToolsElemOfCategory.ToolTip = "Get all Elements of selected Category";
            pbToolsFamilyMultipleSharedParameters.ToolTip = "Add the selected Shared Parameters in all Revit Families within the selected Directory";
            pbToolsLinkReloadAll.ToolTip = "Reload all Revit Links that are currently loaded";

            pbMEPSpacesFromLinkedRooms.ToolTip = "Create MEP Spaces for the Selected Rooms from a Linked Model";

            //Set Button Long description which is the text that flys out when you hover on a button longer
            pbTestButton.LongDescription     = "Give the user more information about how they need to use the button features";
            pbSheetSelection.LongDescription = "The Sheet Selection Form can be used in multiple ways to allow the user to select one or multiple sheets in the project and perform additiona actions on the sheets returned.";
        }
예제 #10
0
        public void Add_WTA_FP_Ribbon(UIControlledApplication a)
        {
            string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
            // create ribbon tab
            String thisTabNameFP = "WTA-FP";

            try {
                a.CreateRibbonTab(thisTabNameFP);
            } catch (Autodesk.Revit.Exceptions.ArgumentException) {
                // Assume error generated is due to "WTA" already existing
            }

            #region Add ribbon panels.
            //   Add ribbon panels.
            String      thisPanelNamBe    = "Be This";
            RibbonPanel thisRibbonPanelBe = a.CreateRibbonPanel(thisTabNameFP, thisPanelNamBe);

            String      thisPanelNameSprinklers   = "Sprinklers";
            RibbonPanel thisRibbonPanelSprinklers = a.CreateRibbonPanel(thisTabNameFP, thisPanelNameSprinklers);

            String      thisPanelNameAiming   = "3d Aiming";
            RibbonPanel thisRibbonPanelAiming = a.CreateRibbonPanel(thisTabNameFP, thisPanelNameAiming);
            #endregion

            ///Note that the full image name is namespace_prefix + "." + the actual imageName);
            ///pushButton.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), "PlunkOMaticTCOM.QVis.png");

            //   Create push button in this ribbon panel
            PushButtonData pbDataSprnkConc = new PushButtonData("SprnkConc", "Concealed", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceConcealedSprinklerInstance");
            PushButtonData pbDataSprnkRec  = new PushButtonData("SprnkRec", "Recessed", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceRecessedSprinklerInstance");
            PushButtonData pbDataSprnkPend = new PushButtonData("SprnkPend", "Pendent", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlacePendentSprinklerInstance");
            PushButtonData pbDataSprnkUp   = new PushButtonData("SprnkUp", "Upright", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceUprightSprinklerInstance");
            PushButtonData pbDataOppArray  = new PushButtonData("OppArray", "Design Array", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceSprinklerArrayTool");
            PushButtonData pbDataOppArea   = new PushButtonData("OppArea", "Oper Area", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceSprinklerOperAreaTool");

            PushButtonData pbDataSelectOnlySprink = new PushButtonData("SelSprnk", "PickOnly", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPickSprinksOnly");

            PushButtonData pbDataSetSprinkOps = new PushButtonData("SprnkOps", "Sprnk Ops", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdResetThisSprnkOps");
            pbDataSetSprinkOps.ToolTip = "Set design tool sprinkler spacing data.";
            string lDescDT = "The Design Array and Oper Area layout tool families take parameters";
            lDescDT += " that control the sprinkler operation area, spacing and array sizes. Those";
            lDescDT += " parameters can be set ahead of time as a persistent user settings so that";
            lDescDT += " it is not necessary to use the Revit properties setter to affect the desired values.";
            lDescDT += " The Sprnk Ops tool sets those values and allows you to apply them to a pick.";
            pbDataSetSprinkOps.LongDescription = lDescDT;
            pbDataSetSprinkOps.LargeImage      = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SprnkOps.png");
            pbDataSetSprinkOps.ToolTipImage    = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SetOpArea.PNG");


            PushButtonData pbBeFP = new PushButtonData("BeFP", "FireP", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBeFPWorkSet");
            pbBeFP.ToolTip = "Switch to Fire Protection Workset.";
            string lDescBeFP = "If you can't beat'm, join'm. Become FIRE PROTECTION workset.";
            pbBeFP.LongDescription = lDescBeFP;

            //   Set the large image shown on button
            //Note that the full image name is namespace_prefix + "." + the actual imageName);
            pbDataSprnkUp.Image   = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".Upright.png");
            pbDataSprnkConc.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".Concealed.png");
            pbDataSprnkPend.Image = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".Pendent.png");
            pbDataSprnkRec.Image  = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".Recessed.png");
            pbDataOppArea.Image   = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".OpArea.png");
            pbDataOppArray.Image  = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".OpArray.png");

            pbDataSelectOnlySprink.Image      = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".PickOnlySprnk16x16.png");
            pbDataSelectOnlySprink.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".PickOnlySprnk32x32.png");


            // add button tips (when data, must be defined prior to adding button.)
            pbDataSprnkConc.ToolTip = "Concealed Sprinkler";
            pbDataSprnkRec.ToolTip  = "Recessed Sprinkler";
            pbDataSprnkPend.ToolTip = "Pendent Sprinkler";
            pbDataSprnkUp.ToolTip   = "Upright Sprinkler";
            pbDataOppArea.ToolTip   = "Operation Area Tool";
            pbDataOppArray.ToolTip  = "Array Design Tool";

            pbDataSelectOnlySprink.ToolTip = "Pick Only Sprinklers";

            string lDesc          = "Places a sprinkler at the ceiling elevation set by picking a ceiling (if prompted).\n\n\u00A7 Workset will be FIRE PROTECTION.";
            string lDescTool      = "Places a sprinkler design tool at the ceiling elevation set by picking a ceiling.\n\n\u00A7 Workset will be FIRE PROTECTION.";
            string lDescPickOnlyS = "Swipe over anything. Only sprinklers are selected.";

            pbDataSprnkConc.LongDescription = lDesc;
            pbDataSprnkRec.LongDescription  = lDesc;
            pbDataSprnkPend.LongDescription = lDesc;
            pbDataSprnkUp.LongDescription   = lDesc;
            pbDataOppArray.LongDescription  = lDescTool;
            pbDataOppArea.LongDescription   = lDescTool;

            pbDataSelectOnlySprink.LongDescription = lDescPickOnlyS;

            RadioButtonGroupData rbgdSTD_EC = new RadioButtonGroupData("rbgdSTD_EC");
            RadioButtonGroup     rbgSTD_EC  = thisRibbonPanelSprinklers.AddItem(rbgdSTD_EC) as RadioButtonGroup;
            ToggleButtonData     tbSTD      = new ToggleButtonData("tbSTD", " STD ",
                                                                   ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetAs_STD");
            ToggleButtonData tbEC = new ToggleButtonData("tbEC", " EC ",
                                                         ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetAs_EC");
            tbSTD.ToolTip    = "Standard Coverage \nsprinklers will be placed.";
            tbEC.ToolTip     = "Extended Coverage \nsprinklers will be placed.";
            tbEC.LargeImage  = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".bt_EC.png");
            tbSTD.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".bt_STD.png");
            rbgSTD_EC.AddItem(tbSTD);
            rbgSTD_EC.AddItem(tbEC);

            // Not working
            //pbDataToggle_STD_EC = new PushButtonData("togbutdata_TOG_STD_EC", "STD/EC", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTogState_STD_EC");
            //pbDataToggle_STD_EC.ToolTip = "Standard Coverage/Extended Coverage";  // undetermined at this point
            //pbDataToggle_STD_EC.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".bt_STD24x24.png");
            //PushButton pushbutdata_TOG_STD_EC = thisNewRibbonPanel.AddItem(pbDataToggle_STD_EC) as PushButton;

            PushButtonData b1x1 = new PushButtonData("OSET_1x1", "1x1", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState1x1");
            PushButtonData b2x1 = new PushButtonData("OSET_2x1", "2x1", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState2x1");
            PushButtonData b3x1 = new PushButtonData("OSET_3x1", "3x1", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState3x1");
            PushButtonData b1x2 = new PushButtonData("OSET_1x2", "1x2", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState1x2");
            PushButtonData b1x3 = new PushButtonData("OSET_1x3", "1x3", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState1x3");
            PushButtonData b0x0 = new PushButtonData("OSET_0x0", "0x0", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSetOffsetState0x0");

            b1x1.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B1x1.png");
            b2x1.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B2x1.png");
            b3x1.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B3x1.png");
            b1x2.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B1x2.png");
            b1x3.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B1x3.png");
            b0x0.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".B0x0.png");

            b1x1.ToolTip = "Item placement will be offset\n" +
                           "1' by 1' from the pick point.\n" +
                           "Think lay-in ceiling tile.";
            b2x1.ToolTip = "Item placement will be offset\n" +
                           "2' by 1' from the pick point.\n" +
                           "Think lay-in ceiling tile.";
            b3x1.ToolTip = "Item placement will be offset\n" +
                           "3' by 1' from the pick point.\n" +
                           "Think lay-in ceiling tile.";
            b1x2.ToolTip = "Item placement will be offset\n" +
                           "1' by 2' from the pick point.\n" +
                           "Think lay-in ceiling tile.";
            b1x3.ToolTip = "Item placement will be offset\n" +
                           "1' by 3' from the pick point.\n" +
                           "Think lay-in ceiling tile.";
            b0x0.ToolTip = "Item placement will be at the\n" +
                           "pick point.";

            SplitButtonData sbOffSetData = new SplitButtonData("splitOffSets", "Loc");
            SplitButton     sbOffSet     = thisRibbonPanelSprinklers.AddItem(sbOffSetData) as SplitButton;
            sbOffSet.AddPushButton(b1x1);
            sbOffSet.AddPushButton(b2x1);
            sbOffSet.AddPushButton(b3x1);
            sbOffSet.AddPushButton(b1x2);
            sbOffSet.AddPushButton(b1x3);
            sbOffSet.AddPushButton(b0x0);


            #region 3dAiming
            PushButtonData pbReset3dAiming  = new PushButtonData("Reset3dAim", "Reset 3D Aiming", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdAimResetRotateOne3DMany");
            PushButtonData pbSingle3dAiming = new PushButtonData("Single3DAim", "Single 3D Aim", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSprinkRot3D");
            PushButtonData pbMany3dAiming   = new PushButtonData("Many3dAim", "Many 3D Aim", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdSprinkRot3DMany");

            pbReset3dAiming.ToolTip = "Reset 3D aimed objects\n" +
                                      "to zero state.";
            pbSingle3dAiming.ToolTip = "3D aim a single object\n" +
                                       "to a target point.";
            pbMany3dAiming.ToolTip = "3D aim multiple objects\n" +
                                     "to the same target point.";
            #endregion

            // add to ribbon panelA
            // List<RibbonItem> projectButtonsBe = new List<RibbonItem>();
            // projectButtonsBe.AddRange(thisRibbonPanelBe.AddStackedItems(pbBeFP, another etc));
            thisRibbonPanelBe.AddItem(pbBeFP);

            // add to ribbon panel
            List <RibbonItem> sprnkButtons = new List <RibbonItem>();
            sprnkButtons.AddRange(thisRibbonPanelSprinklers.AddStackedItems(pbDataSprnkConc, pbDataSprnkRec, pbDataSprnkPend));
            sprnkButtons.AddRange(thisRibbonPanelSprinklers.AddStackedItems(pbDataSprnkUp, pbDataOppArray, pbDataOppArea));

            thisRibbonPanelSprinklers.AddSeparator();
            PushButton pushButtonSprnkOps = thisRibbonPanelSprinklers.AddItem(pbDataSetSprinkOps) as PushButton;

            thisRibbonPanelSprinklers.AddSeparator();
            PushButton pushButtonSelSprnk = thisRibbonPanelSprinklers.AddItem(pbDataSelectOnlySprink) as PushButton;

            // This is to another panel. No separator needed.
            List <RibbonItem> aimerButtons = new List <RibbonItem>();
            aimerButtons.AddRange(thisRibbonPanelAiming.AddStackedItems(pbSingle3dAiming, pbMany3dAiming, pbReset3dAiming));

            /// Anything added after slideout it declared can only be in the slideout
            thisRibbonPanelBe.AddSlideOut();
            PushButtonData bInfo = new PushButtonData("Info", "Info", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdOpenDocFolder");
            bInfo.ToolTip    = "See the help document regarding this.";
            bInfo.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".InfoLg.png");
            thisRibbonPanelBe.AddItem(bInfo);
            thisRibbonPanelSprinklers.AddSlideOut();
            thisRibbonPanelSprinklers.AddItem(bInfo);
        } // AddRibbon
예제 #11
0
        public Result OnStartup(UIControlledApplication a)
        {
            _mMyForm = null; // no dialog needed yet; the command will bring it
            ThisApp  = this; // static access to this application instance

            BrickDimUpdater updater = new BrickDimUpdater(a.ActiveAddInId);

            Debug.Print("register");
            UpdaterRegistry.RegisterUpdater(updater);
            ElementCategoryFilter f = new ElementCategoryFilter(BuiltInCategory.OST_Dimensions);

            Debug.Print("filter");
            UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), f, Element.GetChangeTypeAny());


            // Method to add Tab and Panel
            RibbonPanel panel = RibbonPanel(a);

            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            // BUTTON FOR COLOURING DIMENSIONS
            if (panel.AddItem(
                    new PushButtonData("Colour", "Colour\nIn View", thisAssemblyPath,
                                       "BrickDims.BrickDimsColourOverride")) is PushButton button2)
            {
                button2.ToolTip = "Visual interface for debugging applications.";
                Uri         uriImageB2   = new Uri("pack://application:,,,/BrickDims;component/Resources/brick-Rainbow.png");
                BitmapImage largeImageB2 = new BitmapImage(uriImageB2);
                button2.LargeImage = largeImageB2;
            }

            //panel.AddSeparator();

            /// <summary>
            /// Control buttons for the Dynamic Model Update
            /// </summary>
            ToggleButtonData toggleButtonData3
                = new ToggleButtonData("UpdaterStoptxtOff", "Stop\nAuto", thisAssemblyPath, "BrickDims.UIDynamicModelUpdateOff");
            Uri         uriImageTB3   = new Uri("pack://application:,,,/BrickDims;component/Resources/stop-big.png");
            BitmapImage largeImageTB3 = new BitmapImage(uriImageTB3);

            toggleButtonData3.LargeImage = largeImageTB3;


            ToggleButtonData toggleButtonData4
                = new ToggleButtonData("UpdaterPlaytxtOff", "Start\nAuto", thisAssemblyPath, "BrickDims.UIDynamicModelUpdateOn");
            Uri         uriImageTB4   = new Uri("pack://application:,,,/BrickDims;component/Resources/play-big.png");
            BitmapImage largeImageTB4 = new BitmapImage(uriImageTB4);

            toggleButtonData4.LargeImage = largeImageTB4;

            //TextBoxData brkDimTxt = new TextBoxData("Pause Play Updater");

            //panel.AddItem(toggleButtonData3);
            //panel.AddItem(toggleButtonData4);

            // make dyn update on/off radio button group

            RadioButtonGroupData radioBtnGroupData2 = new RadioButtonGroupData("Updater");

            //IList<RibbonItem> stackedGroup1 = panel.AddStackedItems(toggleButtonData4, toggleButtonData3);
            //as RadioButtonGroup;
            RadioButtonGroup radioBtnGroup2 = panel.AddItem(radioBtnGroupData2) as RadioButtonGroup;

            radioBtnGroup2.AddItem(toggleButtonData3);
            radioBtnGroup2.AddItem(toggleButtonData4);


            // listeners/watchers for external events (if you choose to use them)
            a.ApplicationClosing += a_ApplicationClosing; //Set Application to Idling
            a.Idling             += a_Idling;

            //turn off text in buttons where we want it
            setButtonNoText();

            panel.AddSeparator();

            // BUTTON FOR THE SINGLE-THREADED WPF OPTION
            if (panel.AddItem(
                    new PushButtonData("Brick Dim Selector", "Selector", thisAssemblyPath,
                                       "BrickDims.EntryCommand")) is PushButton button)
            {
                // defines the tooltip displayed when the button is hovered over in Revit's ribbon
                button.ToolTip = "Visual interface for debugging applications.";
                // defines the icon for the button in Revit's ribbon - note the string formatting
                Uri         uriImageB1   = new Uri("pack://application:,,,/BrickDims;component/Resources/brick-Small.png");
                BitmapImage largeImageB1 = new BitmapImage(uriImageB1);
                button.LargeImage = largeImageB1;
            }

            return(Result.Succeeded);
        }
예제 #12
0
        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);
        }
예제 #13
0
        private void SetupUI(UIControlledApplication application)
        {
            RibbonPanel panel = application.CreateRibbonPanel("STL import");

            PushButtonData stlImportButton = new PushButtonData("StlImport", "Import STL file",
                                                                addinAssemblyPath, typeof(StlImport.StlImportCommand).FullName);
            PushButton button = panel.AddItem(stlImportButton) as PushButton;

            //SetIconsForPushButton(button, StlImport.Properties.Resources.StrcturalWall);

            panel = application.CreateRibbonPanel("STL import properties");

            RadioButtonGroupData radioGroupData = new RadioButtonGroupData("Mode");
            RadioButtonGroup     radioGroup     = panel.AddItem(radioGroupData) as RadioButtonGroup;

            ToggleButtonData solidButton = new ToggleButtonData("SetModeToSolid", "Solid",
                                                                addinAssemblyPath, typeof(StlImport.SetToSolidCommand).FullName);
            ToggleButton solid = radioGroup.AddItem(solidButton);

            /*
             * ToggleButtonData anyGeometryButton = new ToggleButtonData("SetModeToAnyGeometry", "Any Geometry",
             * addinAssemblyPath, typeof(StlImport.SetToAnyGeometryCommand).FullName);
             * ToggleButton anyGeometry = radioGroup.AddItem(anyGeometryButton) as ToggleButton;
             */
            ToggleButtonData polymeshButton = new ToggleButtonData("SetModeToPolymesh", "Polymesh",
                                                                   addinAssemblyPath, typeof(StlImport.SetToPolymeshCommand).FullName);

            radioGroup.AddItem(polymeshButton);

            radioGroup.Current = solid;

            panel.AddSeparator();

            radioGroupData = new RadioButtonGroupData("Style");
            radioGroup     = panel.AddItem(radioGroupData) as RadioButtonGroup;

            ToggleButtonData noneButton = new ToggleButtonData("SetStyleToNone", "None",
                                                               addinAssemblyPath, typeof(StlImport.SetStyleToNoneCommand).FullName);

            radioGroup.AddItem(noneButton);

            ToggleButtonData sketchStyleButton = new ToggleButtonData("SetStyleToSketch", "Sketch",
                                                                      addinAssemblyPath, typeof(StlImport.SetStyleToSketchCommand).FullName);

            radioGroup.AddItem(sketchStyleButton);

            panel.AddSeparator();

            radioGroupData = new RadioButtonGroupData("DataType");
            radioGroup     = panel.AddItem(radioGroupData) as RadioButtonGroup;

            ToggleButtonData binaryButton = new ToggleButtonData("SetDataTypeToBinary", "Binary",
                                                                 addinAssemblyPath, typeof(StlImport.SetDataTypeToBinaryCommand).FullName);

            radioGroup.AddItem(binaryButton);

            ToggleButtonData asciiButton = new ToggleButtonData("SetDataTypeToASCII", "ASCII",
                                                                addinAssemblyPath, typeof(StlImport.SetDataTypeToASCIICommand).FullName);

            radioGroup.AddItem(asciiButton);
        }
예제 #14
0
        public Result OnStartup(UIControlledApplication a)
        {
            //Allow for the folderpath to connect dll file as well as images
            //Do this for efficiency
            string folderPath = @"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug";
            string dll        = Path.Combine(folderPath, "CustomTabRibbon.dll");

            //Create Custom Tab
            string TheRibbon = "Custom TAB";

            a.CreateRibbonTab(TheRibbon);

            //Create Seperated Panels
            RibbonPanel panelA = a.CreateRibbonPanel(TheRibbon, "A");
            RibbonPanel panelB = a.CreateRibbonPanel(TheRibbon, "B");
            RibbonPanel panelC = a.CreateRibbonPanel(TheRibbon, "C");
            RibbonPanel panelD = a.CreateRibbonPanel(TheRibbon, "D");
            RibbonPanel panelE = a.CreateRibbonPanel(TheRibbon, "E");
            RibbonPanel panelF = a.CreateRibbonPanel(TheRibbon, "F");


/////////////
            //STANDARD BUTTONS One and Two on Panel A
/////////////
            //--LargeImage--32x32 image seen in panel
            //--Image--16x16 when added to quick access tool bar
            //--ToolTipImage-- unknown png size
            PushButton btnOne = (PushButton)panelA.AddItem(new PushButtonData("One", "One", dll, "CustomTabRibbon.One"));
            //btnOne.LargeImage = new BitmapImage(new Uri(Path.Combine(folderPath, "image32.png"), UriKind.Absolute));
            Uri         uriImage   = new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\32Groot.png");
            BitmapImage largeImage = new BitmapImage(uriImage);

            btnOne.LargeImage      = largeImage; //Actually attaches image to button one - panel A
            btnOne.ToolTip         = "This is a tool tip!";
            btnOne.LongDescription = "This is a lonnnnnnnnnnnnng description!";

            PushButton  btnTwo      = (PushButton)panelA.AddItem(new PushButtonData("Two", "Two", dll, "CustomTabRibbon.Two"));
            Uri         uriImage2   = new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\32Hacker.png");
            BitmapImage largeImage2 = new BitmapImage(uriImage2);

            btnTwo.LargeImage      = largeImage2;
            btnTwo.ToolTip         = "This is a tool tip!";
            btnTwo.LongDescription = "This is a lonnnnnnnnnnnnng description!";

            PushButton  btnThree     = (PushButton)panelA.AddItem(new PushButtonData("Three", "Three", dll, "CustomTabRibbon.Two"));
            Uri         uriImage11   = new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\32Ironman.png");
            BitmapImage largeImage11 = new BitmapImage(uriImage11);

            btnThree.LargeImage      = largeImage11;
            btnThree.ToolTip         = "This is a tool tip!";
            btnThree.LongDescription = "This is a lonnnnnnnnnnnnng description!";

/////////////
            //PULLDOWN LIST
/////////////
            PulldownButtonData pullDownData   = new PulldownButtonData("My PullDown", "My PullDown");
            PulldownButton     pullDownButton = panelB.AddItem(pullDownData) as PulldownButton;

            pullDownButton.LargeImage = new BitmapImage(new Uri(Path.Combine(folderPath, "24Penguin.png"), UriKind.Absolute));

//            Uri uriImage3 = new Uri(@"C:\Samples\AddPanel\AddPanel\bin\Debug\hacker_icon.png");
//            BitmapImage largeImage3 = new BitmapImage(uriImage3);
//            pullDownButton.LargeImage = largeImage3;

            PushButton btnTagAllByCategory  = pullDownButton.AddPushButton(new PushButtonData("One", "Item One", dll, "CustomTabRibbon.One"));
            PushButton btnTagAllBySelection = pullDownButton.AddPushButton(new PushButtonData("Two", "Item Two", dll, "CustomTabRibbon.Two"));
            PushButton btnTagAllByFamily    = pullDownButton.AddPushButton(new PushButtonData("Three", "Item Three", dll, "CustomTabRibbon.Three"));

/////////////
            //STACKED LIST
/////////////
            PushButtonData dataHelp     = new PushButtonData("Help", "Help", dll, "CustomTabRibbon.help");
            PushButtonData dataAbout    = new PushButtonData("About", "About", dll, "CustomTabRibbon.about");
            PushButtonData dataFeedback = new PushButtonData("Feedback", "Feedback", dll, "CustomTabRibbon.feedback");

            IList <RibbonItem> stackedList = panelC.AddStackedItems(dataHelp, dataAbout, dataFeedback);

            PushButton btnHelp = (PushButton)stackedList[0];

            btnHelp.Image = new BitmapImage(new Uri(Path.Combine(folderPath, "16Smileface.png"), UriKind.Absolute));
//            Uri uriImage4 = new Uri(@"C:\Samples\AddPanel\AddPanel\bin\Debug\hacker_icon.png");
//            BitmapImage largeImage4 = new BitmapImage(uriImage4);
//            btnHelp.LargeImage = largeImage4;
//            BitmapImage smallImage = new BitmapImage(uriImage4);
//            btnHelp.Image = smallImage;
            btnHelp.ToolTip = "Click for help!";

            PushButton btnAbout = (PushButton)stackedList[1];

            btnAbout.Image = new BitmapImage(new Uri(Path.Combine(folderPath, "16Snapghost.png"), UriKind.Absolute));
//            Uri uriImage5 = new Uri(@"C:\Samples\AddPanel\AddPanel\bin\Debug\hacker_icon.png");
//            BitmapImage largeImage5 = new BitmapImage(uriImage5);
//            btnAbout.LargeImage = largeImage5;
//            BitmapImage smallImage = new BitmapImage(uriImage4);
//            btnHelp.Image = smallImage;
            btnAbout.ToolTip = "About these tools";

            PushButton btnFeedback = (PushButton)stackedList[2];

            btnFeedback.Image = new BitmapImage(new Uri(Path.Combine(folderPath, "16Tesseract.png"), UriKind.Absolute));
//            Uri uriImage6 = new Uri(@"C:\Samples\AddPanel\AddPanel\bin\Debug\hacker_icon.png");
//            BitmapImage largeImage6 = new BitmapImage(uriImage6);
//            btnFeedback.LargeImage = largeImage6;
//            BitmapImage smallImage = new BitmapImage(uriImage4);
//            btnHelp.Image = smallImage;
            btnFeedback.ToolTip = "Want some feedback?";


/////////////
            //RADIO BUTTONS
/////////////
            RadioButtonGroupData radioData        = new RadioButtonGroupData("radioGroup");
            RadioButtonGroup     radioButtonGroup = panelD.AddItem(radioData) as RadioButtonGroup;

            // create toggle buttons and add to radio button group
            ToggleButtonData tb1 = new ToggleButtonData("toggleButton1", "Red");

            tb1.ToolTip    = "Red Option";
            tb1.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\24red.png"));

            ToggleButtonData tb2 = new ToggleButtonData("toggleButton2", "Green");

            tb2.ToolTip    = "Green Option";
            tb2.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\24green.png"));

            ToggleButtonData tb3 = new ToggleButtonData("toggleButton3", "Yellow");

            tb3.ToolTip    = "Yellow Option";
            tb3.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\24yellow.png"));

            radioButtonGroup.AddItem(tb1);
            radioButtonGroup.AddItem(tb2);
            radioButtonGroup.AddItem(tb3);

/////////////
            //SPLIT BUTTON
/////////////
            string assembly = @"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\CustomTabRibbon.dll";

            // create push buttons for split button drop down
            PushButtonData bOne = new PushButtonData("ButtonNameA", "Option One", assembly, "CustomTabRibbon.One");

            bOne.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\8One.png"));

            PushButtonData bTwo = new PushButtonData("ButtonNameB", "Option Two", assembly, "CustomTabRibbon.Two");

            bTwo.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\8one.png"));

            PushButtonData bThree = new PushButtonData("ButtonNameC", "Option Three", assembly, "CustomTabRibbon.Three");

            bThree.LargeImage = new BitmapImage(new Uri(@"C:\Samples\CustomTabRibbon\CustomTabRibbon\bin\Debug\8one.png"));

            SplitButtonData sb1 = new SplitButtonData("splitButton1", "Split");
            SplitButton     sb  = panelE.AddItem(sb1) as SplitButton;

            sb.AddPushButton(bOne);
            sb.AddPushButton(bTwo);
            sb.AddPushButton(bThree);

/////////////
            //Search
/////////////
            //PushButton btnFive = (PushButton)panelF.AddItem(new PushButtonData("Five", "Five", dll, "CustomTabRibbon.SelectFilterWalls"));


            return(Result.Succeeded);
        }