public Result OnStartup(UIControlledApplication application)
        {
            RibbonPanel panel =
                application.CreateRibbonPanel("EntitlementAPI");

            ContextualHelp contextHelp = new ContextualHelp(
                ContextualHelpType.Url, "http://www.autodesk.com/developapps");

            PushButtonData button = new PushButtonData(
                "EntitlementAPI",
                "EntitlementAPI",
                typeof(ExtApplication).Assembly.Location,
                "EntitlementAPIRevit.Commands");
            button.Image = button.LargeImage =
              getBitmap("appicon2.png");
            button.ToolTip = "This function lets you to check the Entitlement of the user";
            button.LongDescription = "Using this functionality you can create simple copy protection mechanism ";
            button.SetContextualHelp(contextHelp);

            panel.AddItem(button);

            return Result.Succeeded;
        }
Example #2
0
        private static PushButtonData GetButtonData(string dllLocation, ButtonInfo button)
        {
            var name    = button.Name;
            var text    = button.Text ?? "new tool";
            var command = button.Command;

            PushButtonData buttondata = new PushButtonData(
                name,
                text,
                dllLocation,
                command
                );

            if (button.ToolTip != null)
            {
                buttondata.ToolTip = button.ToolTip;
            }
            if (button.LongDescription != null)
            {
                buttondata.LongDescription = button.LongDescription;
            }
            if (button.Availability != null)
            {
                buttondata.AvailabilityClassName = button.Availability;
            }

            BitmapImage image;
            var         icon = button.Icon ?? "icon.png";

            image = new BitmapImage(new Uri($"pack://application:,,,/$safeprojectname$;component/Resources/{icon}"));
            buttondata.LargeImage = image;

            icon             = button.SmallIcon ?? "icon_small.png";
            image            = new BitmapImage(new Uri($"pack://application:,,,/$safeprojectname$;component/Resources/{icon}"));
            buttondata.Image = image;

            if (button.ToolTipImage != null)
            {
                image = new BitmapImage(new Uri($"pack://application:,,,/$safeprojectname$;component/Resources/{button.ToolTipImage}"));
                buttondata.ToolTipImage = image;
            }


            if (button.HelpUrl != null)
            {
                buttondata.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, button.HelpUrl));
            }
            if (button.HelpFile != null)
            {
                buttondata.SetContextualHelp(new ContextualHelp(ContextualHelpType.ChmFile, button.HelpFile));
            }

            return(buttondata);
        }
        internal override RibbonItemData Finish()
        {
            var pushButtonData = new PushButtonData(Name, Text, assemblyLocation, className);

            if (LargeImage != null)
            {
                pushButtonData.LargeImage = LargeImage;
            }

            if (SmallImage != null)
            {
                pushButtonData.Image = SmallImage;
            }

            if (Description != null)
            {
                pushButtonData.LongDescription = Description;
            }

            if (ContextualHelp != null)
            {
                pushButtonData.SetContextualHelp(ContextualHelp);
            }

            if (!string.IsNullOrEmpty(availabilityClassName))
            {
                pushButtonData.AvailabilityClassName = availabilityClassName;
            }

            return(pushButtonData);
        }
Example #4
0
        void CreateRibbonPanel( 
            UIControlledApplication a)
        {
            Assembly exe = Assembly.GetExecutingAssembly();
              string path = exe.Location;

              string className = GetType().FullName.Replace(
            "App", "Command" );

              RibbonPanel p = a.CreateRibbonPanel(
            "DirectShape OBJ Loader" );

              PushButtonData d = new PushButtonData(
              "DirectObjLoader_Command",
              "DirectShape\r\nOBJ Loader",
              path, "DirectObjLoader.Command" );

              d.ToolTip = "Load a WaveFront OBJ model mesh "
            + "into a DirectShape Revit element";

              d.Image = NewBitmapImage( exe,
            "ImgDirectObjLoader16.png" );

              d.LargeImage = NewBitmapImage( exe,
            "ImgDirectObjLoader32.png" );

              d.LongDescription = d.ToolTip;

              d.SetContextualHelp( new ContextualHelp(
            ContextualHelpType.Url,
            Command.TroubleshootingUrl ) );

              p.AddItem( d );
        }
Example #5
0
        private static PushButtonData CreatePushButtonData(
            string name,
            string lName,
            string description,
            string img16,
            string img32,
            string fullDescription,
            string helpImage,
            string location,
            string className,
            string helpUrl)
        {
            var pshBtn = new PushButtonData(name, ConvertLName(lName), location, className)
            {
                ToolTip = description,
            };

            if (!string.IsNullOrEmpty(fullDescription))
            {
                pshBtn.LongDescription = fullDescription;
            }

            // tool tip
            try
            {
                if (!string.IsNullOrEmpty(helpImage))
                {
                    pshBtn.ToolTipImage = new BitmapImage(new Uri(helpImage, UriKind.RelativeOrAbsolute));
                }
            }
            catch
            {
                // ignored
            }

            try
            {
                pshBtn.Image = new BitmapImage(new Uri(img16, UriKind.RelativeOrAbsolute));
            }
            catch
            {
                // ignored
            }

            try
            {
                pshBtn.LargeImage = new BitmapImage(new Uri(img32, UriKind.RelativeOrAbsolute));
            }
            catch
            {
                // ignored
            }

            // help
            if (!string.IsNullOrEmpty(helpUrl))
            {
                pshBtn.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, helpUrl));
            }
            return(pshBtn);
        }
Example #6
0
        //PushButtonData
        internal virtual ButtonData GetButtonData()
        {
            PushButtonData pushButtonData =
                new PushButtonData(_name,
                                   _text,
                                   _assemblyLocation,
                                   _className);

            if (_largeImage != null)
            {
                pushButtonData.LargeImage = _largeImage;
            }

            if (_smallImage != null)
            {
                pushButtonData.Image = _smallImage;
            }
            if (_toolTipsImage != null)
            {
                pushButtonData.ToolTipImage = _toolTipsImage;
            }
            if (!string.IsNullOrWhiteSpace(_toolTips))
            {
                pushButtonData.ToolTip = _toolTips;
            }
            if (!string.IsNullOrWhiteSpace(_description))
            {
                pushButtonData.LongDescription = _description;
            }
            if (_contextualHelp != null)
            {
                pushButtonData.SetContextualHelp(_contextualHelp);
            }
            return(pushButtonData);
        }
Example #7
0
        //Create stack column
        private IList <RibbonItem> CreateStackButtons(string tabName, string panelName, RibbonPanel ribbonPanel, List <Button> buttons, string path)
        {
            PushButtonData[] buttonData  = new PushButtonData[3];
            string []        buttonNames = new string[3];

            int index = 0;

            foreach (var button in buttons)
            {
                PushButtonData data = new PushButtonData(button.Name, button.Text, path, button.Command);
                data.ToolTip = button.ToolTip;
                data.SetContextualHelp(button.ContextualHelp);

                BitmapIcons bitmapIcons = new BitmapIcons(assembly, button.Image, MyApplication);
                var         largeImage  = bitmapIcons.LargeBitmap();
                var         smallImage  = bitmapIcons.SmallBitmap();
                data.LargeImage = largeImage;
                data.Image      = smallImage;

                buttonData[index]  = data;
                buttonNames[index] = button.Name;

                index++;
            }

            IList <RibbonItem> ribbonItem = ribbonPanel.AddStackedItems(buttonData[0], buttonData[1], buttonData[2]);

            SupressStackButtonText(tabName, panelName, buttonNames);

            return(ribbonItem);
        }
Example #8
0
        private void AddRibbonItems(RibbonPanel panel)
        {
            string         location = Assembly.GetExecutingAssembly().Location;
            string         str      = location.Remove(location.Length - "Contents\\LODParameter.dll".Length);
            string         str2     = str + "Resources\\Icons\\";
            PushButtonData val      = new PushButtonData("CreateLODparameter", "Create\nParameters", location, "LODParameter.CreateLODParameter");

            val.set_AvailabilityClassName("LODParameter.CreateParametersButtonAvailability");
            val.SetContextualHelp(new ContextualHelp(2, "http://www.ikerd.com/lodmanager/user-guide"));
            PushButton val2 = panel.AddItem(val) as PushButton;

            val2.set_ToolTip("Create LOD parameters for this document");
            val2.set_LongDescription("Adds Current and Target LOD fields and MEA to each element in document.\nYou must run this command before using other LOD-related commands");
            val2.set_LargeImage((ImageSource) new BitmapImage(new Uri(str2 + "LODCREATEICON.png")));
            PushButtonData val3 = new PushButtonData("SetLOD", "Set\nLOD", location, "LODParameter.SetLODofSelection");

            val3.set_AvailabilityClassName("LODParameter.ParameterRequiredButtonAvailability");
            val3.SetContextualHelp(new ContextualHelp(2, "http://www.ikerd.com/lodmanager/user-guide"));
            PushButton val4 = panel.AddItem(val3) as PushButton;

            val4.set_ToolTip("Set LOD of Selection");
            val4.set_LongDescription("Sets the LOD of all selected items.\nSelect a detail view to set the LOD of all items in that view.");
            val4.set_LargeImage((ImageSource) new BitmapImage(new Uri(str2 + "SETLODICON.png")));
            PushButtonData val5 = new PushButtonData("LODfilters", "LOD\nFilters", location, "LODParameter.FilterByLOD");

            val5.set_AvailabilityClassName("LODParameter.ParameterRequiredButtonAvailability");
            val5.SetContextualHelp(new ContextualHelp(2, "http://www.ikerd.com/lodmanager/user-guide"));
            PushButton val6 = panel.AddItem(val5) as PushButton;

            val6.set_ToolTip("Apply graphical LOD filters");
            val6.set_LongDescription("Applys visibility graphics filters such as coloring,transparency, and visibility to items based on their LOD.");
            val6.set_LargeImage((ImageSource) new BitmapImage(new Uri(str2 + "FILTERLODICON.png")));
        }
Example #9
0
        void CreateRibbonPanel(
            UIControlledApplication a)
        {
            Assembly exe  = Assembly.GetExecutingAssembly();
            string   path = exe.Location;

            string className = GetType().FullName.Replace(
                "App", "Command");

            RibbonPanel p = a.CreateRibbonPanel(
                "DirectShape OBJ Loader");

            PushButtonData d = new PushButtonData(
                "DirectObjLoader_Command",
                "DirectShape\r\nOBJ Loader",
                path, "DirectObjLoader.Command");

            d.ToolTip = "Load a WaveFront OBJ model mesh "
                        + "into a DirectShape Revit element";

            d.Image = NewBitmapImage(exe,
                                     "ImgDirectObjLoader16.png");

            d.LargeImage = NewBitmapImage(exe,
                                          "ImgDirectObjLoader32.png");

            d.LongDescription = d.ToolTip;

            d.SetContextualHelp(new ContextualHelp(
                                    ContextualHelpType.Url,
                                    Command.TroubleshootingUrl));

            p.AddItem(d);
        }
Example #10
0
        public static void CreateIcons(RibbonPanel bim42Panel)
        {
            //Retrive dll path
            string DllPath = Assembly.GetExecutingAssembly().Location;

            ContextualHelp helpFile = CreateContextualHelp("BIM42Help");

            //Add RoomsFinishes Button
            string         ButtonText       = Tools.LangResMan.GetString("roomFinishes_button_name", Tools.Cult);
            PushButtonData FinishButtonData = new PushButtonData("RoomsFiButton", ButtonText, DllPath, "RoomFinishes.RoomsFinishes.RoomsFinishes");

            FinishButtonData.ToolTip    = Tools.LangResMan.GetString("roomFinishes_toolTip", Tools.Cult);
            FinishButtonData.LargeImage = RetriveImage("RoomFinishes.Resources.RoomFinishLarge.png");
            FinishButtonData.Image      = RetriveImage("RoomFinishes.Resources.RoomFinishSmall.png");
            FinishButtonData.SetContextualHelp(helpFile);
            //bim42Panel.AddItem(FinishButtonData);

            //Add FloorFinishes Button
            string         floorButtonText = Tools.LangResMan.GetString("floorFinishes_ribbon_panel_name", Tools.Cult);
            PushButtonData floorButtonData = new PushButtonData("FloorFiButton", floorButtonText, DllPath, "RoomFinishes.RoomsFinishes.FloorFinishes");

            floorButtonData.ToolTip    = Tools.LangResMan.GetString("floorFinishes_toolTip", Tools.Cult);
            floorButtonData.LargeImage = RetriveImage("RoomFinishes.Resources.FloorFinishesLarge.png");
            floorButtonData.Image      = RetriveImage("RoomFinishes.Resources.FloorFinishesSmall.png");
            floorButtonData.SetContextualHelp(helpFile);

            //Group RoomsFinishes button
            SplitButtonData sbRoomData = new SplitButtonData("splitButton2", "BIM 42");
            SplitButton     sbRoom     = bim42Panel.AddItem(sbRoomData) as SplitButton;

            sbRoom.AddPushButton(FinishButtonData);
            sbRoom.AddPushButton(floorButtonData);
        }
Example #11
0
        private static void AddHelpPanel(UIControlledApplication application)
        {
            // create the panel
            var panel = application.CreateRibbonPanel(TabName, TabName);

            // user info
            var userInfoButton = new PushButtonData(
                "mpUserInfo",
                ConvertLName(Language.GetItem(LangItem, "h13")),
                Assembly.GetExecutingAssembly().Location,
                "ModPlus_Revit.App.UserInfoCommand");

            userInfoButton.LargeImage =
                new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/Modplus_Revit_{VersionData.CurrentRevitVersion};component/Resources/UserInfo_32x32.png"));
            userInfoButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, GetHelpUrl("userinfo", "help")));
            panel.AddItem(userInfoButton);

            // settings
            var settingsButton = new PushButtonData(
                "mpSettings",
                Language.GetItem(LangItem, "h12"),
                Assembly.GetExecutingAssembly().Location,
                "ModPlus_Revit.App.SettingsCommand");

            settingsButton.LargeImage =
                new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/Modplus_Revit_{VersionData.CurrentRevitVersion};component/Resources/HelpBt.png"));
            settingsButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, GetHelpUrl("mpsettings", "help")));
            panel.AddItem(settingsButton);
        }
Example #12
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            try
            {
                RibbonPanel    panel = application.CreateRibbonPanel("EnTools");
                PushButtonData list  = new PushButtonData("Swap", "Swap", AddInPath, "Entools.Model.Entools")
                {
                    ToolTip = "Swap"
                };
                string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

                ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.ChmFile, path + @"\Help.htm"); // hard coding for simplicity.
                list.SetContextualHelp(contextHelp);
                PushButton billButton = panel.AddItem(list) as PushButton;
                billButton.LargeImage = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "icons\\iconlarge.png"), UriKind.Absolute));
                billButton.Image      = new BitmapImage(new Uri(Path.Combine(ButtonIconsFolder, "icons\\iconsmall.png"), UriKind.Absolute));

                return(Autodesk.Revit.UI.Result.Succeeded);
            }
            catch (Exception ex)
            {
                TaskDialog.Show("EnToolsLt Sample", ex.ToString());
                return(Autodesk.Revit.UI.Result.Failed);
            }
        }
Example #13
0
        public Result OnStartup(UIControlledApplication a)
        {
            try
            {
                Assembly exe     = Assembly.GetExecutingAssembly();
                string   dllpath = exe.Location;

                string         helpPath = Path.Combine(Path.GetDirectoryName(dllpath), "TimeStampHelp.html");
                ContextualHelp help     = new ContextualHelp(ContextualHelpType.ChmFile, helpPath);

                //Create the panel for the TimeStamp
                RibbonPanel TimeStampPanel = a.CreateRibbonPanel("Time Stamper");

                //Add FSL Button
                PushButtonData timeStampButton = new PushButtonData("TimeStampButton", "Stamp\r\nModel", dllpath, "TimeStamp.ModelTimeStamp");
                timeStampButton.ToolTip    = "Add Date and File information on every Revit model object.";
                timeStampButton.LargeImage = Tools.GetEmbeddedImage("TimeStamp.Resources.TimeStamp_Large.png");
                timeStampButton.Image      = Tools.GetEmbeddedImage("TimeStamp.Resources.TimeStamp_Small.png");
                timeStampButton.SetContextualHelp(help);
                TimeStampPanel.AddItem(timeStampButton);

                return(Result.Succeeded);
            }
            catch
            {
                // Return Failure
                return(Result.Failed);
            }
        }
Example #14
0
        internal virtual ButtonData Finish()
        {
            PushButtonData pushButtonData =
                new PushButtonData(_name,
                                   _text,
                                   _assemblyLocation,
                                   _className);

            if (_largeImage != null)
            {
                pushButtonData.LargeImage = _largeImage;
            }

            if (_smallImage != null)
            {
                pushButtonData.Image = _smallImage;
            }

            if (_description != null)
            {
                pushButtonData.LongDescription = _description;
            }

            if (_contextualHelp != null)
            {
                pushButtonData.SetContextualHelp(_contextualHelp);
            }

            //_panel.Source.AddItem(pushButtonData);

            return(pushButtonData);
        }
Example #15
0
        private static void AddHelpPanel(UIControlledApplication application)
        {
            // create the panel
            var panel = application.CreateRibbonPanel(TabName, TabName);

            // user info
            var userInfoButton = new PushButtonData(
                "mpUserInfo",
                ConvertLName(Language.GetItem(LangItem, "h13")),
                Assembly.GetExecutingAssembly().Location,
                "ModPlus_Revit.App.UserInfoCommand");

            userInfoButton.LargeImage =
                new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/Modplus_Revit_{VersionData.CurrentRevitVersion};component/Resources/UserInfo_32x32.png"));
            userInfoButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, GetHelpUrl("userinfo", "help")));
            panel.AddItem(userInfoButton);

            // settings
            var settingsButton = new PushButtonData(
                "mprSettings",
                Language.GetItem(LangItem, "h12"),
                Assembly.GetExecutingAssembly().Location,
                "ModPlus_Revit.App.SettingsCommand");
            var image = new BitmapImage(new Uri(
                                            $"pack://application:,,,/Modplus_Revit_{VersionData.CurrentRevitVersion};component/Resources/mprSettings_16x16.png"));

            settingsButton.Image      = image;
            settingsButton.LargeImage = image;
            settingsButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, GetHelpUrl("mpsettings", "help")));

            // feedback
            var feedbackButton = new PushButtonData(
                "mprFeedback",
                Language.GetItem("ModPlusAPI", "f1"),
                Assembly.GetExecutingAssembly().Location,
                "ModPlus_Revit.App.FeedbackCommand");

            feedbackButton.ToolTip         = Language.GetItem("ModPlusAPI", "f20");
            feedbackButton.LongDescription = Language.GetItem("ModPlusAPI", "f21");
            image = new BitmapImage(new Uri(
                                        $"pack://application:,,,/Modplus_Revit_{VersionData.CurrentRevitVersion};component/Resources/mprFeedback_16x16.png"));
            feedbackButton.Image      = image;
            feedbackButton.LargeImage = image;
            feedbackButton.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, GetHelpUrl("feedback", "help")));

            panel.AddStackedItems(settingsButton, feedbackButton);

            HideTextOfSmallButtons(TabName, new List <string> {
                "mprSettings", "mprFeedback"
            });
        }
Example #16
0
        }         // end OnShutdown

        private bool AddSplitPushButtons(RibbonPanel rPanel)
        {
            ContextualHelp help = new ContextualHelp(ContextualHelpType.Url, AppStrings.R_CyberStudioDupSheetsAddr);

            try
            {
                // make push button 1
                PushButtonData pbData1 = MakePushButton(
                    rPanel, LocalResMgr.ButtonName,
                    AppStrings.R_ButtonNameTop + nl + AppStrings.R_ButtonNameBott,
                    AppStrings.R_ButtonImage16,
                    AppStrings.R_ButtonImage32,
                    Assembly.GetExecutingAssembly().Location,
                    LocalResMgr.Command, AppStrings.R_CommandDescription);

                if (pbData1 == null)
                {
                    return(false);
                }

                pbData1.SetContextualHelp(help);

                PushButtonData pbData2 = MakePushButton(
                    rPanel, LocalResMgr.ButtonName_1Click,
                    AppStrings.R_ButtonNameTopOneClick + nl + AppStrings.R_ButtonNameBottOneClick,
                    AppStrings.R_ButtonImageOneClick16,
                    AppStrings.R_ButtonImageOneClick32,
                    Assembly.GetExecutingAssembly().Location,
                    LocalResMgr.Command_1Click, AppStrings.R_CommandDescriptionOneClick);

                if (pbData2 == null)
                {
                    return(false);
                }

                SplitButtonData sbd = new SplitButtonData("splitButton", "DupSheets");
                SplitButton     sb  = rPanel.AddItem(sbd) as SplitButton;

                pbData2.SetContextualHelp(help);


                sb.SetContextualHelp(help);

                sb.AddPushButton(pbData1);
                sb.AddPushButton(pbData2);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Example #17
0
        /// <summary> 添加“修复剪切”的按钮 </summary>
        private PushButtonData AddPushButtonDataExcavSoilReCut()
        {
            PushButtonData viewStage = new PushButtonData("ExcavSoilReCut", "修复剪切", Path.Combine(Path_Dlls, Dll_Projects),
                                                          "OldW.Commands.cmd_ExcavSoilReCut");

            viewStage.ToolTip = "修复开挖土体对模型土体的剪切关系。在修复之前请先确保开挖土体与模型土体是位于同一个组“基坑土体”中。";

            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com");

            viewStage.SetContextualHelp(contextHelp);
            // Set Icon
            viewStage.Image = new BitmapImage(new Uri(Path.Combine(Path_icons, "Repair1_16.png")));
            return(viewStage);
        }
Example #18
0
        /// <summary> 添加“手动查看开挖工况”的按钮 </summary>
        private PushButtonData AddPushButtonDataViewStageManually()
        {
            PushButtonData viewStage = new PushButtonData("ViewStageManually", "手动查看", Path.Combine(Path_Dlls, Dll_Projects),
                                                          "OldW.Commands.cmd_ViewStageManually");

            viewStage.ToolTip = "通过在窗口中手动点击在查看任意时间的开挖工况";

            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com");

            viewStage.SetContextualHelp(contextHelp);
            // Set Icon
            viewStage.Image = new BitmapImage(new Uri(Path.Combine(Path_icons, "ViewStage_16.png")));
            return(viewStage);
        }
Example #19
0
        /// <summary> 添加“清理冗余”的按钮 </summary>
        private PushButtonData AddPushButtonDataDeleteRedundantExcavations()
        {
            PushButtonData viewStage = new PushButtonData("DeleteRedundantExcavations", "清理冗余", Path.Combine(Path_Dlls, Dll_Projects),
                                                          "OldW.Commands.cmd_DeleteRedundantExcavations");

            viewStage.ToolTip = "将模型土体或者开挖土体族中,没有对应实例的那些族及对应的族类型删除。";

            ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com");

            viewStage.SetContextualHelp(contextHelp);
            // Set Icon
            viewStage.Image = new BitmapImage(new Uri(Path.Combine(Path_icons, "Repair2_16.png")));
            return(viewStage);
        }
Example #20
0
        private void CreateRibbonPanel(UIControlledApplication application)
        {
            RibbonPanel    ribbonPanel    = application.CreateRibbonPanel(RibbonPanelName);
            PushButtonData pushButtonData = new PushButtonData(
                "Экспорт в Excel",
                "Экспорт в Excel",
                AddInPath,
                "ExcelSpecificationGOST.ExcelSpecificationGOSTCommand");

            pushButtonData.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, @"https://github.com/DenisDavydov1/RevitToGOST/wiki"));
            PushButton pushButton = ribbonPanel.AddItem(pushButtonData) as PushButton;

            pushButton.ToolTip    = "Экспортировать модель в спецификацию по ГОСТ в Excel";
            pushButton.LargeImage = Bitmaps.Convert(Properties.Resources.ButtonIcon);
        }
Example #21
0
        private static PushButtonData GetCategoryOnOffPushButtonData(
            string name, bool isOn, IModPlusPlugin intF, string assembly)
        {
            var showHide = isOn ? "Show" : "Hide";

            // Большое изображение задавать обязательно, иначе не отображается малое
            var pbd = new PushButtonData(
                name, Language.GetItem(LangItem, name), assembly, $"mprTools.Commands.{name}{showHide}")
            {
                Image      = GetIconForCategoryOnOff(name, isOn, intF),
                LargeImage = GetIconForCategoryOnOff(name, isOn, intF)
            };

            pbd.SetContextualHelp(
                new ContextualHelp(ContextualHelpType.Url, ModPlus_Revit.App.RibbonBuilder.GetHelpUrl(intF.Name)));
            return(pbd);
        }
Example #22
0
        public static RibbonPanel CreateLoggedPanel(RibbonPanel bimsyncPanel)
        {
            //Retrive dll path
            string DllPath = Assembly.GetExecutingAssembly().Location;

            //Create contextual help
            string         helpPath = Path.Combine(Path.GetDirectoryName(DllPath), "bimsyncHelp.html");
            ContextualHelp help     = new ContextualHelp(ContextualHelpType.ChmFile, helpPath);

            //Add Logged Buttons
            PushButtonData profileButton = new PushButtonData("profileButton", "Profile", DllPath, "bimsync.Commands.Profile");

            profileButton.ToolTip    = "Open your bimsync account";
            profileButton.LargeImage = RetriveImage("bimsync.Resources.user_large.png");
            profileButton.Image      = RetriveImage("bimsync.Resources.user_small.png");
            profileButton.SetContextualHelp(help);

            PushButtonData logoutButton = new PushButtonData("logoutButton", "Logout", DllPath, "bimsync.Commands.Logout");

            logoutButton.ToolTip    = "Logout";
            logoutButton.LargeImage = RetriveImage("bimsync.Resources.power-off_large.png");
            logoutButton.Image      = RetriveImage("bimsync.Resources.power-off_small.png");
            logoutButton.SetContextualHelp(help);

            SplitButtonData accountButton = new SplitButtonData("AccountButton", "Account");

            _accountButton = bimsyncPanel.AddItem(accountButton) as SplitButton;
            _accountButton.AddPushButton(profileButton);
            _accountButton.AddPushButton(logoutButton);

            //Add upload to bimsync Button
            PushButtonData uploadButton = new PushButtonData("uploadButton", "Upload", DllPath, "bimsync.Commands.Upload");

            uploadButton.ToolTip    = "Upload your model to bimsync";
            uploadButton.LargeImage = RetriveImage("bimsync.Resources.cloud-upload_large.png");
            uploadButton.Image      = RetriveImage("bimsync.Resources.cloud-upload_small.png");
            uploadButton.SetContextualHelp(help);

            _uploadButton = bimsyncPanel.AddItem(uploadButton);

            return(bimsyncPanel);
        }
Example #23
0
        public static RibbonPanel CreateInitialPanel(RibbonPanel bimsyncPanel)
        {
            //Retrive dll path
            string DllPath = Assembly.GetExecutingAssembly().Location;

            //Create contextual help
            string         helpPath = Path.Combine(Path.GetDirectoryName(DllPath), "bimsyncHelp.html");
            ContextualHelp help     = new ContextualHelp(ContextualHelpType.ChmFile, helpPath);

            //Add Login Button
            PushButtonData loginButton = new PushButtonData("loginButton", "Login", DllPath, "bimsync.Commands.Login");

            loginButton.ToolTip    = "Login to bimsync";
            loginButton.LargeImage = RetriveImage("bimsync.Resources.logo_large.png");
            loginButton.Image      = RetriveImage("bimsync.Resources.logo_small.png");
            loginButton.SetContextualHelp(help);

            _loginButton = bimsyncPanel.AddItem(loginButton);

            return(bimsyncPanel);
        }
        //return button data
        public override RibbonItemData GetItemData()
        {
            PushButtonData pushButtonData =
                new PushButtonData(_name,
                                   _text,
                                   _assemblyLocation,
                                   _className);

            if (_largeImage != null)
            {
                pushButtonData.LargeImage = _largeImage;
            }

            if (_smallImage != null)
            {
                pushButtonData.Image = _smallImage;
            }
            if (_toolTipsImage != null)
            {
                pushButtonData.ToolTipImage = _toolTipsImage;
            }
            if (!string.IsNullOrWhiteSpace(_toolTips))
            {
                pushButtonData.ToolTip = _toolTips;
            }
            if (!string.IsNullOrWhiteSpace(_description))
            {
                pushButtonData.LongDescription = _description;
            }
            if (_contextualHelp != null)
            {
                pushButtonData.SetContextualHelp(_contextualHelp);
            }
            if (!string.IsNullOrEmpty(_AvailabilityClassName))
            {
                pushButtonData.AvailabilityClassName = _AvailabilityClassName;
            }
            return(pushButtonData);
        }
Example #25
0
        public PushButtonData CreateButtonData(string assemblyName, string className)
        {
            string dllPath       = Path.Combine(ribbonPath, assemblyName, assemblyName + ".dll");
            string fullClassname = assemblyName + "." + className;
            string dataPath      = Path.Combine(ribbonPath, assemblyName, "data");
            string largeIcon     = Path.Combine(dataPath, className + "_large.png");
            string smallIcon     = Path.Combine(dataPath, className + "_small.png");
            string textPath      = Path.Combine(dataPath, className + ".txt");

            string[] text    = File.ReadAllLines(textPath);
            string   title   = text[0];
            string   tooltip = text[1];
            string   url     = text[2];

            PushButtonData data = new PushButtonData(fullClassname, title, dllPath, fullClassname);

            //PushButton pbutton = null;
            //if(parentItem is RibbonPanel)
            //{
            //    RibbonPanel panel = parentItem as RibbonPanel;
            //    pbutton = panel.AddItem(data) as PushButton;
            //}
            //if(parentItem is SplitButton)
            //{
            //    SplitButton splitBtn = parentItem as SplitButton;
            //    pbutton = splitBtn.AddPushButton(data);
            //}

            data.LargeImage = new BitmapImage(new Uri(largeIcon, UriKind.Absolute));
            data.Image      = new BitmapImage(new Uri(smallIcon, UriKind.Absolute));

            data.ToolTip = text[1];

            ContextualHelp chelp = new ContextualHelp(ContextualHelpType.Url, url);

            data.SetContextualHelp(chelp);

            return(data);
        }
Example #26
0
        public Result OnStartup(UIControlledApplication application)
        {
            RibbonPanel panel =
                application.CreateRibbonPanel("EntitlementAPI");

            ContextualHelp contextHelp = new ContextualHelp(
                ContextualHelpType.Url, "http://www.autodesk.com/developapps");

            PushButtonData button = new PushButtonData(
                "EntitlementAPI",
                "EntitlementAPI",
                typeof(ExtApplication).Assembly.Location,
                "EntitlementAPIRevit.Commands");

            button.Image = button.LargeImage =
                getBitmap("appicon2.png");
            button.ToolTip         = "This function lets you to check the Entitlement of the user";
            button.LongDescription = "Using this functionality you can create simple copy protection mechanism ";
            button.SetContextualHelp(contextHelp);

            panel.AddItem(button);

            return(Result.Succeeded);
        }
Example #27
0
        /// <summary>
        ///   Add a pushbutton to a panel
        /// </summary>
        /// <param name="rPanel"></param>
        /// <param name="buttonName"></param>
        /// <param name="buttonText"></param>
        /// <param name="imagePath16"></param>
        /// <param name="imagePath32"></param>
        /// <param name="dllPath"></param>
        /// <param name="dllClass"></param>
        /// <param name="toolTip"></param>
        /// <param name="pbAvail"></param>
        /// <param name="separatorBeforeButton"></param>
        private void AddButton(RibbonPanel rPanel,
                               string buttonName,
                               string buttonText,
                               string imagePath16,
                               string imagePath32,
                               string dllPath,
                               string dllClass,
                               string toolTip,
                               string pbAvail,
                               bool separatorBeforeButton)
        {
            //File path must exist
            if (!File.Exists(dllPath))
            {
                return;
            }

            //Separator??
            if (separatorBeforeButton)
            {
                rPanel.AddSeparator();
            }

            try
            {
                //Create the pbData
                PushButtonData m_mPushButtonData = new PushButtonData(
                    buttonName,
                    buttonText,
                    dllPath,
                    dllClass);

                if (!string.IsNullOrEmpty(imagePath16))
                {
                    try
                    {
                        m_mPushButtonData.Image = LoadPngImageSource(imagePath16);
                    }
                    catch (Exception m_e)
                    {
                        throw new Exception(m_e.Message);
                    }
                }

                if (!string.IsNullOrEmpty(imagePath32))
                {
                    try
                    {
                        m_mPushButtonData.LargeImage = LoadPngImageSource(imagePath32);
                    }
                    catch (Exception m_e)
                    {
                        throw new Exception(m_e.Message);
                    }
                }

                m_mPushButtonData.ToolTip = toolTip;

                //Availability?
                if (!string.IsNullOrEmpty(pbAvail))
                {
                    m_mPushButtonData.AvailabilityClassName = pbAvail;
                }

                //Add button to the ribbon
                rPanel.AddItem(m_mPushButtonData);
                ContextualHelp help = new ContextualHelp(ContextualHelpType.ChmFile, _path + "/help.htm");
                m_mPushButtonData.SetContextualHelp(help);
            }
            catch (Exception m_e)
            {
                throw new Exception(m_e.Message);
            }
        }
Example #28
0
        public static void CreateIcons(RibbonPanel bim42Panel)
        {
            //Retrive dll path
            string DllPath = Assembly.GetExecutingAssembly().Location;

            //Create contextual help
            ContextualHelp help = CreateContextualHelp("AlignHelp.chm");


            //Add Align Left Button
            PushButtonData alignLeftButton = new PushButtonData("alignLeftButton", "Align Left", DllPath, "AlignTag.AlignLeft");

            alignLeftButton.ToolTip    = "Align Tags or Elements Left";
            alignLeftButton.LargeImage = RetriveImage("AlignTag.Resources.AlignLeftLarge.png");
            alignLeftButton.Image      = RetriveImage("AlignTag.Resources.AlignLeftSmall.png");
            alignLeftButton.SetContextualHelp(help);

            //Add Align Right Button
            PushButtonData alignRightButton = new PushButtonData("alignRightButton", "Align Right", DllPath, "AlignTag.AlignRight");

            alignRightButton.ToolTip    = "Align Tags or Elements Right";
            alignRightButton.LargeImage = RetriveImage("AlignTag.Resources.AlignRightLarge.png");
            alignRightButton.Image      = RetriveImage("AlignTag.Resources.AlignRightSmall.png");
            alignRightButton.SetContextualHelp(help);

            //Add Align TOp Button
            PushButtonData alignTopButton = new PushButtonData("alignTopButton", "Align Top", DllPath, "AlignTag.AlignTop");

            alignTopButton.ToolTip    = "Align Tags or Elements Top";
            alignTopButton.LargeImage = RetriveImage("AlignTag.Resources.AlignTopLarge.png");
            alignTopButton.Image      = RetriveImage("AlignTag.Resources.AlignTopSmall.png");
            alignTopButton.SetContextualHelp(help);

            //Add Align bottom Button
            PushButtonData alignBottomButton = new PushButtonData("alignBottomButton", "Align Bottom", DllPath, "AlignTag.AlignBottom");

            alignBottomButton.ToolTip    = "Align Tags or Elements Bottom";
            alignBottomButton.LargeImage = RetriveImage("AlignTag.Resources.AlignBottomLarge.png");
            alignBottomButton.Image      = RetriveImage("AlignTag.Resources.AlignBottomSmall.png");
            alignBottomButton.SetContextualHelp(help);

            //Add Align Center Button
            PushButtonData alignCenterButton = new PushButtonData("alignCenterButton", "Align Center", DllPath, "AlignTag.AlignCenter");

            alignCenterButton.ToolTip    = "Align Tags or Elements Center";
            alignCenterButton.LargeImage = RetriveImage("AlignTag.Resources.AlignCenterLarge.png");
            alignCenterButton.Image      = RetriveImage("AlignTag.Resources.AlignCenterSmall.png");
            alignCenterButton.SetContextualHelp(help);

            //Add Align Middle Button
            PushButtonData alignMiddleButton = new PushButtonData("alignMiddleButton", "Align Middle", DllPath, "AlignTag.AlignMiddle");

            alignMiddleButton.ToolTip    = "Align Tags or Elements Middle";
            alignMiddleButton.LargeImage = RetriveImage("AlignTag.Resources.AlignMiddleLarge.png");
            alignMiddleButton.Image      = RetriveImage("AlignTag.Resources.AlignMiddleSmall.png");
            alignMiddleButton.SetContextualHelp(help);

            //Add Distribute horizontally Button
            PushButtonData distributeHorizontallyButton = new PushButtonData("distributeHorizontallyButton", "Distribute\nHorizontally", DllPath, "AlignTag.DistributeHorizontally");

            distributeHorizontallyButton.ToolTip    = "Distribute Tags or Elements Horizontally";
            distributeHorizontallyButton.LargeImage = RetriveImage("AlignTag.Resources.DistributeHorizontallyLarge.png");
            distributeHorizontallyButton.Image      = RetriveImage("AlignTag.Resources.DistributeHorizontallySmall.png");
            distributeHorizontallyButton.SetContextualHelp(help);

            //Add Distribute vertically Button
            PushButtonData distributeVerticallyButton = new PushButtonData("distributeVerticallyButton", "Distribute\nVertically", DllPath, "AlignTag.DistributeVertically");

            distributeVerticallyButton.ToolTip    = "Distribute Tags or Elements Vertically";
            distributeVerticallyButton.LargeImage = RetriveImage("AlignTag.Resources.DistributeVerticallyLarge.png");
            distributeVerticallyButton.Image      = RetriveImage("AlignTag.Resources.DistributeVerticallySmall.png");
            distributeVerticallyButton.SetContextualHelp(help);

            //Add Arrange Button
            PushButtonData arrangeButton = new PushButtonData("ArrangeButton", "Arrange\nTags", DllPath, "AlignTag.Arrange");

            arrangeButton.ToolTip    = "Arrange Tags around the view";
            arrangeButton.LargeImage = RetriveImage("AlignTag.Resources.ArrangeLarge.png");
            arrangeButton.Image      = RetriveImage("AlignTag.Resources.ArrangeSmall.png");
            arrangeButton.SetContextualHelp(help);

            //Add Untangle Vertically Button
            PushButtonData untangleVerticallyButton = new PushButtonData("UntangleVerticallyButton", "Untangle\nVertically", DllPath, "AlignTag.UntangleVertically");

            untangleVerticallyButton.ToolTip    = "Untangle Vertically Tags or Elements ";
            untangleVerticallyButton.LargeImage = RetriveImage("AlignTag.Resources.UntangleVerticallyLarge.png");
            untangleVerticallyButton.Image      = RetriveImage("AlignTag.Resources.UntangleVerticallySmall.png");
            untangleVerticallyButton.SetContextualHelp(help);

            //Add Untangle Horizontally Button
            PushButtonData untangleHorizontallyButton = new PushButtonData("UntangleHorizontallyButton", "Untangle\nHorizontally", DllPath, "AlignTag.UntangleHorizontally");

            untangleHorizontallyButton.ToolTip    = "Untangle Horizontally Tags or Elements ";
            untangleHorizontallyButton.LargeImage = RetriveImage("AlignTag.Resources.UntangleHorizontallyLarge.png");
            untangleHorizontallyButton.Image      = RetriveImage("AlignTag.Resources.UntangleHorizontallySmall.png");
            untangleHorizontallyButton.SetContextualHelp(help);

            bim42Panel.AddStackedItems(alignLeftButton, alignCenterButton, alignRightButton);
            bim42Panel.AddStackedItems(alignTopButton, alignMiddleButton, alignBottomButton);
            bim42Panel.AddStackedItems(distributeHorizontallyButton, distributeVerticallyButton, arrangeButton);
            bim42Panel.AddStackedItems(untangleVerticallyButton, untangleHorizontallyButton);
        }
Example #29
0
        // define a method that will create our tab and button
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Проверяем не истёк ли срок действия программы
            int deltaDateDaysInt1 = Security();

            if (deltaDateDaysInt1 < 1)
            {
                return; // Выходим из программы. То есть риббон не создастся
            }

            // Create a custom ribbon tab
            String tabName = "ARMOCAD";

            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Программки общего назначения");

            RibbonPanel electricRibbonPanel = application.CreateRibbonPanel(tabName, "Электрические системы");

            RibbonPanel agpzTagRibbonPanel = application.CreateRibbonPanel(tabName, "AGPZ TAG");

            RibbonPanel ribbonPanel2 = application.CreateRibbonPanel(tabName, "Механические системы");

            RibbonPanel ribbonPanel3 = application.CreateRibbonPanel(tabName, "Слаботочные системы");

            // Get dll assembly path
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;


            #region Common Buttons
            // create push button
            PushButtonData b1Data = new PushButtonData(
                "cmdDetailLinesLength",
                "DL" + System.Environment.NewLine + "length",
                thisAssemblyPath,
                "DetailLinesLength.DetailLinesLengthClass");

            b1Data.SetContextualHelp(helpButtonsDictionary["cmdDetailLinesLength"]);
            b1Data.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/DetailLinesLength_icon.png"));
            b1Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/DetailLinesLength_icon.png"));
            b1Data.ToolTip    = "Нажмите чтобы измерить длину линий детализации";

            // create push button
            PushButtonData b2Data = new PushButtonData(
                "cmdALength",
                "MEP" + System.Environment.NewLine + "length",
                thisAssemblyPath,
                "ALength.OverLength");

            b2Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/measureIcon.png"));
            b2Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/measureIcon.png"));
            b2Data.ToolTip    = "Нажмите чтобы измерить длину инженерных коммуникаций и линий";


            // Создаём выпадающие кнопки
            SplitButtonData sbdata1 = new SplitButtonData("Ara", "MEP Length");
            SplitButton     sb1     = ribbonPanel.AddItem(sbdata1) as SplitButton;
            sb1.AddPushButton(b2Data);
            sb1.AddPushButton(b1Data);

            // create push button for RotateAll
            PushButtonData b3Data = new PushButtonData(
                "cmdRotateAll",
                "Rotate" + System.Environment.NewLine + "Elements",
                thisAssemblyPath,
                "RotateAll.RotateAllClass");

            PushButton pb3 = ribbonPanel.AddItem(b3Data) as PushButton;
            pb3.ToolTip = "Select Elements to rotate them";
            BitmapImage pb3Image = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/rotateIcon.png"));
            pb3.LargeImage = pb3Image;

            // create push button
            PushButtonData b4Data = new PushButtonData(
                "cmdScheduleToExcel",
                "Export" + System.Environment.NewLine + "Schedule",
                thisAssemblyPath,
                "ScheduleToExcel.ScheduleToExcelClass");

            PushButton pb4 = ribbonPanel.AddItem(b4Data) as PushButton;
            pb4.ToolTip = "Select Schedules to export them";
            BitmapImage pb4Image = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/excelIcon.png"));
            pb4.LargeImage = pb4Image;


            // create push button
            PushButtonData b5Data = new PushButtonData(
                "cmdCopySheet",
                "Copy" + System.Environment.NewLine + "sheet",
                thisAssemblyPath,
                "CopySheet.CopySheetClass");

            PushButton pb5 = ribbonPanel.AddItem(b5Data) as PushButton;
            pb5.ToolTip = "Copy Sheet";
            BitmapImage pb5Image = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/copySheetIcon.png"));
            pb5.LargeImage = pb5Image;


            // create push button
            PushButtonData b6Data = new PushButtonData(
                "cmdSimilarParamsClass",
                "Similar" + System.Environment.NewLine + "Parameters",
                thisAssemblyPath,
                "SimilarParams.SimilarParamsClass");

            PushButton pb6 = ribbonPanel.AddItem(b6Data) as PushButton;
            pb6.ToolTip    = "Запись одинкаовых параметров в разные семейства";
            pb6.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/SimilarParams_icon.png"));
            pb6.LargeImage = pb6.Image;
            pb6.SetContextualHelp(helpButtonsDictionary["cmdSimilarParamsClass"]);


            // create push button
            PushButtonData b7Data = new PushButtonData(
                "cmdParamtextreplaceClass",
                "Param" + System.Environment.NewLine + "text replace",
                thisAssemblyPath,
                "Paramtextreplace.ParamtextreplaceClass");

            PushButton pb7 = ribbonPanel.AddItem(b7Data) as PushButton;
            pb7.ToolTip    = "Поиск и замена выбранных параметров в выбранных семействах";
            pb7.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/Paramtextreplace_icon.png"));
            pb7.LargeImage = pb7.Image;
            pb7.SetContextualHelp(helpButtonsDictionary["cmdParamtextreplaceClass"]);

            // create push button
            PushButtonData b9Data = new PushButtonData(
                "cmdOpeningElevation",
                "Opening" + System.Environment.NewLine + "Elevation",
                thisAssemblyPath,
                "OpeningElevation.OpeningElevationClass");

            PushButton pb9 = ribbonPanel.AddItem(b9Data) as PushButton;
            pb9.ToolTip    = "Нажмите чтобы обработать отверстия Cut Opening";
            pb9.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/openElevIcon.png"));
            pb9.LargeImage = pb9.Image;
            pb9.SetContextualHelp(helpButtonsDictionary["cmdOpeningElevation"]);

            // create push button
            PushButtonData b11Data = new PushButtonData(
                "cmdSectionByElement",
                "Section" + System.Environment.NewLine + "by Element",
                thisAssemblyPath,
                "SectionByElement.SectionByElementClass");

            PushButton pb11 = ribbonPanel.AddItem(b11Data) as PushButton;
            pb11.ToolTip    = "Выберите элемент(ы) и нажмите, чтобы создать разрез(ы) вдоль них";
            pb11.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/section_icon.png"));
            pb11.LargeImage = pb11.Image;

            // create push button
            PushButtonData b20Data = new PushButtonData(
                "cmdFilterExCommand",
                "Filter" + System.Environment.NewLine + "by Params",
                thisAssemblyPath,
                "ARMOCAD.FilterExCommand");

            PushButton pb20 = ribbonPanel.AddItem(b20Data) as PushButton;
            pb20.ToolTip    = "Выбирает элементы в модели по условиям";
            pb20.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/filterIcon.png"));
            pb20.LargeImage = pb20.Image;

            // create push button
            PushButtonData b25Data = new PushButtonData(
                "cmdCreateMepSpaces",
                "Пространства" + System.Environment.NewLine + "по АР",
                thisAssemblyPath,
                "ARMOCAD.CreateMepSpaces");
            b25Data.SetContextualHelp(helpButtonsDictionary["cmdCreateMepSpaces"]);

            PushButton pb25 = ribbonPanel.AddItem(b25Data) as PushButton;
            pb25.ToolTip    = "Ставит пространства по модели АР";
            pb25.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/spaceIcon.png"));
            pb25.LargeImage = pb25.Image;



            #endregion Common Buttons

            #region Electric Buttons

            // create push button
            PushButtonData elB1Data = new PushButtonData(
                "cmdSpreadEvenly",
                "Spread" + System.Environment.NewLine + "Evenly",
                thisAssemblyPath,
                "SpreadEvenly.SpreadEvenlyClass");

            PushButton elPB1 = electricRibbonPanel.AddItem(elB1Data) as PushButton;
            elPB1.ToolTip    = "Нажмите чтобы расставить семейства";
            elPB1.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/SpreadEvenly_icon.png"));
            elPB1.LargeImage = elPB1.Image;
            elPB1.SetContextualHelp(helpButtonsDictionary["cmdSpreadEvenly"]);

            //DenisButtons
            // create push button
            PushButtonData elB2Data = new PushButtonData(
                "cmdConPoints",
                "Размещение\n ТП",
                thisAssemblyPath,
                "ARMOCAD.ConPoint");

            elB2Data.SetContextualHelp(helpButtonsDictionary["cmdConPoints"]);
            elB2Data.LargeImage      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tpointsIcon.png"));
            elB2Data.ToolTip         = "Размещение точек подключения из связи";
            elB2Data.ToolTipImage    = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/Screenshot_1.png"));
            elB2Data.LongDescription =
                "Автоматическая расстановка электровыводов для подключения оборудования из связанных моделей с загрузкой технических параметров \n";
            // create push button
            PushButtonData elB3Data = new PushButtonData(
                "cmdConPointLocation",
                "Проверка\n ТП",
                thisAssemblyPath,
                "ARMOCAD.ConPointLocation");

            elB3Data.SetContextualHelp(helpButtonsDictionary["cmdConPointLocation"]);
            elB3Data.LargeImage      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/checkIcon.png"));
            elB3Data.ToolTip         = "Проверка размещенных точек подключения";
            elB3Data.LongDescription = "Проверка размещенных электровыводов оборудования из связанных моделей на количество и правильность размещения \n";
            elB3Data.ToolTipImage    = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/Screenshot_2.png"));
            // Создаём выпадающие кнопки
            SplitButtonData sbElData1 = new SplitButtonData("ConPoints", "ConPointLocation");
            SplitButton     sbEl1     = electricRibbonPanel.AddItem(sbElData1) as SplitButton;
            sbEl1.AddPushButton(elB2Data);
            sbEl1.AddPushButton(elB3Data);
            //sbEl1.CurrentButton.Name



            #endregion Electric Buttons

            #region AGPZ Tag Buttons

            // create push button
            PushButtonData tagB1Data = new PushButtonData(
                "cmdTagOVDucts",
                "TAG\n Комплект.",
                thisAssemblyPath,
                "ARMOCAD.TagOVDucts");

            tagB1Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagIcon.png"));
            tagB1Data.ToolTip    = "Тагирование воздуховодов и соединительных деталей";

            // create push button
            PushButtonData tagB2Data = new PushButtonData(
                "cmdTagOVEquipPhase1",
                "TAG Ф1\n Оборуд.",
                thisAssemblyPath,
                "ARMOCAD.TagOVEquipPhase1");

            tagB2Data.ToolTip    = "Тагирование (Фаза 1) оборудования, арматуры воздуховодов, воздухораспределителей, арматуры труб";
            tagB2Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagIcon.png"));

            // create push button
            PushButtonData tagB3Data = new PushButtonData(
                "cmdTagOVEquip",
                "TAG Ф2+\n Оборуд.",
                thisAssemblyPath,
                "ARMOCAD.TagOVEquip");

            tagB3Data.ToolTip    = "Тагирование (Фаза 2 и сл.) оборудования, арматуры воздуховодов, воздухораспределителей, арматуры труб";
            tagB3Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagIcon.png"));

            // create push button
            PushButtonData tagB4Data = new PushButtonData(
                "cmdTagOVEquipReplace",
                "TAG Ф2+\n Замена",
                thisAssemblyPath,
                "ARMOCAD.TagOVEquipReplace");

            tagB4Data.ToolTip    = "Тагирование (Фаза 2 и сл.) заменяет часть тэга на код системы 0001А => 9901А, не создавая новых тэгов";
            tagB4Data.LargeImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagIcon.png"));

            // Создаём выпадающие кнопки
            SplitButtonData sbTagData1 = new SplitButtonData("AGPZ", "TAGButtons");
            SplitButton     sbTag1     = agpzTagRibbonPanel.AddItem(sbTagData1) as SplitButton;
            sbTag1.AddPushButton(tagB1Data);
            sbTag1.AddPushButton(tagB2Data);
            sbTag1.AddPushButton(tagB3Data);
            sbTag1.AddPushButton(tagB4Data);


            // create push button
            PushButtonData tagB5Data = new PushButtonData(
                "cmdTagsFromSheetsEx",
                "TAG" + System.Environment.NewLine + "на листах",
                thisAssemblyPath,
                "ARMOCAD.TagsFromSheetsEx");

            PushButton tagPB5 = agpzTagRibbonPanel.AddItem(tagB5Data) as PushButton;
            tagPB5.ToolTip    = "Собирает информацию о тэгах и листах, на которых они расположены";
            tagPB5.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagIconGreen.png"));
            tagPB5.LargeImage = tagPB5.Image;

            // create push button
            PushButtonData tagB6Data = new PushButtonData(
                "cmdTBCommand",
                "TAG\n bridge",
                thisAssemblyPath,
                "ARMOCAD.TBCommand");

            PushButton tagPB6 = agpzTagRibbonPanel.AddItem(tagB6Data) as PushButton;
            tagPB6.ToolTip    = "Сцепляет элементы модели и схем";
            tagPB6.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/tagTransferIcon.png"));
            tagPB6.LargeImage = tagPB6.Image;


            #endregion AGPZ Tag Buttons

            #region MEP Buttons
            // create push button
            PushButtonData b8Data = new PushButtonData(
                "cmdSwapDuct",
                "Swap" + System.Environment.NewLine + "Duct",
                thisAssemblyPath,
                "SwapDuct.SwapDuctClass");

            PushButton pb8 = ribbonPanel2.AddItem(b8Data) as PushButton;
            pb8.ToolTip    = "Нажмите чтобы развернуть воздуховод";
            pb8.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/swapIcon.png"));
            pb8.LargeImage = pb8.Image;

            // create push button
            PushButtonData b12Data = new PushButtonData(
                "cmdThiDuct",
                "Толщина" + System.Environment.NewLine + "воздуховодов",
                thisAssemblyPath,
                "ThiDuct.ThiDuctClass");

            PushButton pb12 = ribbonPanel2.AddItem(b12Data) as PushButton;
            pb12.ToolTip    = "Толщина металла воздуховодов и соединительных деталей";
            pb12.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/thicknessIcon.png"));
            pb12.LargeImage = pb12.Image;

            // create push button
            PushButtonData b16Data = new PushButtonData(
                "cmdLengthOfTransition",
                "Длина" + System.Environment.NewLine + "перехода",
                thisAssemblyPath,
                "LengthOfTransition.LengthOfTransitionClass");

            PushButton pb16 = ribbonPanel2.AddItem(b16Data) as PushButton;
            pb16.ToolTip    = "Редактирует длину перехода по ВСН 353-86 Таблица 7";
            pb16.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/transIcon.png"));
            pb16.LargeImage = pb16.Image;


            // create push button
            PushButtonData b17Data = new PushButtonData(
                "cmdMEPSystemScheme",
                "Аксон." + System.Environment.NewLine + "схемы",
                thisAssemblyPath,
                "MEPSystemScheme.MEPSystemSchemeClass");

            PushButton pb17 = ribbonPanel2.AddItem(b17Data) as PushButton;
            pb17.ToolTip    = "Создает 3D виды по механическим системам";
            pb17.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/3dIcon.png"));
            pb17.LargeImage = pb17.Image;

            // create push button
            PushButtonData b19Data = new PushButtonData(
                "cmdChangeUnitExCommand",
                "AGPZ" + System.Environment.NewLine + "Copy Model",
                thisAssemblyPath,
                "ARMOCAD.ChangeUnitExCommand");

            PushButton pb19 = ribbonPanel2.AddItem(b19Data) as PushButton;
            pb19.ToolTip    = "Заменяет параметры для новой модели AGPZ";
            pb19.Image      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/copyIcon.png"));
            pb19.LargeImage = pb19.Image;

            #endregion MEP Buttons

            #region SS Buttons

            // create push button
            PushButtonData b21Data = new PushButtonData(
                "cmdSKSSocketsToShelfsExCommand",
                "Розетки по Шкафам",
                thisAssemblyPath,
                "ARMOCAD.SKSSocketsToShelfsExCommand");
            b21Data.ToolTip = "Заполняет в розетках параметр \"Розетка - Шкаф\"";
            b21Data.Image   = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/socketIcon.png"));

            // create push button
            PushButtonData b22Data = new PushButtonData(
                "cmdSKSFasadExCommand",
                "Схемы и Фасады",
                thisAssemblyPath,
                "ARMOCAD.SKSFasadExCommand");
            b22Data.ToolTip = "Маркирует розетки и создает чертежные виды со схемами и фасадами";
            b22Data.Image   = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/schemeIcon.png"));

            List <RibbonItem> ssButtons1 = new List <RibbonItem>();
            ssButtons1.AddRange(ribbonPanel3.AddStackedItems(b21Data, b22Data));

            // create push button
            PushButtonData b23Data = new PushButtonData(
                "cmdSKUDControlPlacementEx",
                "Точки Доступа",
                thisAssemblyPath,
                "ARMOCAD.SKUDControlPlacementEx");
            b23Data.ToolTip = "Размещение точек доступа по дверям из связанной модели АР";
            b23Data.Image   = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/arrowIcon.png"));
            b23Data.SetContextualHelp(helpButtonsDictionary["cmdSKUDControlPlacementEx"]);

            // create push button
            PushButtonData b24Data = new PushButtonData(
                "cmdSKUDPlaceEquipmentEx",
                "ТД -> Оборудование",
                thisAssemblyPath,
                "ARMOCAD.SKUDPlaceEquipmentEx");
            b24Data.ToolTip = "Размещение оборудования СКУД по точкам доступа";
            b24Data.Image   = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/equipIcon.png"));
            b24Data.SetContextualHelp(helpButtonsDictionary["cmdSKUDControlPlacementEx"]);

            List <RibbonItem> skudButtons1 = new List <RibbonItem>();
            skudButtons1.AddRange(ribbonPanel3.AddStackedItems(b23Data, b24Data));

            //========================= DenisButtons
            // create push button
            PushButtonData b26Data = new PushButtonData("cmdLinkEquipmentSS", "Размещение\n оборудования", thisAssemblyPath, "ARMOCAD.LinkEquipmentSS");

            b26Data.SetContextualHelp(helpButtonsDictionary["cmdLinkEquipmentSS"]);
            b26Data.LargeImage      = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/valveIcon.png"));
            b26Data.ToolTip         = "Размещение оборудования из связной модели";
            b26Data.LongDescription = "Автоматическая расстановка электровыводов для подключения оборудования из связанных моделей с загрузкой технических параметров \n";
            b26Data.ToolTipImage    = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/Screenshot_3.png"));
            // create push button
            PushButtonData b27Data = new PushButtonData("cmdLinkEquipmentLoc", "Проверка\n оборудования", thisAssemblyPath, "ARMOCAD.LinkEquipmentLoc");

            b27Data.SetContextualHelp(helpButtonsDictionary["cmdLinkEquipmentLoc"]);
            b27Data.LargeImage   = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/checkIcon.png"));
            b27Data.ToolTip      = "Проверка оборудования размещенного из связной модели \n";
            b27Data.ToolTipImage = new BitmapImage(new Uri("pack://application:,,,/ARMOCAD;component/Resources/Screenshot_2.png"));
            // Создаём выпадающие кнопки
            SplitButtonData sbdata2 = new SplitButtonData("LinkEquipmentSS", "SS LinkEquipmentSS");
            SplitButton     sb2     = ribbonPanel3.AddItem(sbdata2) as SplitButton;
            sb2.AddPushButton(b26Data);
            sb2.AddPushButton(b27Data);
            PushButton     curbutt = sb2.CurrentButton;
            ContextualHelp h       = curbutt.GetContextualHelp();
            sb2.SetContextualHelp(h);



            #endregion SS Buttons
        }
Example #30
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                // Get the revit version
                Version = Convert.ToInt32(application.ControlledApplication.VersionNumber);

                // Get the revit handle
                RevitHandle = IntPtr.Zero;
                if (Version < 2019)
                {
                    RevitHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
                }
                else
                {
                    RevitHandle = application.GetType().GetProperty("MainWindowHandle") != null
                        ? (IntPtr)application.GetType().GetProperty("MainWindowHandle")?.GetValue(application)
                        : IntPtr.Zero;
                }

                application.ControlledApplication.DocumentOpened += DocumentOpened;

                ScheduleDeleteUpdater excelSchedUpdater = new ScheduleDeleteUpdater(application.ActiveAddInId);
                UpdaterRegistry.RegisterUpdater(excelSchedUpdater, true);
                //ElementCategoryFilter ecf = new ElementCategoryFilter(BuiltInCategory.OST_Views);
                ElementClassFilter ecf = new ElementClassFilter(typeof(ViewSchedule), false);
                UpdaterRegistry.AddTrigger(excelSchedUpdater.GetUpdaterId(), ecf, Element.GetChangeTypeElementDeletion());

                // create the buttons
                string path = typeof(UpdateExcelApp).Assembly.Location;

                // pushbutton for the import command
                PushButtonData excelImportPushButtonData = new PushButtonData(
                    "Import Excel As Schedule", "Import Excel", path, typeof(ImportExcelCmd).FullName)
                {
                    LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.ExcelScheduleIcon.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()),
                    Image      = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.ExcelScheduleIcon_16x16.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()),
                    ToolTip    = "Import data from an Excel worksheet into Revit as a schedule.",
                };


                // Pushbutton for the settings command
                PushButtonData settingsPushButtonData = new PushButtonData(
                    "Import Lineweights", "Settings", path, typeof(SettingsCmd).FullName)
                {
                    ToolTip = "Set the line styles to use for different lineweight settings.",
                };

                // PushButtonData for the Manage Links window
                PushButtonData manageLinksPushButtonData = new PushButtonData(
                    "Manage Links", "Manage Links", path, typeof(ManageLinksCmd).FullName)
                {
                    ToolTip = "Manage linked excel files",
                };

                SplitButtonData excelSBD = new SplitButtonData("Import Excel", "Import\nExcel");

                // Set default config values
                string helpPath  = Path.Combine(Path.GetDirectoryName(typeof(UpdateExcelApp).Assembly.Location), "help\\ImportExcel.pdf");
                string tabName   = "Add-Ins";
                string panelName = "Views";
                if (RevitCommon.FileUtils.GetPluginSettings(typeof(UpdateExcelApp).Assembly.GetName().Name, out Dictionary <string, string> settings))
                {
                    // Settings retrieved, lets try to use them.
                    if (settings.ContainsKey("help-path") && !string.IsNullOrWhiteSpace(settings["help-path"]))
                    {
                        // Check to see if it's relative path
                        string hp = Path.Combine(Path.GetDirectoryName(typeof(UpdateExcelApp).Assembly.Location), settings["help-path"]);
                        if (File.Exists(hp))
                        {
                            helpPath = hp;
                        }
                        else
                        {
                            helpPath = settings["help-path"];
                        }
                    }
                    if (settings.ContainsKey("tab-name") && !string.IsNullOrWhiteSpace(settings["tab-name"]))
                    {
                        tabName = settings["tab-name"];
                    }
                    if (settings.ContainsKey("panel-name") && !string.IsNullOrWhiteSpace(settings["panel-name"]))
                    {
                        panelName = settings["panel-name"];
                    }
                }

                // Create the SplitButton.
                SplitButton excelSB = RevitCommon.UI.AddToRibbon(application, tabName, panelName, excelSBD);

                // Setup the help
                ContextualHelp help = null;
                if (File.Exists(helpPath))
                {
                    help = new ContextualHelp(ContextualHelpType.ChmFile, helpPath);
                }
                else if (Uri.TryCreate(helpPath, UriKind.Absolute, out Uri uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
                {
                    help = new ContextualHelp(ContextualHelpType.Url, helpPath);
                }
                if (help != null)
                {
                    excelImportPushButtonData.SetContextualHelp(help);
                    manageLinksPushButtonData.SetContextualHelp(help);
                    settingsPushButtonData.SetContextualHelp(help);
                    excelSBD.SetContextualHelp(help);
                    excelSB.SetContextualHelp(help);
                }

                PushButton importPB  = excelSB.AddPushButton(excelImportPushButtonData) as PushButton;
                PushButton managePB  = excelSB.AddPushButton(manageLinksPushButtonData) as PushButton;
                PushButton settingPB = excelSB.AddPushButton(settingsPushButtonData) as PushButton;
                excelSB.IsSynchronizedWithCurrentItem = false;

                return(Result.Succeeded);
            }
            catch
            {
                return(Result.Failed);
            }
        }
Example #31
0
        private void CreateRibbonTab(UIControlledApplication application)
        {
            var panel = ModPlus_Revit.App.RibbonBuilder.GetOrCreateRibbonPanel(
                application,
                "ModPlus",
                Language.TryGetCuiLocalGroupName("Утилиты"));

            // interface of current ModPlus function
            var intF           = new ModPlusConnector();
            var assembly       = Assembly.GetExecutingAssembly().Location;
            var contextualHelp = new ContextualHelp(ContextualHelpType.Url, ModPlus_Revit.App.RibbonBuilder.GetHelpUrl(intF.Name));

            // grids mode
            var pbdGridsMode = new PushButtonData(
                "Grids mode",
                ModPlus_Revit.App.RibbonBuilder.ConvertLName(Language.GetItem(LangItem, "h11")),
                Assembly.GetExecutingAssembly().Location,
                "mprTools.Commands.GridsMode.GridsModeCommand")
            {
                ToolTip = Language.GetItem(LangItem, "h12"),
                Image   = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/GridsMode_16x16.png"))
            };

            pbdGridsMode.SetContextualHelp(contextualHelp);

            // Grids bubbles
            var pbdGridsBubbles = new PushButtonData(
                "Grids bubbles",
                ModPlus_Revit.App.RibbonBuilder.ConvertLName(Language.GetItem(LangItem, "h19")),
                Assembly.GetExecutingAssembly().Location,
                "mprTools.Commands.GridsBubbles.GridsBubblesCommand")
            {
                ToolTip = Language.GetItem(LangItem, "h20"),
                Image   = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/GridsBubbles_16x16.png"))
            };

            pbdGridsBubbles.SetContextualHelp(contextualHelp);

            // Rebars outside host
            var pbdRebarsOutsideHost = new PushButtonData(
                "Rebars outside host",
                ModPlus_Revit.App.RibbonBuilder.ConvertLName(Language.GetItem(LangItem, "h17")),
                Assembly.GetExecutingAssembly().Location,
                "mprTools.Commands.RebarsWithoutHost")
            {
                ToolTip = Language.GetItem(LangItem, "h18"),
                Image   = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/RebarsWithoutHost_16x16.png"))
            };

            pbdRebarsOutsideHost.SetContextualHelp(contextualHelp);

            panel.AddStackedItems(pbdGridsMode, pbdGridsBubbles, pbdRebarsOutsideHost);

            // CategoryOn
            var pulldownButtonDataOn = new PulldownButtonData("CategoryOn", Language.GetItem(LangItem, "Show"))
            {
                Image = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/CategoryOnOff/CategoryOn_16x16.png")),
                ToolTip = Language.GetItem(LangItem, "ttShow")
            };

            pulldownButtonDataOn.SetContextualHelp(contextualHelp);

            // CategoryOn
            var pulldownButtonDataOff = new PulldownButtonData("CategoryOff", Language.GetItem(LangItem, "Hide"))
            {
                Image = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/CategoryOnOff/CategoryOff_16x16.png")),
                ToolTip = Language.GetItem(LangItem, "ttHide")
            };

            pulldownButtonDataOff.SetContextualHelp(contextualHelp);

            // Pick annotations
            var pbdPickAnnotations = new PushButtonData(
                "Pick Annotations",
                ModPlus_Revit.App.RibbonBuilder.ConvertLName(Language.GetItem(LangItem, "h29")),
                Assembly.GetExecutingAssembly().Location,
                "mprTools.Commands.PickAnnotationsCommand")
            {
                ToolTip = Language.GetItem(LangItem, "h30"),
                Image   = new BitmapImage(
                    new Uri(
                        $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/PickAnnotations_16x16.png"))
            };

            pbdPickAnnotations.SetContextualHelp(contextualHelp);

            // create stacked panel
            var stackedItems = panel.AddStackedItems(pulldownButtonDataOn, pulldownButtonDataOff, pbdPickAnnotations);

            const int onIndex  = 0;
            const int offIndex = 1;

            // add items to pulldata button
            var commands = new List <string>
            {
                "Windows", "Doors", "Walls", "Columns", "StructuralFraming", "StructuralFoundation", "Reinforcement",
                "Components", "GenericModels", "Separator",
                "Roofs", "Floors", "Ceilings", "Separator",
                "Stairs", "StairsRailing", "Ramps", "Separator",
                "Grids", "Levels", "Sections", "Elevations", "Tags", "ReferencePlanes", "Separator",
                "AllAnalytical", "BeamAnalytical", "BraceAnalytical", "ColumnAnalytical", "FloorAnalytical",
                "FoundationSlabAnalytical", "IsolatedFoundationAnalytical", "LinksAnalytical", "AnalyticalNodes",
                "WallFoundationAnalytical", "WallAnalytical", "BoundaryConditions", "InternalLoads",
                "LoadCases", "Loads"
            };

            if (stackedItems[onIndex] is PulldownButton pdbOn)
            {
                commands.ForEach(c =>
                {
                    if (c.Equals("Separator"))
                    {
                        pdbOn.AddSeparator();
                    }
                    else
                    {
                        pdbOn.AddPushButton(GetCategoryOnOffPushButtonData(c, true, intF, assembly));
                    }
                });
            }

            if (stackedItems[offIndex] is PulldownButton pdbOff)
            {
                commands.ForEach(c =>
                {
                    if (c.Equals("Separator"))
                    {
                        pdbOff.AddSeparator();
                    }
                    else
                    {
                        pdbOff.AddPushButton(GetCategoryOnOffPushButtonData(c, false, intF, assembly));
                    }
                });
            }

            // Coping distance
            var copingDistancePushButtonData = new PushButtonData(
                "Coping Distance",
                ModPlus_Revit.App.RibbonBuilder.ConvertLName(Language.GetItem(LangItem, "h1")),
                assembly,
                "mprTools.Commands.CopingDistance.CopingDistanceCommand")
            {
                LargeImage = new BitmapImage(new Uri(
                                                 $"pack://application:,,,/mprTools_{intF.AvailProductExternalVersion};component/Icons/CopingDistance_32x32.png")),
                ToolTip = Language.GetItem(LangItem, "h7")
            };

            copingDistancePushButtonData.SetContextualHelp(contextualHelp);

            // add to panel
            panel.AddItem(copingDistancePushButtonData);
        }
Example #32
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";
        }