public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context, IUnitsManager units)
            : base(env, viewModelType, context, new UpdateManager.UpdateManager(), units, new RevitWatchHandler(), Dynamo.PreferenceSettings.Load())
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate <NodeModel> requiresTransactionPredicate = node => node is RevitTransactionNode;

            CheckRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            Predicate <NodeModel> manualTransactionPredicate = node => node is Transaction;

            CheckManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            dynSettings.Controller.DynamoViewModel.RequestAuthentication += RegisterSingleSignOn;

            AddPythonBindings();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;
            dynRevitSettings.Revit.ViewActivated += Revit_ViewActivated;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements    = FindNodesFromSelection;

            MigrationManager.Instance.MigrationTargets.Add(typeof(WorkspaceMigrationsRevit));
            ElementNameStore = new Dictionary <ElementId, string>();
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context, IUnitsManager units)
            : base(env, viewModelType, context, new UpdateManager.UpdateManager(), units, new RevitWatchHandler(), Dynamo.PreferenceSettings.Load())
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate<NodeModel> requiresTransactionPredicate = node => node is RevitTransactionNode;
            CheckRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            Predicate<NodeModel> manualTransactionPredicate = node => node is Transaction;
            CheckManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            dynSettings.Controller.DynamoViewModel.RequestAuthentication += RegisterSingleSignOn;

            AddPythonBindings();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;
            dynRevitSettings.Revit.ViewActivated += Revit_ViewActivated;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements = FindNodesFromSelection;

            MigrationManager.Instance.MigrationTargets.Add(typeof(WorkspaceMigrationsRevit));
            ElementNameStore = new Dictionary<ElementId, string>();
        }
Exemple #3
0
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context)
            : base(env, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate <NodeModel> requiresTransactionPredicate = node => node is RevitTransactionNode;

            CheckRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            Predicate <NodeModel> manualTransactionPredicate = node => node is Transaction;

            CheckManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            dynSettings.Controller.DynamoViewModel.RequestAuthentication += RegisterSingleSignOn;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;
            dynRevitSettings.Revit.ViewActivated += Revit_ViewActivated;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements    = FindNodesFromSelection;
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context)
            : base(env, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate<NodeModel> requiresTransactionPredicate = node => node is RevitTransactionNode;
            CheckRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            Predicate<NodeModel> manualTransactionPredicate = node => node is Transaction;
            CheckManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            dynSettings.Controller.DynamoViewModel.RequestAuthentication += RegisterSingleSignOn;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;
            dynRevitSettings.Revit.ViewActivated += Revit_ViewActivated;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements = FindNodesFromSelection;
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater)
            : base(env)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate<dynNode> manualTransactionPredicate = delegate(dynNode node)
            {
                return node is dynTransaction;
            };
            checkManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            Predicate<dynNode> requiresTransactionPredicate = delegate(dynNode node)
            {
                return node is dynRevitTransactionNode;
            };
            checkRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(Application_DocumentClosed);
            dynRevitSettings.Revit.Application.DocumentOpened += new EventHandler<Autodesk.Revit.DB.Events.DocumentOpenedEventArgs>(Application_DocumentOpened);
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, bool withUI, Type viewModelType, string context)
            : base(env, withUI, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(Application_DocumentClosed);
            dynRevitSettings.Revit.Application.DocumentOpened += new EventHandler<Autodesk.Revit.DB.Events.DocumentOpenedEventArgs>(Application_DocumentOpened);
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context)
            : base(env, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements =
                new Action(FindNodesFromSelection);
        }
        public DynamoController_Revit(DynamoUpdater updater)
            : base()
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            Predicate<dynNode> manualTransactionPredicate = delegate(dynNode node)
            {
                return node is dynTransaction;
            };
            checkManualTransaction = new PredicateTraverser(manualTransactionPredicate);

            Predicate<dynNode> requiresTransactionPredicate = delegate(dynNode node)
            {
                return node is dynRevitTransactionNode;
            };
            checkRequiresTransaction = new PredicateTraverser(requiresTransactionPredicate);

            AddPythonBindings();
            AddWatchNodeHandler();
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context)
            : base(env, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            //AppDomain currentDomain = AppDomain.CurrentDomain;
            //currentDomain.AssemblyResolve += ResolveSSONETHandler;

            dynSettings.PackageManagerClient.AuthenticationRequested += RegisterSingleSignOn;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements =
                new Action(FindNodesFromSelection);
        }
        public DynamoController_Revit(FSchemeInterop.ExecutionEnvironment env, DynamoUpdater updater, Type viewModelType, string context)
            : base(env, viewModelType, context)
        {
            Updater = updater;

            dynRevitSettings.Controller = this;

            //AppDomain currentDomain = AppDomain.CurrentDomain;
            //currentDomain.AssemblyResolve += ResolveSSONETHandler;

            dynSettings.PackageManagerClient.AuthenticationRequested += RegisterSingleSignOn;

            AddPythonBindings();
            AddWatchNodeHandler();

            dynRevitSettings.Revit.Application.DocumentClosed += Application_DocumentClosed;
            dynRevitSettings.Revit.Application.DocumentOpened += Application_DocumentOpened;

            //allow the showing of elements in context
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.CanFindNodesFromElements = true;
            dynSettings.Controller.DynamoViewModel.CurrentSpaceViewModel.FindNodesFromElements    =
                new Action(FindNodesFromSelection);
        }
Exemple #11
0
        public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
        {
            try
            {
                //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")); //MDJ todo - move hard-coded strings out to resource files

                //Create a push button in the ribbon panel

                PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo",
                    res.GetString("App_Name"), m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton;

                System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32;

                BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                         dynamoIcon.GetHbitmap(),
                         IntPtr.Zero,
                         System.Windows.Int32Rect.Empty,
                         System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

                pushButton.LargeImage = bitmapSource;
                pushButton.Image = bitmapSource;

                // MDJ = element level events and dyanmic model update
                // MDJ 6-8-12  trying to get new dynamo to watch for user created ref points and re-run definition when they are moved

                IdlePromise.RegisterIdle(application);

                updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication);
                if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater);

                ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager));
                ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance));
                ElementCategoryFilter refPointFilter = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints);
                ElementClassFilter modelCurveFilter = new ElementClassFilter(typeof(CurveElement));
                ElementClassFilter sunFilter = new ElementClassFilter(typeof(SunAndShadowSettings));
                IList<ElementFilter> filterList = new List<ElementFilter>();

                filterList.Add(SpatialFieldFilter);
                filterList.Add(familyFilter);
                filterList.Add(modelCurveFilter);
                filterList.Add(refPointFilter);
                filterList.Add(sunFilter);

                ElementFilter filter = new LogicalOrFilter(filterList);

                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion());
                UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition());

                return Result.Succeeded;
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return Result.Failed;
            }
        }