Exemplo n.º 1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            if (!Launched)
            {
                // Create a new speckle binding instance
                var bindings = new SpeckleUiBindingsRevit(commandData.Application);

                // Create an external event handler to raise actions
                var eventHandler = ExternalEvent.Create(new SpeckleRevitExternalEventHandler(bindings));

                // Give it to our bindings so we can actually do stuff with revit
                bindings.SetExecutorAndInit(eventHandler);

                // Initialise the window
#if DEBUG
                //SpeckleWindow = new SpeckleUiWindow( bindings, @"http://*****:*****@"https://matteo-dev.appui.speckle.systems/#/");
#else
                SpeckleWindow = new SpeckleUiWindow(bindings, @"https://matteo-dev.appui.speckle.systems/#/"); // On release, default to the latest ci-ed version from https://appui.speckle.systems
#endif
                var helper = new System.Windows.Interop.WindowInteropHelper(SpeckleWindow);
                helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;

                // TODO: find a way to set the parent/owner of the speckle window so it minimises/maximises etc. together with the revit window.
                SpeckleWindow.Show();
                Launched = true;
            }

            SpeckleWindow.Show();
            SpeckleWindow.Focus();

            return(Result.Succeeded);
        }
Exemplo n.º 2
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            DataPipeClient dataPipeClient;

            if (e.Args.Length == 4)
            {
                dataPipeClient = new DataPipeClient(e.Args[0], e.Args[1]);
                AutocadDataService.DataPipeClient = dataPipeClient;
                uibindings = new SpeckleUIBindingsAutoCAD(dataPipeClient);

                waitHandles = new WaitHandle[2];
                waitHandles[SHOW_UI_SIGNAL] = EventWaitHandle.OpenExisting(e.Args[2]);
                waitHandles[AUTOCAD_SELECTION_CHANGED_SIGNAL] = EventWaitHandle.OpenExisting(e.Args[3]);
                eventProcessorThread = new Thread(ProcessEvent);
                eventProcessorThread.IsBackground = true;
                eventProcessorThread.Start();
            }
            else
            {
                uibindings = new SpeckleUIBindingsAutoCAD(null);
            }


            //Create main application window
            var path      = Directory.GetParent(Assembly.GetExecutingAssembly().Location);
            var indexPath = string.Format(@"{0}\app\index.html", path);

            indexPath     = indexPath.Replace("\\", "/");
            SpeckleWindow = new SpeckleUiWindow(uibindings, indexPath);
            SpeckleWindow.Show();
        }
Exemplo n.º 3
0
        public void Speckle()
        {
            // Gets the current document, and prints some basic information about it
            // to the command editor window.



            CivilDocument doc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;

            var bindings = new SpeckleUIBindingsAutoCAD(doc);

            ObjectIdCollection alignments = doc.GetAlignmentIds();
            ObjectIdCollection sites      = doc.GetSiteIds();
            String             docInfo    = String.Format("\nHello Speckle!");

            Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(docInfo);

            SpeckleWindow = new SpeckleUiWindow(bindings);

            var helper = new System.Windows.Interop.WindowInteropHelper(SpeckleWindow);

            helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;

            SpeckleWindow.Show();
            Launched = true;
        }
Exemplo n.º 4
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            if (!Launched)
            {
                // Create a new speckle binding instance
                var bindings = new SpeckleUiBindingsRevit(commandData.Application);

                // Create an external event handler to raise actions
                var eventHandler = ExternalEvent.Create(new SpeckleRevitExternalEventHandler(bindings));

                // Give it to our bindings so we can actually do stuff with revit
                bindings.SetExecutorAndInit(eventHandler);

                // Initialise the window
                SpeckleWindow = new SpeckleUiWindow(bindings);

                var helper = new System.Windows.Interop.WindowInteropHelper(SpeckleWindow);
                helper.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;

                // TODO: find a way to set the parent/owner of the speckle window so it minimises/maximises etc. together with the revit window.
                SpeckleWindow.Show();
                Launched = true;
            }

            SpeckleWindow.Show();
            SpeckleWindow.Focus();

            return(Result.Succeeded);
        }
Exemplo n.º 5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
#if DEBUG
            UiWindow = new SpeckleUiWindow(new TestBindings(), @"https://matteo-dev.appui.speckle.systems/#/");
#else
            UiWindow = new SpeckleUiWindow(new TestBindings()); // On release, default to the latest ci-ed version from https://appui.speckle.systems
#endif

            UiWindow.Show();
        }