Example #1
0
        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 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);
        }
        /// <summary>
        /// Adds buttons to the Revit ribbon.
        /// </summary>
        /// <param name="uiApp">The UI application.</param>
        /// <param name="items">The items.</param>
        /// <param name="ribbonPanelName">Name of the ribbon panel.</param>
        /// <param name="ribbonTabName">Name of the ribbon tab.</param>
        internal static void AddButtons(
            UIControlledApplication uiApp,
            IEnumerable <RibbonButton> items,
            string ribbonPanelName = "",
            string ribbonTabName   = "")
        {
            if (uiApp is null)
            {
                throw new ArgumentNullException(nameof(uiApp));
            }

            ribbonPanelName = string.IsNullOrWhiteSpace(ribbonPanelName)
                ? nameof(Addin)
                : ribbonPanelName;

            RibbonPanel ribbonPanel = null;

            try
            {
                uiApp.CreateRibbonTab(ribbonTabName);

                // Add a new ribbon panel
                ribbonPanel = string.IsNullOrWhiteSpace(ribbonTabName)
                    ? uiApp.CreateRibbonPanel(ribbonPanelName)
                    : uiApp.CreateRibbonPanel(ribbonTabName, ribbonPanelName);
            }
            finally
            {
                foreach (var ribbonButton in items)
                {
                    ribbonPanel?.AddItem(ribbonButton);
                }
            }
        }
 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()));
 }
Example #5
0
 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";
 }
Example #6
0
 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);
 }
Example #7
0
        //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);
        }
Example #8
0
        /// <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 );
        }
        public static void AddButtons(
            UIControlledApplication uiApp,
            IEnumerable <RibbonButton> items,
            string ribbonPanelName = "",
            string ribbonTabName   = "")
        {
            ribbonPanelName = string.IsNullOrWhiteSpace(ribbonPanelName)
                ? nameof(RevitAddin)
                : ribbonPanelName;

            RibbonPanel ribbonPanel = null;

            try
            {
                uiApp.CreateRibbonTab(ribbonTabName);
            }
            catch
            {
                TaskDialog.Show("Error", $"Failed to create the following '{ribbonTabName}' ribbon.");
            }

            try
            {
                // Add a new ribbon panel
                ribbonPanel = string.IsNullOrWhiteSpace(ribbonTabName)
                    ? uiApp.CreateRibbonPanel(ribbonPanelName)
                    : uiApp.CreateRibbonPanel(ribbonTabName, ribbonPanelName);
            }
            finally
            {
                foreach (var ribbonButton in items)
                {
                    ribbonPanel?.AddItem(ribbonButton);
                }
            }
        }
        /// <summary>
        /// Adds buttons to the Revit ribbon.
        /// </summary>
        /// <param name="uiApp">The UI application.</param>
        /// <param name="items">The items.</param>
        /// <param name="ribbonPanelName">Name of the ribbon panel.</param>
        /// <param name="ribbonTabName">Name of the ribbon tab.</param>
        public static void AddButtons(
            UIControlledApplication uiApp,
            IEnumerable <RibbonButton> items,
            string ribbonPanelName = "",
            string ribbonTabName   = ""
            )
        {
            ribbonPanelName = string.IsNullOrWhiteSpace(ribbonPanelName)
                ? nameof(RevitAddin)
                : ribbonPanelName;

            RibbonPanel ribbonPanel = null;

            try
            {
                uiApp.CreateRibbonTab(ribbonTabName);
            }
            finally
            {
            }

            try
            {
                // Add a new ribbon panel
                ribbonPanel = string.IsNullOrWhiteSpace(ribbonTabName)
                    ? uiApp.CreateRibbonPanel(ribbonPanelName)
                    : uiApp.CreateRibbonPanel(ribbonTabName, ribbonPanelName);
            }
            finally
            {
                foreach (var ribbonButton in items)
                {
                    ribbonPanel?.AddItem(ribbonButton);
                }
            }
        }
        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;
        }
        public Result OnStartup(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            string tabName = "CRM Tools";

            application.CreateRibbonTab(tabName);

            string revitVersion = string.Empty;

            revitVersion = "v2015";

            string commandsPath = "";

            commandsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + revitVersion + @"\Commands\";

            string iconsPath = "";

            iconsPath = @"C:\Users\" + Environment.UserName + @"\Documents\CRMRevitTools\" + revitVersion + @"\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";

            // 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 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));

            #endregion

            return(Result.Succeeded);
        }
Example #13
0
        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 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 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 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(btnSharedParameterCreator));
            productionButtons.Add(pnlProductionPanel.AddItem(btnCreateSheetSet));
            productionButtons.Add(pnlProductionPanel.AddItem(btnSheetRenamer));
            productionButtons.Add(pnlProductionPanel.AddItem(btnProjectParameters));
            productionButtons.Add(pnlProductionPanel.AddItem(btnRevisionOnSheets));

            #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);
        }
Example #14
0
        public void AddElec_WTA_ELEC_Ribbon(UIControlledApplication a)
        {
            string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
            // create ribbon tab
            String thisNewTabName = "WTA-ELEC";

            try {
                a.CreateRibbonTab(thisNewTabName);
            } catch (Autodesk.Revit.Exceptions.ArgumentException) {
                // Assume error generated is due to "WTA" already existing
            }
            //   Add ribbon panels.
            String      thisNewPanelBe       = "Be This";
            RibbonPanel thisNewRibbonPanelBe = a.CreateRibbonPanel(thisNewTabName, thisNewPanelBe);

            String      thisNewPanelNamLFixt    = "Light Fixtures";
            RibbonPanel thisNewRibbonPanelLFixt = a.CreateRibbonPanel(thisNewTabName, thisNewPanelNamLFixt);

            String      thisNewPanelNameAim   = "Aiming Lights";
            RibbonPanel thisNewRibbonPanelAim = a.CreateRibbonPanel(thisNewTabName, thisNewPanelNameAim);

            //System.Windows.MessageBox.Show(a.GetRibbonPanels(thisNewTabName).Count.ToString());

            //   Create push buttons
            PushButtonData pbTwoPickTagLight  = new PushButtonData("TwoPickLightingTag", "Two Pick\nLighting Tag", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickLightingTag");
            PushButtonData pbTwoPickTagSwitch = new PushButtonData("TwoPickSwitchTag", "Two Pick\nDevice Tag", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickSwitchTag");
            PushButtonData pbTwoPickAimLight  = new PushButtonData("AimLight", " Aim ", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdTwoPickLightRot");
            PushButtonData pbAimManyLights    = new PushButtonData("AimManyLights", " Aim Many", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdAimManyLights");

            PushButtonData pbBeLighting        = new PushButtonData("BeLighting", "Lighting", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBeLightingWorkSet");
            PushButtonData pbBePower           = new PushButtonData("BePower", "Power", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBePowerWorkSet");
            PushButtonData pbBeAuxiliary       = new PushButtonData("BeAuxiliary", "Auxiliary", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdBeAuxiliaryWorkSet");
            PushButtonData pbSelOnlyLights     = new PushButtonData("SelOnlyLightFix", "Only Fixtures", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPickOnlyLights");
            PushButtonData pbSelOnlyDevices    = new PushButtonData("SelOnlyDevices", "Only Devices", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPickOnlyDevices");
            PushButtonData pbLightingReporter  = new PushButtonData("LRPT", "Room Picker", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdRoomLightingReporter");
            PushButtonData pbLightingTotReport = new PushButtonData("LRPTOT", "LPD Totalizer", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdRoomsLightPwrDensityReport");

            PushButtonData pbOCCDetTool = new PushButtonData("OCCDetTool", "OCC Det Tool", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdPlaceOCCSensorToolInstance");

            pbOCCDetTool.ToolTip = "Places Occupancy sensor detection tool.";
            string lDescOCCDetTool = "Requires a linked ceiling pick to set the sensor detection family tool's parameter. The tool adjusts the detection pattern " +
                                     "according to the ceiling height from the ceiling pick. Without a ceiling, place otherwise and manually change the instance parameter as needed. " +
                                     "Use the family's type selector to get the detection pattern you are interested in. " +
                                     "The tool is placed on a diagnostic workset that will be created if needed.";

            pbOCCDetTool.LongDescription = lDescOCCDetTool;
            pbOCCDetTool.ToolTipImage    = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SENSDETLG.PNG");
            pbOCCDetTool.Image           = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".SENSDETSM.PNG");


            //   Set the large image shown on button
            //Note that the full image name is namespace_prefix + "." + the actual imageName);
            pbTwoPickTagLight.LargeImage  = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TwoPickTag.png");
            pbTwoPickTagSwitch.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".TwoPickTagSwitch.png");

            // add button tips (when data, must be defined prior to adding button.)
            pbTwoPickTagLight.ToolTip  = "Places lighting tag in two or less picks.";
            pbTwoPickTagSwitch.ToolTip = "Places device tag in two or less picks.";

            pbTwoPickAimLight.ToolTip = "2D Aims a non hosted light.";
            pbAimManyLights.ToolTip   = "2D Aims a selection of non hosted lights.";

            pbBeLighting.ToolTip     = "Switch to Lighting Workset.";
            pbBePower.ToolTip        = "Switch to Power Workset.";
            pbBeAuxiliary.ToolTip    = "Switch to Auxiliary Workset.";
            pbSelOnlyLights.ToolTip  = "Selecting only lighting fixtures.";
            pbSelOnlyDevices.ToolTip = "Selecting only lighting devices.";

            pbLightingReporter.ToolTip = "Reports on all lighting in a room.";

            string lDescpbTwoPickTagLight = "Places the lighting tag in two picks.\nThe first pick selects the light fixture.\nThe second pick is the tag location.";
            string lDescpbTwoPickAimLight = "Pick a light.\nThen pick where it is supposed to aim.";
            string lDescpbAimManyLights   = "Select a bunch of lights.\nThen pick the one spot where they all should aim towards.";
            string lDescpb3DAim           = "The special element has to be a Sprinkler category family instance.";
            string lDescSelOnlyLights     = "Swipe over anything. Only lighting fixtures are selected.";
            string lDescSelOnlyDevices    = "Swipe over anything. Only lighting devices are selected.";
            string lDescBeLighting        = "If you can't beat'm, join'm. Become Elec Lighting workset.";
            string lDescBePower           = "If you can't beat'm, join'm. Become Elec Power workset.";
            string lDescBeAuxiliary       = "If you can't beat'm, join'm. Become Elec Auxiliary workset.";

            pbTwoPickTagLight.LongDescription = lDescpbTwoPickTagLight;
            pbTwoPickAimLight.LongDescription = lDescpbTwoPickAimLight;
            pbAimManyLights.LongDescription   = lDescpbAimManyLights;
            pbSelOnlyLights.LongDescription   = lDescSelOnlyLights;
            pbSelOnlyDevices.LongDescription  = lDescSelOnlyDevices;
            pbBeLighting.LongDescription      = lDescBeLighting;
            pbBePower.LongDescription         = lDescBePower;
            pbBeAuxiliary.LongDescription     = lDescBeAuxiliary;

            // add to ribbon panelA
            List <RibbonItem> projectButtonsA = new List <RibbonItem>();

            projectButtonsA.AddRange(thisNewRibbonPanelBe.AddStackedItems(pbBeLighting, pbBePower, pbBeAuxiliary));

            // add to ribbon panelB
            thisNewRibbonPanelLFixt.AddItem(pbTwoPickTagLight);
            thisNewRibbonPanelLFixt.AddItem(pbTwoPickTagSwitch);
            thisNewRibbonPanelLFixt.AddSeparator();
            List <RibbonItem> projectButtonsB = new List <RibbonItem>();

            projectButtonsB.AddRange(thisNewRibbonPanelLFixt.AddStackedItems(pbSelOnlyLights, pbSelOnlyDevices));
            thisNewRibbonPanelLFixt.AddSeparator();
            List <RibbonItem> projectButtonsBB = new List <RibbonItem>();

            projectButtonsBB.AddRange(thisNewRibbonPanelLFixt.AddStackedItems(pbLightingReporter, pbOCCDetTool, pbLightingTotReport));

            // add to ribbon panelC
            List <RibbonItem> projectButtonsC = new List <RibbonItem>();

            projectButtonsC.AddRange(thisNewRibbonPanelAim.AddStackedItems(pbTwoPickAimLight, pbAimManyLights));
            //projectButtons.AddRange(thisNewRibbonPanel.AddStackedItems(pbData2DN, pbData4DN, pbDataAPN));

            thisNewRibbonPanelBe.AddSlideOut();
            PushButtonData bInfo = new PushButtonData("Info", "Info", ExecutingAssemblyPath, ExecutingAssemblyName + ".CmdOpenDocFolder");

            bInfo.ToolTip    = "See the help document regarding this.";
            bInfo.LargeImage = NewBitmapImage(System.Reflection.Assembly.GetExecutingAssembly(), ExecutingAssemblyName + ".InfoLg.png");
            thisNewRibbonPanelBe.AddItem(bInfo);

            thisNewRibbonPanelLFixt.AddSlideOut();
            thisNewRibbonPanelLFixt.AddItem(bInfo);
        } // AddMech_WTA_Elec_Ribbon
Example #15
0
        public Result OnStartup(UIControlledApplication application)
        {
            _instance    = this;
            _application = application;

            try
            {
                _serviceHost = new ServiceHost(typeof(SockeyeService), new Uri("net.pipe://localhost/mcneel/sockeyeserver/1/server"));
            }
            catch
            {
                TaskDialog.Show("Sockeye", "Failed to create Sockeye service host.");
                throw;
            }

            try
            {
                _serviceHost.AddServiceEndpoint(typeof(ISockeyeService), new NetNamedPipeBinding(), "pipe");
            }
            catch
            {
                TaskDialog.Show("Sockeye", "Failed to create Sockeye service end point.");
                throw;
            }

            try
            {
                ServiceDebugBehavior debugBehavior = _serviceHost.Description.Behaviors.Find <ServiceDebugBehavior>();
                if (null == debugBehavior)
                {
                    debugBehavior = new ServiceDebugBehavior();
                    debugBehavior.IncludeExceptionDetailInFaults = true;
                    _serviceHost.Description.Behaviors.Add(debugBehavior);
                }
                else
                {
                    debugBehavior.IncludeExceptionDetailInFaults = true;
                }
            }
            catch
            {
                TaskDialog.Show("Sockeye", "Failed to create Sockeye service debug behavior.");
                throw;
            }

            try
            {
                _serviceHost.Open();
            }
            catch
            {
                TaskDialog.Show("Sockeye", "Failed to open Sockeye service.");
                throw;
            }

            RibbonPanel ribbonPanel = application.CreateRibbonPanel(_assemblyTitle);

            PushButton pushButton = ribbonPanel.AddItem(new PushButtonData(
                                                            _assemblyTitle, _assemblyTitle, _assemblyLocation, "SockeyeServer.Commands.CmdAbout")) as PushButton;

            Bitmap logo = SockeyeServer.Properties.Resources.Logo_32_32;

            BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
                logo.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            pushButton.LargeImage = bitmapSource;
            pushButton.Image      = bitmapSource;

            return(Result.Succeeded);
        }
Example #16
0
        public Result OnStartup(UIControlledApplication a)
        {
            kilargo.properities.pass = true;
            a.Idling += OnIdling;

            _app = this;
            // Create a custom ribbon tab
            String tabName = "Kilargo";

            a.CreateRibbonTab(tabName);

            //ribbonPanel = a.CreateRibbonPanel(tabName, "Login");
            //ribbonPanel2 = a.CreateRibbonPanel(tabName, "Logout");
            ribbonPanel1 = a.CreateRibbonPanel(tabName, "Kilargo Products");

            // Create a push button to trigger a command add it to the ribbon panel.
            // string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            //PushButtonData buttonData = new PushButtonData("Login", "Login", assyPath, "Kilargo.Command");

            //pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
            //_button = pushButton;

            //PushButtonData buttonData2 = new PushButtonData("Logout", "Logout", assyPath, "Kilargo.logout");
            //pushButton2 = ribbonPanel2.AddItem(buttonData2) as PushButton;


            PushButtonData buttonData1 = new PushButtonData("Kilargo", "Products", assyPath, "Kilargo.Products1");
            PushButton     pushButton1 = ribbonPanel1.AddItem(buttonData1) as PushButton;

            // Optionally, other properties may be assigned to the button
            // a) tool-tip
            //pushButton.ToolTip = "Kilargo Login";
            pushButton1.ToolTip = "Kilargo Revit File Downloader";

            //Uri uriImagel = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/login.png");
            //BitmapImage largeImagelarge = new BitmapImage(uriImagel);

            //// b) large bitmap
            //Uri uriImage = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/icon1.ico");
            //BitmapImage largeImage = new BitmapImage(uriImage);
            //pushButton.LargeImage = largeImage;
            //pushButton.ToolTipImage = largeImagelarge;
            //ribbonPanel2.Visible = false;



            //Uri uriImagel22 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/logout.png");
            //BitmapImage largeImagelarge2 = new BitmapImage(uriImagel22);

            //Uri uriImage2 = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/icon2.ico");

            //BitmapImage largeImage2 = new BitmapImage(uriImage2);
            //pushButton2.LargeImage = largeImage2;
            //pushButton2.ToolTipImage = largeImagelarge2;



            Uri         uriImagel3       = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/kilargo.png");
            BitmapImage largeImagelarge3 = new BitmapImage(uriImagel3);

            Uri         uriImage1   = new Uri(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/favicon (18).ico");
            BitmapImage largeImage1 = new BitmapImage(uriImage1);

            pushButton1.LargeImage   = largeImage1;
            pushButton1.ToolTipImage = largeImagelarge3;
            ribbonPanel1.Enabled     = true;


            return(Result.Succeeded);
        }
        private static void AddUngroupedCommands(string dllfullpath, RibbonPanel ribbonPanel, List<Command> commands)
        {
            // add canned commands as stacked pushbuttons (try to pack 3 commands per pushbutton, then 2)
            while (commands.Count > 4 || commands.Count == 3)
            {
                // remove first three commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                var command2 = commands[2];
                commands.RemoveAt(0);
                commands.RemoveAt(0);
                commands.RemoveAt(0);

                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image = command1.SmallImage;
                pbdB.LargeImage = command1.LargeImage;

                PushButtonData pbdC = new PushButtonData(command2.Name, command2.Name, dllfullpath, "Command" + command2.Index);
                pbdC.Image = command2.SmallImage;
                pbdC.LargeImage = command2.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB, pbdC);
            }
            if (commands.Count == 4)
            {
                // remove first two commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                commands.RemoveAt(0);
                commands.RemoveAt(0);

                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image = command0.SmallImage;
                pbdB.LargeImage = command0.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB);
            }
            if (commands.Count == 2)
            {
                // remove first two commands from the list
                var command0 = commands[0];
                var command1 = commands[1];
                commands.RemoveAt(0);
                commands.RemoveAt(0);
                PushButtonData pbdA = new PushButtonData(command0.Name, command0.Name, dllfullpath, "Command" + command0.Index);
                pbdA.Image = command0.SmallImage;
                pbdA.LargeImage = command0.LargeImage;

                PushButtonData pbdB = new PushButtonData(command1.Name, command1.Name, dllfullpath, "Command" + command1.Index);
                pbdB.Image = command1.SmallImage;
                pbdB.LargeImage = command1.LargeImage;

                ribbonPanel.AddStackedItems(pbdA, pbdB);
            }
            if (commands.Count == 1)
            {
                // only one command defined, show as a big button...
                var command = commands[0];
                PushButtonData pbd = new PushButtonData(command.Name, command.Name, dllfullpath, "Command" + command.Index);
                pbd.Image = command.SmallImage;
                pbd.LargeImage = command.LargeImage;
                ribbonPanel.AddItem(pbd);
            }
        }
Example #18
0
        public Result OnStartup(UIControlledApplication a)
        {
            //declare variables
            PulldownButton     pulldownButton;
            PulldownButtonData pulldownData;

            //create Ribbon panel
            List <RibbonPanel> panels    = a.GetRibbonPanels();
            RibbonPanel        krspPanel = null;

            foreach (RibbonPanel pnl in panels)
            {
                if (pnl.Name == PANEL_NAME)
                {
                    krspPanel = pnl;
                }
            }
            if (krspPanel == null)
            {
                krspPanel = a.CreateRibbonPanel(PANEL_NAME);
            }

            //Create contextual help
            ContextualHelp help = new ContextualHelp(ContextualHelpType.Url, @"http://krispcad.blogspot.com.au/2013/07/revit-exchange-app-store.html");

            //create pulldown data
            System.Drawing.Image image = Properties.Resources.KRSP_TextUtilities;
            ImageSource          img   = Utils.ImageUtils.GetSource(image);

            pulldownData = new PulldownButtonData("TextUtils", "Text\nUtilities")
            {
                LargeImage = img,
                Image      = img
            };
            pulldownButton = krspPanel.AddItem(pulldownData) as PulldownButton;
            pulldownButton.SetContextualHelp(help);

            image = Properties.Resources.TextCase;
            AddPushButton("KRSP.Revit.TextChangeCase.Format2015.dll",
                          "ChangeTextCase",
                          "Change Case",
                          "KRSP.Revit.TextChangeCase.Format2015.Command",
                          "Change the case of the specified text notes in the project.",
                          "",
                          Utils.ImageUtils.GetSource(image),
                          pulldownButton);

            image = Properties.Resources.TextAlign;
            AddPushButton("KRSP.Revit.TextAlign.Format2015.dll",
                          "TextAlign",
                          "Text Align",
                          "KRSP.Revit.TextAlign.Format2015.Command",
                          "Align selected text notes to the selected text note.",
                          "",
                          Utils.ImageUtils.GetSource(image),
                          pulldownButton);


            //AddPushButton("KRSP.Revit.TextCreateStyles.Format_2013.dll",
            //    "CreateTextStyles",
            //    "KrispCAD Create Text Styles",
            //    "KRSP.Revit.TextCreateStyles.Format_2013.Command",
            //    "Create text styles based on predefined settings.",
            //    "",
            //    img,
            //    pulldownButton);

            return(Result.Succeeded);
        }
Example #19
0
    /// <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;
    }
Example #20
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);
    }
Example #21
0
    /// <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);
    }
Example #22
0
    /// <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);
    }
Example #23
0
    /// <summary>
    /// Simple push button for "Hello World" 
    /// </summary>
    public void AddPushButton(RibbonPanel panel)
    {
      // Set the information about the command we will be assigning to the button 

      PushButtonData pushButtonDataHello 
        = new PushButtonData(
          "PushButtonHello", 
          "Hello World", 
          _introLabPath,
          _introLabName + ".HelloWorld" ); // could also use typeof(HelloWorld).FullName here

      // Add a button to the panel 

      PushButton pushButtonHello = panel.AddItem(pushButtonDataHello) as PushButton;

      // Add an icon 
      // Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace. 

      pushButtonHello.LargeImage = NewBitmapImage("ImgHelloWorld.png");

      // Add a tooltip 

      pushButtonHello.ToolTip = "simple push button";
    }
Example #24
0
 private void CreateButton(RibbonPanel panel, IOpohoScript script)
 {
     try
     {
         if (script.Assembly == null)
         {
             _log.Error("script {0} has no assembly", script.Name);
             return;
         }
         var button =
             (PushButton)
             panel.AddItem(new PushButtonData(script.Name, script.Text, script.Assembly.Location,
                                              script.TypeFullName));
         if (button == null) return;
         if (script.Image != null) button.LargeImage = script.Image;
         button.Enabled = script.IsValid;
         if (!script.IsValid)
         {
             //todo contextural error message due to compile error
             //button.SetContextualHelp();
         }
         else
         {
             if (!string.IsNullOrEmpty(script.Description)) button.ToolTip = script.Description;
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.Message);
     }
 }
Example #25
0
        /// <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.
        /// <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_controlApp = application;

            #region Subscribe to related events

            // Doors are updated from the application level events.
            // That will insure that the doc is correct when it is saved.
            // Subscribe to related events.
            application.ControlledApplication.DocumentSaving   += new EventHandler <DocumentSavingEventArgs>(DocumentSavingHandler);
            application.ControlledApplication.DocumentSavingAs += new EventHandler <DocumentSavingAsEventArgs>(DocumentSavingAsHandler);

            #endregion

            #region create a custom Ribbon panel which contains three buttons

            // The location of this command assembly
            string currentCommandAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            // The directory path of buttons' images
            string buttonImageDir = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName
                                                                                    (Path.GetDirectoryName(currentCommandAssemblyPath))));

            // begin to create custom Ribbon panel and command buttons.
            // create a Ribbon panel.
            RibbonPanel doorPanel = application.CreateRibbonPanel("Door Swing");

            // the first button in the DoorSwing panel, use to invoke the InitializeCommand.
            PushButton initialCommandBut = doorPanel.AddItem(new PushButtonData("Customize Door Opening",
                                                                                "Customize Door Opening",
                                                                                currentCommandAssemblyPath,
                                                                                typeof(InitializeCommand).FullName))
                                           as PushButton;
            initialCommandBut.ToolTip    = "Customize the expression based on family's geometry and country's standard.";
            initialCommandBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "InitialCommand_Large.bmp")));
            initialCommandBut.Image      = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "InitialCommand_Small.bmp")));

            // the second button in the DoorSwing panel, use to invoke the UpdateParamsCommand.
            PushButton updateParamBut = doorPanel.AddItem(new PushButtonData("Update Door Properties",
                                                                             "Update Door Properties",
                                                                             currentCommandAssemblyPath,
                                                                             typeof(UpdateParamsCommand).FullName))
                                        as PushButton;
            updateParamBut.ToolTip    = "Update door properties based on geometry.";
            updateParamBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateParameter_Large.bmp")));
            updateParamBut.Image      = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateParameter_Small.bmp")));

            // the third button in the DoorSwing panel, use to invoke the UpdateGeometryCommand.
            PushButton updateGeoBut = doorPanel.AddItem(new PushButtonData("Update Door Geometry",
                                                                           "Update Door Geometry",
                                                                           currentCommandAssemblyPath,
                                                                           typeof(UpdateGeometryCommand).FullName))
                                      as PushButton;
            updateGeoBut.ToolTip    = "Update door geometry based on From/To room property.";
            updateGeoBut.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateGeometry_Large.bmp")));
            updateGeoBut.Image      = new BitmapImage(new Uri(Path.Combine(buttonImageDir, "UpdateGeometry_Small.bmp")));

            #endregion

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Example #26
0
        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)));
        }
Example #27
0
    /// <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);
    }
Example #28
0
        public Result OnStartup(UIControlledApplication app)
        {
            try
            {
                // uiCtrlApp = app;

                app.ControlledApplication.ApplicationInitialized += OnAppInitalized;

                // create the ribbon tab first - this is the top level
                // ui item.  below this will be the panel that is "on" the tab
                // and below this will be a pull down or split button that is "on" the panel;

                // give the tab a name;
                string tabName = TAB_NAME;
                // give the panel a name
                string panelName = PANEL_NAME;

                // first try to create the tab
                try
                {
                    app.CreateRibbonTab(tabName);
                }
                catch (Exception)
                {
                    // might already exist - do nothing
                }

                // tab created or exists

                // create the ribbon panel if needed
                RibbonPanel ribbonPanel = null;

/*
 *                              // check to see if the panel already exists
 *                              // get the Panel within the tab name
 *                              List<RibbonPanel> rp = new List<RibbonPanel>();
 *
 *                              rp = app.GetRibbonPanels(tabName);
 *
 *                              foreach (RibbonPanel rpx in rp)
 *                              {
 *                                      if (rpx.Name.ToUpper().Equals(panelName.ToUpper()))
 *                                      {
 *                                              ribbonPanel = rpx;
 *                                              break;
 *                                      }
 *                              }
 *
 *                              // if panel not found
 *                              // add the panel if it does not exist
 *                              if (ribbonPanel == null)
 *                              {
 *                                      // create the ribbon panel on the tab given the tab's name
 *                                      // FYI - leave off the ribbon panel's name to put onto the "add-in" tab
 *                                      ribbonPanel = app.CreateRibbonPanel(tabName, panelName);
 *                              }
 */

                ribbonPanel = app.CreateRibbonPanel(tabName, panelName);

                ribbonPanel.AddItem(
                    createButton(BUTTON_NAME_01, BUTTON_TEXT_01, COMMAND_CLASS_NAME_01,
                                 BUTTON_TOOL_TIP_01, SMALLICON, LARGEICON));


                //				// example 1
                //				//add a pull down button to the panel
                //				if (!AddPullDownButton(ribbonPanel))
                //				{
                //					// create the split button failed
                //					MessageBox.Show("Failed to Add the Pull Down Button!", "Information",
                //						MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                //					return Result.Failed;
                //				}
                //
                //				// example 2
                //				//add a stacked pair of push buttons to the panel
                //				if (!AddStackedPushButtons(ribbonPanel))
                //				{
                //					// create the split button failed
                //					MessageBox.Show("Failed to Add the Stacked Push Buttons!", "Information",
                //						MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                //					return Result.Failed;
                //				}
                //
                //				// example 3
                //				//add a stacked pair of push buttons and a text box to the panel
                //				if (!AddStackedPushButtonsAndTextBox(ribbonPanel))
                //				{
                //					// create the split button failed
                //					MessageBox.Show("Failed to Add the Stacked Push Buttons and TextBox!", "Information",
                //						MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                //					return Result.Failed;
                //				}
            }
            catch (Exception e)
            {
                Debug.WriteLine("exception " + e.Message);
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Example #29
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);
    }
Example #30
0
        //public static ModBox.FamFactory.DataProvidor.Installation.InstallationConfiguration installationConfiguration;
        //public static ModBox.FamFactory.DataProvidor.Objects.FamFactoryUser activeUser;
        //public static ModBox.FamFactory.ObjectControls.FamFactoryViewModel famFactoryViewModel;

        public Result OnStartup(UIControlledApplication application)
        {
            application.CreateRibbonTab("FamFactory");

            RibbonPanel famFactoryLogInRibbonPanel    = application.CreateRibbonPanel("FamFactory", "Login");
            RibbonPanel famFactoryRibbonPanel         = application.CreateRibbonPanel("FamFactory", "FamFactory");
            RibbonPanel famFactorySettingsRibbonPanel = application.CreateRibbonPanel("FamFactory", "Settings");
            RibbonPanel helpRibbonPanel = application.CreateRibbonPanel("FamFactory", "Help");

            PushButtonData LibraryButtonData = new PushButtonData("LibraryButton", "Library", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryLibraryCommand");

            LibraryButtonData.LargeImage = BitmapToImageSource(Resources.LibraryIcon32);
            LibraryButtonData.Image      = BitmapToImageSource(Resources.LibraryIcon16);

            PushButtonData SettingsButtonData = new PushButtonData("SettingsButton", "Settings", assemplyPath, "ModBox.FamFactory.Revit.FamFactorySettingsCommand");

            SettingsButtonData.LargeImage = BitmapToImageSource(Resources.SettingsIcon32);
            SettingsButtonData.Image      = BitmapToImageSource(Resources.SettingsIcon16);

            PushButtonData PalleteButtonData = new PushButtonData("PalleteButton", "Pallete", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryPalleteCommand");

            PalleteButtonData.LargeImage = BitmapToImageSource(Resources.PalletWindowOpenIcon32);
            PalleteButtonData.Image      = BitmapToImageSource(Resources.PalletWindowOpenIcon16);

            PushButtonData UsersButtonData = new PushButtonData("UsersButton", "Users", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryUsersCommand");

            UsersButtonData.LargeImage = BitmapToImageSource(Resources.UsersIcon32);
            UsersButtonData.Image      = BitmapToImageSource(Resources.UsersIcon16);

            PushButtonData TemplatesButtonData = new PushButtonData("TemplatesButton", "Templates", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryTemplatesCommand");

            TemplatesButtonData.LargeImage = BitmapToImageSource(Resources.TemplateIcon32);
            TemplatesButtonData.Image      = BitmapToImageSource(Resources.TemplateIcon16);

            PushButtonData HelpButtonData = new PushButtonData("HelpButton", "Help", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryHelpCommand");

            HelpButtonData.LargeImage = BitmapToImageSource(Resources.HelpIcon32);
            HelpButtonData.Image      = BitmapToImageSource(Resources.HelpIcon16);

            PushButtonData AboutButtonData = new PushButtonData("AboutButton", "About", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryAboutCommand");

            AboutButtonData.LargeImage = BitmapToImageSource(Resources.AboutIcon32);
            AboutButtonData.Image      = BitmapToImageSource(Resources.AboutIcon16);

            PushButtonData LoginButtonData = new PushButtonData("LogInButton", "Log In", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryLoginCommand");

            LoginButtonData.AvailabilityClassName = "ModBox.FamFactory.Revit.LoginButtonAvailabile";
            LoginButtonData.LargeImage            = BitmapToImageSource(Resources.LogIn32);
            LoginButtonData.Image = BitmapToImageSource(Resources.LogIn16);

            PushButtonData LogOutButtonData = new PushButtonData("LogOutButton", "Log Out", assemplyPath, "ModBox.FamFactory.Revit.FamFactoryLogOutCommand");

            LogOutButtonData.AvailabilityClassName = "ModBox.FamFactory.Revit.LogOutButtonAvailabile";
            LogOutButtonData.LargeImage            = BitmapToImageSource(Resources.LogOut32);
            LogOutButtonData.Image = BitmapToImageSource(Resources.LogOut16);

            famFactoryLogInRibbonPanel.AddItem(LoginButtonData);
            famFactoryLogInRibbonPanel.AddItem(LogOutButtonData);

            famFactoryRibbonPanel.AddItem(LibraryButtonData);

            famFactorySettingsRibbonPanel.AddItem(TemplatesButtonData);
            famFactorySettingsRibbonPanel.AddStackedItems(PalleteButtonData, UsersButtonData, SettingsButtonData);

            helpRibbonPanel.AddStackedItems(HelpButtonData, AboutButtonData);

            application.ControlledApplication.ApplicationInitialized += ControlledApplication_ApplicationInitialized;

            return(Result.Succeeded);
        }
Example #31
0
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication application)
        {
            Global.UpdateAppConfig("lang_2052", "/Resources/Langs/2052.xaml");
            Global.UpdateAppConfig("lang_1033", "/Resources/Langs/1033.xaml");

            //Global.SetCurrentLanguage(System.Threading.Thread.CurrentThread.CurrentCulture.LCID);

            application.ControlledApplication.DocumentOpened += new EventHandler <DocumentOpenedEventArgs>(Application_DocumentOpened);
            RibbonPanel rpanel = application.CreateRibbonPanel("Facade Helper");

            string         thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            PushButtonData bndataAppconfig  =
                new PushButtonData("cmdConfig", "全局设置",
                                   thisAssemblyPath, "FacadeHelper.Config_Command");
            PushButtonData bndataProcessElements =
                new PushButtonData("cmdProcessElements", "构件处理",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_Process_Elements");
            PushButtonData bndataZone =
                new PushButtonData("cmdZone", "分区处理",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_Zone");
            PushButtonData bndataFixzone =
                new PushButtonData("cmdFixZone", "分区修复",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_FixZone");
            PushButtonData bndataFamilyParam =
                new PushButtonData("cmdFamilyParam", "族参初始",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_AddFamilyParameters");
            PushButtonData bndataSelectfilter =
                new PushButtonData("cmdSelectFilter", "选择过滤",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_SelectFilter");
            PushButtonData bndataCodeMapping =
                new PushButtonData("cmdCodeMapping", "编码映射",
                                   thisAssemblyPath, "FacadeHelper.ICommand_Document_CodeMapping");

            bndataAppconfig.LargeImage = System.Windows.Interop.Imaging
                                         .CreateBitmapSourceFromHBitmap(Properties.Resources.config32.GetHbitmap(),
                                                                        IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataProcessElements.LargeImage = System.Windows.Interop.Imaging.
                                               CreateBitmapSourceFromHBitmap(Properties.Resources.level32.GetHbitmap(),
                                                                             IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataZone.LargeImage = System.Windows.Interop.Imaging
                                    .CreateBitmapSourceFromHBitmap(Properties.Resources.se32.GetHbitmap(),
                                                                   IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataFixzone.LargeImage = System.Windows.Interop.Imaging
                                       .CreateBitmapSourceFromHBitmap(Properties.Resources.fix32.GetHbitmap(),
                                                                      IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataFamilyParam.LargeImage = System.Windows.Interop.Imaging
                                           .CreateBitmapSourceFromHBitmap(Properties.Resources.sv32.GetHbitmap(),
                                                                          IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataSelectfilter.LargeImage = System.Windows.Interop.Imaging
                                            .CreateBitmapSourceFromHBitmap(Properties.Resources.filter32.GetHbitmap(),
                                                                           IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bndataCodeMapping.LargeImage = System.Windows.Interop.Imaging
                                           .CreateBitmapSourceFromHBitmap(Properties.Resources.code32.GetHbitmap(),
                                                                          IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            rpanel.AddItem(bndataAppconfig);
            rpanel.AddItem(bndataZone);
            rpanel.AddItem(bndataFixzone);
            rpanel.AddSeparator();
            rpanel.AddItem(bndataFamilyParam);
            rpanel.AddItem(bndataSelectfilter);
            rpanel.AddItem(bndataCodeMapping);
            return(Result.Succeeded);
        }
Example #32
0
        public Result OnStartup(UIControlledApplication a)
        {
            //string thisAssemblyPath = AssemblyLoadEventArgs.getExecutingAssembly().Location;
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            ////////////
            // 1st Panel
            RibbonPanel modelBuild = ribbonPanel(a, "Manicotti", "Create Model");
            //var globePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "icon.PNG");
            // need to load image in <filename>/bin/Debug file for windows
            // need to load image to C:\users\<USERNAME>\AppData\Roaming\Autodesk\Revit\Addins\2020
            Uri         uriImage = new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Model.ico", UriKind.Absolute);
            BitmapImage modelImg = new BitmapImage(uriImage);

            // Test button for floorplan split
            PushButtonData createAllButtonData = new PushButtonData("create_all", "Build up model\non all levels",
                                                                    thisAssemblyPath, "Manicotti.CmdCreateAll");

            createAllButtonData.AvailabilityClassName = "Manicotti.Util.ButtonControl";
            PushButton createAll = modelBuild.AddItem(createAllButtonData) as PushButton;

            createAll.ToolTip = "Split geometries and texts by their floors." +
                                " Try to create walls and columns on all levels. To test this demo, Link_floor.dwg must be linked. (act on Linked DWG)";
            createAll.LargeImage = modelImg;

            // Button list
            PushButtonData wall = new PushButtonData("create_wall", "Walls",
                                                     thisAssemblyPath, "Manicotti.CmdCreateWall");

            wall.ToolTip = "Extrude walls. To test the demo, Link_demo.dwg must be linked. (act on Linked DWG with WALL layer)";
            BitmapImage wallImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Wall.ico", UriKind.Absolute));

            wall.Image = wallImg;

            PushButtonData column = new PushButtonData("create_column", "Columns",
                                                       thisAssemblyPath, "Manicotti.CmdCreateColumn");

            column.ToolTip = "Extrude columns. To test the demo, Link_demo.dwg must be linked. (act on Linked DWG with COLUMN layer)";
            BitmapImage columnImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Column.ico", UriKind.Absolute));

            column.Image = columnImg;

            PushButtonData opening = new PushButtonData("create_opening", "Openings",
                                                        thisAssemblyPath, "Manicotti.CmdCreateOpening");

            opening.ToolTip = "Insert openings. To test the demo, Link_demo.dwg must be linked. (need layer DOOR, WINDOW & WALL)";
            BitmapImage openingImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Opening.ico", UriKind.Absolute));

            opening.Image = openingImg;

            IList <RibbonItem> stackedGeometry = modelBuild.AddStackedItems(wall, column, opening);


            ////////////
            // 2nd Panel
            RibbonPanel modelSetting = ribbonPanel(a, "Manicotti", "Settings");

            PushButtonData config = new PushButtonData("config", "Default Settings",
                                                       thisAssemblyPath, "Manicotti.Views.CmdConfig");

            wall.ToolTip = "Default and preferance settings. WIP";
            BitmapImage configImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Winform.ico", UriKind.Absolute));

            config.Image = configImg;

            PushButtonData load = new PushButtonData("load", "Reload Families",
                                                     thisAssemblyPath, "Manicotti.CmdPartAtom");

            load.ToolTip = "Reload the default families.";
            BitmapImage loadImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Reload.ico", UriKind.Absolute));

            load.Image = loadImg;

            PushButtonData info = new PushButtonData("info", "Pivot Table",
                                                     thisAssemblyPath, "Manicotti.Views.CmdFindAllFamilyInstance");

            info.ToolTip = "List of generated instances. WIP";
            BitmapImage infoImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Info.ico", UriKind.Absolute));

            info.Image = infoImg;

            IList <RibbonItem> stackedSetting = modelSetting.AddStackedItems(config, load, info);


            ////////////
            // 3rd Panel
            RibbonPanel modelSketch = ribbonPanel(a, "Manicotti", "Sketch");

            PushButtonData sketchDWG = new PushButtonData("sketchDWG", "Photocopy DWG",
                                                          thisAssemblyPath, "Manicotti.CmdSketchDWG");

            sketchDWG.ToolTip = "Extract geometries and texts. To test the demo, Link_test.dwg must be linked. (act on Linked DWG)";
            BitmapImage sketchdwgImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Sketchdwg.ico", UriKind.Absolute));

            sketchDWG.Image = sketchdwgImg;

            PushButtonData sketchLocation = new PushButtonData("sketchLocation", "Mark Location",
                                                               thisAssemblyPath, "Manicotti.CmdSketchLocation");

            sketchLocation.ToolTip = "Draw model lines based on component axis";
            BitmapImage sketchlocImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Sketchlocation.ico", UriKind.Absolute));

            sketchLocation.Image = sketchlocImg;

            IList <RibbonItem> stackedSketch = modelSketch.AddStackedItems(sketchDWG, sketchLocation);


            ////////////
            // 4th Panel
            RibbonPanel modelFix = ribbonPanel(a, "Manicotti", "Algorithm");
            PushButton  mesh     = modelFix.AddItem(new PushButtonData("mesh", "Patch\nAxis Grid",
                                                                       thisAssemblyPath, "Manicotti.CmdPatchBoundary")) as PushButton;

            mesh.ToolTip = "WIP. Patch all the space boundaries. To test the demo, Link_demo.dwg must be linked. (act on Linked DWG) ";
            BitmapImage meshImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Anchor.ico", UriKind.Absolute));

            mesh.LargeImage = meshImg;

            modelFix.Enabled = false;


            ////////////
            // 5th Panel
            RibbonPanel modelTest = ribbonPanel(a, "Manicotti", "Misc.");

            // Currently in progress and disabled
            modelTest.Enabled = false;

            PushButtonData region = new PushButtonData("detect_region", "Detect Region",
                                                       thisAssemblyPath, "Manicotti.RegionDetect");

            region.ToolTip = "Detect enclosed regions. (act on ModelLines with WALL linetype)";
            BitmapImage regionImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Room.ico", UriKind.Absolute));

            region.Image = regionImg;

            PushButtonData fusion = new PushButtonData("fusion", "Regen Axis",
                                                       thisAssemblyPath, "Manicotti.Fusion");

            fusion.ToolTip = "Space mesh regeneration. (act on Walls & Curtains). WIP";
            BitmapImage fusionImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Boundary.ico", UriKind.Absolute));

            fusion.Image = fusionImg;

            PushButtonData test = new PushButtonData("test", "Test\nButton",
                                                     thisAssemblyPath, "Manicotti.TestIntersect");

            test.ToolTip = "Default and preferance settings. WIP";
            BitmapImage testImg = new BitmapImage(new Uri("pack://application:,,,/Manicotti;component/Resources/ico/Error.ico", UriKind.Absolute));

            test.Image = testImg;

            IList <RibbonItem> stackedTest = modelTest.AddStackedItems(region, fusion, test);

            modelTest.Enabled = false;


            a.ApplicationClosing += a_ApplicationClosing;

            return(Result.Succeeded);
        }
Example #33
0
        /// <summary>
        /// 添加标签页,面板和按钮
        /// </summary>
        /// <param name="application"></param>
        private void CreateSamplePanel(UIControlledApplication application)
        {
            string tabName = "AMAZINGLIN";

            //创建标签页
            application.CreateRibbonTab(tabName);
            //在标签页上创建面板
            RibbonPanel selPanal         = application.CreateRibbonPanel(tabName, "选择面板");
            RibbonPanel showRoomBoundary = application.CreateRibbonPanel(tabName, "显示房间边界");
            RibbonPanel manualSelectRoom = application.CreateRibbonPanel(tabName, "手动选择房间");

            //在已有标签页上添加面板
            //在附加模块添加
            application.CreateRibbonPanel(Tab.AddIns, "选择楼层");
            //在分析模块添加
            application.CreateRibbonPanel(Tab.Analyze, "自动分析");

            //创建按钮
            PushButton pushBatton = selPanal.AddItem(
                new PushButtonData("选择楼层", "选择楼层",
                                   "D:/XuJL/Revit/Room/GetRoomList/RoomList/HelloWorld/bin/Debug/HelloWorld.dll", "HelloWorld.HelloWorld"))
                                    as PushButton;

            ////创建显示房间边界按钮
            //PushButton pushBatton = selPanal.AddItem(
            //    new PushButtonData("显示房间边界", "显示房间边界",
            //    "D:/XuJL/Revit/Room/GetRoomList/RoomList/RoomOperation/bin/Debug/RoomOperation.dll", "RoomOperation.DispalyRoomCurve"))
            //    as PushButton;

            //为按钮设置图片
            Uri         uri   = new Uri("C:/Program Files/Autodesk/Revit 2016/SDA/data/resources/languages/italy.png");
            BitmapImage image = new BitmapImage(uri);

            pushBatton.LargeImage      = image;
            pushBatton.ToolTip         = "选择一个楼层";
            pushBatton.LongDescription = "选择一个楼层,自动提取楼层边界";

            //创建显示房间边界按钮
            PushButton displayRoomCurveBtn = showRoomBoundary.AddItem(
                new PushButtonData("显示房间边界", "显示房间边界",
                                   "D:/XuJL/Revit/Room/GetRoomList/RoomList/AutoCreateRoomSlab/bin/Debug/AutoCreateRoomSlab.dll", "AutoCreateRoomSlab.AutoCreateRoomSlab"))
                                             as PushButton;

            //为按钮设置图片
            Uri         roomBoundaryUri   = new Uri("C:/Program Files/Autodesk/Revit 2016/SDA/data/resources/languages/usa.png");
            BitmapImage roomBoundaryImage = new BitmapImage(roomBoundaryUri);

            displayRoomCurveBtn.LargeImage = roomBoundaryImage;

            //
            //创建手动选择房间按钮
            PushButton manualSelectRoomBtn = manualSelectRoom.AddItem(
                new PushButtonData("选择房间", "选择一个房间",
                                   "D:/XuJL/Revit/Room/GetRoomList/RoomList/ManualSelectRoom/bin/Debug/ManualSelectRoom.dll", "ManualSelectRoom.ManualCreateRoomSlab"))
                                             as PushButton;

            //为按钮设置图片
            Uri         selectRoomURI   = new Uri("C:/Program Files/Autodesk/Revit 2016/SDA/data/resources/languages/brazil.png");
            BitmapImage selectRoomImage = new BitmapImage(selectRoomURI);

            manualSelectRoomBtn.LargeImage = selectRoomImage;
        }
Example #34
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);
        }
Example #35
0
        public Result OnStartup(UIControlledApplication a)
        {
            try
            {
                a.CreateRibbonTab(RibbonTab);
            }
            catch (Exception)
            {
                // ignored
            }

            // Get o create the panel
            List <RibbonPanel> panels = a.GetRibbonPanels(RibbonTab);
            RibbonPanel        panel  = panels.FirstOrDefault(ribbonPanel => ribbonPanel.Name == RibbonPanel) ?? a.CreateRibbonPanel(RibbonTab, RibbonPanel);

            // ----------------------------
            // ---Button Add shared parameters---
            // ----------------------------
            // get the image for the button
            Image       img         = Properties.Resources.icons8_add_property_32;
            ImageSource imageSource = GetImageSource(img);

            // create the button data
            var addSharedBtnData = new PushButtonData("Add shared parameters", "Добавить параметры", this.path + "\\CreateParams.dll", "CreateParams.Command")
            {
                ToolTip         = "Пакетное добавление параметров в проект или в семейства по excel файлу",
                LongDescription = "Разработчик: Кожевников Андрей",
                Image           = imageSource,
                LargeImage      = imageSource
            };

            // add the button to the ribbon
            if (panel.AddItem(addSharedBtnData) is PushButton addSharedButton)
            {
                addSharedButton.Enabled = true;
            }

            panel.AddSeparator();

            // ----------------------------
            // ---Button get parameters---
            // ----------------------------
            img         = Properties.Resources.icons8_export_csv_32;
            imageSource = GetImageSource(img);

            var exportParametersBtnData = new PushButtonData("Export model", "Выгрузить модель", this.path + "\\FindParameters.dll", "FindParameters.Command")
            {
                ToolTip         = "Выгрузить модель в excel",
                LongDescription = "Разработчик: Кожевников Андрей",
                Image           = imageSource,
                LargeImage      = imageSource
            };

            if (panel.AddItem(exportParametersBtnData) is PushButton exportParametersButton)
            {
                exportParametersButton.Enabled = true;
            }

            panel.AddSeparator();

            // ----------------------------
            // ---Button Gladkoe---
            // ----------------------------
            img         = Properties.Resources.icons8_administrative_tools_32;
            imageSource = GetImageSource(img);

            PulldownButtonData pullDownDataGladkoe = new PulldownButtonData("Gladkoe", "НБ_Гладкое")
            {
                Image = imageSource, LargeImage = imageSource, ToolTip = "Утилиты для проекта НБ_Гладкое"
            };
            PulldownButton pullDownButtonGladkoe = panel.AddItem(pullDownDataGladkoe) as PulldownButton;

            img         = Properties.Resources.icons8_paint_palette_32;
            imageSource = GetImageSource(img);

            var colorConnectorsBtnData = new PushButtonData("Color Connectors", "Окраска коннекторов", this.path + "\\Gladkoe.dll", "Gladkoe.ConnectorsRecolor")
            {
                ToolTip         = "Окраска коннекторов в проекте НБ_Гладкое",
                LongDescription = "Разработчик: Кожевников Андрей,\n Климович Александр",
                Image           = imageSource,
                LargeImage      = imageSource
            };

            pullDownButtonGladkoe.AddPushButton(colorConnectorsBtnData);

            img         = Properties.Resources.icons8_doctors_folder_32;
            imageSource = GetImageSource(img);

            var fillParametersBtnData = new PushButtonData("Fill parameters", "Заполнить \"Концевое условие\"", this.path + "\\Gladkoe.dll", "Gladkoe.FillingParameters")
            {
                ToolTip         = "Заполнение параметров \"Концевое условие\" (сварной шов / фланец) в проекте НБ_Гладкое",
                LongDescription = "Разработчик: Кожевников Андрей",
                Image           = imageSource,
                LargeImage      = imageSource
            };

            pullDownButtonGladkoe.AddPushButton(fillParametersBtnData);

            return(Result.Succeeded);
        }
Example #36
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            try
            {
                // Create new ribbon panel
                RibbonPanel ribbonPanel = application.CreateRibbonPanel("Visual Programming"); //MDJ todo - move hard-coded strings out to resource files

                //Create a push button in the ribbon panel

                PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo",
                                                                               "Dynamo", m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton;

                System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32;

                BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                    dynamoIcon.GetHbitmap(),
                    IntPtr.Zero,
                    System.Windows.Int32Rect.Empty,
                    System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

                pushButton.LargeImage = bitmapSource;
                pushButton.Image      = bitmapSource;



                // MDJ = element level events and dyanmic model update

                // Register sfm updater with Revit
                //DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId);
                //UpdaterRegistry.RegisterUpdater(updater);
                //// Change Scope = any spatial field element
                //ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
                ////ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
                //// Change type = element addition
                //UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), SpatialFieldFilter,
                //Element.GetChangeTypeAny()); // Element.GetChangeTypeElementAddition()


                DynamoUpdater updater = new DynamoUpdater(application.ActiveAddInId);//, sphere.Id, view.Id);
                if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId()))
                {
                    UpdaterRegistry.RegisterUpdater(updater);
                }
                ElementClassFilter    SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
                ElementClassFilter    familyFilter       = new ElementClassFilter(typeof(FamilyInstance));
                ElementCategoryFilter massFilter         = new ElementCategoryFilter(BuiltInCategory.OST_Mass);
                IList <ElementFilter> filterList         = new List <ElementFilter>();
                filterList.Add(SpatialFieldFilter);
                filterList.Add(familyFilter);
                filterList.Add(massFilter);
                LogicalOrFilter filter = new LogicalOrFilter(filterList);

                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeGeometry());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion());



                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(Result.Failed);
            }
        }
        public static void AddRibbonPanel(UIControlledApplication application)
        {
            //Tab Name that will display in Revit
            string TabName = "Revit App";

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

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


            //
            BitmapImage ButtonImage = new BitmapImage(new Uri(@"C:\Bathanh\Contents\Resources\Button100x100.png"));
            //Create a Panel within the Tab
            RibbonPanel RibbonPanelOne = application.CreateRibbonPanel(TabName, "Demo");
            //Create Push Button Data to create the Push button from
            PushButtonData pbdTestButton = new PushButtonData("cmdTestButton", "HelloRevitAPI", AssemblyPath, "HelloRevitApplication.Commands.HelloWorld");
            //Create a Push Button from the Push Button Data
            PushButton pbTestButton = RibbonPanelOne.AddItem(pbdTestButton) as PushButton;

            //Set Button Image
            pbTestButton.LargeImage = ButtonImage;
            //Set Button Tool Tips
            pbTestButton.ToolTip = "Hello Revit API";
            //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";

            //LoadCombination
            BitmapImage ButtonImageLoadCombination = new BitmapImage(new Uri(@"C:\Bathanh\Contents\Resources\ChangeViewReference100x100.png"));
            //Create a Panel within the Tab
            RibbonPanel RibbonPanelLoadCombination = application.CreateRibbonPanel(TabName, "LoadCombinations");
            //Create Push Button Data to create the Push button from
            PushButtonData pbdLoadCombinaionButton = new PushButtonData("cmdLoadCombinationButton", "LoadCombination", AssemblyPath, "HelloRevitApplication.Commands.LoadCombinnationTCVN");
            //Create a Push Button from the Push Button Data
            PushButton pbLoadCombinationButton = RibbonPanelLoadCombination.AddItem(pbdLoadCombinaionButton) as PushButton;

            //Set Button Image
            pbLoadCombinationButton.LargeImage = ButtonImageLoadCombination;
            //Set Button Tool Tips
            pbLoadCombinationButton.ToolTip = "Tạo tải trọng và tổ hợp tải trọng theo TCVN";
            //Set Button Long description which is the text that flys out when you hover on a button longer
            pbLoadCombinationButton.LongDescription = "Click";

            //LineLoad
            BitmapImage ButtonImageLineLoad = new BitmapImage(new Uri(@"C:\Bathanh\Contents\Resources\ChangeViewReference100x100.png"));
            //Create a Panel within the Tab
            //Create Push Button Data to create the Push button from
            PushButtonData pbdLineLoadButton = new PushButtonData("cmdLineLoad", "LineLoad", AssemblyPath, "HelloRevitApplication.Commands.AutoLineLoads");

            //Set Button Image
            pbdLineLoadButton.LargeImage = ButtonImageLineLoad;
            //Set Button Tool Tips
            pbdLineLoadButton.ToolTip = "Tạo Line Load";
            //Set Button Long description which is the text that flys out when you hover on a button longer
            pbdLineLoadButton.LongDescription = "Chọn dầm cần đặt tải trọng";

            //Arae Load
            BitmapImage ButtonImageAraeLoad = new BitmapImage(new Uri(@"C:\Bathanh\Contents\Resources\ChangeViewReference100x100.png"));
            //Create a Panel within the Tab
            //Create Push Button Data to create the Push button from
            PushButtonData pbdAraeLoadButton = new PushButtonData("cmdAreaLoad", "AraeLoad", AssemblyPath, "HelloRevitApplication.Commands.AutoAreaLoads");

            //Set Button Image
            pbdAraeLoadButton.LargeImage = ButtonImageLineLoad;
            //Set Button Tool Tips
            pbdAraeLoadButton.ToolTip = "Tạo Area Load";
            //Set Button Long description which is the text that flys out when you hover on a button longer
            pbdAraeLoadButton.LongDescription = "Chọn sàn cần đặt tải trọng";



            //Loads
            BitmapImage ButtonImageLoads = new BitmapImage(new Uri(@"C:\Bathanh\Contents\Resources\ChangeViewReference100x100.png"));
            //Create a Panel within the Tab
            RibbonPanel        RibbonPanelLoads        = application.CreateRibbonPanel(TabName, "Loads");
            PulldownButtonData pulldownButtonDataLoads = new PulldownButtonData("pulldownButtonDataLoads", "Loads");
            PulldownButton     pulldownButtonLoads     = RibbonPanelLoads.AddItem(pulldownButtonDataLoads) as PulldownButton;

            pulldownButtonLoads.LargeImage = ButtonImageLoads;
            pulldownButtonLoads.AddPushButton(pbdLineLoadButton);
            pulldownButtonLoads.AddPushButton(pbdAraeLoadButton);
        }
Example #38
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                //TAF load english_us TODO add a way to localize
                res = Resource_en_us.ResourceManager;
                // Create new ribbon panel
                RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description"));

                //Create a push button in the ribbon panel
                var pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo",
                                                                        res.GetString("App_Name"), m_AssemblyName,
                                                                        "Dynamo.Applications.DynamoRevit")) as
                                 PushButton;

                Bitmap dynamoIcon = Resources.Nodes_32_32;


                BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
                    dynamoIcon.GetHbitmap(),
                    IntPtr.Zero,
                    Int32Rect.Empty,
                    BitmapSizeOptions.FromEmptyOptions());

                pushButton.LargeImage = bitmapSource;
                pushButton.Image      = bitmapSource;

#if DEBUG
                var pushButton1 = ribbonPanel.AddItem(new PushButtonData("Test",
                                                                         res.GetString("App_Name"), m_AssemblyName,
                                                                         "Dynamo.Applications.DynamoRevitTester")) as PushButton;
                pushButton1.LargeImage = bitmapSource;
                pushButton1.Image      = bitmapSource;
#endif

                // MDJ = element level events and dyanmic model update
                // MDJ 6-8-12  trying to get new dynamo to watch for user created ref points and re-run definition when they are moved

                IdlePromise.RegisterIdle(application);

                updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication);
                if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId()))
                {
                    UpdaterRegistry.RegisterUpdater(updater);
                }

                var SpatialFieldFilter           = new ElementClassFilter(typeof(SpatialFieldManager));
                var familyFilter                 = new ElementClassFilter(typeof(FamilyInstance));
                var refPointFilter               = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints);
                var modelCurveFilter             = new ElementClassFilter(typeof(CurveElement));
                var sunFilter                    = new ElementClassFilter(typeof(SunAndShadowSettings));
                IList <ElementFilter> filterList = new List <ElementFilter>();

                filterList.Add(SpatialFieldFilter);
                filterList.Add(familyFilter);
                filterList.Add(modelCurveFilter);
                filterList.Add(refPointFilter);
                filterList.Add(sunFilter);

                ElementFilter filter = new LogicalOrFilter(filterList);

                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition());

                env = new ExecutionEnvironment();

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(Result.Failed);
            }
        }
Example #39
0
        // Both OnStartup and OnShutdown must be implemented as public method
        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\TagByCatVersions\TagByCatVersions\bin\Debug";
            string dll        = Path.Combine(folderPath, "TagByCatVersions.dll");

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

            a.CreateRibbonTab(TheRibbon);

            //Create Seperated Panels
            RibbonPanel panelA = a.CreateRibbonPanel(TheRibbon, "Tag Category Versions");
            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");


            // Button TagByCat1
            PushButton btnOne = (PushButton)panelA.AddItem(new PushButtonData("One", "TagByCat1", dll, "TagByCatVersions.TagByCat1"));
            //btnOne.LargeImage = new BitmapImage(new Uri(Path.Combine(folderPath, "image32.png"), UriKind.Absolute));
            Uri         uriImage   = new Uri(@"C:\Samples\TagByCatVersions\TagByCatVersions\bin\Debug\32Groot.png");
            BitmapImage largeImage = new BitmapImage(uriImage);

            btnOne.LargeImage      = largeImage; //Actually attaches image to button one - panel A
            btnOne.ToolTip         = "Tag Color (Halftone)";
            btnOne.LongDescription = "This is a lonnnnnnnnnnnnng description!";

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

            btnTwo.LargeImage      = largeImage2;
            btnTwo.ToolTip         = "Tag Placement (Points)";
            btnTwo.LongDescription = "This is a lonnnnnnnnnnnnng description!";

            // Button TagByCat3
            PushButton  btnThree    = (PushButton)panelA.AddItem(new PushButtonData("Three", "TagByCat3", dll, "TagByCatVersions.TagByCat3"));
            Uri         uriImage3   = new Uri(@"C:\Samples\TagByCatVersions\TagByCatVersions\bin\Debug\32Ironman.png");
            BitmapImage largeImage3 = new BitmapImage(uriImage3);

            btnThree.LargeImage      = largeImage3;
            btnThree.ToolTip         = "Functional";
            btnThree.LongDescription = "This is a lonnnnnnnnnnnnng description!";

            // Button TagByCat4
            PushButton btnFour = (PushButton)panelA.AddItem(new PushButtonData("Four", "TagByCat4", dll, "TagByCatVersions.TagByCat4"));

            btnFour.LargeImage = new BitmapImage(new Uri(Path.Combine(folderPath, "32Ironman.png"), UriKind.Absolute));
            //            PushButton btnFour = (PushButton) panelA.AddItem(new PushButtonData("Four", "TagByCat4", dll, "TagByCatVersions.TagByCat4"));
            //            Uri uriImage4 = new Uri(@"C:\Samples\TagByCatVersions\TagByCatVersions\bin\Debug\24Penguin.png");
            //            BitmapImage largeImage4 = new BitmapImage(uriImage4);
            //            btnFour.LargeImage = largeImage4;
            //            btnFour.ToolTip = "Cleaned up";
            //            btnFour.LongDescription = "This is a lonnnnnnnnnnnnng description!";


            // Button CreateLine
            PushButton  CreateLine  = (PushButton)panelB.AddItem(new PushButtonData("Four", "CreateLine", dll, "TagByCatVersions.CreateLine"));
            Uri         uriImage6   = new Uri(@"C:\Samples\TagByCatVersions\TagByCatVersions\bin\Debug\24Penguin.png");
            BitmapImage largeImage6 = new BitmapImage(uriImage6);

            CreateLine.LargeImage      = largeImage6;
            CreateLine.ToolTip         = "Line Creation";
            CreateLine.LongDescription = "This is a lonnnnnnnnnnnnng description!";



            return(Result.Succeeded);
        }
Example #40
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            string bintab = "陕建BIM";

            application.CreateRibbonTab(bintab);

            var asmpath = Assembly.GetExecutingAssembly().Location;


            var image = Properties.Resource1.hideshow.ToBitmapSource();

            var image_extendwiere = Properties.Resource2.sj1.ToBitmapSource();
            var image_aboutButton = Properties.Resource2.sj2.ToBitmapSource();

            Type extendwireT            = typeof(Cmd_ExtendWire);
            Type Cmd_HideSplitWireT     = typeof(Cmd_HideSplitWire);
            Type Cmd_HideSplitWiretestT = typeof(Cmd_HideSplitWiretest);
            Type Cmd_BreakWire          = typeof(Cmd_BreakWire);
            Type AboutCommandT          = typeof(AboutCommand);

            //PushButtonData button1 = new PushButtonData("binbox", "resetbox", @"C:\ProgramData\Autodesk\Revit\Addins\2015\bincropbox.dll", "bincropbox.CropBoxQuickSet");
            //PushButtonData button2 = new PushButtonData("changeplane", "changeplane", @"C:\ProgramData\Autodesk\Revit\Addins\2015\changeplane.dll", "changeplane.binchangeplane");


            RibbonPanel m_projectPanel = application.CreateRibbonPanel(bintab, "电气");
            // Add the buttons to the panel
            List <RibbonItem> binButtons = new List <RibbonItem>();

            PushButtonData extendwirebuttonData             = new PushButtonData("延长导线", "延长导线", asmpath, extendwireT.FullName);
            PushButtonData Cmd_HideSplitWireTButtonData     = new PushButtonData("导线断线", "导线断线", asmpath, Cmd_HideSplitWireT.FullName);
            PushButtonData Cmd_HideSplitWiretestTButtonData = new PushButtonData("手动断线", "手动断线", asmpath, Cmd_HideSplitWiretestT.FullName);
            PushButtonData Cmd_BreakWireTButtonData         = new PushButtonData("切割导线", "切割导线", asmpath, Cmd_BreakWire.FullName);
            PushButtonData aboutTButtonData = new PushButtonData("About", "About", asmpath, AboutCommandT.FullName);

            extendwirebuttonData.LargeImage             = image_extendwiere;
            Cmd_HideSplitWireTButtonData.LargeImage     = image;
            Cmd_HideSplitWiretestTButtonData.LargeImage = image;
            Cmd_BreakWireTButtonData.LargeImage         = image;
            aboutTButtonData.LargeImage = image_aboutButton;

            m_projectPanel.AddItem(extendwirebuttonData);
            m_projectPanel.AddSeparator();
            m_projectPanel.AddItem(Cmd_HideSplitWireTButtonData);
            m_projectPanel.AddSeparator();
            m_projectPanel.AddItem(Cmd_HideSplitWiretestTButtonData);
            m_projectPanel.AddSeparator();
            m_projectPanel.AddItem(Cmd_BreakWireTButtonData);
            m_projectPanel.AddSeparator();
            m_projectPanel.AddItem(aboutTButtonData);

            //binButtons.AddRange(m_projectPanel.AddStackedItems(extendwirebuttonData));


            // add new ribbon panel
            //RibbonPanel ribbonPanel1 = application.CreateRibbonPanel("binpanel1");
            ////create a push button inthe bibbon panel "newbibbonpanel"
            ////the add=in applintion "helloworld"willbe triggered when button is pushed
            //PushButton pushButton1_1 = ribbonPanel1.AddItem(new PushButtonData("helloworld", "helloworld", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //PushButton pushButton1_2 = ribbonPanel1.AddItem(new PushButtonData("bin", "bin", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //PushButton pushButton1_3 = ribbonPanel1.AddItem(new PushButtonData("bin1", "bin1", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //ribbonPanel1.AddSeparator();

            //RibbonPanel ribbonPanel2 = application.CreateRibbonPanel("binpanel2");

            //PushButton pushbutton2_1 = ribbonPanel2.AddItem(new PushButtonData("binst1", "pipe", @"D:\RevitDebug\bin\postcommand.dll", "BinPostCommand.binpostcommand")) as PushButton;
            //PushButton pushbutton2_2 = ribbonPanel2.AddItem(new PushButtonData("binst2", "resetbox", @"C:\ProgramData\Autodesk\Revit\Addins\2015\bincropbox.dll", "bincropbox.CropBoxQuickSet")) as PushButton;
            //PushButton pushbutton2_3 = ribbonPanel2.AddItem(new PushButtonData("binst3", "binst3", @"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //ribbonPanel2.AddSeparator();

            //RibbonPanel ribbonPanel3 = application.CreateRibbonPanel("binpanel3");

            //PushButton pushbutton3_1 = ribbonPanel3.AddItem(new PushButtonData("binst4","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //PushButton pushbutton3_2 = ribbonPanel3.AddItem(new PushButtonData("binst5","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //PushButton pushbutton3_3 = ribbonPanel3.AddItem(new PushButtonData("binst6","binst4",@"D:\helloworld.dll", "HelloWorld.CsHelloWorld")) as PushButton;
            //ribbonPanel3.AddSeparator();

            return(Result.Succeeded);
        }
Example #41
0
        /// <summary>
        /// Create a custom ribbon panel and populate
        /// it with our commands, saving the resulting
        /// ribbon items for later access.
        /// </summary>
        static void AddRibbonPanel(
            UIControlledApplication a)
        {
            string[] tooltip = new string[] {
                "Upload selected sheets and categories to cloud.",
                "Upload selected rooms to cloud.",
                "Upload all rooms to cloud.",
                "Update furniture from the last cloud edit.",
                "Subscribe to or unsubscribe from updates.",
                "About " + Caption + ": ..."
            };

            string[] text = new string[] {
                "Upload Sheets",
                "Upload Rooms",
                "Upload All Rooms",
                "Update Furniture",
                "Subscribe",
                "About..."
            };

            string[] classNameStem = new string[] {
                "UploadSheets",
                "UploadRooms",
                "UploadAllRooms",
                "Update",
                "Subscribe",
                "About"
            };

            string[] iconName = new string[] {
                "2Up",
                "1Up",
                "2Up",
                "1Down",
                "ZigZagRed",
                "Question"
            };

            int n = classNameStem.Length;

            Debug.Assert(text.Length == n,
                         "expected equal number of text and class name entries");

            _buttons = new RibbonItem[n];

            RibbonPanel panel
                = a.CreateRibbonPanel(Caption);

            SplitButtonData splitBtnData
                = new SplitButtonData(Caption, Caption);

            SplitButton splitBtn = panel.AddItem(
                splitBtnData) as SplitButton;

            Assembly asm = typeof(App).Assembly;

            for (int i = 0; i < n; ++i)
            {
                PushButtonData d = new PushButtonData(
                    classNameStem[i], text[i], _path,
                    _namespace + "." + _cmd_prefix
                    + classNameStem[i]);

                d.ToolTip = tooltip[i];

                d.Image = GetBitmapImage(asm,
                                         IconResourcePath(iconName[i], "16"));

                d.LargeImage = GetBitmapImage(asm,
                                              IconResourcePath(iconName[i], "32"));

                d.ToolTipImage = GetBitmapImage(asm,
                                                IconResourcePath(iconName[i], ""));

                _buttons[i] = splitBtn.AddPushButton(d);
            }
        }
Example #42
0
        public static void CreateAlignIcons(RibbonPanel rPanel)
        {
            string location = Assembly.GetExecutingAssembly().Location;

            //adding buttons

            //Button 1

            PushButtonData pushButtonData1 = new PushButtonData("alignLeftButton", "Align Left", location, "AlignTag.AlignLeft");
            PushButton     pB1             = rPanel.AddItem(pushButtonData1) as PushButton;

            pB1.ToolTip = "Align Tags or Elements Left";
            BitmapImage pb1LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignLeftLarge.png"));
            BitmapImage pb1Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignLeftSmall.png"));

            // Button 2
            PushButtonData pushButtonData2 = new PushButtonData("alignRightButton", "Align Right", location, "AlignTag.AlignRight");
            PushButton     pB2             = rPanel.AddItem(pushButtonData2) as PushButton;

            pB2.ToolTip = "Align Tags or Elements Right";
            BitmapImage pb2LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignRightLarge.png"));
            BitmapImage pb2Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignRightSmall.png"));

            // Button 3

            PushButtonData pushButtonData3 = new PushButtonData("alignTopButton", "Align Top", location, "AlignTag.AlignTop");
            PushButton     pB3             = rPanel.AddItem(pushButtonData3) as PushButton;

            pB3.ToolTip = "Align Tags or Elements Top";
            BitmapImage pb3LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignTopLarge.png"));
            BitmapImage pb3Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignTopSmall.png"));

            //Button 4
            PushButtonData pushButtonData4 = new PushButtonData("alignBottomButton", "Align Bottom", location, "AlignTag.AlignBottom");
            PushButton     pB4             = rPanel.AddItem(pushButtonData4) as PushButton;

            pB4.ToolTip = "Align Tags or Elements Bottom";
            BitmapImage pb4LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignBottomLarge.png"));
            BitmapImage pb4Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignBottomSmall.png"));

            // Button 5
            PushButtonData pushButtonData5 = new PushButtonData("alignCenterButton", "Align Center", location, "AlignTag.AlignCenter");
            PushButton     pB5             = rPanel.AddItem(pushButtonData5) as PushButton;

            pB5.ToolTip = "Align Tags or Elements Center";
            BitmapImage pb5LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignCenterLarge.png"));
            BitmapImage pb5Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignCenterSmall.png"));

            // Button 6
            PushButtonData pushButtonData6 = new PushButtonData("alignMiddleButton", "Align Middle", location, "AlignTag.AlignMiddle");
            PushButton     pB6             = rPanel.AddItem(pushButtonData6) as PushButton;

            pB6.ToolTip = "Align Tags or Elements Middle";
            BitmapImage pb6LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignMiddleLarge.png"));
            BitmapImage pb6Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/AlignMiddleSmall.png"));

            // Button 7
            PushButtonData pushButtonData7 = new PushButtonData("distributeHorizontallyButton", "Distribute\nHorizontally", location, "AlignTag.DistributeHorizontally");
            PushButton     pB7             = rPanel.AddItem(pushButtonData7) as PushButton;

            pB7.ToolTip = "Distribute Tags or Elements Horizontally";
            BitmapImage pb7LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/DistributeHorizontallyLarge.png"));
            BitmapImage pb7Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/DistributeHorizontallySmall.png"));

            // Button 8
            PushButtonData pushButtonData8 = new PushButtonData("distributeVerticallyButton", "Distribute\nVertically", location, "AlignTag.DistributeVertically");
            PushButton     pB8             = rPanel.AddItem(pushButtonData8) as PushButton;

            pB8.ToolTip = "Distribute Tags or Elements Vertically";
            BitmapImage pb8LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/DistributeVerticallyLarge.png"));
            BitmapImage pb8Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/DistributeVerticallySmall.png"));

            // Button 9
            PushButtonData pushButtonData9 = new PushButtonData("ArrangeButton", "Arrange\nTags", location, "AlignTag.Arrange");
            PushButton     pB9             = rPanel.AddItem(pushButtonData9) as PushButton;

            pB9.ToolTip = "Arrange Tags around the view";
            BitmapImage pb9LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/ArrangeLarge.png"));
            BitmapImage pb9Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/ArrangeSmall.png"));

            // Button 10
            PushButtonData pushButtonData10 = new PushButtonData("UntangleVerticallyButton", "Untangle\nVertically", location, "AlignTag.UntangleVertically");
            PushButton     pB10             = rPanel.AddItem(pushButtonData10) as PushButton;

            pB10.ToolTip = "Untangle Vertically Tags or Elements ";
            BitmapImage pb10LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/UntangleVerticallyLarge.png"));
            BitmapImage pb10Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/UntangleVerticallySmall.png"));

            // Button 11
            PushButtonData pushButtonData11 = new PushButtonData("UntangleHorizontallyButton", "Untangle\nHorizontally", location, "AlignTag.UntangleHorizontally");
            PushButton     pB11             = rPanel.AddItem(pushButtonData11) as PushButton;

            pB11.ToolTip = "Untangle Horizontally Tags or Elements ";
            BitmapImage pb11LargeImage = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/UntangleHorizontallyLarge.png"));
            BitmapImage pb11Image      = new BitmapImage(new Uri("pack://application:,,,/AEW_Ribbon;component/Resources/UntangleHorizontallySmall.png"));

            rPanel.AddStackedItems((RibbonItemData)pushButtonData1, (RibbonItemData)pushButtonData5, (RibbonItemData)pushButtonData2);
            rPanel.AddStackedItems((RibbonItemData)pushButtonData3, (RibbonItemData)pushButtonData6, (RibbonItemData)pushButtonData4);
            rPanel.AddStackedItems((RibbonItemData)pushButtonData7, (RibbonItemData)pushButtonData8, (RibbonItemData)pushButtonData9);
            rPanel.AddStackedItems((RibbonItemData)pushButtonData10, (RibbonItemData)pushButtonData11);
        }
Example #43
0
        void createRibbonButton(UIControlledApplication application)
        {
            application.CreateRibbonTab("AddIn Integration");
            RibbonPanel rp = application.CreateRibbonPanel("AddIn Integration", "Testing");

            PushButtonData pbd = new PushButtonData("Wall", "Goto WikiHelp for wall creation",
                                                    addinAssmeblyPath,
                                                    "Revit.SDK.Samples.UIAPI.CS.CalcCommand");
            ContextualHelp ch = new ContextualHelp(ContextualHelpType.ContextId, "HID_OBJECTS_WALL");

            pbd.SetContextualHelp(ch);
            pbd.LongDescription = "We redirect the wiki help for this button to Wall creation.";
            pbd.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);

            PushButton pb = rp.AddItem(pbd) as PushButton;

            pb.Enabled = true;
            pb.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";

            PushButtonData pbd1 = new PushButtonData("GotoGoogle", "Go to Google",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.CalcCommand");
            ContextualHelp ch1 = new ContextualHelp(ContextualHelpType.Url, "http://www.google.com/");

            pbd1.SetContextualHelp(ch1);
            pbd1.LongDescription = "Go to google.";
            pbd1.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd1.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb1 = rp.AddItem(pbd1) as PushButton;

            pb1.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";

            PushButtonData pbd2 = new PushButtonData("GotoRevitAddInUtilityHelpFile", "Go to Revit Add-In Utility",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.CalcCommand");

            ContextualHelp ch2 = new ContextualHelp(ContextualHelpType.ChmFile, Path.GetDirectoryName(addinAssmeblyPath) + @"\RevitAddInUtility.chm");

            ch2.HelpTopicUrl = @"html/3374f8f0-dccc-e1df-d269-229ed8c60e93.htm";
            pbd2.SetContextualHelp(ch2);
            pbd2.LongDescription = "Go to Revit Add-In Utility.";
            pbd2.LargeImage      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd2.Image           = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb2 = rp.AddItem(pbd2) as PushButton;

            pb2.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";


            PushButtonData pbd3 = new PushButtonData("PreviewControl", "Preview all views",
                                                     addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.PreviewCommand");

            pbd3.LargeImage = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd3.Image      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb3 = rp.AddItem(pbd3) as PushButton;

            pb3.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";


            PushButtonData pbd5 = new PushButtonData("Drag_And_Drop", "Drag and Drop", addinAssmeblyPath,
                                                     "Revit.SDK.Samples.UIAPI.CS.DragAndDropCommand");

            pbd5.LargeImage = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall);
            pbd5.Image      = convertFromBitmap(Revit.SDK.Samples.UIAPI.CS.Properties.Resources.StrcturalWall_S);
            PushButton pb5 = rp.AddItem(pbd5) as PushButton;

            pb5.AvailabilityClassName = "Revit.SDK.Samples.UIAPI.CS.ApplicationAvailabilityClass";
        }
Example #44
0
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication application)
        {
            // Registrere event:
            //application.ControlledApplication.FileExporting += new EventHandler<FileExportingEventArgs>(AskForParameterUpdates);
            // Create a custom ribbon tab
            String tabName = "RebarUtils";
            application.CreateRibbonTab(tabName);
            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "EiBre Rebar Utils");
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            // buttons: Copy Rebar, Renumber Rebar, Tag all, cycle tag,  Visibility, Selection, Other

            //Pushbutton copy rebar
            PushButtonData pushDataCopyRebar = new PushButtonData("cmdCopyRebar", "Copy Rebar", thisAssemblyPath, "EiBreRebarUtils.CopyRebar");
            pushDataCopyRebar.ToolTip = "Copies rebar from line based elements such as beams, walls, slanted columns to other line based elements.";
            PushButton pushButtonCopyRebar = ribbonPanel.AddItem(pushDataCopyRebar) as PushButton;
            pushButtonCopyRebar.LargeImage = BitmapToImageSource(Properties.Resources.copyRebar);

            //Pushbutton for rebar renumbering
            //----------------------------------------------------------------
            PushButtonData pushDataRenumber = new PushButtonData("cmdRenumberRebar", "Renumber", thisAssemblyPath, "EiBreRebarUtils.RenumberRebar");
            pushDataRenumber.ToolTip = "Change a Rebar Number";
            PushButton pushButtonRenumber = ribbonPanel.AddItem(pushDataRenumber) as PushButton;
            pushButtonRenumber.LargeImage = BitmapToImageSource(Properties.Resources.renumber);

            // Create a push button to trigger the tag all rebars command.

            PushButtonData buttonData = new PushButtonData("cmdTagAllRebarsInHost",
               "Tag rebars \nin host", thisAssemblyPath, "EiBreRebarUtils.TagAllRebarsInHost");
            
            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
            pushButton.ToolTip = "Tag all rebars in a host, the bars must be visible in active view";
            pushButton.LargeImage = BitmapToImageSource(Properties.Resources.TagAllRebarsInHost);
                              

            // Create a push button to cycle tags
            //--------------------------------------------------------------
            PushButtonData buttonData5 = new PushButtonData("cmdCycleTag", "Cycle Tag\nLeader", thisAssemblyPath, "EiBreRebarUtils.CycleTagLeader");
            PushButton pushButton5 = ribbonPanel.AddItem(buttonData5) as PushButton;
            pushButton5.ToolTip = "Cycle between attached end, free end and no leader";
            pushButton5.LargeImage = BitmapToImageSource(Properties.Resources.CycleTagLeader);

            //PULLDOWN to edit Rebar visibility
            //-----------------------------------------------------------------
            PushButtonData pushData6 = new PushButtonData("cmdSetUnobscuredInView", "Set Unobscured", thisAssemblyPath, "EiBreRebarUtils.SetUnobscuredInView");
            pushData6.ToolTip = "Set selected rebars unboscured in view. Applies to all rebars in view if none is selected";

            PushButtonData pushData7 = new PushButtonData("cmdSetObscuredInView", "Set Obscured", thisAssemblyPath, "EiBreRebarUtils.SetObscuredInView");
            pushData7.ToolTip = "Set selected rebars oboscured in view. Applies to all rebars in view if none is selected";

            PushButtonData pushData8 = new PushButtonData("cmdSetSolidInView", "Set Solid", thisAssemblyPath, "EiBreRebarUtils.SetSolidInView");
            pushData8.ToolTip = "Set selected rebars solid in a 3D view. Applies to all rebars in view if none is selected";

            PushButtonData pushData9 = new PushButtonData("cmdSetNotSolidInView", "Set Not Solid", thisAssemblyPath, "EiBreRebarUtils.SetNotSolidInView");
            pushData9.ToolTip = "Set selected rebars NOT solid in a 3D view. Applies to all rebars in view if none is selected";

            PulldownButtonData pullDataVisibility = new PulldownButtonData("cmdRebarVisibility", "Rebar Visibility");
            PulldownButton pullDownButtonVisibility = ribbonPanel.AddItem(pullDataVisibility) as PulldownButton;

            pullDownButtonVisibility.LargeImage = BitmapToImageSource(Properties.Resources.visibility);
            pullDownButtonVisibility.AddPushButton(pushData6);
            pullDownButtonVisibility.AddPushButton(pushData7);
            pullDownButtonVisibility.AddPushButton(pushData8);
            pullDownButtonVisibility.AddPushButton(pushData9);


            //PULLDOWNGROUP Selection Tools
            //-----------------------------------------------------------------
            PulldownButtonData pullDataSelect = new PulldownButtonData("cmdRebarSelect", "Selection Tools");
            PulldownButton pullDownButtonSelect = ribbonPanel.AddItem(pullDataSelect) as PulldownButton;
            pullDownButtonSelect.LargeImage = BitmapToImageSource(Properties.Resources.select);
            //Create pushbutton data to select all tagged rebars in a view
            PushButtonData pushSelectedTagData = new PushButtonData("cmdSelectTaggedRebar", "Select tagged rebars", thisAssemblyPath, "EiBreRebarUtils.SelectTaggedRebars");
            pushSelectedTagData.ToolTip = "Selects all tagged Rebar elements in view";

            //Create pushbutton data to select all tagged rebars in a view
            PushButtonData pushUnselectedTagData = new PushButtonData("cmdSelectUntaggedRebar", "Select un-tagged rebars", thisAssemblyPath, "EiBreRebarUtils.SelectUntaggedRebars");
            pushUnselectedTagData.ToolTip = "Selects all un-tagged Rebar elements in view";
            
            PushButtonData pushData10 = new PushButtonData("cmdSelectRebar", "Rebar Filter", thisAssemblyPath, "EiBreRebarUtils.SelectRebar");
            pushData10.ToolTip = "Rebar Filter";
  
            PushButtonData pushData11 = new PushButtonData("cmdSelectWorkset", "Select Same Workset", thisAssemblyPath, "EiBreRebarUtils.SelectSameWorkset");
            pushData11.ToolTip = "When an element is selected, use this command to select all elements on the same workset visible in view. ";

            PushButtonData pushData12 = new PushButtonData("cmdSelectCategory", "Select Same Category", thisAssemblyPath, "EiBreRebarUtils.SelectSameCategory");
            pushData12.ToolTip = "When an element is selected, use this command to select all elements of the same Category visible in view.";

            PushButtonData pushSelectTopLayer = new PushButtonData("cmdSelectTopLayer", "Select Top Layer (OK)", thisAssemblyPath, "EiBreRebarUtils.SelectTopLayer");
            pushSelectTopLayer.ToolTip = "Select rebar that is completely inside the bounding box of the top half of a Rebar Host.";

            PushButtonData pushSelectBottomLayer = new PushButtonData("cmdSelectBottomLayer", "Select Bottom Layer (UK)", thisAssemblyPath, "EiBreRebarUtils.SelectBottomLayer");
            pushSelectBottomLayer.ToolTip = "Select rebar that is completely inside the bounding box of the bottom half of a Rebar Host.";

            pullDownButtonSelect.AddPushButton(pushSelectedTagData);
            pullDownButtonSelect.AddPushButton(pushUnselectedTagData);
            pullDownButtonSelect.AddPushButton(pushData10);
            pullDownButtonSelect.AddPushButton(pushData11);
            pullDownButtonSelect.AddPushButton(pushData12);
            pullDownButtonSelect.AddPushButton(pushSelectTopLayer);
            pullDownButtonSelect.AddPushButton(pushSelectBottomLayer);

            //Pushbutton RebarInBend
            PushButtonData pushDataRebarInBend = new PushButtonData("cmdRebarInBend", "Rebar in bend", thisAssemblyPath, "EiBreRebarUtils.RebarInBend");
            pushDataRebarInBend.ToolTip = "Pick a rebar set to add rebars in all bends with same diameter as the bent bar.";
            PushButton pushButtonRebarInBend = ribbonPanel.AddItem(pushDataRebarInBend) as PushButton;
            pushButtonRebarInBend.LargeImage = BitmapToImageSource(Properties.Resources.RebarInBend);

            //Pushbutton PickRebarToIsolateAndTag
            PushButtonData pushDataPickRebarToIsolateAndTag = new PushButtonData("cmdPickRebarToIsolateAndTag", "Pick and tag", thisAssemblyPath, "EiBreRebarUtils.PickRebarToIsolateAndTag");
            pushDataPickRebarToIsolateAndTag.ToolTip = "Pick a rebar from a rebar set and a dimension line to isolate the rebar, attach it to the dimension line and place a tag";
            PushButton pushButtonPickRebarToIsolateAndTag = ribbonPanel.AddItem(pushDataPickRebarToIsolateAndTag) as PushButton;
            pushButtonPickRebarToIsolateAndTag.LargeImage = BitmapToImageSource(Properties.Resources.PickRebarToIsolateAndTag);

            //Pushbutton RebarParameterFromText
            PushButtonData pushDataRebarParameterFromText = new PushButtonData("cmdRebarParameterFromText", "Parameters\nfrom text", thisAssemblyPath, "EiBreRebarUtils.RebarParameterFromText");
            pushDataRebarParameterFromText.ToolTip = "Set bar type (diameter), layout rule, spacing, partition and comment from a string. e.g. ø12c200-P UK";
            PushButton pushButtonRebarParameterFromText = ribbonPanel.AddItem(pushDataRebarParameterFromText) as PushButton;
            pushButtonRebarParameterFromText.LargeImage = BitmapToImageSource(Properties.Resources.RebarParameterFromText);
            
            //Pushbutton Schedule Mark Update
            PushButtonData pushDataScheduleMark = new PushButtonData("cmdSceduleMarkUpdate", "Schedule Mark Update", thisAssemblyPath, "EiBreRebarUtils.ScheduleMarkUpdate");
            pushDataScheduleMark.ToolTip = "Combine the value from Partition and Rebar Number to Schedule Mark.";

            //Pushbutton sum of geometry
            PushButtonData pushDataSum = new PushButtonData("cmdSumGeometry", "Sum of geometry", thisAssemblyPath, "EiBreRebarUtils.SumGeometry");
            pushDataSum.ToolTip = "Returns the sum of Length, Area and Volume of the selected elements.";

            //Pushbutton Move from internal to shared
            PushButtonData pushDataMoveInternalShared = new PushButtonData("cmdMoveFromInternalToShared", "Move from internal to shared", thisAssemblyPath, "EiBreRebarUtils.MoveFromInternalToShared");
            pushDataMoveInternalShared.ToolTip = "This command moves and rotates a link or any element from the internal coordinate system to the shared coordinate system. This is useful if you insert links Origin to Origin because Surevey Point to Survey Point doesn't exist.";
            //Create a pushbutton to remove dimension values
            PushButtonData pushDataRemoveDimVal = new PushButtonData("cmdRemoveDimensionValue", "Remove\ndim. value", thisAssemblyPath, "EiBreRebarUtils.RemoveDimensionValue");
            pushDataRemoveDimVal.ToolTip = "Removes the dimension values from dimension lines.";

            //Pushbutton CopyRebarNumberFromScheduleMark
            PushButtonData pushDataCopyRebarNumberFromScheduleMark = new PushButtonData("cmdCopyRebarNumberFromScheduleMark", "Copy Rebar Number from Shedule Mark", thisAssemblyPath, "EiBreRebarUtils.CopyRebarNumberFromScheduleMark");
            pushDataCopyRebarNumberFromScheduleMark.ToolTip = "This command asks the user to select a partition and tries to change all Rebar Number values to match the last part of Schedue Mark. All schedule marks must begin with the partition name, and there can only be one number extracted from Schedule Mark for each Rebar Number.";

            //Pushbutton TagToDim
            PushButtonData pushDataTagToDim = new PushButtonData("cmdTagToDim", "Connect tag to dimension", thisAssemblyPath, "EiBreRebarUtils.TagToDim");
            pushDataTagToDim.ToolTip = "Pick a tag and a dimension to attach the tag leader to the nearest endpoint of the dimesion.";

            //Pushbutton ActiveViewToOpenSheet
            PushButtonData pushDataActiveViewToOpenSheet = new PushButtonData("cmdActiveViewToOpenSheet", "Add active view to open sheet", thisAssemblyPath, "EiBreRebarUtils.ActiveViewToOpenSheet");
            pushDataActiveViewToOpenSheet.ToolTip = "Adds the active view to a open sheet. If more than one sheet is open you are prompted to choose one.";

            //Pushbutton DisallowJoin
            PushButtonData pushDataDisallowJoin = new PushButtonData("cmdDisallowJoin", "Disallow Join", thisAssemblyPath, "EiBreRebarUtils.DisallowJoin");
            pushDataDisallowJoin.ToolTip = "Pick walls and/or structural framing to disallow join in both ends. End the selection by clicking finish in top left corner.";
            //Pushbutton ColumnsCutFloors
            PushButtonData pushDataColumnsCutFloor = new PushButtonData("cmdColumnsCutFloor", "Columns Cut Floor", thisAssemblyPath, "EiBreRebarUtils.SwitchJoinOrder");
            pushDataColumnsCutFloor.ToolTip = "Pick floors to switch join order such that floors are cut by columns. End the selection by clicking finish in top left corner.";
            //Pushbutton PasteImageFromClipboard
            PushButtonData pushDataPasteImage = new PushButtonData("cmdPasteImageFromClipboard", "Paste Image From Clipboard", thisAssemblyPath, "EiBreRebarUtils.PasteImageFromClipboard");
            pushDataPasteImage.ToolTip = "Copy a image to clipboard and paste it. The image will be saved in a new folder in the same location as your central file. You will be prompted to pick a point which is the center poit of the image";
            //Pushbutton About
            PushButtonData pushDataAbout = new PushButtonData("cmdAbout", "About", thisAssemblyPath, "EiBreRebarUtils.About");
            pushDataAbout.ToolTip = "About..";

            //PULLDOWN BUTTON OTHER
            PulldownButtonData pullDataOther = new PulldownButtonData("cmdOther", "Other tools");
            PulldownButton pullDownButtonOther = ribbonPanel.AddItem(pullDataOther) as PulldownButton;

            pullDownButtonOther.AddPushButton(pushDataRemoveDimVal);
            pullDownButtonOther.AddPushButton(pushDataScheduleMark);
            pullDownButtonOther.AddPushButton(pushDataTagToDim);
            pullDownButtonOther.AddPushButton(pushDataSum);
            pullDownButtonOther.AddPushButton(pushDataMoveInternalShared);
            pullDownButtonOther.AddPushButton(pushDataActiveViewToOpenSheet);
            pullDownButtonOther.AddPushButton(pushDataDisallowJoin);
            pullDownButtonOther.AddPushButton(pushDataColumnsCutFloor);
            pullDownButtonOther.AddPushButton(pushDataPasteImage);
            pullDownButtonOther.AddSeparator();
            pullDownButtonOther.AddPushButton(pushDataAbout);
            

            pullDownButtonOther.LargeImage = BitmapToImageSource(Properties.Resources.other);

            return Result.Succeeded;
        }
Example #45
0
        /// <summary>
        /// The OnStartup
        /// </summary>
        /// <param name="uicapp">The uicapp<see cref="UIControlledApplication"/></param>
        /// <returns>The <see cref="Result"/></returns>
        public Result OnStartup(UIControlledApplication uicapp)
        {
            Instance          = this;
            ModelHandler      = new ModelRequestHandler();
            ModelEvent        = ExternalEvent.Create(ModelHandler);
            HistoryHandler    = new HistoryRequestHandler();
            HistoryEvent      = ExternalEvent.Create(HistoryHandler);
            DiscussionHandler = new DiscussionRequestHandler();
            DiscussionEvent   = ExternalEvent.Create(DiscussionHandler);

            PaletteUtilities.RegisterPalette(uicapp);

            _uicapp = uicapp;

            // 获取程序集 dll 的路径
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            /************************************创建选项卡 ***********************************************/
            string      tabName     = "Manh Hoang";
            MyRibbonTab myRibbonTab = new MyRibbonTab();

            myRibbonTab.Add(uicapp, tabName);
            MyButton button = new MyButton();

            //********************Create panel*******************

            MyRibbonPanel panel             = new MyRibbonPanel();
            RibbonPanel   rbAuth            = panel.Add(uicapp, tabName, "Authentification");
            RibbonPanel   rbVerification    = panel.Add(uicapp, tabName, "Verification");
            RibbonPanel   rbDatabase        = panel.Add(uicapp, tabName, "Database");
            RibbonPanel   ribbonPanel       = panel.Add(uicapp, tabName, "Update Data");
            RibbonPanel   rib_panelProprety = panel.Add(uicapp, tabName, "history Palette");

            rbDatabase.Visible        = false;
            ribbonPanel.Visible       = false;
            rib_panelProprety.Visible = false;

            PushButtonData login = new PushButtonData("Connecter", "Login", thisAssemblyPath, "ProjectManagement.CmdRevit.CmdLogin")
            {
                AvailabilityClassName = "ProjectManagement.AvailabilityButtonLogin"
            };

            _button = rbAuth.AddItem(login);

            rbAuth.AddSeparator();

            PushButtonData logout = new PushButtonData("Logout", "Logout", thisAssemblyPath, "ProjectManagement.CmdRevit.CmdLogout")
            {
                AvailabilityClassName = "ProjectManagement.AvailabilityButtonLogout"
            };

            rbAuth.AddItem(logout);

            uicapp.ViewActivated += new EventHandler <ViewActivatedEventArgs>(onViewActivated); //for panel proprety
            uicapp.ControlledApplication.DocumentOpened  += OnDocumentOpened;
            uicapp.ControlledApplication.DocumentCreated += OnDocumentCreated;
            uicapp.ControlledApplication.DocumentClosing += OnDocumentClosing;
            uicapp.ControlledApplication.DocumentClosed  += OnDocumentClosed;
            uicapp.ControlledApplication.DocumentSaved   += OnDocumentSave;
            uicapp.ControlledApplication.DocumentSynchronizedWithCentral += OnDocumentSynchronized;
            uicapp.ControlledApplication.DocumentChanged += OnDocumentChanged;

            return(Result.Succeeded);
        }
Example #46
0
        private void CreateModelingRibbon(UIControlledApplication uiApp, string tabName)
        {
            RibbonPanel panel = uiApp.CreateRibbonPanel(tabName, "Моделирование");

            SplitButton splitHolesElev = panel
                                         .AddItem(new SplitButtonData("HolesElevSplitButton", "Отверстия"))
                                         as SplitButton;
            PushButtonData pbdElevations = CreateButtonData("RevitElementsElevation", "Command");

            pbdElevations.Text = "Определить\nотметки";
            splitHolesElev.AddPushButton(pbdElevations);

            splitHolesElev.AddSeparator();
            PushButtonData pbdHolesSettings = CreateButtonData("RevitElementsElevation", "CommandConfig");

            splitHolesElev.AddPushButton(pbdHolesSettings);

            PushButtonData pbdPropertiesCopy = CreateButtonData("PropertiesCopy", "CommandPropertiesCopy");

            pbdPropertiesCopy.Text = "Супер-\nкисточка";
            panel.AddItem(pbdPropertiesCopy);

            PushButtonData pbdGroupedAssembly = CreateButtonData("GroupedAssembly", "CommandSuperAssembly");

            pbdGroupedAssembly.Text = "Сборка-\nгруппа";
            panel.AddItem(pbdGroupedAssembly);

            //PushButtonData pbd = CreateButtonData("", "");

            SplitButton splitJoin = panel
                                    .AddItem(new SplitButtonData("JoingeometrySplitButton", "Геометрия"))
                                    as SplitButton;

            PushButtonData pbdAutoJoin = CreateButtonData("AutoJoin", "CommandAutoJoin");

            pbdAutoJoin.Text = "Авто\nсоединение";
            splitJoin.AddPushButton(pbdAutoJoin);

            PushButtonData pbdJoinByOrder = CreateButtonData("AutoJoin", "CommandJoinByOrder");

            pbdJoinByOrder.Text = "Задать\nприоритет";
            splitJoin.AddPushButton(pbdJoinByOrder);

            PushButtonData pbdAutoUnjoin = CreateButtonData("AutoJoin", "CommandBatchUnjoin");

            pbdAutoUnjoin.Text = "Авто\nразделение";
            splitJoin.AddPushButton(pbdAutoUnjoin);

            PushButtonData pbdAutoCut = CreateButtonData("AutoJoin", "CommandAutoCut");

            pbdAutoCut.Text = "Авто\nвырезание";
            splitJoin.AddPushButton(pbdAutoCut);
            splitJoin.AddPushButton(CreateButtonData("AutoJoin", "CommandCreateCope"));


            PushButtonData     pbdHost  = CreateButtonData("PropertiesCopy", "CommandSelectHost");
            SplitButtonData    sbdPiles = new SplitButtonData("Piles", "Сваи");
            IList <RibbonItem> stacked1 = panel.AddStackedItems(pbdHost, sbdPiles);

            SplitButton splitPiles = stacked1[1] as SplitButton;

            splitPiles.AddPushButton(CreateButtonData("PilesCoords", "PilesNumberingCommand"));
            splitPiles.AddPushButton(CreateButtonData("PilesCoords", "PileCutCommand"));
            splitPiles.AddPushButton(CreateButtonData("PilesCoords", "PilesElevationCommand"));
            splitPiles.AddPushButton(CreateButtonData("PilesCoords", "PilesCalculateRangeCommand"));
            splitPiles.AddSeparator();
            splitPiles.AddPushButton(CreateButtonData("PilesCoords", "SettingsCommand"));
        }
Example #47
0
        void pushButton_Setting(RibbonPanel p)
        {
            //p.AddSlideOut();

            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            ////Set globel directory
            var globePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Settings.jpg");

            //Large image
            Uri uriImage = new Uri(globePath);
            BitmapImage NewBitmapImage = new BitmapImage(uriImage);

            PushButtonData pushButton = new PushButtonData("Settings", "Settings", thisAssemblyPath, "SOM.RevitTools.AlignViewToSheetCell.CommandSettings");
            pushButton.LargeImage = NewBitmapImage;
            pushButton.Image = NewBitmapImage;
            pushButton.ToolTip = "Titleblock Cell Size Properties";

            p.AddItem(pushButton);
        }
Example #48
0
        /// <summary>
        /// Add Ribbon Tab, Panels, and Buttons
        /// </summary>
        /// <param name="app"></param>
        private void AddRibbon(UIControlledApplication app)
        {
            string dll = Assembly.GetExecutingAssembly().Location;

            // CHANGESETTINGS: Change the Ribbon Tab to your company name in Properties-> Settings -> RevitTab
            string ribbonTab = Properties.Settings.Default.RevitTab;

            app.CreateRibbonTab(ribbonTab);

            // Add some Ribbone Panels
            RibbonPanel panelSupport  = app.CreateRibbonPanel(ribbonTab, "Support");
            RibbonPanel panelWebsites = app.CreateRibbonPanel(ribbonTab, "Websites");
            RibbonPanel panelTools    = app.CreateRibbonPanel(ribbonTab, "Tools");

            // Button for EmailSupport
            // CHANGESETTINGS: Change the email address for support in Properties-> Settings -> EmailSupport
            PushButton btnEmailSupport = (PushButton)panelSupport.AddItem(new PushButtonData("email_support", "Email\nSupport", dll, "CompanyCustomTab.Email"));

            btnEmailSupport.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.Email32.png");
            btnEmailSupport.Image      = GetEmbeddedImage("CompanyCustomTab.Images.Email32.png");
            btnEmailSupport.ToolTip    = "Create a new email to email to support";

            // Split Button for Journal file and folder
            PushButtonData btnJournalFile   = new PushButtonData("JournalFile", "Open\nJournal File", dll, "CompanyCustomTab.JournalFile");
            PushButtonData btnJournalFolder = new PushButtonData("JournalFolder", "Open\nJournal Folder", dll, "CompanyCustomTab.JournalFolder");

            btnJournalFile.LargeImage   = GetEmbeddedImage("CompanyCustomTab.Images.JournalFile32.png");
            btnJournalFolder.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.JournalFolder32.png");
            btnJournalFile.Image        = GetEmbeddedImage("CompanyCustomTab.Images.JournalFile16.png");
            btnJournalFolder.Image      = GetEmbeddedImage("CompanyCustomTab.Images.JournalFolder16.png");
            btnJournalFile.ToolTip      = "Open the current model's journal file in notepad";
            btnJournalFolder.ToolTip    = "Open the folder containing the journal files for this version of Revit";
            SplitButtonData sbdJournal = new SplitButtonData("splitJournal", "Journal File & Folder");
            SplitButton     sbJournal  = panelSupport.AddItem(sbdJournal) as SplitButton;

            sbJournal.AddPushButton(btnJournalFile);
            sbJournal.AddPushButton(btnJournalFolder);

            // Button for Company Intranet
            // CHANGESETTINGS: Change the address to your company's intranet address in Properties-> Settings -> IntranetAddress
            // CHANGESETTINGS: Change the name of this button in Properties-> Settings -> IntranetName
            PushButton btnIntranet = (PushButton)panelWebsites.AddItem(new PushButtonData("intranet", Properties.Settings.Default.IntranetName, dll, "CompanyCustomTab.CompanyIntranet"));

            btnIntranet.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.Intranet32.png");
            btnIntranet.Image      = GetEmbeddedImage("CompanyCustomTab.Images.Intranet16.png");
            btnIntranet.ToolTip    = "Launch the company's intranet";

            // Button for website #1
            // CHANGESETTINGS: Change the web address for this website in Properties-> Settings -> Website1Address
            // CHANGESETTINGS: Change the name of this button in Properties-> Settings -> Website1Name
            PushButton btnWebsite1 = (PushButton)panelWebsites.AddItem(new PushButtonData("website1", Properties.Settings.Default.Website1Name, dll, "CompanyCustomTab.Website1"));

            btnWebsite1.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.Website32.png");
            btnWebsite1.Image      = GetEmbeddedImage("CompanyCustomTab.Images.Website16.png");
            btnWebsite1.ToolTip    = "Launch " + Properties.Settings.Default.Website1Name + " website";

            // Button for website #2
            // CHANGESETTINGS: Change the web address for this website in Properties-> Settings -> Website2Address
            // CHANGESETTINGS: Change the name of this button in Properties-> Settings -> Website2Name
            PushButton btnWebsite2 = (PushButton)panelWebsites.AddItem(new PushButtonData("website2", Properties.Settings.Default.Website2Name, dll, "CompanyCustomTab.Website2"));

            btnWebsite2.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.Website32.png");
            btnWebsite2.Image      = GetEmbeddedImage("CompanyCustomTab.Images.Website16.png");
            btnWebsite2.ToolTip    = "Launch " + Properties.Settings.Default.Website2Name + " website";

            // Button for website #3
            // CHANGESETTINGS: Change the web address for this website in Properties-> Settings -> Website3Address
            // CHANGESETTINGS: Change the name of this button in Properties-> Settings -> Website3Name
            PushButton btnWebsite3 = (PushButton)panelWebsites.AddItem(new PushButtonData("website3", Properties.Settings.Default.Website3Name, dll, "CompanyCustomTab.Website3"));

            btnWebsite3.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.Website32.png");
            btnWebsite3.Image      = GetEmbeddedImage("CompanyCustomTab.Images.Website16.png");
            btnWebsite3.ToolTip    = "Launch " + Properties.Settings.Default.Website3Name + " website";

            // Button for Revit Server Admin
            // CHANGESETTINGS: Set the Revit Server Name in Properties-> Settings -> RevitServerAdmin
            // CHANGESETTINGS: If no Revit Server in company, change setting to FALSE for Properties-> Settings -> ShowRevitServerAdmin
            if (Properties.Settings.Default.ShowRevitServerAdmin)
            {
                PushButton btnRevitServer = (PushButton)panelTools.AddItem(new PushButtonData("revit server", "Revit Server\nAdmin", dll, "CompanyCustomTab.RevitServer"));
                btnRevitServer.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.RevitServer32.png");
                btnRevitServer.Image      = GetEmbeddedImage("CompanyCustomTab.Images.RevitServer16.png");
                btnRevitServer.ToolTip    = "Open Revit Server Admin interface in a web browser";
            }

            // project folder
            PushButton btnProjectFolder = (PushButton)panelTools.AddItem(new PushButtonData("project folder", "Project\nFolder", dll, "CompanyCustomTab.ProjectFolder"));

            btnProjectFolder.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.ProjectFolder32.png");
            btnProjectFolder.Image      = GetEmbeddedImage("CompanyCustomTab.Images.ProjectFolder16.png");
            btnProjectFolder.ToolTip    = "Open Windows Explorer to the central file's location";

            // Created & Last Edited By
            PushButton btnCreatedEditedBy = (PushButton)panelTools.AddItem(new PushButtonData("created edited by", "Created &\nLast Edited By", dll, "CompanyCustomTab.CreatedLastEdited"));

            btnCreatedEditedBy.LargeImage = GetEmbeddedImage("CompanyCustomTab.Images.CreatedEditedBy32.png");
            btnCreatedEditedBy.Image      = GetEmbeddedImage("CompanyCustomTab.Images.CreatedEditedBy16.png");
            btnCreatedEditedBy.ToolTip    = "Use this tool to select an Element to find out who Created and Last Edited it.";
        }
 private static void AddGroupedCommands(string dllfullpath, RibbonPanel ribbonPanel, IEnumerable<IGrouping<string, Command>> groupedCommands)
 {
     foreach (var group in groupedCommands)
     {
         SplitButtonData splitButtonData = new SplitButtonData(group.Key, group.Key);
         var splitButton = ribbonPanel.AddItem(splitButtonData) as SplitButton;
         foreach (var command in group)
         {
             var pbd = new PushButtonData(command.Name, command.Name, dllfullpath, "Command" + command.Index);
             pbd.Image = command.SmallImage;
             pbd.LargeImage = command.LargeImage;
             splitButton.AddPushButton(pbd);
         }
     }
 }