예제 #1
0
        private void ReleaseButtons(object sender, RunWorkerCompletedEventArgs e)
        {
            ButtonStart.Enabled  = true;
            buttonOK.Enabled     = true;
            buttonCancel.Enabled = true;
            buttonStop.Enabled   = false;

            //Enable GUI
            GH_DocumentEditor ghCanvas = Owner as GH_DocumentEditor;

            ghCanvas.EnableUI();
        }
예제 #2
0
        private void OnStartup()
        {
            Instances.CanvasCreated += OnCanvasCreated;

            GH_DocumentEditor editor = null;

            while (editor == null)
            {
                editor = Grasshopper.Instances.DocumentEditor;
                Thread.Sleep(200);
            }

            Populate(editor.MainMenuStrip);
        }
        /** Function to run on GH startup */
        private void OnStartup()
        {
            /** Create an event for when canvas is created. */
            Instances.CanvasCreated += OnCanvasCreated;

            /** Check for GH_DocumentEditor every 0.2s */
            GH_DocumentEditor editor = null;

            while (editor == null)
            {
                editor = Grasshopper.Instances.DocumentEditor;
                Thread.Sleep(200);
            }

            /** Register menu when GH_DocumentEditor is not null */
            Populate(editor.MainMenuStrip);
        }
예제 #4
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            //Disable GUI
            GH_DocumentEditor ghCanvas = Owner as GH_DocumentEditor;

            ghCanvas.DisableUI();

            //Read expert settings
            OptimizationLoop.solversettings = textBoxExpertSettings.Text;

            //Lock Buttons
            ButtonStart.Enabled  = false;
            buttonOK.Enabled     = false;
            buttonCancel.Enabled = false;

            //Options
            OptimizationLoop.BolMaxIter = CheckBoxIterations.Checked;
            if (CheckBoxIterations.Checked)
            {
                OptimizationLoop.MaxIter = (int)numUpDownIterations.Value;
            }

            OptimizationLoop.BolMaxIterNoProgress = CheckBoxImprovement.Checked;
            if (CheckBoxImprovement.Checked)
            {
                OptimizationLoop.MaxIterNoProgress = (int)numUpDownImprovement.Value;
            }

            OptimizationLoop.BolMaxDuration = CheckBoxDuration.Checked;
            if (CheckBoxDuration.Checked)
            {
                OptimizationLoop.MaxDuration = (int)numUpDownDuration.Value;
            }

            OptimizationLoop.BolLog = CheckBoxLog.Checked;
            if (CheckBoxLog.Checked)
            {
                OptimizationLoop.LogName = textBoxLogName.Text;
            }

            OptimizationLoop.BolMaximize    = radioButtonMaximize.Checked;
            OptimizationLoop.ExpertSettings = textBoxExpertSettings.Text.Replace(Environment.NewLine, " ");
            OptimizationLoop.PresetIndex    = comboBoxPresets.SelectedIndex;

            //Number of Runs
            OptimizationLoop.BolRuns = CheckBoxRuns.Checked;
            if (CheckBoxRuns.Checked)
            {
                OptimizationLoop.Runs = Convert.ToInt32(numUpDownRuns.Value);
            }
            else
            {
                OptimizationLoop.Runs = 1;
            }

            //Start Optimization
            backgroundWorkerSolver.RunWorkerAsync(_frogComponent);

            //Unlock Stop
            buttonStop.Enabled = true;
        }