// Token: 0x06000001 RID: 1 RVA: 0x00002048 File Offset: 0x00000248
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab("Leica");
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            RibbonPanel ribbonPanel = application.CreateRibbonPanel("Leica", "Leica Building Link");
            string      text        = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LeicaBimLinkRevit.dll");

            ribbonPanel.AddItem(new PushButtonData("HeXML_Import", "HeXML Import", text, "LeicaBimLinkRevit.Extensions.HeXML_Import")
            {
                ToolTip    = "\"HeXML Import\" allows to import \"Measurement Points\" from a file into the current project.",
                LargeImage = Imaging.CreateBitmapSourceFromHBitmap(Resources.Import_HeXML.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
            });
            ribbonPanel.AddItem(new PushButtonData("Family_Place", "Measurement Point", text, "LeicaBimLinkRevit.Extensions.Family_Place")
            {
                ToolTip    = "Allows the user to place a \"Measurement Point\" in the current project.",
                LargeImage = Imaging.CreateBitmapSourceFromHBitmap(Resources.MeasurementPoint_Place.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
            });
            ribbonPanel.AddItem(new PushButtonData("HeXML_Export", "HeXML Export", text, "LeicaBimLinkRevit.Extensions.HeXML_Export")
            {
                ToolTip    = "\"HeXML Export\" allows to select \"Measurement Points\" from the current project and export them into an *.hexml file.",
                LargeImage = Imaging.CreateBitmapSourceFromHBitmap(Resources.Export_HeXML.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
            });
            ribbonPanel.AddItem(new PushButtonData("Help", "Help", text, "LeicaBimLinkRevit.Extensions.Help")
            {
                LargeImage = Imaging.CreateBitmapSourceFromHBitmap(Resources.Help_HeXML.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions())
            });
            return(0);
        }
Beispiel #2
0
        public RibbonPanel ribbonPanel(UIControlledApplication a)
        {
            string      tab         = "My test tab";
            RibbonPanel ribbonPanel = null;

            try
            {
                a.CreateRibbonTab(tab);
            }
            catch { }
            try
            {
                RibbonPanel panel = a.CreateRibbonPanel(tab, "test");
            }
            catch { }

            List <RibbonPanel> panels = a.GetRibbonPanels(tab);

            foreach (RibbonPanel p in panels)
            {
                if (p.Name == "test")
                {
                    ribbonPanel = p;
                }
            }
            return(ribbonPanel);
        }
        public void CreateRibbonPanel(UIControlledApplication application)
        {
            #region Tab, Panel
            //Initialize tab name
            string tabName = "Exporter";
            //Initialize panel name
            string panelName = "OBJExportPanel";
            //Initialize assembly path
            string path         = Assembly.GetExecutingAssembly().Location;
            String assemblyPath = Path.GetDirectoryName(path) + "\\configObjModule.dll";
            //Instantiate the CreateRibbonTab method
            application.CreateRibbonTab(tabName);
            //Instantiate the CreateRibbonPanel method to create a panel instance
            var firstPanel = application.CreateRibbonPanel(tabName, panelName);
            #endregion

            #region User Interface
            //Instantiate the PushButtonData class (and send it to the memory) to create a button instance
            //Set object initializers to add extra properties to avoid messy overloading
            PushButtonData firstButtonData = new PushButtonData("firstButtonData", "Export", assemblyPath, "configObjModule.Command");
            {
                //Object initializers
            };
            //Assign the instantiated AddItem method to the PushButton class to add the button to the panel
            PushButton firstButton = firstPanel.AddItem(firstButtonData) as PushButton;
            //Assign the BitmapImage instantiated class to the LargeImage property to add new icon to the button
            firstButton.LargeImage = new BitmapImage(new Uri(Path.Combine(Path.GetDirectoryName(path) + "\\Icon_0309.ico"), UriKind.Absolute));
            #endregion
        }
Beispiel #4
0
        //*****************************ribbonPanel()*****************************
        public RibbonPanel ribbonPanel(UIControlledApplication a)
        {
            string tab = "Построение линейной схемы"; // Tab name
            // Empty ribbon panel
            RibbonPanel ribbonPanel = null;

            // Try to create ribbon tab.
            try
            {
                a.CreateRibbonTab(tab);
            }
            catch { }
            // Try to create ribbon panel.
            try
            {
                RibbonPanel panel = a.CreateRibbonPanel(tab, "Построение линейных схем");
            }
            catch { }
            // Search existing tab for your panel.
            List <RibbonPanel> panels = a.GetRibbonPanels(tab);

            foreach (RibbonPanel p in panels)
            {
                if (p.Name == "Построение линейных схем")
                {
                    ribbonPanel = p;
                }
            }
            //return panel
            return(ribbonPanel);
        }
Beispiel #5
0
        public Result OnStartup(UIControlledApplication application)
        {
            assemblyPath   = System.Reflection.Assembly.GetExecutingAssembly().Location;
            assemblyFolder = System.IO.Path.GetDirectoryName(assemblyPath);

            string tabName      = "Weandrevit";
            string solutionName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

            try { application.CreateRibbonTab(tabName); } catch { }
            RibbonPanel panel1 = application.CreateRibbonPanel(tabName, solutionName);

            string     btn1name = solutionName + ".Command";
            PushButton btn      = panel1.AddItem(new PushButtonData(
                                                     btn1name,
                                                     btn1name,
                                                     assemblyPath,
                                                     btn1name)
                                                 ) as PushButton;

            string     btn2name = solutionName + ".CommandConfig";
            PushButton btn2     = panel1.AddItem(new PushButtonData(
                                                     btn2name,
                                                     btn2name,
                                                     assemblyPath,
                                                     btn2name)
                                                 ) as PushButton;


            return(Result.Succeeded);
        }
        private void Initialize(UIControlledApplication application)
        {
            string panelName = "Test";
            string tabName   = "test001";

            var         assembly = Assembly.GetExecutingAssembly();
            var         location = assembly.Location;
            var         panels   = application.GetRibbonPanels();
            RibbonPanel panel    = null;

            if (panels.Count(x => x.Name == panelName) > 0)
            {
                panel = panels.First(x => x.Name == panelName);
            }
            else
            {
                try
                {
                    application.CreateRibbonTab(tabName);
                }
                catch (Autodesk.Revit.Exceptions.ArgumentException argException) { }

                panel = application.CreateRibbonPanel(tabName, panelName);
            }

            PushButtonData data;

            data = new PushButtonData("HalfTone", "Полутона", location, "Orlovtsev.Externals.HalfToneCommand");
            var pbTrussCreate = panel.AddItem(data) as PushButton;

            pbTrussCreate.LargeImage = new BitmapImage(new Uri
                                                           (Path.Combine(Path.GetDirectoryName(location) ?? throw new InvalidOperationException(),
                                                                         @"Resources/icons", "iconHalfTone.png")));
            pbTrussCreate.ToolTip = "Полутона помещений";
        }
Beispiel #7
0
        public Result OnStartup(UIControlledApplication application)
        {
            assemblyPath = typeof(App).Assembly.Location;
            iconsPath    = Path.GetDirectoryName(assemblyPath);

            string tabName = "Weandrevit";

            try { application.CreateRibbonTab(tabName); }
            catch { }

            RibbonPanel        panel  = null;
            List <RibbonPanel> panels = application.GetRibbonPanels(tabName)
                                        .Where(i => i.Name == "Армирование")
                                        .ToList();

            if (panels.Count == 1)
            {
                panel = panels.First();
            }
            else
            {
                panel = application.CreateRibbonPanel(tabName, "Армирование");
            }

            PushButton btnAllRebarAsBody = panel.AddItem(new PushButtonData(
                                                             "ExplodeRebarSer",
                                                             "Взорвать",
                                                             assemblyPath,
                                                             "ExplodeRebarSet.CommandExplode")
                                                         ) as PushButton;

            return(Result.Succeeded);
        }
Beispiel #8
0
        //public static Dictionary<Document, List<ViewSheet>> allSheets
        //    = new Dictionary<Document, List<ViewSheet>>();


        public Result OnStartup(UIControlledApplication application)
        {
            string tabName = "Weandrevit";

            try { application.CreateRibbonTab(tabName); } catch { }

            assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            RibbonPanel panel1 = application.CreateRibbonPanel(tabName, "Печать2");

            PushButton btnCreate = panel1.AddItem(new PushButtonData(
                                                      "CreateHoleTask",
                                                      "Печать",
                                                      assemblyPath,
                                                      "BatchPrintYay.CommandBatchPrint")
                                                  ) as PushButton;

            btnCreate.LargeImage = PngImageSource("BatchPrintYay.Resources.PrintBig.png");
            btnCreate.Image      = PngImageSource("BatchPrintYay.Resources.PrintSmall.png");
            btnCreate.ToolTip    = "Пакетная печать выбранных листов в формат PDF";

            PushButton btnRefresh = panel1.AddItem(new PushButtonData(
                                                       "RefreshSchedules",
                                                       "Обновить спец-и",
                                                       assemblyPath,
                                                       "BatchPrintYay.CommandRefreshSchedules")
                                                   ) as PushButton;

            btnRefresh.LargeImage = PngImageSource("BatchPrintYay.Resources.UpdateBig.png");
            btnRefresh.Image      = PngImageSource("BatchPrintYay.Resources.UpdateSmall.png");


            return(Result.Succeeded);
        }
Beispiel #9
0
        public Result OnStartup(UIControlledApplication application)
        {
            String tabName = "LM2";

            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch (Autodesk.Revit.Exceptions.ArgumentException)
            { }

            List <RibbonPanel> allRibbonPanels = application.GetRibbonPanels(tabName);

            foreach (RibbonPanel rp in allRibbonPanels)
            {
                if (rp.Name == "Elevations")
                {
                    AddPushButton(rp);
                    return(Result.Succeeded);
                }
            }
            RibbonPanel intElevPanel = application.CreateRibbonPanel(tabName, "Elevations");

            AddPushButton(intElevPanel);
            return(Result.Succeeded);
        }
Beispiel #10
0
        Result IExternalApplication.OnStartup(UIControlledApplication application)
        {
            appCommand = this;
            m_app      = application;
            try
            {
                m_app.CreateRibbonTab(tabName);
            }
            catch { }

            RibbonPanel setupPanel      = m_app.CreateRibbonPanel(tabName, "Project Setup");
            string      currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;

            Assembly   assembly   = Assembly.GetExecutingAssembly();
            PushButton pushButton = setupPanel.AddItem(new PushButtonData("Settings", "Settings", currentAssembly, "HOK.DoorMonitor.SettingCommand")) as PushButton;

            pushButton.LargeImage = LoadBitmapImage(assembly, "settings.png");

            //doorFail = new DoorFailureProcessor();
            //Autodesk.Revit.ApplicationServices.Application.RegisterFailuresProcessor(doorFail);
            //Autodesk.Revit.ApplicationServices.ControlledApplication.RegisterFailuresProcessor(doorFail);

            thisAppId   = application.ActiveAddInId;
            doorUpdater = new DoorUpdater(thisAppId);

            application.ControlledApplication.DocumentOpened     += RegisterDoorUpdaterOnOpen;
            application.ControlledApplication.FailuresProcessing += CheckDoorWarning;

            return(Result.Succeeded);
        }
Beispiel #11
0
        public Result OnStartup(UIControlledApplication application)
        {
            assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            string tabName = "Weandrevit";

            try { application.CreateRibbonTab(tabName); } catch { }
            string             panelName = "INGRAD";
            RibbonPanel        panel     = null;
            List <RibbonPanel> tryPanels = application.GetRibbonPanels(tabName).Where(i => i.Name == panelName).ToList();

            if (tryPanels.Count == 0)
            {
                panel = application.CreateRibbonPanel(tabName, panelName);
            }
            else
            {
                panel = tryPanels.First();
            }

            PushButton btn = panel.AddItem(new PushButtonData(
                                               "IngradParams",
                                               "IngradParams",
                                               assemblyPath,
                                               "IngradParametrisation.Cmd")
                                           ) as PushButton;


            return(Result.Succeeded);
        }
Beispiel #12
0
        static void AddRibbonPanel(UIControlledApplication application)
        {
            String tabName = "Useful things";

            application.CreateRibbonTab(tabName);

            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Tools");

            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData PB1Data = new PushButtonData("Button", "Create and Set params", thisAssemblyPath, "FamilyParamTransfer.CreateSetParam");

            PushButton PB1 = ribbonPanel.AddItem(PB1Data) as PushButton;

            PB1.ToolTip = "Just click it";
            //BitmapImage PB1image = new BitmapImage(new Uri("pack://*****:*****@"C:\Users\Plucio\source\repos\FamilyParamTransfer\FamilyParamTransfer\Resources\tool.png.ico"));

            PB1.LargeImage = PB1image;

            PushButtonData PB2Data = new PushButtonData("Button2", "Read and Save params", thisAssemblyPath, "FamilyParamTransfer.ReadSaveParam");

            PushButton PB2 = ribbonPanel.AddItem(PB2Data) as PushButton;

            PB2.ToolTip = "Just click it";
            //BitmapImage PB1image = new BitmapImage(new Uri("pack://*****:*****@"C:\Users\Plucio\source\repos\FamilyParamTransfer\FamilyParamTransfer\Resources\tree.png.ico"));

            PB2.LargeImage = PB2image;
        }
Beispiel #13
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                appCommand = this;
                m_app      = application;
                thisAppId  = application.ActiveAddInId;
                addInGuid  = thisAppId.GetGUID(); //9C4D37B2-155D-4AC8-ACCF-383D86673F1C
                addInName  = thisAppId.GetAddInName();

                try
                {
                    m_app.CreateRibbonTab(tabName);
                }
                catch { }

                RibbonPanel setupPanel      = m_app.CreateRibbonPanel(tabName, "DTM Tool");
                string      currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;

                Assembly   assembly   = Assembly.GetExecutingAssembly();
                PushButton pushButton = setupPanel.AddItem(new PushButtonData("Admin", "Admin", currentAssembly, "HOK.ElementWatcher.AdminCommand")) as PushButton;
                pushButton.LargeImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.dtm32.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

                dtmUpdater = new DTMUpdater(thisAppId);

                application.ControlledApplication.DocumentOpened     += RegisterElementUpdaterOnOpen;
                application.ControlledApplication.FailuresProcessing += CheckElementWarning;
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                MessageBox.Show("Failed to initialize DTM Tool.\n" + ex.Message, "DTM Initialization", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(Result.Succeeded);
        }
Beispiel #14
0
        public Result OnStartup(UIControlledApplication application)
        {
            assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string tabName = "BIM-STARTER TEST";

            try { application.CreateRibbonTab(tabName); } catch { }

            string             panelName = "Шаблоны";
            RibbonPanel        panel     = null;
            List <RibbonPanel> tryPanels = application.GetRibbonPanels(tabName).Where(i => i.Name == panelName).ToList();

            if (tryPanels.Count == 0)
            {
                panel = application.CreateRibbonPanel(tabName, panelName);
            }
            else
            {
                panel = tryPanels.First();
            }

            PushButton btn = panel.AddItem(new PushButtonData(
                                               "CopyViewTemplate",
                                               "Копировать шаблон",
                                               assemblyPath,
                                               "ViewTemplateUtils.CommandCopyTemplate")
                                           ) as PushButton;

            return(Result.Succeeded);
        }
Beispiel #15
0
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            string tabName = "BimTeamTools";

            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Общее");

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

            // create push button for TotalLength
            PushButtonData b1Data = new PushButtonData(
                "cmdTotalLength",
                "Посчитать" + System.Environment.NewLine + "  длину  ",
                thisAssemblyPath,
                "BimTeamTools.TotalLength");

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

            pb1.ToolTip = "Подсчет длины выбранных элементов";
            BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/BimTeamTools;component/Resources/TotalLengthIcon.png"));

            pb1.LargeImage = pb1Image;
        }
        /// <summary>
        /// Create Instance of Tab in Ribbon Panel and assign Data
        /// </summary>
        /// <param name="application"></param>
        public static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            //Set Tab Name
            string tabName = Constants.uiTabName;

            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "DockableWindow");
            // Get dll assembly path
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            //Assign Data and Actions to Buttons
            PushButtonData b1Data = new PushButtonData(
                "cmdShowDockableWindow",
                "  Show  " + System.Environment.NewLine + "  Tab  ",
                thisAssemblyPath,
                "Application_E2A.RibbonPanel_ShowDockableWindow");

            PushButtonData b2Data = new PushButtonData(
                "cmdHideDockableWindow",
                "  Hide  " + System.Environment.NewLine + "  Tab  ",
                thisAssemblyPath,
                "Application_E2A.RibbonPanel_HideDockableWindow");

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

            pb1.ToolTip = "Show Dockable Tab";
            PushButton pb2 = ribbonPanel.AddItem(b2Data) as PushButton;

            pb2.ToolTip = "Hide Dockable Tab";
        }
Beispiel #17
0
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication a)
        {

            // Allow for the folderpath to connect dll file as well as images 
            // Do this for efficiency
            string folderPath = @"C:\Samples\DFWtags0\DFWtags0\bin\Debug";
            string dll = Path.Combine(folderPath, "DFWtags0.dll");

            // Create Custom Tab
            string TheRibbon = "DFW-CGI-Tag";
            a.CreateRibbonTab(TheRibbon);

            // Create Seperated Panels
            RibbonPanel panelA = a.CreateRibbonPanel(TheRibbon, "Tag Function");
            RibbonPanel panelB = a.CreateRibbonPanel(TheRibbon, "B");

            // Below is two seperate ways to create the same button with different code. The second way being more efficient
            // Create Button btnOne
            PushButton btnOne = (PushButton)panelA.AddItem(new PushButtonData("One", "Tag", dll, "DFWtags0.TagFunction"));
            Uri uriImage = new Uri(@"C:\Samples\TagByCatVersions\TagByCatVersions\bin\Debug\32Groot.png");
            BitmapImage largeImage = new BitmapImage(uriImage);
            btnOne.LargeImage = largeImage; //Actually attaches image to button one - panel A
            btnOne.ToolTip = "Lets hope this tag works...";
            btnOne.LongDescription = "This is a lonnnnnnnnnnnnng description!";

            // Create Button btnTwo
            PushButton btnTwo = (PushButton)panelA.AddItem(new PushButtonData("Two", "Get Element Info", dll, "DFWtags0.ElementInfo"));
            btnTwo.LargeImage = new BitmapImage(new Uri(Path.Combine(folderPath, "32Ironman.png"), UriKind.Absolute));



            return Result.Succeeded;
        }
Beispiel #18
0
        public Result OnStartup(UIControlledApplication uic_app)
        {
            // get existing SOM Ribbon Tab
            var panels = uic_app.GetRibbonPanels("SOM Tools");

            if (null == panels)
            {
                uic_app.CreateRibbonTab("SOM Tools");
            }
            // get or create panel
            RibbonPanel panel = panels.Where(x => x.Name == "SOM-NY").FirstOrDefault();

            if (null == panel)
            {
                panel = uic_app.CreateRibbonPanel("SOM Tools", "SOM NY");
            }

            // pull down button
            PulldownButtonData pdBtnData  = new PulldownButtonData("SOMNY_Utils", "UTILITIES");
            RibbonItem         ribbonItem = panel.AddItem(pdBtnData);
            PulldownButton     pdBtn      = ribbonItem as PulldownButton;

            // get assembly
            string ExecutingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string ExecutingAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

            string ExecutingAssemblyDirectory = Path.GetDirectoryName(ExecutingAssemblyPath);


            // add items
            pdBtn.AddPushButton(new PushButtonData("RenumberAreasByPickSeq", "Re-Number Areas By Pick Order", Path.Combine(ExecutingAssemblyDirectory, "RenumberAreasByPickSeq.dll"), "RenumberAreasByPickSeq.Cmd_PickAreasBySeq"));

            return(Result.Succeeded);
        }
Beispiel #19
0
        public Result OnStartup(UIControlledApplication application)
        {
            String tabName = "StreamVR";

            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch (Autodesk.Revit.Exceptions.ArgumentException)
            { }

            List <RibbonPanel> allRibbonPanels = application.GetRibbonPanels(tabName);

            RibbonPanel intElevPanel = null;

            foreach (RibbonPanel rp in allRibbonPanels)
            {
                if (rp.Name == "Stream Actions")
                {
                    intElevPanel = rp;
                    break;
                }
            }

            if (intElevPanel == null)
            {
                intElevPanel = application.CreateRibbonPanel(tabName, "Stream Actions");
            }

            AddStreamButton(intElevPanel, application);
            AddExportButton(intElevPanel, application);
            AddExportMaterialsButton(intElevPanel, application);

            return(Result.Succeeded);
        }
Beispiel #20
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch
            {
                Log.AppendLog(LogMessageType.INFO, "Ribbon tab was not created because it already exists: " + tabName);
            }

            var assembly = Assembly.GetAssembly(GetType());
            var panel    = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Mission Control")
                           ?? application.CreateRibbonPanel(tabName, "Mission Control");
            var unused = (PushButton)panel.AddItem(new PushButtonData("StylesManager_Command", "  Styles  " + Environment.NewLine + "Manager",
                                                                      assembly.Location, "HOK.MissionControl.StylesManager.StylesManagerCommand")
            {
                LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl.StylesManager", Properties.Resources.StylesManager_ImageName),
                ToolTip    = Properties.Resources.StylesManager_Description
            });

            StylesManagerHandler = new StylesManagerRequestHandler();
            StylesManagerEvent   = ExternalEvent.Create(StylesManagerHandler);

            return(Result.Succeeded);
        }
Beispiel #21
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            string path     = Assembly.GetExecutingAssembly().Location;
            string myRibbon = "BIM Coordination";

            try
            {
                application.CreateRibbonTab(myRibbon);
            }
            catch { }

            RibbonPanel panel1 = application.CreateRibbonPanel(myRibbon, "Gestion des espaces");

            PushButton space_creation = (PushButton)panel1.AddItem(new PushButtonData("Créer des espaces", "Créer des espaces", path, "Space_Manager.Space_creation"));

            space_creation.LargeImage = PngImageSource("Space_Manager.Resources.Space_Creation_32.png");
            space_creation.Image      = PngImageSource("Space_Manager.Resources.Space_Creation_16.png");
            //space_creation.ToolTipImage = PngImageSource("Space_Manager.Resources.Space_Creation_16.png");
            space_creation.ToolTip         = "Crée les espaces MEP sur la base des pièces architectes.";
            space_creation.LongDescription = "Sélectionnez les options souhaitées dans la boîte de dialogue pour générer les espaces MEP à partir des pièces d'une maquette en lien.";

            PushButton space_analyse = (PushButton)panel1.AddItem(new PushButtonData("Analyser les écarts espaces/pièces", "Analyser les espaces", path, "Space_Manager.Space_analyse"));

            //space_creation.LargeImage = PngImageSource("Space_Manager.Resources.Space_Analyse_32.png");
            //space_creation.Image = PngImageSource("Space_Manager.Resources.Space_Analyse_16.png");
            //space_creation.ToolTipImage = PngImageSource("Space_Manager.Resources.Space_Analyse_16.png");
            space_analyse.ToolTip         = "Analyse les écarts entre les espaces MEP et les pièces architectes.";
            space_analyse.LongDescription = "Sélectionnez le ou les liens contenant les pièces pour lancer l'analyse.";

            return(Result.Succeeded);
        }
Beispiel #22
0
        public RibbonPanel ribbonPanel(UIControlledApplication a, String tabName, String panelName)
        {
            RibbonPanel ribbonPanel = null;

            try
            {
                a.CreateRibbonTab(tabName);
            }
            catch { }
            try
            {
                RibbonPanel panel = a.CreateRibbonPanel(tabName, panelName);
            }
            catch { }

            List <RibbonPanel> panels = a.GetRibbonPanels(tabName);

            foreach (RibbonPanel p in panels)
            {
                if (p.Name == panelName)
                {
                    ribbonPanel = p;
                }
            }

            return(ribbonPanel);
        }
Beispiel #23
0
        /// <summary>
        /// Executes when Revit has started, and is
        /// in a zero-document state.
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication a)
        {
            string tabName = "AMA Tools";

            try
            {
                a.CreateRibbonTab(tabName);
            }
            catch (Autodesk.Revit.Exceptions.ArgumentException)
            {
                // Do nothing.
            }
            // Add a new ribbon panel
            RibbonPanel newPanel         = a.CreateRibbonPanel(tabName, "AutoAudit");
            string      thisAssemblyPath = Assembly.GetExecutingAssembly().Location;

            PushButtonData button1Data = new PushButtonData("command",
                                                            "Audit", thisAssemblyPath, "AutoAudit.Command");

            button1Data.AvailabilityClassName = "AutoAudit.Availability";
            PushButton pushButton1 = newPanel.AddItem(button1Data) as PushButton;

            pushButton1.LargeImage = BmpImageSource(@"AutoAudit.Embedded_Media.large.png");


            return(Result.Succeeded);
        }
Beispiel #24
0
        private void CreateRibbonPanel(UIControlledApplication application)
        {
            string resourceDir   = CommonUtils.Utils.GetResourceDir();
            string buttonIcons32 = Path.Combine(resourceDir, CommonUtils.DefineUtils.ICONS_32_DIR);
            string buttonIcons16 = Path.Combine(resourceDir, CommonUtils.DefineUtils.ICONS_16_DIR);

            // Create a custom ribbon tab
            application.CreateRibbonTab(Define.RevitToolRibbonTab);

            #region About

            string assembly = @"C:\ProgramData\Autodesk\Revit\Addins\2019\OpeningCombiler" + @"\OpeningTools.dll";

            // Add Combine ribbon panel
            RibbonPanel combineRibbonPanel = application.CreateRibbonPanel(Define.RevitToolRibbonTab, Define.CombinePanel);
            assembly = @"C:\ProgramData\Autodesk\Revit\Addins\2019\OpeningCombiler" + @"\CommonOpeningTools.dll";

            // create pull down button for Combine opening
            PulldownButtonData combineDownButton = new PulldownButtonData("Combine Opening", "Combine \nOpening");
            PulldownButton     groupCombine      = combineRibbonPanel.AddItem(combineDownButton) as PulldownButton;
            combineDownButton.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening32x32.png"), UriKind.Absolute));
            combineDownButton.Image      = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening16X16.png"), UriKind.Absolute));
            groupCombine.LargeImage      = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening32x32.png"), UriKind.Absolute));
            groupCombine.Image           = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening16X16.png"), UriKind.Absolute));

            // add button for synchronize
            PushButtonData synchronoursButtonData = new PushButtonData("Synchronous", "Synchronous", assembly, "CommonTools.OpeningClient.Synchronize.Commandata");
            PushButton     synchronoursBtn        = groupCombine.AddPushButton(synchronoursButtonData) as PushButton;
            synchronoursBtn.LargeImage = new BitmapImage(new Uri(Path.Combine(buttonIcons32, "Combine_Opening_Synchronous32x32.png"), UriKind.Absolute));
            synchronoursBtn.Image      = new BitmapImage(new Uri(Path.Combine(buttonIcons16, "Combine_Opening_Synchronous16x16.png"), UriKind.Absolute));
            synchronoursBtn.ToolTip    = "Synchronous";

            #endregion About
        }
 public static void AddRibbonTab(this UIControlledApplication uiCa, string tabName)
 {
     if (!HasTab(uiCa, tabName))
     {
         uiCa.CreateRibbonTab(tabName);
     }
 }
Beispiel #26
0
        public Result OnStartup(UIControlledApplication application)
        {
            string puthFolder = @"C:\Users\Дмитрий\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug";
            string fileDLL    = Path.Combine(puthFolder, "ClassLibrary1.dll");
            string nameRibon  = "Расширенные команды";

            application.CreateRibbonTab(nameRibon);

            RibbonPanel panelA = application.CreateRibbonPanel(nameRibon, "Панель A");

            PushButton btnShowRooms = (PushButton)panelA.AddItem(
                CreateButton <RibbonButtonsAddons>("Получить список комнат", fileDLL));

            PushButton btnShowAllWalls = (PushButton)panelA.AddItem(
                CreateButton <RibbonBtnShowWall>("Получить список стен", fileDLL));

            PushButton btnShowHide = (PushButton)panelA.AddItem(
                CreateButton <RibbonBtnShowHide>("Показать категории", fileDLL));

            PushButton btnNewColor = (PushButton)panelA.AddItem(
                CreateButton <RibbonBtnSetNewColorRoom>("Выделить подходящие квартиры", fileDLL));

            PushButton btnCreatePath = (PushButton)panelA.AddItem(
                CreateButton <RibbonPath>("Построить путь", fileDLL));

            string pathImage = @"C:\Users\Дмитрий\Desktop\Revit\Revit2016APITraining\Labs\2_Revit_UI_API\Images";

            btnShowRooms.LargeImage    = new BitmapImage(new Uri(Path.Combine(pathImage, "ImgHelloWorld.png"), UriKind.Absolute));
            btnShowAllWalls.LargeImage = new BitmapImage(new Uri(Path.Combine(pathImage, "Elements.ico"), UriKind.Absolute));
            btnShowHide.LargeImage     = new BitmapImage(new Uri(Path.Combine(pathImage, "Parameters.ico"), UriKind.Absolute));
            btnNewColor.LargeImage     = new BitmapImage(new Uri(Path.Combine(pathImage, "eye.png")));
            btnCreatePath.LargeImage   = new BitmapImage(new Uri(Path.Combine(pathImage, "draw_path.png")));

            return(Result.Succeeded);
        }
        public Result OnStartup(UIControlledApplication application)
        {
            application.CreateRibbonTab("Vina Takeuchi Tab");
            var ribbon = application.CreateRibbonPanel("Vina Takeuchi Tab", "Learn-Selection-Panel");

            //CreateRibbonButton(application,ribbon, "GetObjectInfo", "Get Selected Object Info!", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, "CountDoor", "Count all Door in Current Document!", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, "CountDoorSimilar", "Count Similar Selected Door in Current Document!", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, "CountSimilarObject", "Count Similar Selected Object in Current Document!", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, "CountWalls", "Count Walls Object in Current Document!", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, "TransactionDemo", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, "EditParametersValue", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, "AddInstanceFamily", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, "GetParameterValue", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, "SetWallThicknessSample", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, "EditTNFFootingParam", "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(CreateWall), "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(CreateFloor), "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(MoveByLocation), "Demo Using Transaction!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(MoveByMoveFunction), "Demo Move Object By Element Move Funcion!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(RotateByFuntion), "Demo Move Object By Element Move Funcion!", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(CreateFamilyInstance), "Demo add new Family instance to !", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(GetObjectIntersect), "Demo add new Family instance to !", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(GetIntersectPointOfElement), "Demo add new Family instance to !", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(CountDoorAndWindowInAWall), "Demo add new Family instance to !", @"\About.ico", "LearnSelectionFilter");
            //CreateRibbonButton(application, ribbon, nameof(GetElementIntersect), "Demo Get Intersect !", @"\About.ico", "LearnTransaction");
            //CreateRibbonButton(application, ribbon, nameof(CreateViewPlan), "Demo Get Intersect !", @"\About.ico", "WorkingWithView");
            //CreateRibbonButton(application, ribbon, nameof(CreateFilterView), "Demo Get Intersect !", @"\About.ico", "WorkingWithView");
            //CreateRibbonButton(application, ribbon, nameof(AutoCreateDoorAndWindowTag), "Demo Get Intersect !", @"\About.ico", "WorkingWithView");
            //CreateRibbonButton(application, ribbon, nameof(AutoCreateWallTag), "Demo Get Intersect !", @"\About.ico", "WorkingWithView");
            //CreateRibbonButton(application, ribbon, nameof(CreateSheets), "Demo Get Intersect !", @"\AddSheet.ico", "WorkingWithView");
            //CreateRibbonButton(application, ribbon, nameof(CreateRebar), "Demo Create Rebar !", @"\AddSheet.ico", "LearnTransaction");

            return(Result.Succeeded);
        }
Beispiel #28
0
        //*****************************RibbonPanel()*****************************
        public RibbonPanel RibbonPanel(UIControlledApplication a)
        {
            string tab             = Util.AddinRibbonTabName; // Archcorp
            string ribbonPanelText = Util.AddinRibbonPanel;   // Architecture

            // Empty ribbon panel
            RibbonPanel ribbonPanel = null;

            // Try to create ribbon tab.
            try
            {
                a.CreateRibbonTab(tab);
            }
            catch { }
            // Try to create ribbon panel.
            try
            {
                RibbonPanel panel = a.CreateRibbonPanel(tab, ribbonPanelText);
            }
            catch { }
            // Search existing tab for your panel.
            List <RibbonPanel> panels = a.GetRibbonPanels(tab);

            foreach (RibbonPanel p in panels)
            {
                if (p.Name == ribbonPanelText)
                {
                    ribbonPanel = p;
                }
            }
            //return panel
            return(ribbonPanel);
        }
Beispiel #29
0
        /// <summary>
        /// Create the RibbonTab.
        /// </summary>
        /// <param name="application">Appliction to create the RibbonTab in.</param>
        /// <param name="ribbon">RibbonTab to associate the RibbonTab with.</param>
        /// <param name="tabName">Name of the RibbonTab to create</param>
        /// <returns>The created RibbonTab.</returns>
        internal static RibbonTab CreateTab(UIControlledApplication application, RibbonControl ribbon, string tabName)
        {
            try
            {
                application.CreateRibbonTab(tabName);

                RibbonTab _tab = null;

                foreach (RibbonTab _existingTab in ribbon.Tabs)
                {
                    if (_existingTab.Id == tabName)
                    {
                        _tab = _existingTab;

                        break;
                    }
                }

                if (_tab == null)
                {
                    throw new Exception("Could not create tab: " + tabName);
                }

                return(_tab);
            }
            catch (System.Exception _ex)
            {
                throw _ex;
            }
        }
Beispiel #30
0
        public static RibbonPanel CreatePanel(UIControlledApplication a, string tabName, string panelName)
        {
            RibbonPanel ribbonPanel = null;

            try
            {
                a.CreateRibbonTab(tabName);
            }
            catch { }
            // Try to create ribbon panel.
            try
            {
                RibbonPanel panel = a.CreateRibbonPanel(tabName, panelName);
            }
            catch { }
            // Search existing tab for your panel.
            List <RibbonPanel> panels = a.GetRibbonPanels(tabName);

            foreach (RibbonPanel p in panels)
            {
                if (p.Name == panelName)
                {
                    ribbonPanel = p;
                }
            }
            return(ribbonPanel);
        }
Beispiel #31
0
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Grimshaw Architects");

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

            #region Curve Total Length Button
            PushButtonData buttonData = new PushButtonData("cmdCurveTotalLength",
               "Total Length", thisAssemblyPath, "GrimshawRibbon.CurveTotalLength");
            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
            pushButton.ToolTip = "Select Multiple Lines to Obtain Total Length";
            // Add image icon to
            Uri uriImage = new Uri(@"D:\Stuff\RevitVisualStudio\CurveTotalLength\CurveTotalLength\bin\Debug\CurveTotalLength.png");
            BitmapImage largeImage = new BitmapImage(uriImage);
            pushButton.LargeImage = largeImage;
            #endregion // Curve Total Length Button

            #region Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons
            // Create two push buttons
            // Project Management Commands
            PushButtonData pushButton1 = new PushButtonData("cmdWorkset3dView", "Make 3D View/Workset", thisAssemblyPath, "GrimshawRibbon.Workset3dView");
            pushButton1.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\Workset3dView\Workset3dView\bin\Debug\favicon.png"));
            pushButton1.ToolTip = "Create one 3D View per workset with all elemets on that workset isolated.";

            PushButtonData pushButton2 = new PushButtonData("cmdUpperCaseViewsOnSheets", "UpperCase Sheet Views", thisAssemblyPath, "GrimshawRibbon.UpperCaseViewsOnSheets");
            pushButton2.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\UpperCaseViewsOnSheets\UpperCaseViewsOnSheets\bin\Debug\UpperCaseViewsOnSheets.png"));
            pushButton2.ToolTip = "Rename all Views in the Project to 'uppercase' if its on a Sheet and 'lowercase' if its not on a Sheet.";

            PushButtonData pushButton3 = new PushButtonData("cmdDeleteReferencePlanes", "Delete Reference Planes", thisAssemblyPath, "GrimshawRibbon.DeleteReferencePlanes");
            pushButton3.Image = new BitmapImage(new Uri(@"D:\Stuff\RevitVisualStudio\DeleteReferencePlanes\DeleteReferencePlanes\bin\Debug\deleteReferencePlanes.png"));
            pushButton3.ToolTip = "Delete all unnamed reference planes in the project.";

            // Add the buttons to the panel
            List<RibbonItem> projectButtons = new List<RibbonItem>();
            projectButtons.AddRange(ribbonPanel.AddStackedItems(pushButton1, pushButton2, pushButton3));
            #endregion // Workset 3d View, Upper Case Views on Sheet and Delete Reference Planes Buttons

            #region Prevent Deletion Button
            PushButtonData preventDelButtonData = new PushButtonData("cmdPreventDeletion",
               "Prevent Deletion", thisAssemblyPath, "GrimshawRibbon.PreventDeletion");
            PushButton preventDelButton = ribbonPanel.AddItem(preventDelButtonData) as PushButton;
            preventDelButton.ToolTip = "Prevent elements from being deleted.";
            // Add image icon to
            Uri preventDelImage = new Uri(@"D:\Stuff\RevitVisualStudio\PreventDeletion\PreventDeletion\bin\Debug\preventDeletion.png");
            BitmapImage preventDellargeImage = new BitmapImage(preventDelImage);
            preventDelButton.LargeImage = preventDellargeImage;
            #endregion // Prevent Deletion Button
        }
Beispiel #32
0
        /// <summary>
        /// Startup
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
            // Version
            if (!application.ControlledApplication.VersionName.Contains(RevitVersion))
                {
                    using (TaskDialog td = new TaskDialog("Cannot Continue"))
                    {
                        td.TitleAutoPrefix = false;
                        td.MainInstruction = "Incompatible Revit Version";
                        td.MainContent = "This Add-In was built for Revit "+ RevitVersion + ", please contact CASE for assistance.";
                        td.Show();
                    }
                    return Result.Cancelled;
                }

                // Master Tab
                const string c_tabName = "CASE";

                try
                {
                    // Create the Tab
                    application.CreateRibbonTab(c_tabName);
                }
                catch { }

            string m_issuetracker = "Case.IssueTracker.dll";
            // Tab
            RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Case Issue Tracker");

                // Button Data
                PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                                                 "Issue Tracker",
                                                                                                 Path.Combine(_path, "Case.IssueTracker.Revit.dll"),
                                                                                                 "Case.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

                // Images and Tooltip
                if (m_pushButton != null)
                {
                    m_pushButton.Image = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon16x16.png", m_issuetracker);
                    m_pushButton.LargeImage = LoadPngImgSource("Case.IssueTracker.Assets.CASEIssueTrackerIcon32x32.png", m_issuetracker);
                    m_pushButton.ToolTip = "Case Issue Manager";
                }

            }
            catch (Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
                return Result.Failed;
            }

            return Result.Succeeded;
        }
Beispiel #33
0
        //Built in startup command for Revit
        public Result OnStartup(UIControlledApplication a)
        {
            //the name of the new tab to be created
            string tabName = "TLC";
            //method to create the tab
            a.CreateRibbonTab(tabName);
            //method to create a new panel
            RibbonPanel panel1 = a.CreateRibbonPanel(tabName, "TLC View Creator");

            //Buttons go in this area
            CreateView(panel1);
            //return succeeded
            return Result.Succeeded;
        }
Beispiel #34
0
        //Built in startup command for Revit
        public Result OnStartup(UIControlledApplication a)
        {
            //the name of the new tab to be created
            string tabName = "RTC 2014";
            //method to create the tab
            a.CreateRibbonTab(tabName);
            //method to create a new panel
            RibbonPanel panel1 = a.CreateRibbonPanel(tabName, "Programming");

            //Buttons go in this area
            PullDown(panel1);
            updateDoor(panel1);
            //return succeeded
            return Result.Succeeded;
        }
Beispiel #35
0
        //Add UI buttons
        public void AddButtons(UIControlledApplication a)
        {
            //Create a add to SOM Tools ribbon tab
            try
            {
                a.CreateRibbonTab("SOM Tools");
            }
            catch (Exception)
            {

            }

            //create a ribbon panel
            RibbonPanel panel = a.CreateRibbonPanel("SOM Tools", "Views on Sheets");

            addVRCommandButtons(panel);
        }
Beispiel #36
0
 /// <summary>
 /// Create the Panel
 /// </summary>
 /// <param name="uiapp"></param>
 public void CreateRibbonPanel(UIControlledApplication uiapp)
 {
     try
     {
         // Create a custom ribbon tab
         uiapp.CreateRibbonTab("Case Design Inc.");
     }
     catch
     {
         // Might Already Exist
     }
     // Tools
     AddButton(
         "Free Tools",
         "ViewCreator",
         "View\nCreator",
         m_Path + "\\Case.ViewCreator.16.png",
         m_Path + "\\Case.ViewCreator.32.png",
         m_Path + "\\Case.ViewCreator.dll",
         "Case.ViewCreator.cmd",
         "Create New Views");
 }
Beispiel #37
0
        /// <summary>
        /// Add the Ribbon Item and Panel
        /// </summary>
        /// <param name="a"></param>
        /// <remarks></remarks>
        public void AddRibbonPanel(UIControlledApplication a)
        {
            try
            {
                // First Create the Tab
                a.CreateRibbonTab("Case Design Inc.");
            }
            catch
            {
                // Might already exist...
            }

            // Tools
            AddButton("Panel",
                      "Tool_Name",
                      "Text",
                      "?_16.png",
                      "?_32.png",
                      m_Path + "\\?.dll",
                      "?.cmd",
                      "Description");
        }
        public Result OnStartup(UIControlledApplication application)
        {
            // add new ribbon panel
            application.CreateRibbonTab("Národní BIM knihovna");
            _panel = application.CreateRibbonPanel("Národní BIM knihovna", "Nástroje");
            _panel.Enabled = true;

            //get assembly of this class to set the right path to other objects in this assembly
            var assembly = Assembly.GetAssembly(this.GetType());
            var assemblyPath = assembly.Location;
            var dirPath = Path.GetDirectoryName(assemblyPath);

            //-----------------------------BUTTONS FOR COMMANDS ----------------------------
            var btnSettings = _panel.AddItem(new PushButtonData(
                "GetObject",
                "Vyhledávání",
                assemblyPath,
                "BimLibraryAddin.AddIns.ProductSearchAddIn"
                )) as PushButton;
            btnSettings.LargeImage = new BitmapImage(new Uri("pack://*****:*****@"Vyhledané objekty je možné importovat do aktuálního projektu a okamžitě použít.";

            application.ControlledApplication.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(ControlledApplication_DocumentOpened);
            application.ControlledApplication.DocumentCreated += new EventHandler<DocumentCreatedEventArgs>(ControlledApplication_DocumentCreating);
            application.ControlledApplication.DocumentClosing += new EventHandler<DocumentClosingEventArgs>(ControlledApplication_DocumentClosing);
            application.ControlledApplication.DocumentOpening += new EventHandler<DocumentOpeningEventArgs>(ControlledApplication_DocumentOpening);
            //application.ControlledApplication.DocumentChanged += new EventHandler<DocumentChangedEventArgs>();

            //register failures
            Failures.RegisterFailures();

            return Result.Succeeded;
        }
Beispiel #39
0
        // define a method that will create our tab and button
        static void AddRibbonPanel(UIControlledApplication application)
        {
            // Create a custom ribbon tab
            String tabName = "Grimshaw";
            application.CreateRibbonTab(tabName);

            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel(tabName, "Tools");

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

            // create push button for CurveTotalLength
            PushButtonData b1Data = new PushButtonData(
                "cmdCurveTotalLength", 
                "Total" + System.Environment.NewLine + "  Length  ", 
                thisAssemblyPath,
                "TotalLength.CurveTotalLength");

            PushButton pb1 = ribbonPanel.AddItem(b1Data) as PushButton;
            pb1.ToolTip = "Select Multiple Lines to Obtain Total Length";
            BitmapImage pb1Image = new BitmapImage(new Uri("pack://application:,,,/GrimshawRibbon;component/Resources/totalLength.png"));
            pb1.LargeImage = pb1Image;
        }
Beispiel #40
0
    /// <summary>
    /// Startup
    /// </summary>
    /// <param name="application"></param>
    /// <returns></returns>
    public Result OnStartup(UIControlledApplication application)
    {

      try
      {

        // Version
          if (!application.ControlledApplication.VersionName.Contains("2014") && !application.ControlledApplication.VersionName.Contains("2015"))
          {
              using (TaskDialog td = new TaskDialog("Cannot Continue"))
              {
                  td.TitleAutoPrefix = false;
                  td.MainInstruction = "Incompatible Revit Version";
                  td.MainContent = "This Add-In was built for Revit 2014 and 2015, please contact CASE for assistance.";
                  td.Show();
              }
              return Result.Cancelled;
          }

        // Master Tab 
        const string c_tabName = "CASE";

        try
        {
          // Create the Tab
          application.CreateRibbonTab(c_tabName);
        }
        catch { }

        // Assembly Paths
        string m_issuetracker = Path.Combine(ProgramFilesx86(), "CASE", "ARUP Issue Tracker", "ARUP.IssueTracker.dll");

        // Check that File Exists
        if (!File.Exists(m_issuetracker))
        {
          using (TaskDialog td = new TaskDialog("Cannot Continue"))
          {
            td.TitleAutoPrefix = false;
            td.MainInstruction = "Required Issue Tracker Library Not Found";
            td.MainContent = m_issuetracker;
            td.Show();
          }
          return Result.Cancelled;
        }
        
        // Load Assemblies
        Assembly.LoadFrom(m_issuetracker);

        // Tab
        RibbonPanel m_panel = application.CreateRibbonPanel(c_tabName, "Arup Issue Tracker");

        // Button Data
        PushButton m_pushButton = m_panel.AddItem(new PushButtonData("Issue Tracker",
                                                                     "Issue Tracker", 
                                                                     Path.Combine(_path, "ARUP.IssueTracker.Revit.dll"),
                                                                     "ARUP.IssueTracker.Revit.Entry.CmdMain")) as PushButton;

        // Images and Tooltip
        if (m_pushButton != null)
        {
          m_pushButton.Image = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon16x16.png", m_issuetracker);
          m_pushButton.LargeImage = LoadPngImgSource("ARUP.IssueTracker.Assets.ARUPIssueTrackerIcon32x32.png", m_issuetracker);
          m_pushButton.ToolTip = "Arup Issue Manager";
        }
      }
      catch (Exception ex1)
      {
        MessageBox.Show("exception: " + ex1);
        return Result.Failed;
      }

      return Result.Succeeded;
    }
   /// 实现OnStartup
   public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
   {
      // 在OnStartup函数里创建一个Ribbon文本框
      application.CreateRibbonTab("CustomTag");
      RibbonPanel panel = application.CreateRibbonPanel("CustomTag", "CustomPanel");
      TextBox textBox = panel.AddItem(new TextBoxData("CustomTextBox")) as TextBox;

      return Autodesk.Revit.UI.Result.Succeeded;
   }
    /// <summary>
    /// Create our own ribbon panel with verious buttons 
    /// for our exercise. We re-use commands defined in the
    /// Revit Intro Labs here. Cf. Section 3.8 (pp 46) of 
    /// the Developers Guide. 
    /// </summary>
    public void AddRibbonSampler(UIControlledApplication app)
    {
      // (1) create a ribbon tab and ribbon panel 

      app.CreateRibbonTab("Ribbon Sampler");

      RibbonPanel panel = app.CreateRibbonPanel("Ribbon Sampler", "Ribbon Sampler");

      // Below are samplers of ribbon items. Uncomment 
      // functions of your interest to see how it looks like 

      // (2.1) add a simple push button for Hello World 

      AddPushButton(panel);

      // (2.2) add split buttons for "Command Data", "DB Element" and "Element Filtering" 

      AddSplitButton(panel);

      // (2.3) add pulldown buttons for "Command Data", "DB Element" and "Element Filtering" 

      AddPulldownButton(panel);

      // (2.4) add radio/toggle buttons for "Command Data", "DB Element" and "Element Filtering" 
      // we put it on the slide-out below. 
      //AddRadioButton(panel);
      //panel.AddSeparator();

      // (2.5) add text box - TBD: this is used with the conjunction with event. Probably too complex for day one training. 
      //  for now, without event. 
      // we put it on the slide-out below. 
      //AddTextBox(panel);
      //panel.AddSeparator();

      // (2.6) combo box - TBD: this is used with the conjunction with event. Probably too complex for day one training. 
      // For now, without event. show two groups: Element Bascis (3 push buttons) and Modification/Creation (2 push button)  

      AddComboBox(panel);

      // (2.7) stacked items - 1. hello world push button, 2. pulldown element bscis (command data, DB element, element filtering) 
      // 3. pulldown modification/creation(element modification, model creation). 

      AddStackedButtons_Complex(panel);

      // (2.8) slide out - if you don't have enough space, you can add additional space below the panel. 
      // anything which comes after this will be on the slide out. 

      panel.AddSlideOut();

      // (2.4) radio button - what it is 

      AddRadioButton(panel);

      // (2.5) text box - what it is 

      AddTextBox(panel);
    }
Beispiel #43
0
        Result IExternalApplication.OnStartup(UIControlledApplication application)
        {
            //set static PluginHost
            _Host = this;

            //Parse settings
            try
            {
                string path = Utilities.AssemblyDirectory;

                string file = Path.Combine(path, "Settings.revithost");
                _Settings = SettingsIO.LoadSettings(file);
            }
            catch (Exception e)
            {

            }
            // Create New Ribbon Tab -
            try
            {
                application.CreateRibbonTab(_Settings.HostPanel_ID);
            }
            catch (Exception e)
            {

            }
            ///Create a Tab Ribon Panel for each PluginFolder.
            try
            {
                foreach (KeyValuePair<string, string> value in _Settings._Disciplines)
                {
                    Autodesk.Revit.UI.RibbonPanel _panel = application.CreateRibbonPanel(_Settings.HostPanel_ID, value.Key);
                    RevitCore.UI._PluginPanels.Add(value.Key, _panel);
                }
            }
            catch (Exception e)
            {

            }

            ///Load individual plungins
            try
            {
                foreach (KeyValuePair<string, string> value in _Settings._Disciplines)
                {
                    //Load Assembly
                    List<Assembly> plugInAssemblies = new List<Assembly>();
                    try
                    {
                        plugInAssemblies.AddRange(Utilities.LoadPlugInAssemblies(value.Value));
                    }
                    catch (LoadPluginException e)
                    {
                        MessageBox.Show(e.Message, "Error Loading Plugins",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (plugInAssemblies != null)
                    {
                        //Find Plugin Info and create Button to exicute the command.
                        IList<IRevitCoreInfo> plugInInfo = Utilities.GetPlugIns<IRevitCoreInfo>(plugInAssemblies);
                        IList<RequestHandler> handlers = Utilities.GetPluginClass<RequestHandler>(plugInAssemblies);
                        Dictionary<Guid, RequestHandler> _Handlers;
                        _Handlers = new Dictionary<Guid, RequestHandler>();
                        if (handlers != null)
                        {
                            foreach (RequestHandler handle in handlers)
                            {
                                _Handlers.Add(handle.ID, handle);
                            }
                        }

                        IList<RevitCoreBaseDialogWindow> windows = Utilities.GetPluginClass<RevitCoreBaseDialogWindow>(plugInAssemblies);
                        Dictionary<Guid, RevitCoreBaseDialogWindow> _Windows;
                        _Windows = new Dictionary<Guid, RevitCoreBaseDialogWindow>();
                        if (_Windows != null)
                        {
                            foreach (RevitCoreBaseDialogWindow window in windows)
                            {
                                _Windows.Add(window.ID, window);
                            }
                        }
                        foreach (IRevitCoreInfo info in plugInInfo)
                        {
                            if (info.IsWindowed)
                            {
                                ///Link Handler and Window
                                RevitCoreWindowedCommand winCMD = (RevitCoreWindowedCommand)info;
                                Guid? handlderID = Utilities.stringGuid(winCMD.Requesthandler);
                                Guid? windowID = Utilities.stringGuid(winCMD.DialogWindow);
                                if (handlderID != null)
                                {
                                    RequestHandler theHandle = _Handlers[handlderID.Value];
                                    RevitCoreBaseDialogWindow theWIndow = _Windows[windowID.Value];
                                    RevitCore.UI.AddWindowedCommand(theHandle, theWIndow);
                                    PushButtonData _ButtonData = new PushButtonData(winCMD.Name, winCMD.Text, winCMD.AssemblyName, winCMD.ClassName);
                                    PushButton _PushButton = RevitCore.UI.GetDisciplinePanel(value.Key).AddItem(_ButtonData) as PushButton;
                                    _PushButton.ToolTip = winCMD.ToolTip;
                                }
                                ///Build Button
                            }
                            else
                            {

                            }
                        }
                    }

                }
            }
            catch (Exception ex)
            {
                if (ex is System.Reflection.ReflectionTypeLoadException)
                {
                    var typeLoadException = ex as ReflectionTypeLoadException;
                    var loaderExceptions = typeLoadException.LoaderExceptions;
                }
            }

            // 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.
            application.ControlledApplication.ApplicationInitialized += OnApplicationInitialized;
            return Result.Succeeded;
        }
Beispiel #44
0
        public Result OnStartup(UIControlledApplication application)
        {
            address = new Uri(addr + application.ControlledApplication.VersionNumber);
            uicApp = application;


            _app = this;
            serverActive = Properties.Settings.Default.defaultServerOn;
            // Create the button
            try
            {
                BitmapSource bms;
                PushButtonData lyrebirdButton;
                //StartServer();
                if (disableButton)
                {
                    bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird Server\nDisabled", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                    {
                        LargeImage = bms,
                        ToolTip = "The Lyrebird Server is currently disabled in this session of Revit.  This is most likely because you have more than one session of Revit and the server can only run in one.",
                    };
                    Properties.Settings.Default.enableServer = false;
                    Properties.Settings.Default.Save();
                }
                else
                {
                    if (serverActive)
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_On.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer On", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server currently on and will accept requests for data and can create objects.  Push button to toggle the server off.",
                        };
                        StartServer();
                        //ServiceOn();
                    }
                    else
                    {
                        bms = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Off.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                        lyrebirdButton = new PushButtonData("Lyrebird Server", "Lyrebird\nServer Off", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.ServerToggle")
                        {
                            LargeImage = bms,
                            ToolTip = "The Lyrebird Server is currently off and will not accept requests for data or create objects.  Push button to toggle the server on.",
                        };
                    }
                    Properties.Settings.Default.enableServer = true;
                    Properties.Settings.Default.Save();
                }

                // Settings button
                BitmapSource setBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Settings.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData settingsButtonData = new PushButtonData("Lyrebird Settings", "Lyrebird Settings", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SettingsCmd")
                {
                    LargeImage = setBMS,
                    ToolTip = "Lyrebird Server settings.",
                };

                // Selection button
                BitmapSource selBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_Select.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData selectionButtonData = new PushButtonData("Select Run", "Select Run", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.SelectRunElementsCmd")
                {
                    LargeImage = selBMS,
                    ToolTip = "Select elements created from Lyrebird",
                };

                // Selection button
                BitmapSource delBMS = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Lyrebird_RemoveData.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                PushButtonData removeButtonData = new PushButtonData("Remove Data", "Remove Data", typeof(RevitServerApp).Assembly.Location, "LMNA.Lyrebird.RemoveDataCmd")
                {
                    LargeImage = delBMS,
                    ToolTip = "Remove Lyrebird data from selected elements",
                };

                // Create the tab if necessary
                const string tabName = "LMN";
                Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;
                Autodesk.Windows.RibbonTab tab = null;
                foreach (Autodesk.Windows.RibbonTab t in ribbon.Tabs)
                {
                    if (t.Id == tabName)
                    {
                        tab = t;
                    }
                }
                if (tab == null)
                {
                    application.CreateRibbonTab(tabName);
                }

                bool found = false;
                List<RibbonPanel> panels = application.GetRibbonPanels(tabName);
                RibbonPanel panel = null;
                foreach (RibbonPanel rp in panels)
                {
                    if (rp.Name == "Utilities")
                    {
                        panel = rp;
                        found = true;
                    }
                }

                SplitButtonData sbd = new SplitButtonData("Lyrebird", "Lyrebird");

                if (!found)
                {
                    // Create the panel
                    RibbonPanel utilitiesPanel = application.CreateRibbonPanel(tabName, "Utilities");

                    // Split button
                    SplitButton sb = utilitiesPanel.AddItem(sbd) as SplitButton;
                    serverButton = sb.AddPushButton(lyrebirdButton) as PushButton;
                    PushButton settingsButton = sb.AddPushButton(settingsButtonData) as PushButton;
                    PushButton selButton = sb.AddPushButton(selectionButtonData) as PushButton;
                    PushButton removeButton = sb.AddPushButton(removeButtonData) as PushButton;
                    sb.IsSynchronizedWithCurrentItem = false;
                }
                else
                {
                    SplitButton sb = panel.AddItem(sbd) as SplitButton;
                    serverButton = sb.AddPushButton(lyrebirdButton) as PushButton;
                    PushButton settingsButton = sb.AddPushButton(settingsButtonData) as PushButton;
                    PushButton selButton = sb.AddPushButton(selectionButtonData) as PushButton;
                    PushButton removeButton = sb.AddPushButton(removeButtonData) as PushButton;
                    sb.IsSynchronizedWithCurrentItem = false;
                }

                if (disableButton)
                {
                    serverButton.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                TaskDialog.Show("Error", ex.ToString());
            }

            return Result.Succeeded;
        }
        public RibbonPanel ribbonPanel(UIControlledApplication a)
        {
            RibbonPanel ribbonPanel = null;

            //Create add-in to the SOM tool ribbon tab
            try
            {
                a.CreateRibbonTab("SOM Tools");
            }
            catch (Exception)
            { }
            //Create Ribbon Panel
            try
            {
                RibbonPanel alignViewsPanel = a.CreateRibbonPanel("SOM Tools", "Sheet Layout");

            }

            catch (Exception)
            { }

            List<RibbonPanel> alignViewpanels = a.GetRibbonPanels("SOM Tools");
            foreach (RibbonPanel panel in alignViewpanels)
            {
                if (panel.Name == "Sheet Layout")
                {
                    ribbonPanel = panel;
                }
            }
            return ribbonPanel;
        }