Пример #1
0
        public static void ReceiveChangesFromDB()
        {
            Rootobject RootObject = new Rootobject();

            try
            {
                DocumentReference       docRef   = firestoreDb.Collection(CollectionName).Document(DocumentName);
                FirestoreChangeListener listener = docRef.Listen(snapshot =>
                {
                    Console.WriteLine("Callback received document snapshot.");

                    if (snapshot.Exists)
                    {
                        Console.WriteLine("Document data for {0} document:", snapshot.Id);

                        var st     = Newtonsoft.Json.JsonConvert.SerializeObject(snapshot.ToDictionary());
                        RootObject = snapshot.ConvertTo <Rootobject>();
                        RevitManagement.CompareAndUpdateCurrentModel(RootObject);

                        //TODO check this to detect changes
                    }
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error " + ex.Message);
                return;
            }
        }
Пример #2
0
        public void Execute(UIApplication app)
        {
            var _doc = app.ActiveUIDocument.Document;

            using (Transaction tx = new Transaction(_doc, "Updating Model"))
            {
                tx.Start();
                RevitManagement.ProcessReceivedChanges();
                tx.Commit();
                MainForm.ClearReceivedItems();
            }
        }
Пример #3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            mainForm = new MainForm(commandData);
            Process process = Process.GetCurrentProcess();

            RevitManagement.SetCurrentDocument(commandData.Application.ActiveUIDocument.Document);
            RevitManagement.SetCurrentUIDocument(commandData.Application.ActiveUIDocument);

            IntPtr h = process.MainWindowHandle;

            mainForm.Topmost = true;
            mainForm.Show(); //Changed to modeless
            return(Result.Succeeded);
        }
Пример #4
0
        public void Execute(UIApplication app)
        {
            var _doc = app.ActiveUIDocument.Document;

            RevitManagement.SetCurrentDocument(_doc);
            RevitManagement.SetCurrentUIDocument(app.ActiveUIDocument);
            var changes = RevitManagement.ProcessLocalChanges();


            RevitManagement.changedElements = new List <ElementId>();
            MainForm.ClearChangedItems();

            if (changes == null)
            {
                return;
            }
            FireBaseConnection.SendChangesToDB(changes, null);
        }
Пример #5
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            _doc = commandData.Application.ActiveUIDocument.Document;
            RevitManagement.SetCurrentDocument(_doc);
            RevitManagement.SetCurrentUIDocument(commandData.Application.ActiveUIDocument);

            if (_doc.ActiveView.ViewType != ViewType.ThreeD)
            {
                var td = new TaskDialog("Wrong view type");
                td.MainInstruction = "Select a 3D View to start the app";
                td.Show();
                return(Result.Cancelled);
            }

            RevitManagement.SetView3D((View3D)_doc.ActiveView);
            ConnectToDB();
            App.ExportModelExternalEvent.Raise();
            return(Result.Succeeded);
        }
Пример #6
0
        public void Execute(UIApplication app)
        {
            var _doc = app.ActiveUIDocument.Document;

            RevitManagement.SetCurrentDocument(_doc);
            RevitManagement.SetCurrentUIDocument(app.ActiveUIDocument);

            if (_doc.ActiveView.ViewType != ViewType.ThreeD)
            {
                var td = new TaskDialog("Wrong view type");
                td.MainInstruction = "Select a 3D View to start the app";
                td.Show();
                return;
            }

            RevitManagement.SetView3D(_doc.ActiveView as View3D);
            var CurrentRootObject = RevitManagement.ProcessAllModel();

            FireBaseConnection.SendModelToDB(CurrentRootObject, "models", _doc.Title);
        }