Example #1
0
        public void extraAddtoList(IModel m, matrixModelEventArgs e)
        {
            double gearWidth = this.gearWidth;

            //Add List
            listBox1.Visible    = true;
            listBox1.DataSource = e.theMatrix;

            ContactLineCheckBox.Items.Clear();
            ContactLineCheckBox.Visible = true;

            //Add Chart
            chart1.Series.Clear();
            chart1.Titles.Clear();
            Title tt = new Title();

            tt.Name = "ExtraTitle";
            tt.Text = "Extra Variable for Gear:" + e.gearCount + " Mesh:" + e.eingriffCount;
            chart1.Titles.Add(tt);
            chart1.Tag     = "Gear" + e.gearCount + "_Meshing" + e.eingriffCount + "_ExtraValue";
            chart1.Visible = true;

            saveChartToolStripMenuItem.Enabled = true;
            gNUPlotToolStripMenuItem.Enabled   = true;
            labelsToolStripMenuItem.Enabled    = true;
            toolStripStatusLabel1.Text         = "Save Chart!";

            chart1.ChartAreas[0].AxisX.Maximum  = gearWidth;
            chart1.ChartAreas[0].AxisX.Minimum  = 0;
            chart1.ChartAreas[0].AxisX.Interval = 2;
            chart1.ChartAreas[0].AxisX.Title    = ("Width (mm)");
            // This next Line is just added becsause there is a problem with xml, reading the unit
            string newUnit = e.unit.Split('"', '"')[1];

            chart1.ChartAreas[0].AxisY.Title = ("ExtraValue (" + newUnit + ")");

            int    contactLines = e.ContactLines;
            int    pointsNum    = e.theMatrix.Count / contactLines;
            double xwidth       = gearWidth / (double)pointsNum;
            double startPoint   = 0.5555;

            for (int seriesNum = 0; seriesNum < contactLines; seriesNum++)
            {
                chart1.Series.Add("ExtraValue " + (seriesNum + 1));
                chart1.Series[seriesNum].MarkerStyle = MarkerStyle.Square;
                chart1.Series[seriesNum].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                ContactLineCheckBox.Items.Add("ExtraValue " + (seriesNum + 1), true);
            }

            int flag = 0;

            for (int i = 0; i < contactLines; i++)
            {
                for (int j = 0; j < pointsNum; j++)
                {
                    chart1.Series[i].Points.AddXY((startPoint + j) * xwidth, e.theMatrix[j + (pointsNum * flag)]);
                }
                flag++;
            }
        }
Example #2
0
        public void ysidinisoAddtoList(IModel m, matrixModelEventArgs e)
        {
            double gearWidth = this.gearWidth;

            //Add List
            listBox1.Visible    = true;
            listBox1.DataSource = e.theMatrix;

            ContactLineCheckBox.Items.Clear();
            ContactLineCheckBox.Visible = true;


            //Add Chart
            chart1.Series.Clear();
            chart1.Titles.Clear();
            Title tt = new Title();

            tt.Name = "ysidinisoTitle";
            tt.Text = "Max of YSIDINISO for Gear:" + e.gearCount;
            chart1.Titles.Add(tt);
            chart1.Tag     = "Gear" + e.gearCount + "_maxYSIDINISO";
            chart1.Visible = true;


            saveChartToolStripMenuItem.Enabled = true;
            gNUPlotToolStripMenuItem.Enabled   = true;
            labelsToolStripMenuItem.Enabled    = true;
            toolStripStatusLabel1.Text         = "Save Chart!";

            chart1.ChartAreas[0].AxisX.Maximum  = gearWidth;
            chart1.ChartAreas[0].AxisX.Minimum  = 0;
            chart1.ChartAreas[0].AxisX.Interval = 2;
            chart1.ChartAreas[0].AxisX.Title    = ("Width (mm)");
            // This next Line is just added becsause there is a problem with xml, reading the unit
            string newUnit = e.unit.Split('"', '"')[1];

            chart1.ChartAreas[0].AxisY.Title = ("YSIDINISO (" + newUnit + ")");

            int    pointsNum = e.theMatrix.Count;
            double xwidth    = gearWidth / (double)pointsNum;

            chart1.Series.Add("Max YSIDINISO");
            chart1.Series[0].MarkerStyle = MarkerStyle.Circle;
            chart1.Series[0].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

            ContactLineCheckBox.Items.Add("Max YSIDINISO", true);

            double startPoint = 0.5555;

            for (int i = 0; i < pointsNum; i++)
            {
                chart1.Series["Max YSIDINISO"].Points.AddXY((startPoint + i) * xwidth, e.theMatrix[i]);
            }
        }
Example #3
0
        public void momentAddtoList(IModel m, matrixModelEventArgs e)
        {
            // get the width from global geraWidth value
            double gearWidth = this.gearWidth;

            //Add List
            listBox1.Visible    = true;
            listBox1.DataSource = e.theMatrix;
            //MessageBox.Show(listBox1.Items.Count.ToString());
            //Add CheckBox
            ContactLineCheckBox.Items.Clear();
            ContactLineCheckBox.Visible = true;

            //Add Chart
            chart1.Series.Clear();
            chart1.Titles.Clear();
            Title tt = new Title();

            tt.Name = "MomentTitle";
            tt.Text = "Bending Moment for Gear:" + e.gearCount + " Mesh:" + e.eingriffCount;
            chart1.Titles.Add(tt);
            chart1.Tag     = "Gear" + e.gearCount + "_Meshing" + e.eingriffCount + "_BendingMoment";
            chart1.Visible = true;

            saveChartToolStripMenuItem.Enabled = true;
            gNUPlotToolStripMenuItem.Enabled   = true;
            labelsToolStripMenuItem.Enabled    = true;
            toolStripStatusLabel1.Text         = "Save Chart!";

            chart1.ChartAreas[0].AxisX.Maximum  = gearWidth;
            chart1.ChartAreas[0].AxisX.Minimum  = 0;
            chart1.ChartAreas[0].AxisX.Interval = 2;
            chart1.ChartAreas[0].AxisX.Title    = ("Width (mm)");

            // This next Line is just added becsause there is a problem with xml, reading the unit
            string newUnit = e.unit.Split('"', '"')[1];

            chart1.ChartAreas[0].AxisY.Title = ("Moment (" + newUnit + ")");

            // we devide points by three because we have 3 contact lines this can change
            // accroding to number of contact lines

            int    contactLines = e.ContactLines;
            int    pointsNum    = e.theMatrix.Count / contactLines;
            double xwidth       = gearWidth / (double)pointsNum;
            double startPoint   = 0.5555;


            for (int seriesNum = 0; seriesNum < contactLines; seriesNum++)
            {
                chart1.Series.Add("Moment " + (seriesNum + 1));
                chart1.Series[seriesNum].MarkerStyle = MarkerStyle.Diamond;
                chart1.Series[seriesNum].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                ContactLineCheckBox.Items.Add("Moment " + (seriesNum + 1), true);
            }
            int flag = 0;

            for (int i = 0; i < contactLines; i++)
            {
                for (int j = 0; j < pointsNum; j++)
                {
                    chart1.Series[i].Points.AddXY((startPoint + j) * xwidth, e.theMatrix[j + (pointsNum * flag)]);
                }
                flag++;
            }
        }