public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                application.ControlledApplication.DocumentOpened  += EventDocOpen;
                application.ControlledApplication.DocumentClosing += EventDocClose;
                application.ControlledApplication.DocumentSynchronizingWithCentral += EventSwcStart;
                application.ControlledApplication.DocumentSynchronizedWithCentral  += EventSwcStop;

                application.ControlledApplication.DocumentChanged += EventCommandFinished;

                if (_binding != null)
                {
                    return(Result.Succeeded);
                }
                _commandId = RevitCommandId.LookupPostableCommandId(PostableCommand.PurgeUnused);

                if (!_commandId.CanHaveBinding)
                {
                    return(Result.Succeeded);
                }
                _binding = application.CreateAddInCommandBinding(_commandId);
                _binding.BeforeExecuted += EventCommandStart;
                return(Result.Succeeded);
            }
            catch (Exception e)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
                return(Result.Failed);
            }
        }
Exemple #2
0
        /// <summary>
        /// Implements the OnStartup event
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public Result OnStartup(UIControlledApplication application)
        {
            // Lookup the desired command by name
            s_commandId = RevitCommandId.LookupCommandId(s_commandToDisable);

            // Confirm that the command can be overridden
            if (!s_commandId.CanHaveBinding)
            {
                ShowDialog("Error", "The target command " + s_commandToDisable +
                           " selected for disabling cannot be overridden");
                return(Result.Failed);
            }

            // Create a binding to override the command.
            // Note that you could also implement .CanExecute to override the accessibiliy of the command.
            // Doing so would allow the command to be grayed out permanently or selectively, however,
            // no feedback would be available to the user about why the command is grayed out.
            try
            {
                AddInCommandBinding commandBinding = application.CreateAddInCommandBinding(s_commandId);
                commandBinding.Executed += DisableEvent;
            }
            // Most likely, this is because someone else has bound this command already.
            catch (Exception)
            {
                ShowDialog("Error", "This add-in is unable to disable the target command " + s_commandToDisable +
                           "; most likely another add-in has overridden this command.");
            }

            return(Result.Succeeded);
        }
Exemple #3
0
        /// <summary>
        /// Loads the default Mass template automatically rather than showing UI.
        /// </summary>
        /// <param name="application">An object that is passed to the external application
        /// which contains the controlled application.</param>
        void createCommandBinding(UIControlledApplication application)
        {
            RevitCommandId      wallCreate = RevitCommandId.LookupCommandId("ID_NEW_REVIT_DESIGN_MODEL");
            AddInCommandBinding binding    = application.CreateAddInCommandBinding(wallCreate);

            binding.Executed   += new EventHandler <Autodesk.Revit.UI.Events.ExecutedEventArgs>(binding_Executed);
            binding.CanExecute += new EventHandler <Autodesk.Revit.UI.Events.CanExecuteEventArgs>(binding_CanExecute);
        }
        /// <summary>
        /// Implementation of Startup for the external application.
        /// </summary>
        /// <param name="application">The Revit application.</param>
        /// <returns>The result (typically Succeeded).</returns>
        public Result OnStartup(UIControlledApplication application)
        {
            // Register execution override
            RevitCommandId commandId = RevitCommandId.LookupCommandId("ID_EXPORT_IFC");
            m_ifcCommandBinding = application.CreateAddInCommandBinding(commandId);
            m_ifcCommandBinding.Executed += OnIFCExport; 

            return Result.Succeeded;
        }
        public Result OnStartup(UIControlledApplication uiControlledApplication)
        {
            try
            {
                //binding commands
                RevitCommandId commandId = RevitCommandId.LookupCommandId("ID_MEP_DUCT_PRESSURE_LOSS_REPORT");
                if (commandId != null)
                {
                    AddInCommandBinding pressureLossCommand = uiControlledApplication.CreateAddInCommandBinding(commandId);
                    if (pressureLossCommand != null)
                    {
                        pressureLossCommand.CanExecute += new EventHandler <Autodesk.Revit.UI.Events.CanExecuteEventArgs>(CanDuctExecute);
                        pressureLossCommand.Executed   += new EventHandler <Autodesk.Revit.UI.Events.ExecutedEventArgs>(DuctExecute);
                    }
                }

                commandId = RevitCommandId.LookupCommandId("ID_MEP_PIPE_PRESSURE_LOSS_REPORT");
                if (commandId != null)
                {
                    AddInCommandBinding pressureLossCommand = uiControlledApplication.CreateAddInCommandBinding(commandId);
                    if (pressureLossCommand != null)
                    {
                        pressureLossCommand.CanExecute += new EventHandler <Autodesk.Revit.UI.Events.CanExecuteEventArgs>(CanPipeExecute);
                        pressureLossCommand.Executed   += new EventHandler <Autodesk.Revit.UI.Events.ExecutedEventArgs>(PipeExecute);
                    }
                }


                commandId = RevitCommandId.LookupCommandId("ID_MEP_SELECT_DUCT_PRESSURE_LOSS_REPORT");
                if (commandId != null)
                {
                    AddInCommandBinding pressureLossCommand = uiControlledApplication.CreateAddInCommandBinding(commandId);
                    if (pressureLossCommand != null)
                    {
                        pressureLossCommand.CanExecute += new EventHandler <Autodesk.Revit.UI.Events.CanExecuteEventArgs>(CanDuctSelectExecute);
                        pressureLossCommand.Executed   += new EventHandler <Autodesk.Revit.UI.Events.ExecutedEventArgs>(DuctSelectExecute);
                    }
                }

                commandId = RevitCommandId.LookupCommandId("ID_MEP_SELECT_PIPE_PRESSURE_LOSS_REPORT");
                if (commandId != null)
                {
                    AddInCommandBinding pressureLossCommand = uiControlledApplication.CreateAddInCommandBinding(commandId);
                    if (pressureLossCommand != null)
                    {
                        pressureLossCommand.CanExecute += new EventHandler <Autodesk.Revit.UI.Events.CanExecuteEventArgs>(CanPipeSelectExecute);
                        pressureLossCommand.Executed   += new EventHandler <Autodesk.Revit.UI.Events.ExecutedEventArgs>(PipeSelectExecute);
                    }
                }

                return(Result.Succeeded);
            }
            catch
            {
                return(Result.Failed);
            }
        }
Exemple #6
0
        /// <summary>
        /// Implementation of Startup for the external application.
        /// </summary>
        /// <param name="application">The Revit application.</param>
        /// <returns>The result (typically Succeeded).</returns>
        public Result OnStartup(UIControlledApplication application)
        {
            // Register execution override
            RevitCommandId commandId = RevitCommandId.LookupCommandId("ID_EXPORT_IFC");

            m_ifcCommandBinding           = application.CreateAddInCommandBinding(commandId);
            m_ifcCommandBinding.Executed += OnIFCExport;

            return(Result.Succeeded);
        }
        public Result OnShutdown(UIControlledApplication application)
        {
            if (dynamoCommand != null)
            {
                dynamoCommand.BeforeExecuted -= beforeExecuted;
                dynamoCommand.CanExecute     -= canExecute;
                dynamoCommand.Executed       -= executed;
                dynamoCommand = null;
            }

            UnsubscribeAssemblyEvents();
            UnsubscribeApplicationEvents();
            UnsubscribeDocumentChangedEvent();
            RevitServicesUpdater.DisposeInstance();

            return(Result.Succeeded);
        }
        /// <summary>
        /// Implementation of Startup for the external application.
        /// </summary>
        /// <param name="application">The Revit application.</param>
        /// <returns>The result (typically Succeeded).</returns>
        public Result OnStartup(UIControlledApplication application)
        {
            TryLoadCommonAssembly();

            // Register execution override
            RevitCommandId commandId = RevitCommandId.LookupCommandId("ID_EXPORT_IFC");

            try
            {
                m_ifcCommandBinding = application.CreateAddInCommandBinding(commandId);
            }
            catch
            {
                return(Result.Failed);
            }

            m_ifcCommandBinding.Executed += OnIFCExport;
            return(Result.Succeeded);
        }
        private void RemoveCommandBinding()
        {
            if (null != dynamoCommand)
            {
                uiControlledApplication.RemoveAddInCommandBinding(dynamoCommand.RevitCommandId);
                dynamoCommand.BeforeExecuted -= beforeExecuted;
                dynamoCommand.CanExecute     -= canExecute;
                dynamoCommand.Executed       -= executed;
                dynamoCommand = null;
            }

            if (null != dynamoPlayerCommand)
            {
                uiControlledApplication.RemoveAddInCommandBinding(dynamoPlayerCommand.RevitCommandId);
                dynamoPlayerCommand.BeforeExecuted -= beforeExecuted;
                dynamoPlayerCommand.CanExecute     -= canExecute;
                dynamoPlayerCommand.Executed       -= executedPlaylist;
                dynamoPlayerCommand = null;
            }
        }
Exemple #10
0
        /// <summary>
        /// 提示编辑修订版本号,并重新保存
        /// </summary>
        /// <param name="application"></param>
        private void PromptToEditRevisionsAndResave(UIApplication application)
        {
            // Setup external event to be notified when activity is done
            externalEvent = ExternalEvent.Create(new PostCommandRevisionMonitorEventHandler(this));

            // Setup event to be notified when revisions command starts (this is a good place to raise this external event)
            RevitCommandId id = RevitCommandId.LookupPostableCommandId(PostableCommand.SheetIssuesOrRevisions);

            if (binding == null)
            {
                binding = application.CreateAddInCommandBinding(id);
            }

            binding.BeforeExecuted += ReactToRevisionsAndSchedulesCommand;
            //在执行RevitCommandId之前,执行externalEvent,也就是 CleanupAfterRevisionEdit 方法,这个方法注销了注册的事件,并 repost了 Save 命令
            //这里为什么要使用外部事件?先执行屏蔽“未保存文件”对话框,然后外部事件排队,执行修订命令的对话框,执行结束后revit空闲,这里才执行 CleanupAfterRevisionEdit 方法,注销事件(以防止影响到其他命令),在调用保存方法。

            // Post the revision editing command
            application.PostCommand(id);
        }
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                if (false == TryResolveDynamoCore())
                {
                    return(Result.Failed);
                }

                UIControlledApplication = application;
                ControlledApplication   = application.ControlledApplication;

                SubscribeAssemblyEvents();
                SubscribeApplicationEvents();

                TransactionManager.SetupManager(new AutomaticTransactionStrategy());
                ElementBinder.IsEnabled = true;

                var dynamoCmdId = RevitCommandId.LookupCommandId("ID_VISUAL_PROGRAMMING_DYNAMO");
                dynamoCommand                 = application.CreateAddInCommandBinding(dynamoCmdId);
                dynamoCommand.CanExecute     += canExecute;
                dynamoCommand.BeforeExecuted += beforeExecuted;
                dynamoCommand.Executed       += executed;
                DynamoButtonEnabled           = true; //initialize

                RegisterAdditionalUpdaters(application);

                RevitServicesUpdater.Initialize(DynamoRevitApp.Updaters);
                SubscribeDocumentChangedEvent();

                loadDependentComponents();

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(Result.Failed);
            }
        }
        public Result OnStartup(UIControlledApplication application)
        {
            uiControlledApplication = application;
            var revitVersion = application.ControlledApplication.VersionNumber;

            var revitFolder =
                new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            var debugPath      = revitFolder.Parent.FullName;
            var dynamoProducts = FindDynamoRevitInstallations(debugPath, revitVersion);

            Products         = new List <DynamoProduct>();
            PlaylistProducts = new List <DynamoProduct>();
            foreach (var p in dynamoProducts)
            {
                var path = VersionLoader.GetDynamoRevitPath(p, revitVersion);
                if (!File.Exists(path))
                {
                    continue;
                }

                Products.Add(p);

                if (p.VersionInfo.Major >= MinDynamoMajorVersionForPlaylist &&
                    p.VersionInfo.Minor >= MinDynamoMinorVersionForPlaylist)
                {
                    PlaylistProducts.Add(p);
                }
            }

            if (Products.Count == 0)
            {
                return(Result.Failed);
            }

            Result preliminaryLoadResult = Result.Succeeded;

            // If there are multiple versions installed, then do the command
            // binding to prompt for version selector task dialog for user to
            // select specific Dynamo version.
            if (Products.Count > 1)
            {
                var dynamoCmdId = RevitCommandId.LookupCommandId("ID_VISUAL_PROGRAMMING_DYNAMO");
                dynamoCommand                 = application.CreateAddInCommandBinding(dynamoCmdId);
                dynamoCommand.CanExecute     += canExecute;
                dynamoCommand.BeforeExecuted += beforeExecuted;
                dynamoCommand.Executed       += executed;

                if (PlaylistProducts.Count >= 1)
                {
                    var dynamoPlayerCmdId = RevitCommandId.LookupCommandId("ID_PLAYLIST_DYNAMO");
                    if (dynamoPlayerCmdId != null)
                    {
                        dynamoPlayerCommand                 = application.CreateAddInCommandBinding(dynamoPlayerCmdId);
                        dynamoPlayerCommand.CanExecute     += canExecute;
                        dynamoPlayerCommand.BeforeExecuted += beforeExecuted;
                        dynamoPlayerCommand.Executed       += executedPlaylist;
                    }
                }
            }
            else //If only one product is installed load the Revit App directly
            {
                preliminaryLoadResult = loadProduct(Products.First(), revitVersion);
            }

            return(preliminaryLoadResult);
        }
Exemple #13
0
        }                                                          // declare assembly version property

        public Result OnStartup(UIControlledApplication application)
        {
            AssemblyPath    = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //get ribbon assembly directory.
            AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            #region Import CAD message
            UIControlledApplication uicontrolapp    = application;
            RevitCommandId          importCommandId = RevitCommandId.LookupCommandId("ID_FILE_IMPORT");
            try
            {
                AddInCommandBinding importBinding = uicontrolapp.CreateAddInCommandBinding(importCommandId);
                importBinding.BeforeExecuted += new EventHandler <Autodesk.Revit.UI.Events.BeforeExecutedEventArgs>(ImportReplacement);
            }
            catch (Exception)
            {
                throw;
            }
            #endregion

            #region InPlace component message
            RevitCommandId inplaceCommandId = RevitCommandId.LookupCommandId("ID_INPLACE_COMPONENT");
            try
            {
                AddInCommandBinding inplaceBinding = uicontrolapp.CreateAddInCommandBinding(inplaceCommandId);
                inplaceBinding.BeforeExecuted += new EventHandler <Autodesk.Revit.UI.Events.BeforeExecutedEventArgs>(InplaceReplacement);
            }
            catch (Exception)
            {
                throw;
            }
            #endregion

            #region Create Ribbon tab
            application.CreateRibbonTab(ArpTabName);
            #endregion

            #region Create Panels
            //create ribbon panels
            RibbonPanel helpPanel            = application.CreateRibbonPanel(ArpTabName, "ARP Toolkit v" + AssemblyVersion);
            RibbonPanel modellingPanel       = application.CreateRibbonPanel(ArpTabName, "Modelling");
            RibbonPanel drawingsPanel        = application.CreateRibbonPanel(ArpTabName, "Drawings");
            RibbonPanel printPanel           = application.CreateRibbonPanel(ArpTabName, "Print & Export");
            RibbonPanel modelManagementPanel = application.CreateRibbonPanel(ArpTabName, "Model Management");
            #endregion

            #region Create Buttons
            // PANEL HELP
            #region Help
            PushButtonData helpButtonData = new PushButtonData(
                "cmdHelp",
                "Help",
                Path.Combine(AssemblyPath, "ArpRibbon.dll"),
                "Data.CmdAbout");

            PushButton helpButton = helpPanel.AddItem(helpButtonData) as PushButton;

            helpButton.ToolTip = "ARP Tools info and User Guide.";

            BitmapImage helpLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/Help_32.ico"));
            helpButton.LargeImage = helpLargeImage;
            #endregion

            // PANEL MODELLING
            #region Flip button
            PushButtonData flipButtonData = new PushButtonData(
                "cmdFlip",
                "Flip Walls" + "\n" + "or Doors",
                Path.Combine(AssemblyPath, "Flip.dll"),
                "Entry.CmdMain");

            PushButton flipButton = modellingPanel.AddItem(flipButtonData) as PushButton;

            flipButton.ToolTip = "Flip a selection of Walls by centerline regardless of the Location Line." + "\n"
                                 + "Flip a selection of doors controlling whether you want to flip the hand or the facing.";

            BitmapImage flipLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/Flip_32.ico"));
            flipButton.LargeImage = flipLargeImage;
            #endregion

            // PANEL DRAWINGS
            #region Room Centroid and Tag Button
            PushButtonData roomCentroidButtonData = new PushButtonData(
                "cmdRoomCentroid",
                "Room Centroid," + "\n" + "Tag to Room",
                Path.Combine(AssemblyPath, "RoomCentroidAndTags.dll"),
                "Entry.CmdMain");

            PushButton roomCentroidButton = drawingsPanel.AddItem(roomCentroidButtonData) as PushButton;

            roomCentroidButton.ToolTip = "Moves room insertion point to room centroid." + "\n"
                                         + "Move room tags to room insertion point. " +
                                         "It works with both tags tagging rooms in the current model or in a linked model " +
                                         "(but linked models and current model coordinates must match).";

            BitmapImage roomCentroidLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/RoomCentroidAndTags_32.ico"));
            roomCentroidButton.LargeImage = roomCentroidLargeImage;
            #endregion

            #region Remove Empty Elevation Tags
            PushButtonData elevationTagsButtonData = new PushButtonData(
                "cmdElevationTags",
                "Remove Empty" + "\n" + "Elevation Tags",
                Path.Combine(AssemblyPath, "RemoveEmptyElevationTags.dll"),
                "Entry.CmdMain");

            PushButton elevationTagsButton = drawingsPanel.AddItem(elevationTagsButtonData) as PushButton;

            elevationTagsButton.ToolTip = "Generally if all elevations hosted in an elevation tag are deleted from the model, " + "\n"
                                          + "the empty elevation tag still remains in its location. This application will delete " + "\n"
                                          + "all empty elevation tags from the model.";

            BitmapImage elevationTagsLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/RemoveEmptyElevationTags_32.ico"));
            elevationTagsButton.LargeImage = elevationTagsLargeImage;
            #endregion

            #region Assign View Template
            PushButtonData AssignTemplateButtonData = new PushButtonData(
                "cmdAssignTemplate",
                "Assign" + "\n" + "View Templates",
                Path.Combine(AssemblyPath, "AssignViewTemplates.dll"),
                "Entry.CmdMain");

            PushButton AssignTemplateButton = drawingsPanel.AddItem(AssignTemplateButtonData) as PushButton;

            AssignTemplateButton.ToolTip = "Use this tool to assign View Templates to Views accross the project." + "\n" +
                                           "Just drag a View into a View Template to assign it.";

            BitmapImage AssignTemplateLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/AssignViewTemplates_32.ico"));
            AssignTemplateButton.LargeImage = AssignTemplateLargeImage;
            #endregion

            #region Transfer View Filters
            PushButtonData transFiltersButtonData = new PushButtonData(
                "cmdTransferViewFilters",
                "Transfer" + "\n" + "View Filters",
                Path.Combine(AssemblyPath, "TransferViewFilters.dll"),
                "Entry.CmdMain");

            PushButton transFiltersButton = drawingsPanel.AddItem(transFiltersButtonData) as PushButton;

            transFiltersButton.ToolTip = "Transfer multiple View Filters from one template to another." + "\n"
                                         + "Or override their graphic settings if the selected filters are already applied in the target Template.";

            BitmapImage transFiltersLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/TransferViewFilters_32.ico"));
            transFiltersButton.LargeImage = transFiltersLargeImage;
            #endregion

            #region Reassign Detail Number
            PushButtonData ReassignDetNumButtonData = new PushButtonData(
                "cmdReassignDetNum",
                "Reassign" + "\n" + "Detail Number",
                Path.Combine(AssemblyPath, "ReassignDetailNumbers.dll"),
                "Entry.CmdMain");

            PushButton ReassignDetNumButton = drawingsPanel.AddItem(ReassignDetNumButtonData) as PushButton;

            ReassignDetNumButton.ToolTip = "Run this tool in a sheet view and click on sheet viewports" + "\n"
                                           + "one by one to change the detail number sequentially.";

            BitmapImage ReassignDetNumLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/ReassignDetailNumber_32.ico"));
            ReassignDetNumButton.LargeImage = ReassignDetNumLargeImage;
            #endregion

            #region Sheet Duplicator
            PushButtonData sheetDuplicatorButtonData = new PushButtonData(
                "cmdSheetDuplicator",
                "Sheet" + "\n" + "Duplicator",
                Path.Combine(AssemblyPath, "SheetDuplicator.dll"),
                "Entry.CmdMain");

            PushButton sheetDuplicatorButton = drawingsPanel.AddItem(sheetDuplicatorButtonData) as PushButton;

            sheetDuplicatorButton.ToolTip = "Select a sheet and duplicate it multiple times." + "\n"
                                            + "Default duplicate option is 'with Detailing'. For dependent views, you can choose 'Duplicate as a Dependent'." + "\n"
                                            + "Legend Views and Schedules are not duplicated, just placed again in the sheet.";

            BitmapImage sheetDuplicatorLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/SheetDuplicator_32.ico"));
            sheetDuplicatorButton.LargeImage = sheetDuplicatorLargeImage;
            #endregion

            // PANEL PRINT & EXPORT
            #region Create Print Set
            PushButtonData printSetButtonData = new PushButtonData(
                "cmdPrintSet",
                "Create" + "\n" + "Print Set",
                Path.Combine(AssemblyPath, "CreatePrintSet.dll"),
                "Entry.CmdMain");

            PushButton printSetButton = printPanel.AddItem(printSetButtonData) as PushButton;

            printSetButton.ToolTip = "Creates a Sheet Set from selected sheets." + "\n"
                                     + "Once created, it will appear in the Print menu > Print Range > Selected views/sheets.";

            BitmapImage printSetLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/CreatePrintSet_32.ico"));
            printSetButton.LargeImage = printSetLargeImage;
            #endregion

            #region Schedule to Excel
            PushButtonData scheduleToExcelData = new PushButtonData(
                "cmdScheduleToExcel",
                "Schedule" + "\n" + "to Excel",
                Path.Combine(AssemblyPath, "ScheduleToExcel.dll"),
                "Entry.CmdMain");

            PushButton scheduleToExcelButton = printPanel.AddItem(scheduleToExcelData) as PushButton;

            scheduleToExcelButton.ToolTip = "Select schedules in the Project Browser and then click this button. They will open in Excel." + "\n"
                                            + "It can also open your active view in Excel (if this is a schedule).";

            BitmapImage scheduleToExcelLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/ScheduleToExcel_32.ico"));
            scheduleToExcelButton.LargeImage = scheduleToExcelLargeImage;
            #endregion

            // uncomment the if block below if you want to restrict button load to specific users
            //load the following buttons ONLY for entitled users
            //if (Data.Helpers.IsExtendedToolsEntitled())
            //{
            // PANEL MODEL MANAGEMENT
            #region Delete Unused Filters Button
            // create data needed for the button
            PushButtonData deleteFiltersButtonData = new PushButtonData(
                "cmdDeleteFilters",                                        // unique name/id for the new button
                "Purge" + "\n" + "Filters",                                // text that will be displayed under the button
                Path.Combine(AssemblyPath, "DeleteUnusedFilters.dll"),     // dll location that will run where the button is pushed
                "DeleteUnusedFilters.CmdMain");                            // namespace and method that will be called

            // data is added to the button and then to the panel
            PushButton deleteFiltersButton = modelManagementPanel.AddItem(deleteFiltersButtonData) as PushButton;

            // tooltip message that will be displayed when the users hover over the button
            deleteFiltersButton.ToolTip = "Removed unused view filters from the project.";

            // bitmap image for the button
            BitmapImage deleteFiltersLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/DeleteUnusedFilters_32.ico"));
            deleteFiltersButton.LargeImage = deleteFiltersLargeImage;
            #endregion

            #region Delete Unused Text Note Button
            PushButtonData deleteTextButtonData = new PushButtonData(
                "cmdPurgeText",
                "Purge" + "\n" + "Text",
                Path.Combine(AssemblyPath, "DeleteUnusedTextNoteTypes.dll"),
                "DeleteUnusedTextNoteTypes.CmdMain");

            PushButton deleteTextButton = modelManagementPanel.AddItem(deleteTextButtonData) as PushButton;

            deleteTextButton.ToolTip = "Removes unused Text Note Types from the project.";

            BitmapImage deleteTextLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/DeleteUnusedTextNoteTypesIcon_32.ico"));
            deleteTextButton.LargeImage = deleteTextLargeImage;
            #endregion

            #region Purge Dimension Styles Button
            PushButtonData purgeDimStylesButtonData = new PushButtonData(
                "cmdPurgeDimStyles",
                "Purge" + "\n" + "Dim Styles",
                Path.Combine(AssemblyPath, "PurgeDimStyles.dll"),
                "Entry.CmdMain");

            PushButton purgeDimStylesButton = modelManagementPanel.AddItem(purgeDimStylesButtonData) as PushButton;

            purgeDimStylesButton.ToolTip = "Removes unused Dimension Styles from the project.";

            BitmapImage purgeDimStylesLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/PurgeDimStyles_32.ico"));
            purgeDimStylesButton.LargeImage = purgeDimStylesLargeImage;
            #endregion

            #region Purge Nested Families Button
            PushButtonData purgeNestedFamButtonData = new PushButtonData(
                "cmdPurgeNestedFam",
                "Purge" + "\n" + "Nested Families",
                Path.Combine(AssemblyPath, "PurgeNestedFamilies.dll"),
                "Entry.CmdMain");

            PushButton purgeNestedFamButton = modelManagementPanel.AddItem(purgeNestedFamButtonData) as PushButton;

            purgeNestedFamButton.ToolTip = "Purge families nested into your project loadable families." + "\n"
                                           + "It purges up to one level of nesting, and only model categories (not annotation categories).";

            BitmapImage purgeNestedFamLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/PurgeNestedFamilies_32.ico"));
            purgeNestedFamButton.LargeImage = purgeNestedFamLargeImage;
            #endregion

            #region Parameter Mapper Button
            PushButtonData paramMapperButtonData = new PushButtonData(
                "cmdParamMapper",
                "Parameter" + "\n" + "Mapper",
                Path.Combine(AssemblyPath, "ParameterMapper.dll"),
                "Entry.CmdMain");

            PushButton paramMapperButton = modelManagementPanel.AddItem(paramMapperButtonData) as PushButton;

            paramMapperButton.ToolTip = "Copy values from one parameter to another by selecting Category and Source Parameter." + "\n"
                                        + "Grouped elements are excluded from edition.";

            BitmapImage paramMapperLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/ParameterMapper_32.ico"));
            paramMapperButton.LargeImage = paramMapperLargeImage;
            #endregion

            #region Parameter Loader Button
            PushButtonData ParameterLoaderButtonData = new PushButtonData(
                "cmdParameterLoader",
                "Parameter" + "\n" + "Loader",
                Path.Combine(AssemblyPath, "ParameterLoader.dll"),
                "Entry.CmdMain");

            PushButton ParameterLoaderButton = modelManagementPanel.AddItem(ParameterLoaderButtonData) as PushButton;

            ParameterLoaderButton.ToolTip = "Load Shared Parameters in batch." + "\n"
                                            + "It can be used in both Project and Family environment.";

            BitmapImage ParameterLoaderLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/ParameterLoader_32.ico"));
            ParameterLoaderButton.LargeImage = ParameterLoaderLargeImage;
            #endregion

            #region Transfer Worksets Button
            PushButtonData transferWorksetsButtonData = new PushButtonData(
                "cmdTransferWorksets",
                "Transfer" + "\n" + "Worksets",
                Path.Combine(AssemblyPath, "TransferWorksets.dll"),
                "Entry.CmdMain");

            PushButton transferWorksetsButton = modelManagementPanel.AddItem(transferWorksetsButtonData) as PushButton;

            transferWorksetsButton.ToolTip = "Transfer selected worksets from another project. Only the workset is transferred, not the geometry inside." + "\n"
                                             + "The source project must be open in the same Revit session.";

            BitmapImage transferWorksetsLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/TransferWorksets_32.ico"));
            transferWorksetsButton.LargeImage = transferWorksetsLargeImage;
            #endregion

            #region Transfer View Template
            PushButtonData transTemplateButtonData = new PushButtonData(
                "cmdTransferTemplate",
                "Transfer" + "\n" + "View Templates",
                Path.Combine(AssemblyPath, "TransferViewTemplate.dll"),
                "Entry.CmdMain");

            PushButton transTemplateButton = modelManagementPanel.AddItem(transTemplateButtonData) as PushButton;

            transTemplateButton.ToolTip = "Transfer selected View Templates from another project." + "\n"
                                          + "The source porject must be either opened in the same Revit session" +
                                          " or linked (and loaded) in the current project.";

            BitmapImage transferTemplateLargeImage = new BitmapImage(new Uri("pack://application:,,,/ArpRibbon;component/Icons/TransferViewTemplates_32.ico"));
            transTemplateButton.LargeImage = transferTemplateLargeImage;
            #endregion
            //}
            #endregion

            return(Result.Succeeded);
        }