示例#1
0
 private void getSurfaceRoughnessButton_Click(object sender, EventArgs e)
 {
     FunctionWise.initializeLeadAndTilt(double.Parse(lead.Text), double.Parse(tilt.Text));
     FunctionWise.initializeStepOver(followingCut.Checked, double.Parse(stepOver.Text));
     if (double.IsNaN(FunctionWise.getSurfaceRoughness()))
     {
         MessageBox.Show("Stepover value is too large (Stepover cannot be greater than diameter of the tool)");
     }
     else
     {
         MessageBox.Show("Surface Roughness for tilt " + tilt.Text + ", and stepover " + stepOver.Text + ", is " + Math.Round(FunctionWise.getSurfaceRoughness(), 4) + " mm");
     }
 }
示例#2
0
        public void getBestLeadAndTilt()
        {
            button1.Hide();
            finalLabel.Hide();

            double FminForDifferentLeadAndTilts = double.MaxValue;
            double lBest = 0;
            double tBest = 0;
            int    lmin  = int.Parse(leadMin.Text);
            int    lmax  = int.Parse(leadMax.Text);
            int    tmin  = int.Parse(tiltMin.Text);
            int    tmax  = int.Parse(tiltMax.Text);

            progressBar1.Maximum = (int)((lmax - lmin + 1) * (tmax - tmin + 1));
            int count = 0;

            for (int l = lmin; l <= lmax; l++)
            {
                for (int t = tmin; t <= tmax; t++)
                {
                    count++;
                    FunctionWise.initializeLeadAndTilt(l, t);
                    FunctionWise.descritizationOfMultipleTool(); // Not writing descritezation in getFmax Function because tool geometry is fixed
                    dynamicLabel.Text = "Calculating Fmax for lead = " + l + " degrees and tilt = " + t + " degrees";
                    double Fmax = FunctionWise.getFmax(time);
                    maximumForceForLeadTilt.Text = "Maximum Force for the and lead and tilt = " + Math.Round(Fmax, 2) + " N";
                    progressBar1.Value           = count;
                    if (FminForDifferentLeadAndTilts > Fmax)
                    {
                        FminForDifferentLeadAndTilts  = Fmax;
                        leadTiltForMimimumForces.Text = "Best combination till now is lead = " + l + " , tilt = " + t;
                        minForceTIllNow.Text          = "Minimum value of force till now = " + Math.Round(Fmax, 2) + " N";
                        Update();
                        lBest = l;
                        tBest = t;
                    }
                    this.Update();
                }
            }
            finalLabel.Text = "Lead = " + lBest + " degrees and Tilt = " + tBest + " degrees for minimum forces";
            button1.Show();
            finalLabel.Show();
            dynamicLabel.Hide();
            progressBar1.Hide();
            leadTiltForMimimumForces.Hide();
            maximumForceForLeadTilt.Hide();
            minForceTIllNow.Hide();
            this.Update();
        }
示例#3
0
 private void taskButton_Click(object sender, EventArgs e)
 {
     if (dataValidation())
     {
         if (exportToExcel.Checked)
         {
             saveFileDialog1.Filter   = "Excel Spreadsheet|*.xls";
             saveFileDialog1.FileName = (taskSimulateForces.Checked) ? "FCN data till time " + time.Text + " for lead " + lead.Text + " and tilt " + tilt.Text : "Cutting Zone at time " + time.Text + " for lead " + lead.Text + " and tilt " + tilt.Text;
             saveFileDialog1.Title    = "Export file at";
             if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 FunctionWise.locationOfExport   = saveFileDialog1.FileName;
                 FunctionWise.isExportExcelSheet = true;
             }
         }
         if (taskSimulateForces.Checked == true)
         {
             FunctionWise.initializeLeadAndTilt(double.Parse(lead.Text), double.Parse(tilt.Text));
             FunctionWise.initializeStepOver(followingCut.Checked, double.Parse(stepOver.Text));
             FunctionWise.plotGraphs(double.Parse(time.Text));
         }
         if (taskLeadTiltAngle.Checked == true)
         {
             FunctionWise.initializeStepOver(followingCut.Checked, double.Parse(stepOver.Text));
             FindLeadAndTiltForm output = new FindLeadAndTiltForm(double.Parse(time.Text));
             //output.Parent = this;
             output.Show();
         }
         if (taskDisplayCuttingZone.Checked == true)
         {
             FunctionWise.initializeLeadAndTilt(double.Parse(lead.Text), double.Parse(tilt.Text));
             FunctionWise.initializeStepOver(followingCut.Checked, double.Parse(stepOver.Text));
             FunctionWise.simulateEngagementRegion(double.Parse(time.Text));
         }
     }
 }