Esempio n. 1
0
        public SetTagsInterface(Autodesk.Revit.UI.ExternalEvent exEvent,
                                ExternalEventHandler handler,
                                ModelessForms.Application thisApp)
        {
            InitializeComponent();

            m_ExEvent = exEvent;
            m_Handler = handler;
            ThisApp   = thisApp;

            pathToDataFile = ModelessForms.Properties.Settings.Default.pathToExcel;
            textBox2.Text  = pathToDataFile;
        }
Esempio n. 2
0
        internal void ShowSnSForm(UIApplication application)
        {
            // If we do not have a dialog yet, create and show it
            if (m_SearchAndSelect == null || m_SearchAndSelect.IsDisposed)
            {
                // A new handler to handle request posting by the dialog
                ExternalEventHandler handler = new ExternalEventHandler(thisApp);

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                // We give the objects to the new dialog;
                // The dialog becomes the owner responsible fore disposing them, eventually.
                m_SearchAndSelect = new SearchAndSelect.SnS(exEvent, handler, thisApp);
                m_SearchAndSelect.Show();
            }
        }
Esempio n. 3
0
        /// <summary>
        ///   This method creates and shows a modeless dialog, unless it already exists.
        /// </summary>
        /// <remarks>
        ///   The external command invokes this on the end-user's request
        /// </remarks>
        ///
        public void ShowMepUtilsForm(UIApplication uiapp)
        {
            // If we do not have a dialog yet, create and show it
            if (m_MepUtilsForm == null || m_MepUtilsForm.IsDisposed)
            {
                // A new handler to handle request posting by the dialog
                ExternalEventHandler handler = new ExternalEventHandler(thisApp);

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);

                // We give the objects to the new dialog;
                // The dialog becomes the owner responsible fore disposing them, eventually.
                m_MepUtilsForm = new MEPUtilsChooser(exEvent, handler, thisApp);
                m_MepUtilsForm.Show();
            }
        }
Esempio n. 4
0
        public MEPUtilsChooser(Autodesk.Revit.UI.ExternalEvent exEvent,
                               ExternalEventHandler handler,
                               ModelessForms.Application thisApp)
        {
            InitializeComponent();

            m_ExEvent = exEvent;
            m_Handler = handler;
            ThisApp   = thisApp;

            //From here: http://stackoverflow.com/questions/34426888/dynamic-button-creation-placing-them-in-a-predefined-order-using-c-sharp
            //Edit the number of methods in rowCount here
            int columnCount = 1;
            int rowCount    = 3;

            tableLayoutPanel1.ColumnCount = columnCount;
            tableLayoutPanel1.RowCount    = rowCount;

            tableLayoutPanel1.ColumnStyles.Clear();
            tableLayoutPanel1.RowStyles.Clear();

            for (int i = 0; i < columnCount; i++)
            {
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columnCount));
            }
            for (int i = 0; i < rowCount; i++)
            {
                tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / rowCount));
            }

            //Place methods to execute in this dict
            methodDict = new Dictionary <int, Func <UIApplication, Result> >
            {
                { 0, InsulationHandler.CreateAllInsulation },
                { 1, InsulationHandler.DeleteAllPipeInsulation },
                { 2, new InsulationHandler().ExecuteInsulationSettings },
                { 3, PipeCreator.CreatePipeFromConnector },
                { 4, FlangeCreator.CreateFlangeForElements },
                { 5, TotalLineLength.TotalLineLengths },
                { 6, MEPUtils.CreateInstrumentation.StartCreatingInstrumentation.StartCreating },
                { 7, MEPUtils.SupportTools.SupportToolsMain.CallForm },
                { 8, MEPUtils.MoveToDistance.MoveToDistance.Move },
                { 9, new MEPUtils.CountWelds.CountWelds().CountWeldsMethod },
                { 10, new MEPUtils.NumberStuff.NumberStuff().NumberStuffMethod }
            };

            //Place names for methods in this dict
            nameDict = new Dictionary <int, string>
            {
                { 0, "Create all insulation" },
                { 1, "Delete all insulation" },
                { 2, "Insulation settings" },
                { 3, "Create pipe from connector" },
                { 4, "Create flanges" },
                { 5, "Total length of lines" },
                { 6, "Create Instrument!" },
                { 7, "Support Tools" },
                { 8, "Move e to distance" },
                { 9, "(ctrl) Count welds" },
                { 10, "(ctrl) (Re-)Number" }
            };

            for (int i = 0; i < nameDict.Count; i++)
            {
                var b = new Button
                {
                    Text = nameDict[i],
                    Name = string.Format("b_{0}", i)
                };
                b.Click       += B_Click;
                b.Dock         = DockStyle.Fill;
                b.AutoSizeMode = 0;
                tableLayoutPanel1.Controls.Add(b);
            }
        }