Ejemplo n.º 1
0
 public Products(ExternalCommandData comma, ref string mess, Autodesk.Revit.DB.ElementSet ele)
 {
     InitializeComponent();
     comma1  = comma;
     mess1   = mess;
     element = ele;
 }
Ejemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            HelpForm helpForm = new HelpForm();

            helpForm.ShowDialog();
            return(Result.Succeeded);
        }
Ejemplo n.º 3
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            if (!DockablePane.PaneExists(DefaultFamilyTypes.PaneId) ||
                !DockablePane.PaneExists(DefaultElementTypes.PaneId))
            {
                return(Result.Failed);
            }

            UIApplication uiApp = commandData.Application;

            if (uiApp == null)
            {
                return(Result.Failed);
            }

            DockablePane pane = uiApp.GetDockablePane(DefaultFamilyTypes.PaneId);

            pane.Show();
            DockablePane elemTypePane = uiApp.GetDockablePane(DefaultElementTypes.PaneId);

            elemTypePane.Show();

            if (ThisApplication.DefaultFamilyTypesPane != null)
            {
                ThisApplication.DefaultFamilyTypesPane.SetDocument(commandData.Application.ActiveUIDocument.Document);
            }
            if (ThisApplication.DefaultElementTypesPane != null)
            {
                ThisApplication.DefaultElementTypesPane.SetDocument(commandData.Application.ActiveUIDocument.Document);
            }

            return(Result.Succeeded);
        }
Ejemplo n.º 4
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            Autodesk.Revit.DB.ElementSet elements)
        {
            if (commandData == null)
            {
                return(Result.Failed);
            }

            UIDocument udoc = commandData.Application.ActiveUIDocument;

            dynamic settings = new ExpandoObject();

            settings.Height        = 480;
            settings.Width         = 768;
            settings.Title         = "Destructive Purge - By Andrew Nicholas";
            settings.ShowInTaskbar = false;
            settings.SizeToContent = System.Windows.SizeToContent.Manual;

            var vm = new ViewModels.DestructivePurgeViewModel(udoc.Document);

            SCaddinsApp.WindowManager.ShowDialog(vm, null, settings);
            return(Result.Succeeded);
        }
Ejemplo n.º 5
0
 public ProductDetails(ExternalCommandData commadet, ref string messdet, Autodesk.Revit.DB.ElementSet eledet)
 {
     InitializeComponent();
     properities.tempCommandData = commadet;
     properities.tempElementSet  = eledet;
     properities.tempMessage     = messdet;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                                ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                // Verify active document
                if (null == commandData.Application.ActiveUIDocument.Document)
                {
                    message = "Active view is null.";
                    return(Autodesk.Revit.UI.Result.Failed);
                }

                MainData mainData = new MainData(commandData);
                // Show the dialog
                using (MainForm mainForm = new MainForm(mainData))
                {
                    if (mainForm.ShowDialog() == DialogResult.Cancel)
                    {
                        return(Autodesk.Revit.UI.Result.Cancelled);
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.ToString();
                return(Autodesk.Revit.UI.Result.Failed);
            }

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                                ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                CoordinateSystemData Data = new CoordinateSystemData(commandData);
                Data.GatData();

                using (CoordinateSystemDataForm displayForm =
                           new CoordinateSystemDataForm(Data, commandData.Application.Application.Cities,
                                                        commandData.Application.ActiveUIDocument.Document.SiteLocation))
                {
                    if (DialogResult.OK != displayForm.ShowDialog())
                    {
                        return(Autodesk.Revit.UI.Result.Cancelled);
                    }
                }
                return(Autodesk.Revit.UI.Result.Succeeded);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(Autodesk.Revit.UI.Result.Failed);
            }
        }
Ejemplo n.º 8
0
 public login(ExternalCommandData commandata2, ref string mess, Autodesk.Revit.DB.ElementSet ele)
 {
     InitializeComponent();
     commandata1 = commandata2;
     elements1   = ele;
     message1    = mess;
 }
Ejemplo n.º 9
0
 public Result Execute(
     ExternalCommandData commandData,
     ref string message,
     Autodesk.Revit.DB.ElementSet elements)
 {
     ThinLinesApp.SetThinLines(commandData.Application, true);
     return(Result.Succeeded);
 }
Ejemplo n.º 10
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            var tempuseRequestMaker = new UseRequestMaker(commandData.Application.ActiveUIDocument);

            var useFrameWork = new QuickModelFrameWork(tempuseRequestMaker, new UseRespondHanlder());

            useFrameWork.ExcuteWithWhile(commandData);
            return(Result.Succeeded);
        }
Ejemplo n.º 11
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            Autodesk.Revit.DB.ElementSet elements)
        {
            var vm = new ViewModels.SCincrementViewModel();

            SCaddinsApp.WindowManager.ShowDialog(vm, null, ViewModels.SCincrementViewModel.DefaultWindowSettings);
            return(Result.Succeeded);
        }
Ejemplo n.º 12
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Log.AppendLog(LogMessageType.INFO, "Started");

            try
            {
                var addins = AppCommand.thisApp.addins;
                StoreTempCollection(addins.AddinCollection);
                var viewModel  = new AddInViewModel(addins);
                var mainWindow = new MainWindow {
                    DataContext = viewModel
                };
                if (mainWindow.ShowDialog() == true)
                {
                    var vm = (AddInViewModel)mainWindow.DataContext;
                    try
                    {
                        // (Konrad) We are gathering information about the addin use. This allows us to
                        // better maintain the most used plug-ins or discontiue the unused ones.
                        // If Window was closed using the OK button we can collect more details about the app to publish.
                        var log = new AddinLog("AddinManager", commandData.Application.Application.VersionNumber)
                        {
                            DetailInfo = vm.AddinsObj.AddinCollection
                                         .Select(x => new InfoItem {
                                Name = x.ToolName, Value = x.ToolLoadType.ToString()
                            })
                                         .ToList()
                        };
                        AddinUtilities.PublishAddinLog(log);
                    }
                    catch (Exception e)
                    {
                        Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
                    }

                    // write setting and load addins.
                    AppCommand.thisApp.addins = vm.AddinsObj;
                    AppCommand.thisApp.ProcessPlugins();
                }
                else
                {
                    // If user cancelled out of this window, we don't need to log all the details, other than that it was opened.
                    AddinUtilities.PublishAddinLog(new AddinLog("AddinManager", commandData.Application.Application.VersionNumber));

                    OverrideTempSettings();
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }

            Log.AppendLog(LogMessageType.INFO, "Ended");
            return(Result.Succeeded);
        }
Ejemplo n.º 13
0
 public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     try
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to import JSON to Revit.\n" + ex.Message, "Import JSON", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     return(Result.Succeeded);
 }
Ejemplo n.º 14
0
 ElementSet(string label, ICollection<Autodesk.Revit.DB.ElementId> val, Autodesk.Revit.DB.Document doc)
 : base(label)
 {
     m_val = new Autodesk.Revit.DB.ElementSet();
     foreach(Autodesk.Revit.DB.ElementId elemId in val)
     {
         if(Autodesk.Revit.DB.ElementId.InvalidElementId == elemId)
             continue;
         Autodesk.Revit.DB.Element elem = doc.GetElement(elemId);
         if(null != elem)
             m_val.Insert(elem);
     }
 }
Ejemplo n.º 15
0
 public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     try
     {
         RevitServerApp.Instance.Toggle();
         return(Result.Succeeded);
     }
     catch (Exception ex)
     {
         message = ex.Message;
         return(Result.Failed);
     }
 }
Ejemplo n.º 16
0
 public ElementSet(string label, ICollection<Autodesk.Revit.DB.ElementId> val, Autodesk.Revit.DB.Document doc)
     : base(label)
 {
     m_val = new Autodesk.Revit.DB.ElementSet();
     foreach(Autodesk.Revit.DB.ElementId elemId in val)
     {
         if(Autodesk.Revit.DB.ElementId.InvalidElementId == elemId)
             continue;
         Autodesk.Revit.DB.Element elem = doc.GetElement(elemId);
         if(null != elem)
             m_val.Insert(elem);
     }
 }
Ejemplo n.º 17
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                RevitServerApp._app.ShowSettingsForm();
            }
            catch (Exception exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
            }

            return(Result.Succeeded);
        }
Ejemplo n.º 18
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            if (m_displacementstructuremodelAnimator == null)
            {
                m_displacementstructuremodelAnimator = new DisplacementStructureModelAnimator(commandData.Application, false);
                m_displacementstructuremodelAnimator.StartAnimation();
            }
            else
            {
                m_displacementstructuremodelAnimator.AnimateNextStep();
            }

            return(Result.Succeeded);
        }
Ejemplo n.º 19
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            Autodesk.Revit.DB.ElementSet elements)
        {
            if (commandData == null)
            {
                return(Result.Failed);
            }
            var uidoc = commandData.Application.ActiveUIDocument;

            ViewUnderlays.RemoveUnderlays(uidoc);
            return(Result.Succeeded);
        }
Ejemplo n.º 20
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            Autodesk.Revit.DB.ElementSet elements)
        {
            var vms = new ParameterUtilities.ViewModels.SCincrementViewModel();
            var roomConverterViewModel       = new RoomConverter.ViewModels.SettingsViewModel();
            var sheetCopierViewModel         = new SheetCopier.ViewModels.SheetCopierSettingsViewModel();
            var viewUtilitiesViewModel       = new ViewUtilities.ViewModels.ViewUtilitiesSettingsViewModel();
            var spellCheckerOptionsViewModel = new SpellChecker.ViewModels.SpellCheckerOptionsViewModel();
            var vm = new ViewModels.SettingsViewModel(vms, roomConverterViewModel, sheetCopierViewModel, viewUtilitiesViewModel, spellCheckerOptionsViewModel);

            SCaddinsApp.WindowManager.ShowDialog(vm, null, ViewModels.SettingsViewModel.DefaultWindowSettings);
            return(Result.Succeeded);
        }
Ejemplo n.º 21
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                App.revonApp.ShowShellForm(commandData.Application);

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(Result.Failed);
            }

            return(Result.Succeeded);
        }
Ejemplo n.º 22
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            IParameterHelper ph = new ParameterHelper(commandData.Application.ActiveUIDocument.Document);

            var paramName = "SomeParameterThatNormallyDoesnotExist";
            var exists    = ph.HasParameter(paramName);

            MessageBox.Show(paramName + " exists: " + exists);


            paramName = "Project Name";
            exists    = ph.HasParameter(paramName);

            MessageBox.Show(paramName + " exists: " + exists);

            return(Result.Succeeded);
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Command entry point
 /// </summary>
 /// <param name="commandData"></param>
 /// <param name="message"></param>
 /// <param name="elements"></param>
 /// <returns></returns>
 public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     try
     {
         EADocumentData    eadd = new EADocumentData(elements, commandData);
         EASharedParamData easp = new EASharedParamData("Rooms");
         //easp.SetNewParameterToTypeRoom("Display");
         MainWindow mw = new MainWindow();
         mw.ShowDialog();
         return(Result.Succeeded);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.Read();
         return(Result.Failed);
     }
 }
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            // get ThinLies state and set it to its opposite value

            ThinLinesApp.SetThinLines(commandData.Application, !ThinLinesApp.IsThinLines());

            // you also could toggle the ThinLines state by just invoking PostableCommand.ThinLines

            /*
             * RevitCommandId commandId = RevitCommandId.LookupPostableCommandId(PostableCommand.ThinLines);
             *
             * if (commandData.Application.CanPostCommand(commandId))
             * {
             *      commandData.Application.PostCommand(commandId);
             * }
             */

            return(Result.Succeeded);
        }
Ejemplo n.º 25
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Log.AppendLog(LogMessageType.INFO, "Started");

            try
            {
                // (Konrad) We are gathering information about the addin use. This allows us to
                // better maintain the most used plug-ins or discontiue the unused ones.
                AddinUtilities.PublishAddinLog(new AddinLog("Beta-SheetManager", commandData.Application.Application.VersionNumber));

                m_app = commandData.Application;
                AppCommand.thisApp.ShowWindow(m_app);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }

            Log.AppendLog(LogMessageType.INFO, "Ended");
            return(Result.Succeeded);
        }
Ejemplo n.º 26
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            Autodesk.Revit.DB.ElementSet elements)
        {
            dynamic settings = new ExpandoObject();

            settings.Height = 640;
            settings.Width  = 480;
            settings.Title  = "About SCaddins";
            settings.Icon   = new System.Windows.Media.Imaging.BitmapImage(
                new System.Uri("pack://application:,,,/SCaddins;component/Assets/scexport.png"));
            settings.ShowInTaskbar = false;
            settings.ResizeMode    = System.Windows.ResizeMode.NoResize;
            settings.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
            var aboutViewModel = new ViewModels.AboutViewModel();

            SCaddinsApp.WindowManager.ShowDialog(aboutViewModel, null, settings);

            return(Result.Succeeded);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                                ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Autodesk.Revit.DB.Transaction newTran = null;
            try
            {
                newTran = new Autodesk.Revit.DB.Transaction(commandData.Application.ActiveUIDocument.Document, "ViewPrinter");
                newTran.Start();

                PrintMgr pMgr = new PrintMgr(commandData);

                if (null == pMgr.InstalledPrinterNames)
                {
                    PrintMgr.MyMessageBox("No installed printer, the external command can't work.");
                    return(Autodesk.Revit.UI.Result.Cancelled);
                }

                using (PrintMgrForm pmDlg = new PrintMgrForm(pMgr))
                {
                    if (pmDlg.ShowDialog() != DialogResult.Cancel)
                    {
                        newTran.Commit();
                        return(Autodesk.Revit.UI.Result.Succeeded);
                    }
                    newTran.RollBack();
                }
            }
            catch (Exception ex)
            {
                if (null != newTran)
                {
                    newTran.RollBack();
                }
                message = ex.ToString();
                return(Autodesk.Revit.UI.Result.Failed);
            }

            return(Autodesk.Revit.UI.Result.Cancelled);
        }
Ejemplo n.º 28
0
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Log.AppendLog(LogMessageType.INFO, "Started");

            try
            {
                // (Konrad) We are gathering information about the addin use. This allows us to
                // better maintain the most used plug-ins or discontiue the unused ones.
                AddinUtilities.PublishAddinLog(
                    new AddinLog("HOK Navigator", commandData.Application.Application.VersionNumber));

                var helpForm = new HelpForm();
                helpForm.ShowDialog();
            }
            catch (Exception e)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
            }

            Log.AppendLog(LogMessageType.INFO, "Ended");
            return(Result.Succeeded);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                                ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            // try to initialize necessary data to create framing
            FrameData data = FrameData.CreateInstance(commandData);

            // display UI for user's input
            using (CreateFrameForm framingForm = new CreateFrameForm(data))
            {
                if (framingForm.ShowDialog() == DialogResult.OK)
                {
                    // create framing
                    FrameBuilder builder = new FrameBuilder(data);
                    builder.CreateFraming();
                }
                else
                {
                    // cancel the command
                    return(Autodesk.Revit.UI.Result.Cancelled);
                }
            }

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            using (frmPanelArea form = new frmPanelArea(commandData))
            {
                // The form is created successfully
                if (null != form && !form.IsDisposed)
                {
                    form.ShowDialog();
                }
            }

            return(Autodesk.Revit.UI.Result.Succeeded);
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Implementation of the external command.
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            SiteUIUtils.ChangeSubregionAndPointsElevation(commandData.Application.ActiveUIDocument, 3);

            return(Result.Succeeded);
        }
Ejemplo n.º 32
0
 public ElementSet(string label, Autodesk.Revit.DB.ElementSet val)
     : base(label)
 {
     m_val = val;
 }