Exemplo n.º 1
0
    /// <summary>
    /// OnStartup() - called when Revit starts. 
    /// </summary>
    public Result OnStartup(UIControlledApplication app)
    {
      // (1) resgister our document changed event hander 
      app.ControlledApplication.DocumentChanged += UILabs_DocumentChanged;

      // (2) register our dynamic model updater (WindowDoorUpdater class definition below.) 
      // We are going to keep doors and windows at the center of the wall. 
      // 
      // Construct our updater. 
      WindowDoorUpdater winDoorUpdater = new WindowDoorUpdater(app.ActiveAddInId);
      // ActiveAddInId is from addin menifest. 
      // Register it 
      UpdaterRegistry.RegisterUpdater(winDoorUpdater);

      // Tell which elements we are interested in being notified about. 
      // We want to know when wall changes its length. 

      ElementClassFilter wallFilter = new ElementClassFilter(typeof(Wall));
      UpdaterRegistry.AddTrigger(winDoorUpdater.GetUpdaterId(), wallFilter, Element.GetChangeTypeGeometry());

      return Result.Succeeded;
    }
Exemplo n.º 2
0
        /// <summary>
        /// OnStartup() - called when Revit starts.
        /// </summary>
        public Result OnStartup(UIControlledApplication app)
        {
            // (1) resgister our document changed event hander
            app.ControlledApplication.DocumentChanged += UILabs_DocumentChanged;

            // (2) register our dynamic model updater (WindowDoorUpdater class definition below.)
            // We are going to keep doors and windows at the center of the wall.
            //
            // Construct our updater.
            WindowDoorUpdater winDoorUpdater = new WindowDoorUpdater(app.ActiveAddInId);

            // ActiveAddInId is from addin menifest.
            // Register it
            UpdaterRegistry.RegisterUpdater(winDoorUpdater);

            // Tell which elements we are interested in being notified about.
            // We want to know when wall changes its length.

            ElementClassFilter wallFilter = new ElementClassFilter(typeof(Wall));

            UpdaterRegistry.AddTrigger(winDoorUpdater.GetUpdaterId(), wallFilter, Element.GetChangeTypeGeometry());

            return(Result.Succeeded);
        }