Esempio n. 1
0
        private void PopulateOptimumDesignTable()
        {
            DGVHelpers.RemoveAllRows(dgvOptimumDesigns);

            double dmax = double.Parse(txtDmax.Text);
            double L    = double.Parse(txtL.Text);

            IManufacturer beamCatalogue = new ShayMurtagh();
            List <IBeam>  fullCatalogue = beamCatalogue.GetFullCatalogue();

            SuitableSections          ss = new SuitableSections(L, dmax, fullCatalogue);
            List <DesignVerification> suitableDesigns = ss.GetSuitableSections();

            //Add a row in the dgv for each suitable section, keeping track of row index using
            //variable counter.
            int counter = 0;

            foreach (DesignVerification design in suitableDesigns)
            {
                dgvOptimumDesigns.Rows.Add();
                dgvOptimumDesigns.Rows[counter].Cells[0].Value = design.Beam.Type;
                dgvOptimumDesigns.Rows[counter].Cells[1].Value = design.Beam.Spacing;
                dgvOptimumDesigns.Rows[counter].Cells[2].Value = design.Beam.Lmin;
                dgvOptimumDesigns.Rows[counter].Cells[3].Value = design.Beam.Lmax;
                dgvOptimumDesigns.Rows[counter].Cells[4].Value = design.Beam.Dtot;
                dgvOptimumDesigns.Rows[counter].Cells[5].Value = design.RemainingDepth;
                counter++;
            }

            if (suitableDesigns.Count == 0)
            {
                MessageBox.Show("No suitable designs found!");
            }
        }
Esempio n. 2
0
        private void PopulateBeamTable(List <string> beamTypes, DataGridView dgv)
        {
            DGVHelpers.RemoveAllRows(dgv);

            //Design data
            double dmax = double.Parse(txtDmax.Text);
            double L    = double.Parse(txtL.Text);

            //Get a list of Y8 Beams
            var          catalogue     = new ShayMurtagh();
            List <IBeam> fullCatalogue = catalogue.GetFullCatalogue();

            int counter = 0;

            foreach (string beamType in beamTypes)
            {
                //Add a row to dgv
                dgv.Rows.Add();

                //Get a list of YX beam arrangements, sorted by spacing from smallest to largest.
                List <IBeam> beamTypeSpacings = fullCatalogue.Where(x => x.Type == beamType).ToList().OrderBy(x => x.Spacing).ToList();

                //Set the type column to the type e.g. Y8 of the first object in the ybeamTypeSpacings List.
                dgv.Rows[counter].Cells[0].Value = beamTypeSpacings[0].Type;

                //For each of the 1m/2m/3m spacings, create a design verification and output "sectionok" to the respective column.
                for (int i = 0; i < beamTypeSpacings.Count; i++)
                {
                    var verification = new DesignVerification(beamTypeSpacings[i], L, dmax);
                    if (verification.sectionOk)
                    {
                        dgv.Rows[counter].Cells[i + 1].Style.ForeColor = System.Drawing.Color.Green;
                        dgv.Rows[counter].Cells[i + 1].Value           = "✔";
                        dgv.Rows[counter].Cells[8].Value           = verification.RemainingDepth;
                        dgv.Rows[counter].Cells[8].Style.ForeColor = System.Drawing.Color.Black;
                    }
                    else
                    {
                        dgv.Rows[counter].Cells[i + 1].Style.ForeColor = System.Drawing.Color.Red;
                        dgv.Rows[counter].Cells[i + 1].Value           = "X";
                        dgv.Rows[counter].Cells[8].Value           = "N/A";
                        dgv.Rows[counter].Cells[8].Style.ForeColor = System.Drawing.Color.LightGray;
                    }
                }

                //Report Db+Dslab+Dtotal, and RemDepth if any of the spacings are acceptable
                dgv.Rows[counter].Cells[5].Value = beamTypeSpacings[0].Dbeam;
                dgv.Rows[counter].Cells[6].Value = beamTypeSpacings[0].Dslab;
                dgv.Rows[counter].Cells[7].Value = beamTypeSpacings[0].Dtot;

                counter++;

                DeleteLastRowIfBlank(dgv);
            }
        }