/// <summary> /// This method executes some tasks when Autodesk Revit /// shuts down. /// </summary> /// <param name="application">Handle to the Revit /// Application object.</param> /// <returns>Indicates if the external db application /// completes its work successfully.</returns> ExternalDBApplicationResult IExternalDBApplication .OnShutdown(ControlledApplication application) { // TODO: put your code here (optional). return(ExternalDBApplicationResult.Succeeded); }
public Result OnStartup(UIControlledApplication application) { SupportSettings.assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location; string tabName = "Weandrevit"; try { application.CreateRibbonTab(tabName); } catch { } RibbonPanel panel1 = application.CreateRibbonPanel(tabName, "Ведомость деталей"); PushButton btnCreatePictures = panel1.AddItem(new PushButtonData( "CreatePictures", "Создать", SupportSettings.assemblyPath, "RebarSketch.CommandCreatePictures3") ) as PushButton; PushButton btnFormGenerator = panel1.AddItem(new PushButtonData( "FormGenerator", "Генератор", SupportSettings.assemblyPath, "RebarSketch.CommandFormGenerator") ) as PushButton; //события ControlledApplication ctrlApp = application.ControlledApplication; ctrlApp.DocumentSaving += new EventHandler <DocumentSavingEventArgs>(SavingDocumentEventHandler); return(Result.Succeeded); }
/// <summary> /// Add and register the sever on Revit startup. /// </summary> public ExternalDBApplicationResult OnStartup(ControlledApplication application) { ExternalService plumbingFixtureService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePlumbingFixtureFlowService); Pipe.PlumbingFixtureFlowServer flowServer = new Pipe.PlumbingFixtureFlowServer(); if (plumbingFixtureService != null) { plumbingFixtureService.AddServer(flowServer); } ExternalService pipePressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePressureDropService); Pipe.PipePressureDropServer pressureDropServer = new Pipe.PipePressureDropServer(); if (pipePressureDropService != null) { pipePressureDropService.AddServer(pressureDropServer); } ExternalService ductPressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctPressureDropService); Duct.DuctPressureDropServer ductPressureDropServer = new Duct.DuctPressureDropServer(); if (ductPressureDropService != null) { ductPressureDropService.AddServer(ductPressureDropServer); } return(ExternalDBApplicationResult.Succeeded); }
public ExternalDBApplicationResult OnStartup( ControlledApplication a) { // ApplicationInitialized cannot be used in Forge! a.ApplicationInitialized += OnApplicationInitialized; return(ExternalDBApplicationResult.Succeeded); }
// <summary> // Startup // </summary> // <param name="a"></param> // <returns> // Result // </returns> // <remarks></remarks> public Result OnStartup(UIControlledApplication a) { try { //Path _path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //UI App _uiApp = a; //Controlled App m_CtrlApp = a.ControlledApplication; //Set an event handler for opening documents. m_CtrlApp.DocumentOpened += new EventHandler <Autodesk.Revit.DB.Events.DocumentOpenedEventArgs>(CtrlApp_DocumentOpened); //get current user Currentuser = GetUser(login); //General Buttons if (CurrentDomain.Name.ToLower() == KirkseyDomain.ToLower()) { LoadItems(Currentuser); } } catch { } return(Result.Succeeded); }
void Initialize(ControlledApplication app) { // Fix the bug of Revit 2017.1.1 // More info read here: // https://revit-addins.blogspot.ru/2017/01/revit-201711.html RevitPatches.PatchCultures(app.Language); }
/// <summary> /// This method executes some tasks when Autodesk Revit /// shuts down. /// </summary> /// <param name="application">Handle to the Revit /// Application object.</param> /// <returns>Indicates if the external db application /// completes its work successfully.</returns> ExternalDBApplicationResult IExternalDBApplication .OnShutdown(ControlledApplication application) { ResourceManager res_mng = new ResourceManager( GetType()); ResourceManager def_res_mng = new ResourceManager( typeof(Properties.Resources)); ExternalDBApplicationResult result = ExternalDBApplicationResult.Succeeded; try { // TODO: put your code here (optional). AppDomain.CurrentDomain.AssemblyResolve -= CurDom_AssemblyResolve; } catch (Exception ex) { TaskDialog.Show(def_res_mng.GetString("_Error") , ex.Message); result = ExternalDBApplicationResult.Failed; } finally { res_mng.ReleaseAllResources(); def_res_mng.ReleaseAllResources(); } return(result); }
public Result OnStartup(UIControlledApplication ui_control_app) { try { log_worker = new UltimateLogCreator(); List <string> list_of_log_string = new List <string>(); _cached_Ui_Ctr_App = ui_control_app; ControlledApplication contrl_app = _cached_Ui_Ctr_App.ControlledApplication; // Method to add Tab and Panel RibbonPanel panel = RibbonPanel(_cached_Ui_Ctr_App); string thisAssemblyPath = Assembly.GetExecutingAssembly().Location; button1 = panel.AddItem(new PushButtonData("Connect to db", "Connect to db", thisAssemblyPath, "DBListenTest.SubscribeCommand")) as PushButton; button1.ToolTip = "Connect to db"; button2 = panel.AddItem(new PushButtonData("Test db", "Test db", thisAssemblyPath, "DBListenTest.TestDbCommand")) as PushButton; button2.ToolTip = "Test db"; //button1.Enabled = true; //panel.Enabled = true; return(Result.Succeeded); } catch (Exception exception) { var _logModel = new LoggerView("UpdateParam Exception", exception.ToString()); _logModel.Show(); //TaskDialog.Show("Construction model's tools APP run faild", exception.ToString()); return(Result.Failed); } }
public ExternalDBApplicationResult OnShutdown( ControlledApplication a) { _settings.Save(); _logger.Done(); return(ExternalDBApplicationResult.Succeeded); }
private static void SetupBatchScriptHost(ControlledApplication controlledApplication) { var pluginFolderPath = Path.GetDirectoryName(typeof(BatchRvtAddinApplication).Assembly.Location); var batchRvtExternalEventHandler = new BatchRvtExternalEventHandler(pluginFolderPath); batchRvtExternalEventHandler.Raise(); }
public Result OnStartup(UIControlledApplication application) { try { // The executing assembly will be in Revit_20xx, so // we have to walk up one level. Unfortunately, we // can't use DynamoPaths here because those are not // initialized until the controller is constructed. var assDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); DynamoPaths.SetupDynamoPaths(Path.GetFullPath(assDir + @"\..")); //add an additional node processing folder DynamoPaths.Nodes.Add(Path.Combine(assDir, "nodes")); AppDomain.CurrentDomain.AssemblyResolve += AssemblyHelper.ResolveAssembly; ControlledApplication = application.ControlledApplication; RevThread.IdlePromise.RegisterIdle(application); TransactionManager.SetupManager(new AutomaticTransactionStrategy()); ElementBinder.IsEnabled = true; //TAF load english_us TODO add a way to localize res = Resource_en_us.ResourceManager; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); dynamoButton = (PushButton)ribbonPanel.AddItem( new PushButtonData( "Dynamo 0.7 Alpha", res.GetString("App_Name"), assemblyName, "Dynamo.Applications.DynamoRevit")); Bitmap dynamoIcon = Resources.logo_square_32x32; BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); dynamoButton.LargeImage = bitmapSource; dynamoButton.Image = bitmapSource; RegisterAdditionalUpdaters(application); return(Result.Succeeded); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(Result.Failed); } }
public Result OnStartup(UIControlledApplication a) { ControlledApplication c_app = a.ControlledApplication; MyApplication = a; AddRibbonPanel(a); return(Result.Succeeded); }
public Result OnStartup(UIControlledApplication application) { // Revit2015+ has disabled hardware acceleration for WPF to // avoid issues with rendering certain elements in the Revit UI. // Here we get it back, by setting the ProcessRenderMode to Default, // signifying that we want to use hardware rendering if it's // available. RenderOptions.ProcessRenderMode = RenderMode.Default; try { SubscribeAssemblyResolvingEvent(); ControlledApplication = application.ControlledApplication; TransactionManager.SetupManager(new AutomaticTransactionStrategy()); ElementBinder.IsEnabled = true; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(Resources.App_Description); var fvi = FileVersionInfo.GetVersionInfo(assemblyName); var dynVersion = String.Format(Resources.App_Name, fvi.FileMajorPart, fvi.FileMinorPart); DynamoButton = (PushButton) ribbonPanel.AddItem( new PushButtonData( dynVersion, dynVersion, assemblyName, "Dynamo.Applications.DynamoRevit")); Bitmap dynamoIcon = Resources.logo_square_32x32; BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DynamoButton.LargeImage = bitmapSource; DynamoButton.Image = bitmapSource; RegisterAdditionalUpdaters(application); return(Result.Succeeded); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(Result.Failed); } }
CollectEvent(object sender, CollectorEventArgs e) { // cast the sender object to the SnoopCollector we are expecting Collector snoopCollector = sender as Collector; if (snoopCollector == null) { Debug.Assert(false); // why did someone else send us the message? return; } // see if it is a type we are responsible for Autodesk.Revit.ApplicationServices.Application app = e.ObjToSnoop as Autodesk.Revit.ApplicationServices.Application; if (app != null) { Stream(snoopCollector.Data(), app); return; } // no more app options? //Autodesk.Revit.Options.Application appOptions = e.ObjToSnoop as Autodesk.Revit.Options.Application; //if (appOptions != null) { // Stream(snoopCollector.Data(), appOptions); // return; //} ControlledApplication contrApp = e.ObjToSnoop as Autodesk.Revit.ApplicationServices.ControlledApplication; if (contrApp != null) { Stream(snoopCollector.Data(), contrApp); return; } Autodesk.Revit.UI.ExternalCommandData extCmd = e.ObjToSnoop as Autodesk.Revit.UI.ExternalCommandData; if (extCmd != null) { Stream(snoopCollector.Data(), extCmd); return; } RibbonItem ribbonItem = e.ObjToSnoop as RibbonItem; if (ribbonItem != null) { Stream(snoopCollector.Data(), ribbonItem); return; } RibbonPanel ribbonPanel = e.ObjToSnoop as RibbonPanel; if (ribbonPanel != null) { Stream(snoopCollector.Data(), ribbonPanel); return; } }
public ExternalDBApplicationResult OnStartup(ControlledApplication application) { #if DEBUG application.ApplicationInitialized += HandleApplicationInitializedEvent; #else DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; #endif return(ExternalDBApplicationResult.Succeeded); }
// constructor takes the AddInId for the add-in associated with this updater public RevitServicesUpdater(/*AddInId id, */ ControlledApplication app, IEnumerable <IUpdater> updaters) { application = app; application.DocumentChanged += ApplicationDocumentChanged; foreach (var updater in updaters) { ((ElementTypeSpecificUpdater)updater).Updated += RevitServicesUpdater_Updated; } }
// constructor takes the AddInId for the add-in associated with this updater public RevitServicesUpdater(/*AddInId id, */ControlledApplication app, IEnumerable<IUpdater> updaters) { application = app; application.DocumentChanged += ApplicationDocumentChanged; foreach (var updater in updaters) { ((ElementTypeSpecificUpdater)updater).Updated += RevitServicesUpdater_Updated; } }
// constructor takes the AddInId for the add-in associated with this updater public DynamoUpdater(AddInId id, ControlledApplication app) { m_appId = id; m_updaterId = new UpdaterId(m_appId, new Guid("1F1F44B4-8002-4CC1-8FDB-17ACD24A2ECE")); //[Guid("1F1F44B4-8002-4CC1-8FDB-17ACD24A2ECE")] _updateDict[ChangeTypeEnum.Delete] = new Dictionary<ElementId, DynElementUpdateDelegate>(); _updateDict[ChangeTypeEnum.Modify] = new Dictionary<ElementId, DynElementUpdateDelegate>(); _updateDict[ChangeTypeEnum.Add] = new Dictionary<ElementId, DynElementUpdateDelegate>(); app.DocumentChanged += Application_DocumentChanged; }
// constructor takes the AddInId for the add-in associated with this updater public DynamoUpdater(AddInId id, ControlledApplication app) { m_appId = id; m_updaterId = new UpdaterId(m_appId, new Guid("1F1F44B4-8002-4CC1-8FDB-17ACD24A2ECE")); //[Guid("1F1F44B4-8002-4CC1-8FDB-17ACD24A2ECE")] _updateDict[ChangeTypeEnum.Delete] = new Dictionary <ElementId, DynElementUpdateDelegate>(); _updateDict[ChangeTypeEnum.Modify] = new Dictionary <ElementId, DynElementUpdateDelegate>(); _updateDict[ChangeTypeEnum.Add] = new Dictionary <ElementId, DynElementUpdateDelegate>(); app.DocumentChanged += Application_DocumentChanged; }
/// <summary> /// This method executes some tasks when Autodesk Revit /// starts. Typically, event handlers and updaters are /// registered in this method. /// </summary> /// <param name="ctrl_app">Handle to the Revit /// Application object.</param> /// <returns>Indicates if the external db application /// completes its work successfully.</returns> ExternalDBApplicationResult IExternalDBApplication .OnStartup(ControlledApplication ctrl_app) { // Fix the bug of Revit 2017.1.1 // More info read here: // https://revit-addins.blogspot.ru/2017/01/revit-201711.html RevitPatches.PatchCultures(ctrl_app.Language); // TODO: put your code here. return(ExternalDBApplicationResult.Succeeded); }
// constructor takes the AddInId for the add-in associated with this updater private RevitServicesUpdater(/*AddInId id, */ ControlledApplication app, IEnumerable <IUpdater> updaters) { application = app; registeredUpdaters = new HashSet <IUpdater>(updaters); application.DocumentChanged += ApplicationDocumentChanged; foreach (var updater in registeredUpdaters) { ((ElementTypeSpecificUpdater)updater).Updated += RevitServicesUpdater_Updated; } }
/// <summary> /// Initializes the static Instance of the RevitServicesUpdater. /// </summary> /// <param name="app"></param> /// <param name="updaters"></param> public static void Initialize(ControlledApplication app, IEnumerable <IUpdater> updaters) { lock (mutex) { if (instance != null) { DisposeInstance(); } instance = new RevitServicesUpdater(app, updaters); } }
public Result OnStartup(UIControlledApplication application) { try { SetupDynamoPaths(application); SubscribeAssemblyResolvingEvent(); ControlledApplication = application.ControlledApplication; TransactionManager.SetupManager(new AutomaticTransactionStrategy()); ElementBinder.IsEnabled = true; //TAF load english_us TODO add a way to localize res = Resource_en_us.ResourceManager; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); DynamoButton = (PushButton) ribbonPanel.AddItem( new PushButtonData( "Dynamo 0.7", res.GetString("App_Name"), assemblyName, "Dynamo.Applications.DynamoRevit")); Bitmap dynamoIcon = Resources.logo_square_32x32; BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DynamoButton.LargeImage = bitmapSource; DynamoButton.Image = bitmapSource; RegisterAdditionalUpdaters(application); return(Result.Succeeded); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(Result.Failed); } }
public Result OnStartup(UIControlledApplication application) { try { SetupDynamoPaths(application); SubscribeAssemblyResolvingEvent(); ControlledApplication = application.ControlledApplication; TransactionManager.SetupManager(new AutomaticTransactionStrategy()); ElementBinder.IsEnabled = true; //TAF load english_us TODO add a way to localize res = Resource_en_us.ResourceManager; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); DynamoButton = (PushButton) ribbonPanel.AddItem( new PushButtonData( "Dynamo 0.7", res.GetString("App_Name"), assemblyName, "Dynamo.Applications.DynamoRevit")); Bitmap dynamoIcon = Resources.logo_square_32x32; BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DynamoButton.LargeImage = bitmapSource; DynamoButton.Image = bitmapSource; RegisterAdditionalUpdaters(application); return Result.Succeeded; } catch (Exception ex) { MessageBox.Show(ex.ToString()); return Result.Failed; } }
public ExternalDBApplicationResult OnStartup(ControlledApplication a) { try { //registered event a.DocumentChanged += new EventHandler <DocumentChangedEventArgs>(elementChangedEvent); } catch (Exception) { return(ExternalDBApplicationResult.Failed); } return(ExternalDBApplicationResult.Succeeded); }
Stream(ArrayList data, ControlledApplication contrApp) { data.Add(new Snoop.Data.ClassSeparator(typeof(ControlledApplication))); data.Add(new Snoop.Data.Enumerable("Cities", contrApp.Cities)); data.Add(new Snoop.Data.Object("Create", contrApp.Create)); data.Add(new Snoop.Data.Enumerable("Library Paths", contrApp.GetLibraryPaths())); data.Add(new Snoop.Data.String("Shared Parameter File", contrApp.SharedParametersFilename)); data.Add(new Snoop.Data.String("Product", contrApp.Product.ToString())); data.Add(new Snoop.Data.String("Version build", contrApp.VersionBuild)); data.Add(new Snoop.Data.String("Version name", contrApp.VersionName)); data.Add(new Snoop.Data.String("Version number", contrApp.VersionNumber)); }
public ExternalDBApplicationResult OnStartup( ControlledApplication a) { string path = Assembly.GetExecutingAssembly().Location; JtLogger.Init(Path.ChangeExtension(path, "log")); JtSettings.Init(Path.ChangeExtension(path, "json")); a.ApplicationInitialized += OnApplicationInitialized; return(ExternalDBApplicationResult.Succeeded); }
public ExternalDBApplicationResult OnStartup(ControlledApplication application) { if (RuntimeValue.RunOnCloud) { DesignAutomationBridge.DesignAutomationReadyEvent += HandleDesignAutomationReadyEvent; } else { // For local test application.ApplicationInitialized += HandleApplicationInitializedEvent; } return(ExternalDBApplicationResult.Succeeded); }
/// <summary> /// Initializes the static Instance of the RevitServicesUpdater. /// </summary> /// <param name="app"></param> /// <param name="updaters"></param> public static void Initialize(ControlledApplication app, IEnumerable <IUpdater> updaters) { lock (mutex) { if (instance == null) { instance = new RevitServicesUpdater(app, updaters); } else { throw new InvalidOperationException("RevitServicesUpdater can only be initialized once."); } } }
public ExternalDBApplicationResult OnStartup(ControlledApplication application) { try { //application.DocumentChanged += new EventHandler<DocumentChangedEventArgs>(ElementChangedEvent); application.DocumentSaving += new EventHandler <DocumentSavingEventArgs>(RegisterSaveEvent); } catch (Exception) { return(ExternalDBApplicationResult.Failed); } return(ExternalDBApplicationResult.Succeeded); }
public IExternalApplication.Result OnStartup(ControlledApplication application) { Toolbar newToolbar = application.CreateToolbar(); if (newToolbar == null) return IExternalApplication.Result.Failed; newToolbar.Name = "My Toolbar"; newToolbar.Image = "C:\\REVIT\\CH02\\MyToolbar\\Toolbar_Image.bmp";//工具条图像文件 //参数依次为:应用程序文件路径,类名称 ToolbarItem item = newToolbar.AddItem("C:\\REVIT\\CH02\\HelloRevit\\bin\\Release\\HelloRevit.dll", "RevitDevelop.HelloRevit"); //该按钮的状态条提示和ToolTip提示 item.StatusbarTip = item.ToolTip = "Shows a message box with Hello Revit!"; return IExternalApplication.Result.Succeeded; }
public IExternalApplication.Result OnStartup(ControlledApplication application) { //创建一级菜单,参数即为菜单名称 MenuItem topMenu = application.CreateTopMenu("My Menu"); if (topMenu == null) return IExternalApplication.Result.Failed; //菜单类型除了BasicMenu,还有PopupMenu, SeparatorMenu MenuItem.MenuType basicM = MenuItem.MenuType.BasicMenu; //Append参数含义分别为:菜单类型,名称,应用程序路径,类名称 MenuItem subMenu = topMenu.Append(basicM, "Hello Revit", "C:\\REVIT\\CH02\\HelloRevit\\bin\\Release\\HelloRevit.dll", "RevitDevelop.HelloRevit"); //设置该菜单的提示信息,当鼠标移到该菜单上时将在状态条上显示 subMenu.StatusbarTip = "Shows a message box with Hello Revit!"; return IExternalApplication.Result.Succeeded; }
public Result OnStartup(UIControlledApplication a) { ControlledApplication c_app = a.ControlledApplication; MyApplication = a; AddRibbonPanel(a); thisApp = this; // static access to this application instance c_app.DocumentChanged += new EventHandler <Autodesk.Revit.DB.Events.DocumentChangedEventArgs>(c_app_DocumentChanged); c_app.DocumentClosed += new EventHandler <Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(c_app_DocumentClosed); a.ViewActivated += new EventHandler <Autodesk.Revit.UI.Events.ViewActivatedEventArgs>(OnViewActivated); return(Result.Succeeded); }
/// <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 false is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference.</returns> public Result OnStartup(UIControlledApplication application) { // initialize member variables. m_CtrlApp = application.ControlledApplication; m_ChangesInfoTable = CreateChangeInfoTable(); m_InfoForm = new ChangesInformationForm(ChangesInfoTable); // register the DocumentChanged event m_CtrlApp.DocumentChanged += new EventHandler <Autodesk.Revit.DB.Events.DocumentChangedEventArgs>(CtrlApp_DocumentChanged); // show dialog m_InfoForm.Show(); return(Result.Succeeded); }
/// <summary> /// Registers an instance of a SampleExternalResourceDBServer with the ExternalService /// of type ExternalResourceService. /// </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 was able to register the IExternalResourceServer. /// </returns> public ExternalDBApplicationResult OnStartup(ControlledApplication application) { // Get Revit's ExternalResourceService. ExternalService externalResourceService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.ExternalResourceService); if (externalResourceService == null) { return(ExternalDBApplicationResult.Failed); } // Create an instance of your IExternalResourceServer and register it with the ExternalResourceService. IExternalResourceServer sampleServer = new SampleExternalResourceDBServer(); externalResourceService.AddServer(sampleServer); return(ExternalDBApplicationResult.Succeeded); }
/// <summary> /// Add and register the sever on Revit startup. /// </summary> public ExternalDBApplicationResult OnStartup(ControlledApplication application) { ExternalService plumbingFixtureService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePlumbingFixtureFlowService); Pipe.PlumbingFixtureFlowServer flowServer = new Pipe.PlumbingFixtureFlowServer(); if (plumbingFixtureService != null) plumbingFixtureService.AddServer(flowServer); ExternalService pipePressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePressureDropService); Pipe.PipePressureDropServer pressureDropServer = new Pipe.PipePressureDropServer(); if (pipePressureDropService != null) pipePressureDropService.AddServer(pressureDropServer); ExternalService ductPressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctPressureDropService); Duct.DuctPressureDropServer ductPressureDropServer = new Duct.DuctPressureDropServer(); if (ductPressureDropService != null) ductPressureDropService.AddServer(ductPressureDropServer); return ExternalDBApplicationResult.Succeeded; }
public Result OnStartup(UIControlledApplication application) { documentLoaded = false; try { process = Process.GetCurrentProcess(); handle = process.MainWindowHandle; revitWindowHandle = new RevitWindowHandle(handle); uiCtrlApp = application; app = uiCtrlApp.ControlledApplication; app.DocumentOpened += ((object o, DocumentOpenedEventArgs e) => { UpdateDocument(e.Document); documentLoaded = true; ShowDialog(); }); app.DocumentClosed += ((object o, DocumentClosedEventArgs e) => { documentLoaded = false; }); uiCtrlApp.ViewActivated += ((object o, ViewActivatedEventArgs e) => { if (documentLoaded) { UpdateActiveView(e); ShowDialog(); } }); } catch (Exception) { return Result.Failed; } return Result.Succeeded; }
public IExternalApplication.Result OnStartup(ControlledApplication application) { try { //注册事件 application.DocumentOpened += new EventHandler <Autodesk.Revit.Events.DocumentOpenedEventArgs>(application_DocumentOpened); } catch (Exception) { return Autodesk.Revit.UI.Result.Failed; } return Autodesk.Revit.UI.Result.Succeeded; }
/// <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 false is returned then Revit should inform the user that the external application /// failed to load and the release the internal reference.</returns> public Result OnStartup(UIControlledApplication application) { // initialize member variables. m_CtrlApp = application.ControlledApplication; m_ChangesInfoTable = CreateChangeInfoTable(); m_InfoForm = new ChangesInformationForm(ChangesInfoTable); // register the DocumentChanged event m_CtrlApp.DocumentChanged += new EventHandler<Autodesk.Revit.DB.Events.DocumentChangedEventArgs>(CtrlApp_DocumentChanged); // show dialog m_InfoForm.Show(); return Result.Succeeded; }
public IExternalApplication.Result OnStartup(ControlledApplication application) { application.OnDocumentOpened += new Autodesk.Revit.Events.DocumentOpenedEventHandler(onDocOpened); return IExternalApplication.Result.Succeeded; }
// no more app options? MM //private void //Stream(ArrayList data, Autodesk.Revit.ApplicationServices.Application appOptions) //{ // data.Add(new Snoop.Data.ClassSeparator(typeof(Autodesk.Revit.Options.Application))); // data.Add(new Snoop.Data.String("Shared parameters filename", appOptions.SharedParametersFilename)); // data.Add(new Snoop.Data.CategorySeparator("Library Paths")); // StringStringMapIterator iter = appOptions.LibraryPaths.ForwardIterator(); // while (iter.MoveNext()) // data.Add(new Snoop.Data.String(iter.Key, iter.Current.ToString())); //} private void Stream(ArrayList data, ControlledApplication contrApp) { data.Add(new Snoop.Data.ClassSeparator(typeof(ControlledApplication))); data.Add(new Snoop.Data.Enumerable("Cities", contrApp.Cities)); data.Add(new Snoop.Data.Object("Create", contrApp.Create)); data.Add(new Snoop.Data.Enumerable("Library Paths", contrApp.GetLibraryPaths())); data.Add(new Snoop.Data.String("Shared Parameter File", contrApp.SharedParametersFilename)); data.Add(new Snoop.Data.String("Product", contrApp.Product.ToString())); data.Add(new Snoop.Data.String("Version build", contrApp.VersionBuild)); data.Add(new Snoop.Data.String("Version name", contrApp.VersionName)); data.Add(new Snoop.Data.String("Version number", contrApp.VersionNumber)); }
public IExternalApplication.Result OnShutdown(ControlledApplication application) { return IExternalApplication.Result.Succeeded; }
// constructor takes the AddInId for the add-in associated with this updater public RevitServicesUpdater(/*AddInId id, */ControlledApplication app) { application = app; application.DocumentChanged += Application_DocumentChanged; }
public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { return ExternalDBApplicationResult.Succeeded; }
public AppDocEvents(ControlledApplication app) { m_app = app; }
public IExternalApplication.Result OnShutdown(ControlledApplication application) { //注销事件 application.DocumentOpened -= new EventHandler <Autodesk.Revit.Events.DocumentOpenedEventArgs>(application_DocumentOpened); return Autodesk.Revit.UI.Result.Succeeded; }
/// <summary> /// Add and register the server on Revit startup. /// </summary> public ExternalDBApplicationResult OnStartup(ControlledApplication application) { AddDuctFittingAndAccessoryPressureDropServers(); AddPipeFittingAndAccessoryPressureDropServers(); return ExternalDBApplicationResult.Succeeded; }