Example #1
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                m_app = commandData.Application;
                m_doc = m_app.ActiveUIDocument.Document;

                if (m_app.Application.Documents.Size > 1)
                {
                    ManagerWindow managerWindow = new ManagerWindow(m_app, ModelManagerMode.ModelBuilder);
                    managerWindow.Show();
                }
                else
                {
                    MessageBox.Show("Please open more than two Revit documents before running this tool.\n A source model and a recipient model are required.", "Opened Revit Documents Required!", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to initialize Model Builder.\n" + ex.Message, "Model Builder", MessageBoxButton.OK, MessageBoxImage.Warning);
                return(Result.Cancelled);
            }
        }
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                m_app = commandData.Application;
                m_doc = m_app.ActiveUIDocument.Document;

                ManagerWindow   managerWindow = new ManagerWindow(m_app, ModelManagerMode.ProjectReplication);
                Nullable <bool> dlgResult     = managerWindow.ShowDialog();


                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to initialize Project Replication.\n" + ex.Message, "Project Replication", MessageBoxButton.OK, MessageBoxImage.Warning);
                return(Result.Cancelled);
            }
        }