Пример #1
0
        private void updatadataGridView()
        {
            dataGridView_AxisParamSet.Rows.Clear();

            UpdataMotonType();
            dataGridView_HomeSet.Rows.Clear();
            List <MotionCardBase> list = MotionMgr.GetInstace().GetCardList();
            TMovePrm movePrm           = new TMovePrm();
            THomePrm homePrm           = new THomePrm();

            foreach (var temp in list)
            {
                for (int index = temp.GetMinAxisNo(); index <= temp.GetMaxAxisNo(); index++)
                {
                    movePrm = MotionMgr.GetInstace().GetAxisMovePrm(index);
                    dataGridView_AxisParamSet.Rows.Add(index.ToString(),
                                                       MotionMgr.GetInstace().GetAxisName(index),
                                                       MotionMgr.GetInstace().GetMotorType(index).ToString(),
                                                       movePrm.VelH.ToString(), movePrm.AccH.ToString(), movePrm.DccH.ToString(),
                                                       movePrm.VelM.ToString(), movePrm.AccM.ToString(), movePrm.DccM.ToString(),
                                                       movePrm.VelL.ToString(), movePrm.AccL.ToString(), movePrm.DccL.ToString(),
                                                       movePrm.PlusePerRote.ToString(), movePrm.AxisLeadRange.ToString());

                    homePrm = MotionMgr.GetInstace().GetAxisHomePrm(index);
                    dataGridView_HomeSet.Rows.Add(
                        index.ToString(),
                        MotionMgr.GetInstace().GetAxisName(index),
                        homePrm._nHomeMode.ToString(),
                        homePrm._bHomeDir.ToString(),
                        homePrm.VelH.ToString(), homePrm.AccH.ToString(), homePrm.DccH.ToString(),
                        homePrm.VelL.ToString(), homePrm.AccL.ToString(), homePrm.DccL.ToString(),
                        homePrm._iSeachOffstPluse.ToString());
                }
            }
        }
Пример #2
0
        private void SaveMotorParam_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(ParamSetMgr.GetInstance().CurrentWorkDir + ("\\") + ParamSetMgr.GetInstance().CurrentProductFile) ||
                ParamSetMgr.GetInstance().CurrentProductFile == null || ParamSetMgr.GetInstance().CurrentProductFile == "")
            {
                MessageBox.Show("当前产品文件夹不存在,请创建载入或者创建当前产品", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            TMovePrm prm       = new TMovePrm();
            THomePrm homePrm   = new THomePrm();
            int      indexCell = 0;

            for (int index = 0; index < dataGridView_AxisParamSet.RowCount; index++)
            {
                int nAxisNo = Convert.ToInt32(dataGridView_AxisParamSet.Rows[index].Cells[0].Value);

                prm.VelH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[3].Value);
                prm.AccH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[4].Value);
                prm.DccH = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[5].Value);

                prm.VelM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[6].Value);
                prm.AccM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[7].Value);
                prm.DccM = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[8].Value);

                prm.VelL          = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[9].Value);
                prm.AccL          = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[10].Value);
                prm.DccL          = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[11].Value);
                prm.PlusePerRote  = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[12].Value);
                prm.AxisLeadRange = Convert.ToDouble(dataGridView_AxisParamSet.Rows[index].Cells[13].Value);
                MotionMgr.GetInstace().SetAxisMoveParam(nAxisNo, prm);
                MotionMgr.GetInstace().SetAxisName(nAxisNo, dataGridView_AxisParamSet.Rows[index].Cells[1].Value == null ? "NoNamedAxis" : dataGridView_AxisParamSet.Rows[index].Cells[1].Value.ToString());
                string strAxisType = dataGridView_AxisParamSet.Rows[index].Cells[2].Value == null?MotorType.SEVER.ToString() : dataGridView_AxisParamSet.Rows[index].Cells[2].Value.ToString();

                MotionMgr.GetInstace().SetMotorType(nAxisNo, (MotorType)Enum.Parse(typeof(MotorType), strAxisType));

                indexCell                 = 2;
                homePrm._nHomeMode        = Convert.ToInt32(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm._bHomeDir         = Convert.ToBoolean(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.VelH              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.AccH              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.DccH              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.VelL              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.AccL              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm.DccL              = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                homePrm._iSeachOffstPluse = Convert.ToDouble(dataGridView_HomeSet.Rows[index].Cells[indexCell++].Value);
                MotionMgr.GetInstace().SetAxisHomeParam(nAxisNo, homePrm);
            }
            ConfigToolMgr.GetInstance().SaveMoveParam();
            ConfigToolMgr.GetInstance().SaveHomeParam();
        }