public Autodesk.Revit.UI.Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        {
            Log.WriteLog("Revit关闭");

            exportEventForm.Close();
            return(Result.Succeeded);
        }
Exemple #2
0
        public Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        {
            WallUpdater updater = new WallUpdater(application.ActiveAddInId);

            UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
            return(Result.Succeeded);
        }
Exemple #3
0
        public Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        {
            Form1 form1 = new Form1();

            form1.Show();

            // Register wall updater with Revit
            WallUpdater updater = new WallUpdater(application.ActiveAddInId, form1);

            UpdaterRegistry.RegisterUpdater(updater);


            List <BuiltInCategory> builtInCats = new List <BuiltInCategory>();

            builtInCats.Add(BuiltInCategory.OST_Walls);
            builtInCats.Add(BuiltInCategory.OST_StructuralColumns);
            builtInCats.Add(BuiltInCategory.OST_Floors);
            builtInCats.Add(BuiltInCategory.OST_StructuralFoundation);
            builtInCats.Add(BuiltInCategory.OST_StructuralFraming);

            ElementMulticategoryFilter filter1 = new ElementMulticategoryFilter(builtInCats);

            UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter1, Element.GetChangeTypeElementAddition());

            return(Result.Succeeded);
        }
Exemple #4
0
        /// <summary>
        /// Implement this method to implement the external application which should be called when
        /// Revit is about to exit, Any documents must have been closed before this method is called.
        /// </summary>
        /// <param name="application">An object that is passed to the external application
        /// which contains the controlled application.</param>
        /// <returns>Return the status of the external application.
        /// A result of Succeeded means that the external application successfully shutdown.
        /// Cancelled can be used to signify that the user cancelled the external operation at
        /// some point.
        /// If Failed is returned then the Revit user should be warned of the failure of the external
        /// application to shut down correctly.
        ///
        /// This method also unregisters a the IPerformanceAdviserRule-implementing class
        /// (m_FlippedDoorApiRule) with PerformanceAdviser.
        /// </returns>
        public Autodesk.Revit.UI.Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        {
            #region Unregister API rule
            Autodesk.Revit.DB.PerformanceAdviser.GetPerformanceAdviser().DeleteRule(m_FlippedDoorApiRule.getRuleId());
            m_FlippedDoorApiRule = null;
            #endregion

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Exemple #5
0
        //////////////////////////////////////////////////////////////////
        // creating and registering our updaters on Revit startup

        public Result OnStartup(Autodesk.Revit.UI.UIControlledApplication app)
        {
            // this application's Id is the currently active AddIn Id:
            // (the Id is taken form the manifest file(AddIn) of this application)

            m_thisAppId = app.ActiveAddInId;

            app.ControlledApplication.DocumentOpened += RegisterSectionUpdaterOnOpen;

            return(Result.Succeeded);
        }
Exemple #6
0
        public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        {
            RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel");
            //PushButtonData pbd = new PushButtonData("name", "text", @"C:\Users\einst\Desktop\Danqing\GitRepo\RevitLab\2.2 HelloWorld\bin\Debug\2.2 HelloWorld.dll", "HelloWorld");
            PushButton pushBotton = ribbonPanel.AddItem(new PushButtonData("HelloWorld", "HelloWorld", @"C:\Users\einst\AppData\Roaming\Autodesk\Revit\Addins\2016\HelloWorld.dll", "_2._2_HelloWorld.HelloWorld")) as PushButton;

            Uri         urlImage   = new Uri(@"C:\Users\einst\Desktop\Danqing\UrlImage\01.jpg");
            BitmapImage largeImage = new BitmapImage(urlImage);

            pushBotton.LargeImage = largeImage;

            return(Result.Succeeded);
        }
        public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        {
            Log.WriteLog("Revit启动");

            ExportEventHandler handle   = new ExportEventHandler();
            ExternalEvent      extEvent = ExternalEvent.Create(handle);

            exportEventForm = new ExportEventForm(extEvent);
            exportEventForm.Show();
            exportEventForm.Visible = false;

            return(Result.Succeeded);
        }
Exemple #8
0
        public Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        {
            // Register wall updater with Revit
            WallUpdater updater = new WallUpdater(application.ActiveAddInId);

            UpdaterRegistry.RegisterUpdater(updater);

            // Change Scope = any Wall element
            ElementClassFilter wallFilter = new ElementClassFilter(typeof(Wall));

            // Change type = element addition
            UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), wallFilter, Element.GetChangeTypeElementAddition());
            return(Result.Succeeded);
        }
        private void AddMenu(RevitUI.UIControlledApplication app)
        {
            RevitUI.RibbonPanel        ribbon_panel = app.CreateRibbonPanel("数据接口");
            RevitUI.PulldownButtonData data_pull    = new RevitUI.PulldownButtonData("RevitTest", "测试功能");

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

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

            RevitUI.PushButtonData data_push = new RevitUI.PushButtonData("RevitExcel", "导出Excel", appAssembly, "RevitEx.cmdExportExcel");
            RevitUI.PushButton     btn_push  = ribbon_panel.AddItem(data_push) as RevitUI.PushButton;
            btn_push.LargeImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(appAssemblyPath + @"\Revit\RevitExcel.png"));
        }
Exemple #10
0
        /// <summary>
        /// Implement this method to implement the external application which should be called when
        /// Revit starts before a file or default template is actually loaded.
        /// </summary>
        /// <param name="application">An object that is passed to the external application
        /// which contains the controlled application.</param>
        /// <returns>Return the status of the external application.
        /// A result of Succeeded means that the external application successfully started.
        ///
        /// Cancelled can be used to signify that the user cancelled the external operation at
        /// some point.
        ///
        /// If Failed is returned then Revit should inform the user that the external application
        /// failed to load and the release the internal reference.
        ///
        /// This method also adds a ribbon panel and button to launch an IExternalCommand
        /// defined in UICommand.cs.  It also registers a new IPerformanceAdviserRule-implementing class
        /// (m_FlippedDoorApiRule) with PerformanceAdviser.
        ///
        /// </returns>
        public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
        {
            #region Add command button
            RibbonPanel rp = application.CreateRibbonPanel("PerformanceAdviserControl");
            string      currentAssembly = System.Reflection.Assembly.GetAssembly(this.GetType()).Location;
            PushButton  pb         = rp.AddItem(new PushButtonData("Performance Adviser", "Performance Adviser", currentAssembly, "Revit.SDK.Samples.PerformanceAdviserControl.CS.UICommand")) as PushButton;
            Uri         uriImage   = new Uri(System.IO.Path.GetDirectoryName(currentAssembly) + "\\Button32.png");
            BitmapImage largeImage = new BitmapImage(uriImage);
            pb.LargeImage = largeImage;
            #endregion

            #region Create and register new API rule (FlippedDoorCheck)
            m_FlippedDoorApiRule = new FlippedDoorCheck();
            Autodesk.Revit.DB.PerformanceAdviser.GetPerformanceAdviser().AddRule(m_FlippedDoorApiRule.getRuleId(), m_FlippedDoorApiRule);
            #endregion

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
        private void AddRibbon(RevitUI.UIControlledApplication app)
        {
            app.CreateRibbonTab("数据接口");

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

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

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

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

                RevitUI.ComboBoxMemberData data_cbxm = new RevitUI.ComboBoxMemberData("Close", "关闭");
                data_cbxm.GroupName = "编辑操作";
                cbx.AddItem(data_cbxm);
                data_cbxm = new RevitUI.ComboBoxMemberData("Change", "修改");
                cbx.AddItem(data_cbxm);
            }
            cbx.CurrentChanged += change;
            cbx.DropDownClosed += closed;
        }
        public static void OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        {
            MaterialLibrary updater = new MaterialLibrary(application.ActiveAddInId);

            UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
        }
Exemple #13
0
 public Result OnStartup(UIControlledApplication application)
 {
     _app = application;
     buildUI();
     return(Result.Succeeded);
 }
Exemple #14
0
 //////////////////////////////////////////////////////////////////
 // Unregister our registered our updater on Revit shutdown
 public Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
 {
     return(Result.Succeeded);
 }
 public UI.Result OnStartup(UI.UIControlledApplication app)
 {
     app.CreateRibbonTab("External Application Template");
     return(UI.Result.Succeeded);
 }
 public UI.Result OnShutdown(UI.UIControlledApplication app)
 {
     return(UI.Result.Succeeded);
 }
        public RevitUI.Result OnShutdown(RevitUI.UIControlledApplication application)
        {
            RemoveAppDocEvents();

            return(RevitUI.Result.Succeeded);
        }
Exemple #18
0
 internal static void register(Autodesk.Revit.UI.UIControlledApplication uIApplication)
 {
     uIApplication.Idling += new EventHandler <Autodesk.Revit.UI.Events.IdlingEventArgs>(Application_Idling);
 }
Exemple #19
0
        public static void OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
        {
            TypeNamingUpdater updater = new TypeNamingUpdater(application.ActiveAddInId);

            UpdaterRegistry.UnregisterUpdater(updater.GetUpdaterId());
        }
 public RevitUI.Result OnStartup(RevitUI.UIControlledApplication application)
 {
     AddRibbon(application);
     AddAppDocEvents(application.ControlledApplication);
     return(RevitUI.Result.Succeeded);
 }