Exemplo n.º 1
0
        private void DrawingIssusance()
        {
            Autodesk.Revit.UI.RibbonPanel m_panelIssueData = GetRibbonPanelByTabName(CTabName, "Drawing Issuance");

            string m_sheetIndexPath = Path.Combine(_path, "SheetIndex.dll");

            if (File.Exists(m_sheetIndexPath))
            {
                m_panelIssueData.AddItem(GetPushButtonData("SheetIndex",
                                                           "Import \nConsultants Sheets",
                                                           m_sheetIndexPath,
                                                           "SheetIndex.Command",
                                                           "KirkseyAppsRibbon.Icons.SheetIndex16.png",
                                                           "KirkseyAppsRibbon.Icons.SheetIndex32.png",
                                                           "Load Consultants Sheet Data to Sheet Index",
                                                           ""));
            }

            string m_revisionNarrativePath = Path.Combine(_path, "RevisionNarrative.dll");

            if (File.Exists(m_revisionNarrativePath))
            {
                m_panelIssueData.AddItem(GetPushButtonData("RevisionNarrative",
                                                           "Generate \nRevision Narrative",
                                                           m_revisionNarrativePath,
                                                           "RevisionNarrative.Command",
                                                           "KirkseyAppsRibbon.Icons.RevisionNarrative16.png",
                                                           "KirkseyAppsRibbon.Icons.RevisionNarrative32.png",
                                                           "Export Revision Data to Word Document for Revision Narrative",
                                                           ""));
            }
        }
Exemplo n.º 2
0
        private void AddMenu(UIControlledApplication app)
        {
            Autodesk.Revit.UI.RibbonPanel pannel = app.CreateRibbonPanel("UniBIM Tablas 1.5");
            //IMPORTANT NOTE: las imagenes de los botones deben tener su propiedad "Build Action" como Resource.
            string pathResource = "pack://application:,,,/UniBimTablas;component/Resources/";

            // Botones
            PushButtonData button1 = new PushButtonData("ubTablas01", "Exportar Tablas",
                                                        ExecutingAssemblyPath, "UniBimTablas.ExportarTablas");

            button1.LargeImage = new BitmapImage(new Uri(pathResource + "Excel32.png"));

            PushButtonData button2 = new PushButtonData("ubTablas02", "Crear Tablas",
                                                        ExecutingAssemblyPath, "UniBimTablas.CrearTablas");

            button2.LargeImage = new BitmapImage(new Uri(pathResource + "table32.png"));

            PushButtonData button3 = new PushButtonData("dbTablas03", "Sincronizar Ids",
                                                        ExecutingAssemblyPath, "UniBimTablas.SincronizarId");

            button3.LargeImage = new BitmapImage(new Uri(pathResource + "tag.png"));

            // PullDown Buttons
            pannel.AddItem(button2);
            pannel.AddItem(button1);
            pannel.AddItem(button3);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Implements the OnStartup event
        /// </summary>
        /// <param name="uiConApp"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication uiConApp)
        {
            thisApp = this;  // static access to this application instance

            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            string bitmapFolder     = Path.GetDirectoryName(thisAssemblyPath) + "\\icons";

            // Create New Ribbon Tab - SOM
            // If exists, throw Exception
            try
            {
                uiConApp.CreateRibbonTab(SystemPanelId);
            }
            catch
            {
                //MessageBox.Show(e.ToString());
            }

            try
            {
                Autodesk.Revit.UI.RibbonPanel Edit_RibbonPanel = uiConApp.CreateRibbonPanel(SystemPanelId, "Edit");
                // Create Buttons for Ribbon Panel
                PushButtonData IntersectButtonData = new PushButtonData("Intersect", "Intersect\n Elements ", thisAssemblyPath, "EditElements.IntersectDialog");

                // Bind Buttons to Ribbon Panel
                PushButton IntersectButton = Edit_RibbonPanel.AddItem(IntersectButtonData) as PushButton;

                IntersectButton.ToolTip      = "Intersect Elements.";
                IntersectButton.Image        = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute));
                IntersectButton.LargeImage   = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute));
                IntersectButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Intersect_24_new.png"), UriKind.Absolute));

                Edit_RibbonPanel.AddSeparator();

                // Create Buttons for Ribbon Panel
                PushButtonData SplitButtonData = new PushButtonData("Split", "Split\n Elements ", thisAssemblyPath, "EditElements.SplitDialog");

                // Bind Buttons to Ribbon Panel
                PushButton SplitButton = Edit_RibbonPanel.AddItem(SplitButtonData) as PushButton;
                SplitButton.ToolTip      = "Split Elements by cutting elements.";
                SplitButton.Image        = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute));
                SplitButton.LargeImage   = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute));
                SplitButton.ToolTipImage = new BitmapImage(new Uri(Path.Combine(bitmapFolder, "EasyRevit_Split_24_new.png"), UriKind.Absolute));

                // Subscribe to the "ApplicationInitialized" event
                // then continue from there once it is fired.
                // This is to ensure that the ribbon is fully
                // populated before we mess with it.
                uiConApp.ControlledApplication.ApplicationInitialized += OnApplicationInitialized;

                return(Result.Succeeded);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(Result.Succeeded);
        }
Exemplo n.º 4
0
        internal static Autodesk.Revit.UI.RibbonPanel AddPanel(UIControlledApplication uiControlledApplication, RibbonTab ribbonTab, string panelName)
        {
            //Setup
            Autodesk.Revit.UI.RibbonPanel _panel = uiControlledApplication.CreateRibbonPanel(ribbonTab.Name, panelName);

            DirectoryInfo _thisAssemblyDirectoryInfo = new DirectoryInfo(Assembly.GetExecutingAssembly().Location);

            //About Button
            PushButtonData _aboutButtonData = new PushButtonData(
                "BIM365_About",
                "About",
                _thisAssemblyDirectoryInfo.FullName,
                typeof(AboutCommand).FullName);

            ImageSource _aboutImage = Helpers.GetPngImageSource(nameof(Properties.Resources.About_16x16));

            if (_aboutImage != null)
            {
                _aboutButtonData.Image = _aboutImage;
            }

            ImageSource _aboutLargeImage = Helpers.GetPngImageSource(nameof(Properties.Resources.About_32x32));

            if (_aboutLargeImage != null)
            {
                _aboutButtonData.LargeImage = _aboutLargeImage;
            }
            _aboutButtonData.ToolTip = "Visit BIM365.tech!";

            _panel.AddItem(_aboutButtonData);

            //Help button
            PushButtonData _helpButtonData = new PushButtonData(
                "BIM365_Help",
                "Help",
                _thisAssemblyDirectoryInfo.FullName,
                typeof(HelpCommand).FullName);

            ImageSource _helpImage = Helpers.GetPngImageSource(nameof(Properties.Resources.Help_16x16));

            if (_aboutImage != null)
            {
                _helpButtonData.Image = _helpImage;
            }

            ImageSource _helpLargeImage = Helpers.GetPngImageSource(nameof(Properties.Resources.Help_32x32));

            if (_aboutLargeImage != null)
            {
                _helpButtonData.LargeImage = _helpLargeImage;
            }
            _helpButtonData.ToolTip = "Learn more about this add-in!";

            _panel.AddItem(_helpButtonData);

            return(_panel);
        }
Exemplo n.º 5
0
        public static void AddItems(Autodesk.Revit.UI.RibbonPanel panelToUse, string[] dynPaths, bool forceLargeIcon = false)
        {
            var totalFiles = dynPaths.Length;

            List <PushButtonData> pushButtonDatas = new List <PushButtonData>();

            foreach (var file in dynPaths)
            {
                FileInfo       fInfo         = new FileInfo(file);
                string         buttonName    = $"relay{fInfo.Name.Replace(" ", "")}";
                PushButtonData newButtonData = new PushButtonData(buttonName,
                                                                  fInfo.Name.GenerateButtonText(),
                                                                  Path.Combine(Globals.ExecutingPath, "Relay.dll"), "Relay.Run")
                {
                    ToolTip = fInfo.FullName
                };

                //set the images, if there are none, use default
                string icon32 = fInfo.FullName.Replace(".dyn", "_32.png");
                newButtonData.LargeImage = File.Exists(icon32)
                    ? new BitmapImage(new Uri(icon32))
                    : new BitmapImage(new Uri(Path.Combine(Globals.RelayGraphs, "Dynamo_32.png")));

                string icon16 = fInfo.FullName.Replace(".dyn", "_16.png");
                newButtonData.Image = File.Exists(icon16)
                    ? new BitmapImage(new Uri(icon16))
                    : new BitmapImage(new Uri(Path.Combine(Globals.RelayGraphs, "Dynamo_16.png")));

                pushButtonDatas.Add(newButtonData);
            }

            if (forceLargeIcon)
            {
                foreach (var pushButton in pushButtonDatas)
                {
                    panelToUse.AddItem(pushButton);
                }
                return;
            }

            var splitButtons = SplitList(pushButtonDatas, 2);

            foreach (var buttonGroup in splitButtons)
            {
                switch (buttonGroup.Count)
                {
                case 2:
                    panelToUse.AddStackedItems(buttonGroup[0], buttonGroup[1]);
                    break;

                case 1:
                    panelToUse.AddItem(buttonGroup[0]);
                    break;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create push button on the panel
        /// </summary>
        /// <param name="name">Internal name of the button</param>
        /// <param name="text">Text user will see</param>
        /// <param name="externalCommandType">Class which implements IExternalCommand interface.
        /// This command will be execute when user push the button</param>
        /// <param name="action">Additional action with whe button</param>
        /// <returns>Panel where button were created</returns>
        public CustomPanel CreateButton(string name,
                                        string text,
                                        Type externalCommandType,
                                        Action <CustomPushButton> action)
        {
            var button = new CustomPushButton(name,
                                              text,
                                              externalCommandType);

            action?.Invoke(button);
            var buttonData = button.GetButtonData();

            ConvertToPushButton = _panel.AddItem(buttonData) as PushButton;
            return(this);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Adds the push button.
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="pbd"></param>
        /// <param name="pbds"></param>
        /// <returns></returns>
        public static void AddPushButton(this RibbonPanel pnl, PulldownButtonData pbd, List <PushButtonData> pbds)
        {
            if (!(pnl.AddItem(pbd) is PulldownButton pdbtn))
            {
                return;
            }

            pdbtn.ToolTip         = pbd.ToolTip;
            pdbtn.LongDescription = pbd.LongDescription;
            pdbtn.LargeImage      = pbd.LargeImage;

            foreach (var pbdl in pbds)
            {
                var btn = pdbtn.AddPushButton(pbdl);

                if (btn == null)
                {
                    continue;
                }

                btn.ToolTip         = pbdl.ToolTip;
                btn.LongDescription = pbdl.LongDescription;
                btn.LargeImage      = pbdl.LargeImage;
            }
        }
Exemplo n.º 8
0
        static void CreateLegendPlacerButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdHelloWorld",
                                                           "Place\nLegends", thisAssemblyPath, "EssentialTools.LegendPlacer"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Select a series of sheets and choose to place a legend automatically on each one at a specified location.";

            try
            {
                // Uri uriImage = new Uri((@"C:\Users\rahil\Documents\Visual Studio 2015\Projects\designtechRibbon-master-20180206T094812Z-001\designtechRibbon-master\DesignTechRibbon\Resources\EssentialTools\place_legends.png"));
                Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/place_legends.png"));

                // Apply image to bitmap
                BitmapImage largeImage = new BitmapImage(uriImage);
                // Apply image to button
                pushButton.LargeImage = largeImage;
            }
            catch (Exception ex)
            {
                Autodesk.Revit.UI.TaskDialog.Show("a", ex.Message);
            }
        }
Exemplo n.º 9
0
        private void AddMenu(RevitUI.UIControlledApplication app)
        {
            RevitUI.RibbonPanel        ribbon_panel = app.CreateRibbonPanel("数据接口");
            RevitUI.PulldownButtonData data_pull    = new RevitUI.PulldownButtonData("RevitTest", "测试功能");

            RevitUI.PulldownButton btn_pull = ribbon_panel.AddItem(data_pull) as RevitUI.PulldownButton;
            btn_pull.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitEx.png"));

            btn_pull.AddPushButton(new RevitUI.PushButtonData("Test", "Hello World", appAssembly, "RevitEx.cmdTest"));
            btn_pull.AddPushButton(new RevitUI.PushButtonData("Journaling", "Objects Journaling.", appAssembly, "RevitEx.cmdJournaling"));
            btn_pull.AddPushButton(new RevitUI.PushButtonData("ShowObjects", "Objects Show", appAssembly, "RevitEx.cmdShowSteels"));

            RevitUI.PushButtonData data_push = new RevitUI.PushButtonData("RevitExcel", "导出Excel", appAssembly, "RevitEx.cmdExportExcel");
            RevitUI.PushButton     btn_push  = ribbon_panel.AddItem(data_push) as RevitUI.PushButton;
            btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitExcel.png"));
        }
Exemplo n.º 10
0
        static void CreateMatchFireRatingButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdFireDoorWall",
                                                           "Match Fire\nRatings", thisAssemblyPath, "EssentialTools.MatchFireDoorWall"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Push Fire Rating From Walls to Doors/Windows";

            try
            {
                Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/fire_ratings.png"));
                // Apply image to bitmap
                BitmapImage largeImage = new BitmapImage(uriImage);
                // Apply image to button
                pushButton.LargeImage = largeImage;
            }
            catch (Exception ex)
            {
                Autodesk.Revit.UI.TaskDialog.Show("a", ex.Message);
            }
        }
Exemplo n.º 11
0
        static void CreateSplineRenumberButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdSpline",
                                                           "Renumber\nElements", thisAssemblyPath, "EssentialTools.RenumberSpline"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            //  SetRibbonItemToolTip(pushButton, CreateSplineToolTip);
            pushButton.ToolTip = "Renumber doors, windows or rooms based on a picked spline. Elements are then numbered based on their proximity to parameters on that curve.";


            try
            {
                Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/renumber_elements.png"));
                // Apply image to bitmap
                BitmapImage largeImage = new BitmapImage(uriImage);
                // Apply image to button
                pushButton.LargeImage = largeImage;
            }
            catch (Exception ex)
            {
                Autodesk.Revit.UI.TaskDialog.Show("a", ex.Message);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Adds the button.
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="pbd"></param>
        /// <returns></returns>
        public static void AddButton(this RibbonPanel pnl, PushButtonData pbd)
        {
            if (!(pnl.AddItem(pbd) is PushButton btn))
            {
                return;
            }

            btn.ToolTip         = pbd.ToolTip;
            btn.LongDescription = pbd.LongDescription;
            btn.LargeImage      = pbd.LargeImage;
        }
Exemplo n.º 13
0
        /// <summary>
        /// Adds the button.
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        public static void AddButton <T>(this RibbonPanel pnl, ButtonInfo <T> info) where T : IExternalCommand
        {
            if (!(pnl.AddItem(info.CreatePbd()) is PushButton btn))
            {
                return;
            }

            btn.ToolTip         = info.ToolTip;
            btn.LongDescription = info.LongDescription;
            btn.LargeImage      = info.LargeImage;
        }
Exemplo n.º 14
0
        private void LoadAutomationTools()
        {
            //List<string> vaildUser = new List<string>();
            //vaildUser.Add("michaelr");
            //vaildUser.Add("clays");
            //vaildUser.Add("russellw");
            //vaildUser.Add("garthw");
            //vaildUser.Add("craigp");
            //vaildUser.Add("amandam");
            //foreach (String user in vaildUser)
            //{
            //if (user == Currentuser.ToLower())
            //{
            string m_detailPath = Path.Combine(_path, "DetailBuilder.dll");

            if (File.Exists(m_detailPath))
            {
                Autodesk.Revit.UI.RibbonPanel m_panelUtilities = GetRibbonPanelByTabName(CTabName, "Automation Tools");

                PushButtonData m_pbData = GetPushButtonData("Detail Builder", "Detail \nBuilder", m_detailPath, "DetailBuilder.Command", "KirkseyAppsRibbon.Icons.DetailBuilder16.png", "KirkseyAppsRibbon.Icons.DetailBuilder32.png", "Formerly Project Seagul. *M*A*G*I*C*", "");

                var button1 = m_panelUtilities.AddItem(m_pbData);

                var tempPath = Path.Combine(Path.GetTempPath(), "Magic.swf");

                using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("KirkseyAppsRibbon.Magic.swf"))
                {
                    var buffer = new byte[stream.Length];

                    stream.Read(buffer, 0, buffer.Length);

                    using (FileStream fs = new FileStream(
                               tempPath, FileMode.Create, FileAccess.Write))
                    {
                        fs.Write(buffer, 0, buffer.Length);
                    }
                }

                RibbonToolTip toolTip1 = new RibbonToolTip()
                {
                    Title           = "Detail Builder",
                    Content         = "Import standard details based on model componets",
                    ExpandedContent = "Formerly Project Seagul. *M*A*G*I*C*",
                    ExpandedVideo   = new Uri(tempPath),
                    HelpSource      = new Uri("https://www.youtube.com/watch?v=U9t-slLl30E"),
                    IsHelpEnabled   = true,
                    IsProgressive   = true
                };

                SetRibbonItemToolTip(button1, toolTip1);
            }
            //}
            //}
        }
Exemplo n.º 15
0
        private void AddRibbon(RevitUI.UIControlledApplication app)
        {
            app.CreateRibbonTab("数据接口");

            RevitUI.RibbonPanel        ribbon_panel = app.CreateRibbonPanel("数据接口", "数据");
            RevitUI.PulldownButtonData data_pull    = new RevitUI.PulldownButtonData("RevitMethod", "功能");
            RevitUI.PulldownButton     btn_pull     = ribbon_panel.AddItem(data_pull) as RevitUI.PulldownButton;
            btn_pull.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitEx.png"));
            btn_pull.AddPushButton(new RevitUI.PushButtonData("TestDlg", "Hello World", appAssembly, "RevitEx.cmdTest"));
            btn_pull.AddPushButton(new RevitUI.PushButtonData("Journaling", "Objects Journaling", appAssembly, "RevitEx.cmdJournaling"));
            btn_pull.AddPushButton(new RevitUI.PushButtonData("ShowObjects", "Objects Show", appAssembly, "RevitEx.cmdShowSteels"));

            ribbon_panel = app.CreateRibbonPanel("数据接口", "接口");
            RevitUI.SplitButtonData data_split = new RevitUI.SplitButtonData("RevitExcel", "Excel接口");
            RevitUI.SplitButton     btn_split  = ribbon_panel.AddItem(data_split) as RevitUI.SplitButton;
            btn_split.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitExcel.png"));
            RevitUI.PushButton btn_push = btn_split.AddPushButton(new RevitUI.PushButtonData("ExportExcel", "导出Excel", appAssembly, "RevitEx.cmdExportExcel"));
            btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\ExportExcel.png"));
            btn_push            = btn_split.AddPushButton(new RevitUI.PushButtonData("ImportExcel", "导入Excel", appAssembly, "RevitEx.cmdImportExcel"));
            btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\ImportExcel.png"));

            //创建下拉组合框
            ribbon_panel = app.CreateRibbonPanel("数据接口", "控件");
            RevitUI.ComboBoxData data_combo = new RevitUI.ComboBoxData("选项");
            RevitUI.ComboBox     cbx        = ribbon_panel.AddItem(data_combo) as RevitUI.ComboBox;

            if (cbx != null)
            {
                cbx.ItemText = "选择操作";

                RevitUI.ComboBoxMemberData data_cbxm = new RevitUI.ComboBoxMemberData("Close", "关闭");
                data_cbxm.GroupName = "编辑操作";
                cbx.AddItem(data_cbxm);
                data_cbxm = new RevitUI.ComboBoxMemberData("Change", "修改");
                cbx.AddItem(data_cbxm);
            }
            cbx.CurrentChanged += change;
            cbx.DropDownClosed += closed;
        }
Exemplo n.º 16
0
        private void AddMenu(UIControlledApplication app)
        {
            Autodesk.Revit.UI.RibbonPanel rvtRibbonPanel = app.CreateRibbonPanel("Revit Lookup");
            PulldownButtonData            data           = new PulldownButtonData("Options", "Revit Lookup");

            RibbonItem     item       = rvtRibbonPanel.AddItem(data);
            PulldownButton optionsBtn = item as PulldownButton;

            optionsBtn.AddPushButton(new PushButtonData("HelloWorld", "Hello World...", ExecutingAssemblyPath, "RevitLookup.HelloWorld"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Db..", "Snoop DB...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopDb"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Current Selection...", "Snoop Current Selection...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopModScope"));
            optionsBtn.AddPushButton(new PushButtonData("Snoop Application...", "Snoop Application...", ExecutingAssemblyPath, "RevitLookup.CmdSnoopApp"));
            optionsBtn.AddPushButton(new PushButtonData("Test Framework...", "Test Framework...", ExecutingAssemblyPath, "RevitLookup.CmdTestShell"));
            optionsBtn.AddPushButton(new PushButtonData("Events...", "Events...", ExecutingAssemblyPath, "RevitLookup.CmdEvents"));
        }
Exemplo n.º 17
0
        /// <summary>
        /// A method that allows you to create a Push Button with greater ease
        /// </summary>
        /// <param name="ribbonPanel"></param>
        /// <param name="name"></param>
        /// <param name="path"></param>
        /// <param name="command"></param>
        /// <param name="tooltip"></param>
        /// <param name="icon"></param>
        private static void CreatePushButton(Autodesk.Revit.UI.RibbonPanel ribbonPanel, string name, string path, string command, string tooltip, string icon)
        {
            PushButtonData pbData = new PushButtonData(
                name,
                name,
                path,
                command);

            PushButton pb = ribbonPanel.AddItem(pbData) as PushButton;

            pb.ToolTip = tooltip;
            BitmapImage pb2Image = new BitmapImage(new Uri(String.Format("pack://application:,,,/DesignTechRibbonPaid;component/Resources/{0}", icon)));

            pb.LargeImage = pb2Image;
        }
Exemplo n.º 18
0
        public Result OnStartup(UIControlledApplication application)
        {
            string        tabName  = "IFC";
            RibbonControl myRibbon = ComponentManager.Ribbon;
            RibbonTab     ggTab    = null;

            foreach (RibbonTab tab in myRibbon.Tabs)
            {
                if (string.Compare(tab.Id, tabName, true) == 0)
                {
                    ggTab = tab;
                    break;
                }
            }
            if (ggTab == null)
            {
                application.CreateRibbonTab(tabName);
            }
            Autodesk.Revit.UI.RibbonPanel rp = application.CreateRibbonPanel(tabName, "Browser");
            PushButtonData pbd = new PushButtonData("propBrowser", "Ifc Property Browser", Assembly.GetExecutingAssembly().Location, "RevitIfcPropertyBrowser.ShowBrowser");

            pbd.ToolTip = "Show Property Browser";

            rp.AddItem(pbd);
            DockablePaneProviderData data = new DockablePaneProviderData();
            Browser browser = new Browser();

            data.FrameworkElement          = browser as System.Windows.FrameworkElement;
            data.InitialState              = new DockablePaneState();
            data.InitialState.DockPosition = DockPosition.Tabbed;

            mPropertyPanel = new DockablePaneId(new Guid("{C7C70722-1B9B-4454-A054-DFD142F23580}"));
            application.RegisterDockablePane(mPropertyPanel, "IFC Properties", browser);

            foreach (RibbonTab tab in ComponentManager.Ribbon.Tabs)
            {
                if (tab.Id == "Modify")
                {
                    tab.PropertyChanged += PanelEvent;
                    break;
                }
            }
            RequestHandler handler = new RequestHandler(browser);

            mExEvent = ExternalEvent.Create(handler);
            application.ControlledApplication.DocumentChanged += handler.ControlledApplication_DocumentChanged;
            return(Result.Succeeded);
        }
Exemplo n.º 19
0
        private void AddSplitButton(Autodesk.Revit.UI.RibbonPanel panel, string m_masterSchedulePath, string m_ExcelImportPath)
        {
            PushButtonData buttonOne = new PushButtonData("ButtonOne", "Image Based Import", m_masterSchedulePath, "ManageMasterSchedule.Command");

            buttonOne.LargeImage = LoadPngImgSource("KirkseyAppsRibbon.Icons.MasterScheduleUpdateImage32.png");

            PushButtonData buttonTwo = new PushButtonData("ButtonTwon", "Text/Schedule Based Import", m_ExcelImportPath, "ExcelImport.Command");

            buttonTwo.LargeImage = LoadPngImgSource("KirkseyAppsRibbon.Icons.MasterScheduleUpdateText32.png");

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

            sb.AddPushButton(buttonOne);
            sb.AddPushButton(buttonTwo);
        }
Exemplo n.º 20
0
        //Manage Tab Buttons
        static void CreateRemoveViewTemplatesButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdTemplates",
                                                           "View\nTemplates", thisAssemblyPath, "EssentialTools.CommandRemoveTemplates"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Delete view templates from a custom UI interface. Toggle between view templates that are used and not used, or search for a particular view template by its name.";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/view_template.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 21
0
        public static void CreateButton(string cmdName, string cmdClassName, string toolTip, RibbonPanel ribbonPanel, string iconName)
        {
            // Get dll assembly path
            var thisAssemblyPath = Assembly.GetExecutingAssembly().Location;


            var buttonData = new PushButtonData(
                $"cmd{cmdName.Replace(" ", "")}",
                cmdName,
                thisAssemblyPath,
                cmdClassName);
            var pushButton = ribbonPanel.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = toolTip;
            var image =
                new BitmapImage(new Uri($"pack://application:,,,/WeWork.MyFirstAddin;component/Resources/{iconName}"));

            pushButton.LargeImage = image;
        }
Exemplo n.º 22
0
        static void CreateExportCategoryParametersButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp) //#########################
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdExportCategoryParameter",
                                                           "Export\nParameters", thisAssemblyPath, "EssentialTools.ExportCategoryParameters"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Export Category Parameter";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbonPaid;component/Resources/EssentialTools/export_category_parameters.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 23
0
        static void CreateAutoDimCurtainWallsButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdAutoDimCurtainWalls",
                                                           "Auto-Dim\nCurtain Walls", thisAssemblyPath, "EssentialTools.Info"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Auto Dimension Curtain Walls";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbonPaid;component/Resources/EssentialTools/auto_dimension_curtain_walls.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 24
0
        //Excel Tab Buttons
        static void CreateExcelSheetButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdExcelSheet",
                                                           "Import\nSheets", thisAssemblyPath, "EssentialTools.SheetsFromExcel"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Create drawing sheets by importing a simple Excel drawing list.";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/import_sheets.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 25
0
        static void CreateAdvancedSharedParamaterMapButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdInfo",
                                                           "Paramater\nMap", thisAssemblyPath, "EssentialTools.Info"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Advanced Shared Paramater Map";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbonPaid;component/Resources/EssentialTools/parameter_map.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 26
0
        static void CreateRemoveFiltersButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdRemoveFilters",
                                                           "Remove\nFilters", thisAssemblyPath, "EssentialTools.CommandRemoveFilters"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = "Delete filters from a custom UI interface. Toggle between any filters in the model that are unused, used or unassigned, or search for a particular filter by its name";

            Uri uriImage = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/filters.png"));
            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }
Exemplo n.º 27
0
        // define a method that will create our tab and button
        static void AddRibbonPanel(UIControlledApplication application)
        {
            String tabName   = "Island";
            String panelName = "Tools";

            try
            {
                // Create a custom ribbon tab
                application.CreateRibbonTab(tabName);
            }
            catch
            {
            }
            try
            {
                // Add a new ribbon panel
                Autodesk.Revit.UI.RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, panelName);
            }
            catch
            {
            }

            Autodesk.Revit.UI.RibbonPanel panel = application.GetRibbonPanels(tabName).FirstOrDefault(n => n.Name.Equals(panelName, StringComparison.InvariantCulture));

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

            // create push button for CurveTotalLength
            PushButtonData b1Data = new PushButtonData(
                "cmdPart_Library",
                "Part Library",
                thisAssemblyPath,
                "Part_Library.Command");

            PushButton pb1 = panel.AddItem(b1Data) as PushButton;

            pb1.ToolTip = "Part Library";
            Image       img    = Resource.pLibraryico;
            ImageSource imgSrc = GetImageSource(img);

            pb1.LargeImage = imgSrc;
        }
Exemplo n.º 28
0
 public static void CreateCommand(Autodesk.Revit.UI.RibbonPanel panel, ToolbarPanel toolPanel, string name, string title, string path, string com, Bitmap bitmap, string tooltip, Bitmap bitmapHelp, string longDesc, ContextualHelp contextHelp)
 {
     try
     {
         PushButton button = panel.AddItem(new PushButtonData(name, title, path, com)) as PushButton;
         button.LargeImage = ConvertBitmap(bitmap);
         button.ToolTip    = tooltip;
         if (null != bitmapHelp)
         {
             button.ToolTipImage = ConvertBitmap(bitmapHelp);
         }
         button.LongDescription = longDesc;
         button.SetContextualHelp(contextHelp);
         toolPanel.Commands.Add(new ToolbarCommand(name, button));
     }
     catch (Exception ex)
     {
         Metrics.AppendLog("Exception creating button: " + name + "\r\n" + ex.Message);
     }
 }
Exemplo n.º 29
0
 public Result OnStartup(UIControlledApplication application)
 {
     m_AssemblyPath = typeof(App).Assembly.Location;
     m_ribbonPath   = Path.GetDirectoryName(m_AssemblyPath) + "\\Icons";
     try
     {
         application.CreateRibbonTab(tabName);
         return(Result.Succeeded);
     }
     catch (Exception ex)
     {
         return(Result.Succeeded);
     }
     finally
     {
         Autodesk.Revit.UI.RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, strPanelChinese);
         PushButtonData familyParameterEdit        = new PushButtonData("familyParameterEdit", strProductNameChinese, m_AssemblyPath, typeof(Addin).FullName);
         familyParameterEdit.LargeImage = new BitmapImage(new Uri(m_ribbonPath + "\\familyParameterEdit.png"));
         familyParameterEdit.ToolTip    = "Domain Manager tool";
         ribbonPanel.AddItem(familyParameterEdit);
     }
 }
Exemplo n.º 30
0
        //Tools Buttons

        static void CreatePinUnpinButton(UIControlledApplication a, string tabname, Autodesk.Revit.UI.RibbonPanel rp)
        {
            // Autodesk.Revit.UI.RibbonPanel newPanel = a.CreateRibbonPanel(tabname, "Manage");

            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData buttonData = new PushButtonData("cmdPin/UnpinFromList",
                                                           "Pin/Unpin", thisAssemblyPath, "EssentialTools.PinAndUnpinList"); //Make sure this class exists

            PushButton pushButton = rp.AddItem(buttonData) as PushButton;

            pushButton.ToolTip = @"Choose to pin/unpin levels, grids and links in bulk from a custom UI interface.";

            Uri uriImage2 = new Uri((@"pack://application:,,,/DesignTechRibbon;component/Resources/EssentialTools/pin_unpin.png"));

            // Apply image to bitmap
            BitmapImage largeImage = new BitmapImage(uriImage2);

            // Apply image to button
            pushButton.LargeImage = largeImage;
        }