Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)//Рассчитать
        {
            lb_output.Items.Clear();
            Cutting cutting = new Cutting(Convert.ToDouble(tb_length.Text), dl);

            cutting.create_ffd_cutting_map();
            label2.Text = cutting.cp_list.Count.ToString();
            cutting.calc_botton_border();
            if (cutting.cp_list.Count > cutting.bottom_border)
            {
                int i = 0;
                while (true)
                {
                    cutting.S_task();

                    ++i;
                    if (cutting.cp_list.Count == cutting.bottom_border || i > 20000)
                    {
                        break;
                    }
                }

                label3.Text = cutting.cp_list.Count.ToString();
            }
            //output(cutting);
            outputDGV(cutting);
            int niz = Convert.ToInt32(tb_length.Text) * Convert.ToInt32(label2.Text);

            label3.Text = Convert.ToString(Math.Round((verh / niz), 4));
        }
Ejemplo n.º 2
0
        public void output(Cutting c)
        {
            int    n = c.cp_list.Count;
            string s = "";

            for (int j = 0; j < c.dl.list.Count; ++j)
            {
                s += c.dl.list[j].l.ToString();
                s += "\t";
            }
            s += "H";
            lb_output.Items.Add(s);
            s = "";
            for (int j = 0; j < c.dl.list.Count; ++j)
            {
                s += "-";
                s += "\t";
            }
            s += "-";
            lb_output.Items.Add(s);
            for (int i = 0; i < n; i++)
            {
                s = "";
                for (int j = 0; j < c.cp_list[i].map.Length; ++j)
                {
                    s += c.cp_list[i].map[j].ToString();
                    s += "\t";
                }
                s += c.cp_list[i].h;
                lb_output.Items.Add(s);
            }
        }
Ejemplo n.º 3
0
        public void outputDGV(Cutting c)
        {
            dgvOutput.Rows.Clear();
            dgvOutput.Columns.Clear();
            int n = c.cp_list.Count;

            for (int j = 0; j < c.dl.list.Count; ++j)
            {
                dgvOutput.Columns.Add(1.ToString(), c.dl.list[j].l.ToString());
            }
            dgvOutput.Columns.Add(1.ToString(), "Остаток");
            for (int i = 0; i < n; i++)
            {
                dgvOutput.Rows.Add();
                for (int j = 0; j < c.cp_list[i].map.Length; ++j)
                {
                    dgvOutput.Rows[i].Cells[j].Value = c.cp_list[i].map[j];
                }
                dgvOutput.Rows[i].Cells[c.cp_list[i].map.Length].Value = c.cp_list[i].h;
            }
        }