Пример #1
0
        /************************************************************************/

        public DemoForm()
        {
            InitializeComponent();

            //设置评估因子 1 => 10
            m_nestParam.SetEvalFactor(10);
        }
Пример #2
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            // verify input.
            try
            {
                Convert.ToDouble(tolTextBox.Text);
                Convert.ToDouble(rotTextBox.Text);
                Convert.ToInt32(evalTextBox.Text);
                Convert.ToInt32(timeTextBox.Text);
            }
            catch (FormatException exception)
            {
                MessageBox.Show("Incorrect input: " + exception.Message, "NestProfessor DEMO");
                return;
            }

            // updating the nest param.
            m_nestParam.SetConTol(Convert.ToDouble(tolTextBox.Text));
            m_nestParam.SetPartRotStep(Convert.ToDouble(rotTextBox.Text));
            m_nestParam.SetEvalFactor(Convert.ToInt32(evalTextBox.Text));
            m_iNestingTime = Convert.ToInt32(timeTextBox.Text);

            ConfigHighEntity cfg = new ConfigHighEntity();

            cfg.ConnectTolerance = Convert.ToDouble(tolTextBox.Text);
            cfg.PartRotateStep   = Convert.ToDouble(rotTextBox.Text);
            cfg.EvaluationFactor = Convert.ToInt32(evalTextBox.Text);
            cfg.NestTime         = Convert.ToInt32(timeTextBox.Text);

            if (partInPartCheckBox.Checked)
            {
                m_nestParam.IsPartInPart(true);
                cfg.PartInPart = true;
            }
            else
            {
                m_nestParam.IsPartInPart(false);
                cfg.PartInPart = false;
            }
            if (optimizationCheckBox.Checked)
            {
                m_nestParam.EnableOptimization(true);
                cfg.Optimization = true;
            }
            else
            {
                m_nestParam.EnableOptimization(false);
                cfg.Optimization = false;
            }

            SaveConfig(cfg);
            this.DialogResult = DialogResult.OK;
        }
Пример #3
0
        static private NestParamEx LoadNestParam_V1(XmlNode paramNode, ref int iNestingTime)
        {
            NestParamEx nestParam = new NestParamEx();

            // MatLeftMargin.
            nestParam.SetMatLeftMargin(Convert.ToDouble(paramNode.SelectSingleNode("MatLeftMargin").InnerText));

            // MatRightMargin.
            nestParam.SetMatRightMargin(Convert.ToDouble(paramNode.SelectSingleNode("MatRightMargin").InnerText));

            // MatTopMargin.
            nestParam.SetMatTopMargin(Convert.ToDouble(paramNode.SelectSingleNode("MatTopMargin").InnerText));

            // MatBottomMargin.
            nestParam.SetMatBottomMargin(Convert.ToDouble(paramNode.SelectSingleNode("MatBottomMargin").InnerText));

            // MatBottomMargin.
            nestParam.SetMatMargin(Convert.ToDouble(paramNode.SelectSingleNode("MatMargin").InnerText));

            // PartDis.
            nestParam.SetPartDis(Convert.ToDouble(paramNode.SelectSingleNode("PartDis").InnerText));

            // ConTol.
            nestParam.SetConTol(Convert.ToDouble(paramNode.SelectSingleNode("ConTol").InnerText));

            // PartRotStep.
            nestParam.SetPartRotStep(Convert.ToDouble(paramNode.SelectSingleNode("PartRotStep").InnerText));

            // StartCorner.
            nestParam.SetStartCorner((RECT_CORNER_EX)Convert.ToInt32(paramNode.SelectSingleNode("StartCorner").InnerText));

            // NestDir.
            nestParam.SetNestDir((NEST_DIRECTION_EX)Convert.ToInt32(paramNode.SelectSingleNode("NestDir").InnerText));

            // PartInPart.
            if (Convert.ToInt32(paramNode.SelectSingleNode("PartInPart").InnerText) == 1)
            {
                nestParam.IsPartInPart(true);
            }
            else if (Convert.ToInt32(paramNode.SelectSingleNode("PartInPart").InnerText) == 0)
            {
                nestParam.IsPartInPart(false);
            }

            // EvalFactor.
            nestParam.SetEvalFactor(Convert.ToInt32(paramNode.SelectSingleNode("EvalFactor").InnerText));

            // nesting time.
            iNestingTime = Convert.ToInt32(paramNode.SelectSingleNode("NestingTime").InnerText);

            return(nestParam);
        }