Exemple #1
0
        /// <summary>
        /// 轴运动并等待停止并判断位置
        /// </summary>
        /// <param name="stationName"></param>
        /// <param name="axisName"></param>
        /// <param name="pointName"></param>
        /// <param name="asxisIndex"></param>
        /// <returns></returns>
        public static short GT_AxisAbsoluteMoveAndWaitStopVrf(AxisConfig axisC, double pos, double speed)
        {
            if (GT_AbsoluteMove(axisC, pos, speed) != 0)
            {
                Global.WorkVar.tag_StopState = 2;
                if (MessageBoxLog.Show("轴名:\r\n" + axisC.AxisName + "\t移动异常,请检查伺服驱动!") == DialogResult.OK)
                {
                }
                return(shrFail);
            }
            if (WaitAxisStop(axisC) != 0)
            {
                return(shrFail);
            }
            double pos_loadY = 0;
            short  ret       = SR_GetPrfPos((int)axisC.tag_MotionCardManufacturer, axisC.CardNum, axisC.AxisNum, ref pos_loadY);

            if (Global.WorkVar.tag_SuspendState == 1 || (Global.WorkVar.bSuspendState_L && axisC.AxisName == "左Y轴") || (Global.WorkVar.bSuspendState_R && axisC.AxisName == "右Y轴"))
            {
            }
            else if (pos_loadY / axisC.Eucf < pos - 1 || pos_loadY / axisC.Eucf > pos + 1)
            {
                return(shrFail);
            }

            return(shrSuccess);
        }
Exemple #2
0
        /// <summary>
        /// 单轴绝对运动
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axis"></param>
        /// <param name="postion">目标点位</param>
        /// <param name="speed">速度</param>
        /// <returns></returns>
        public short _SR_AbsoluteMove(AxisConfig axisC, PointModule point)
        {
            short shrResult = 0;

            if (point.dblPonitSpeed == 0.0)
            {
                MessageBoxLog.Show(axisC.AxisName + "速度设置位0,急停请设置");
                return(-1);
            }

            if (tag_CardCount < 1 || axisC.CardNum >= tag_CardCount)
            {
                return(-1);
            }
            LTDMC.dmc_set_s_profile((ushort)tag_cardids[axisC.CardNum], (ushort)axisC.AxisNum, 0, point.db_S_Time);                                                                          //设置S段时间(0-0.05s)
            LTDMC.dmc_set_profile((ushort)tag_cardids[axisC.CardNum], (ushort)axisC.AxisNum, axisC.StartSpeed, point.dblPonitSpeed, point.db_StopSpeed, point.dblAccTime, point.dblDecTime); //设置起始速度、运行速度、停止速度、加速时间、减速时间
            shrResult = LTDMC.dmc_pmove((ushort)tag_cardids[axisC.CardNum], (ushort)axisC.AxisNum, (int)(point.dblPonitValue * axisC.Eucf), 1);                                              //定长运动


            if (shrResult != shrGtsSuccess)
            {
                CommandResult("_SR_RelativeMove", shrResult);
                return(shrFail);
            }
            return(shrResult);
        }
Exemple #3
0
        /// <summary>
        /// 直线查补运动
        /// </summary>
        /// <param name="card"></param>
        /// <param name="postion">目标点位</param>
        /// <param name="crd">坐标系</param>
        /// <param name="posi_mode">运动模式,1:相对坐标模式,0:绝对坐标模式</param>
        public static short SR_LineMulticoorMove(AxisConfig[] axisC, PointModule[] point, short crd, short posi_mode)
        {
            short           shrResult = 0;
            NewCtrlCardBase Base_     = tag_NewCtrlCardBase[(int)axisC[0].tag_MotionCardManufacturer];

            if (Base_ == null || Base_.SR_LineMulticoorMove == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)axisC[0].tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }

            if (Base_.SR_LineMulticoorMove != null)
            {
                if (posi_mode == 0)
                {
                    posi_mode = 1;
                }
                else
                {
                    posi_mode = 0;
                }
                shrResult = Base_.SR_LineMulticoorMove(axisC, point, crd, posi_mode);
            }
            if (shrResult != shrGtsSuccess)
            {
                return(shrFail);
            }
            return(shrResult);
        }
Exemple #4
0
        private void Delete_Click(object sender, EventArgs e)
        {
            PointAggregate pvale = (PointAggregate)sender;
            int            j     = 0;

            if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
            {
                MessageBoxLog.Show("无权限");
                return;
            }
            if (MessageBoxLog.Show("是否删除", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            tag_StationModule.intUsePointCount = tag_StationModule.arrPoint.Count;
            for (int i = 0; i < tag_StationModule.intUsePointCount; i++)
            {
                if (pvale == tag_StationModule.arrPoint[i])
                {
                    tag_StationModule.arrPoint.Remove(pvale);
                    tag_StationModule.intUsePointCount--;
                    break;
                }
            }
            Show();
        }
Exemple #5
0
        private void 首尾嵌代码中间共用ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
            {
                MessageBoxLog.Show("无权限");
                return;
            }
            if (Global.WorkVar.g_projectDir == "" || !DirIsSubDir(Global.WorkVar.g_projectDir, "Work"))
            {
                MessageBoxLog.Show("请设置工程路径");
                return;
            }

            if (DialogResult.OK == saveFileDialog_Code.ShowDialog())
            {
                string         filename = saveFileDialog_Code.FileName;
                StationPattern sp       = new StationPattern(trVStation.SelectedNode.Text);
                sp.CodeCreateN3(filename, 1, GetPortCount(), GetNetCount());

                string filiNename = Global.WorkVar.g_projectDir + "\\work\\workObjectManage.cs";
                sp.InsertToWorkObjectManage(filiNename, 1, GetPortCount(), GetNetCount());


                filiNename = Global.WorkVar.g_projectDir + "\\Project.csproj";
                if (sp.InsertTocsproj(filiNename, 1, GetPortCount(), GetNetCount()) != 0)
                {
                    filiNename = Global.WorkVar.g_projectDir + "\\Project.csproj";
                    sp.InsertTocsproj(filiNename, 1, GetPortCount(), GetNetCount());
                }
            }
        }
Exemple #6
0
        private void button_RemoveOutputIo_Click(object sender, EventArgs e)
        {
            Control[] finChild = new Control[intOutputControlCount];
            int       i        = 0;

            foreach (Control con in panel_OutputIo.Controls)
            {
                if (con is IOSetPanelControl)
                {
                    finChild[i] = con;
                    i++;
                }
            }

            if (i > 0)
            {
                //_StationM.arrOutputIo.RemoveAt(i-1);
                panel_OutputIo.Controls.Remove(finChild[i - 1]);
                intOutputControlCount--;
                if (intOutputControlCount < 1)
                {
                    panel_OutputIo.Controls.Clear();
                }
            }
            else
            {
                MessageBoxLog.Show("输出IO已清空!");
            }
        }
Exemple #7
0
        /// <summary>
        /// 等待轴停止
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axis"></param>
        /// <returns></returns>
        public static short WaitAxisStop(AxisConfig axisC)
        {
            int   intAxisStatus = 0;
            short shrResult     = 0;

            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)axisC.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)axisC.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            short ret = 0;

            do
            {
                //程序是否正常运行
                if (IsExit())
                {
                    Base_.SR_AxisEmgStop(axisC.CardNum, axisC.AxisNum);
                    return(shrFail);
                }
                //读轴状态
                shrResult = Base_.SR_GetAxisStatus(axisC.CardNum, axisC.AxisNum, out intAxisStatus);
                if (shrResult != shrGtsSuccess)
                {
                    return(shrFail);
                }
                Thread.Sleep(5);
            } while (intAxisStatus != 0);  //运动中
            return(shrSuccess);
        }
Exemple #8
0
        /// <summary>
        /// 单轴相对运动
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axis"></param>
        /// <param name="postion">目标点位</param>
        /// <param name="speed">速度</param>
        /// <returns></returns>
        public short _SR_RelativeMove(AxisConfig axisC, PointModule point)
        {
            short shrResult = 0;

            if (point.dblPonitSpeed == 0.0)
            {
                MessageBoxLog.Show(axisC.AxisName + "速度设置位0,急停请设置");
                return(-1);
            }
            if (tag_CardCount < 1 || axisC.CardNum >= tag_CardCount)
            {
                return(-1);
            }

            Dmc1000.d1000_set_s_profile(axisC.CardNum * tag_AxisCount + axisC.AxisNum, point.db_S_Time);            //设置S段时间(0-0.05s)
            // Dmc1000.d1000_set_profile((ushort)axisC.CardNum, (ushort)axisC.AxisNum, dblPonitSpeed.StartSpeed, point.dblPonitSpeed, point.db_StopSpeed, point.dblAccTime, point.dblDecTime);//设置起始速度、运行速度、停止速度、加速时间、减速时间
            shrResult = (short)Dmc1000.d1000_start_t_move(axisC.CardNum * tag_AxisCount + axisC.AxisNum,
                                                          (int)(point.dblPonitValue * axisC.Eucf), (int)point.dblPonitStartSpeed, (int)point.dblPonitSpeed, point.dblAcc);//定长运动


            if (shrResult != shrGtsSuccess)
            {
                CommandResult("_SR_RelativeMove", shrResult);
                return(shrFail);
            }
            return(shrResult);
        }
Exemple #9
0
 /// <summary>
 /// IO dao ru
 /// </summary>
 /// <param name="strIo"></param>
 public static void OutIoCardImport(string strIo)
 {
     try
     {
         string[]      str2       = System.Text.RegularExpressions.Regex.Split(strIo, "\r\n");
         string[]      title      = System.Text.RegularExpressions.Regex.Split(str2[0], ",");
         StationModule stationOld = FindStation(title[0]);
         if (stationOld == null && title[0] != "")
         {
             stationOld = new StationModule();
             _Config.arrWorkStation.Add(stationOld);
             _Config.arrWorkStation[_Config.arrWorkStation.Count - 1].strStationName = title[0];
             _Config.intUseStationCount++;
         }
         for (int j = 1; j < str2.Length; j++)
         {
             string[] IO = System.Text.RegularExpressions.Regex.Split(str2[j], ",");
             if (FindOutputIo(IO[0]) == null && IO[0] != "")
             {
                 IOParameter newIo = new IOParameter(IO[0]);
                 newIo.CardNum = short.Parse(IO[1]);
                 newIo.IOBit   = short.Parse(IO[2]);
                 stationOld.arrOutputIo.Add(newIo);
                 stationOld.intUseOutputIoCount++;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxLog.Show(ex.Message);
     }
 }
Exemple #10
0
 /// <summary>
 /// IO dao ru
 /// </summary>
 /// <param name="strIo"></param>
 public static void InIoImport(string strIo)
 {
     try
     {
         string[] str2  = System.Text.RegularExpressions.Regex.Split(strIo, "\r\n");
         string[] title = System.Text.RegularExpressions.Regex.Split(str2[0], ",");
         for (int i = 0; i < title.Length; i++)
         {
             StationModule stationOld = FindStation(title[i]);
             for (int j = 1; j < str2.Length; j++)
             {
                 string[] IO = System.Text.RegularExpressions.Regex.Split(str2[j], ",");
                 if (stationOld != null)
                 {
                     if (i < IO.Length && FindInputIo(IO[i]) == null && IO[i] != "")
                     {
                         stationOld.arrInputIo.Add(new IOParameter(IO[i]));
                         stationOld.intUseInputIoCount++;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxLog.Show(ex.Message);
     }
 }
Exemple #11
0
        public static void StepImport(string strIo)
        {
            try
            {
                string[] str2  = System.Text.RegularExpressions.Regex.Split(strIo, "\r\n");
                string[] title = System.Text.RegularExpressions.Regex.Split(str2[0], ",");

                for (int i = 0; i < title.Length; i++)
                {
                    StationModule stationOld = FindStation(title[i]);
                    if (stationOld == null && title[i] != "")
                    {
                        _Config.arrWorkStation.Add(new StationModule());
                        _Config.arrWorkStation[_Config.arrWorkStation.Count - 1].strStationName = title[i];
                        _Config.intUseStationCount++;
                    }
                    for (int n = 1; n < str2.Length; n++)
                    {
                        string[] IO = System.Text.RegularExpressions.Regex.Split(str2[n], ",");
                        if (stationOld != null)
                        {
                            if (i < IO.Length && FindPoint(stationOld, IO[i]) == null && IO[i] != "")
                            {
                                stationOld.arrPoint.Add(new PointAggregate(stationOld.strStationName, IO[i]));
                                stationOld.intUsePointCount++;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxLog.Show(ex.Message);
            }
        }
Exemple #12
0
 private void FrmWait_Load(object sender, EventArgs e)
 {
     ThreadPool.QueueUserWorkItem(
         delegate
     {
         try
         {
             short ret = tag_delegate_Exe(tag_o);
             this.Invoke(
                 (MethodInvoker) delegate
             {
                 if (tag_delegate_End != null)
                 {
                     tag_delegate_End(tag_o);
                 }
                 else
                 {
                     if (ret != 0)
                     {
                         MessageBoxLog.Show("操作失败");
                     }
                 }
                 this.Close();
             }
                 );
         }
         catch (System.Exception ex)
         {
             LogOutControl.OutLog(ex.Message, 0);
         }
     }
         );
 }
Exemple #13
0
        public static bool IsMove(int type)
        {
            if (Global.WorkVar.tag_ResetState == 1)
            {
                MessageBoxLog.Show("复位中,请等待");
                return(false);
            }
            if (Global.WorkVar.tag_ResetState == 0 && (!Global.WorkVar.tag_isAxisMove))
            {
                MessageBoxLog.Show("没有复位,请复位");
                return(false);
            }


            if (Global.WorkVar.tag_StopState == 1 && (!Global.WorkVar.tag_isAxisMove))
            {
                MessageBoxLog.Show("急停中");
                return(false);
            }
            if (Global.WorkVar.tag_workState == 1)
            {
                MessageBoxLog.Show("工作中,请调为自动状态");
                return(false);
            }
            return(true);
        }
Exemple #14
0
        private void button_RemoveAxis_Click(object sender, EventArgs e)
        {
            Control[] finChild = new Control[CardManager.iMaxAxisCount];
            int       i        = 0;

            foreach (Control con in panel_Axis.Controls)
            {
                if (con is AxisSetConfigControl)
                {
                    finChild[i] = con;
                    i++;
                }
            }
            if (i > 0)
            {
                panel_Axis.Controls.Remove(finChild[i - 1]);
                intAxisControlCount--;
                if (intAxisControlCount < 1)
                {
                    panel_Axis.Controls.Clear();
                }
            }
            else
            {
                MessageBoxLog.Show("轴已清空!");
            }

            RefreshPoint();
        }
Exemple #15
0
        public static short set_io_mode(AxisConfig axisC)
        {
            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)axisC.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)axisC.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            short ret = 0;

            if (axisC == null)
            {
                return(shrFail);
            }

            short shrResult = Base_.SR_set_io_mode(axisC.CardNum, 0, 0);

            if (shrResult != shrSuccess)
            {
                return(shrFail);
            }

            return(shrResult);
        }
Exemple #16
0
        private void button2_Click(object sender, EventArgs e)
        {
            Global.WorkVar.tag_IsExit          = 0;
            Global.WorkVar.tag_isFangDaiJieChu = false;
            if (Global.WorkVar.tag_ResetState != 2)
            {
                MessageBoxLog.Show("请先复位!");
                return;
            }
            if (tag_StationModule == worker._Config.tag_safeStationModule)
            {
                MessageBoxLog.Show("此工位为安全配置工位,不能运行");
                return;
            }
            if (tag_StationModule == null)
            {
                MessageBoxLog.Show("请选择工位");
                return;
            }
            tag_stationName = tag_StationModule.strStationName;

            tag_PointAggregate = GetIndexPointAggregate();

            if (!checkBox3_statioOpen.Checked)
            {
                WaitUI wait = new WaitUI(pointRun, pointRunEnd, tag_PointAggregate);
                wait.ShowDialog();
            }
            else
            {
                WaitUI wait = new WaitUI(pointRun2, pointRunEnd, tag_PointAggregate);
                wait.ShowDialog();
            }
        }
Exemple #17
0
        //选择回零轴
        private void button_home_Click(object sender, EventArgs e)
        {
            Global.WorkVar.tag_isFangDaiJieChu = false;
            if (!Work.IsMove(1))
            {
                return;
            }
            if (CBChoiceAxis.Text == "")
            {
                MessageBoxLog.Show("选择轴位不能为空");
                return;
            }
            AxisConfig acg;

            acg = StationManage.FindAxis(CBStnChioce.Text, CBChoiceAxis.Text);
            if (acg == null)
            {
                MessageBoxLog.Show("查找轴失败");
                return;
            }

            GoHomeParameterUI gohome = new GoHomeParameterUI(acg);

            gohome.ShowDialog();
        }
Exemple #18
0
        /// <summary>
        /// 卡初始化
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axisCount"></param>
        /// <param name="configFileName"></param>
        /// <returns></returns>
        public short _SR_InitCard()
        {
            ushort _num        = 0;
            short  returnValue = 0;

            if (tag_isInit == 0)
            {
                returnValue = (short)Dmc1000.d1000_board_init(); //获取卡数量
                tag_isInit  = 1;
                if (returnValue <= 0 || returnValue > 8)
                {
                    string str = "DMC100B控制卡初始化失败!";
                    if (returnValue == 0)
                    {
                        str = str + "\r\n没有安装雷晒卡";
                    }
                    if (returnValue == -1)
                    {
                        str = str + "没有安装端口驱动程序!";
                    }
                    if (returnValue == -2)
                    {
                        str = str + "PCI桥故障!";
                    }

                    MessageBoxLog.Show(str);
                    return(-1);
                }
            }

            return(returnValue);
        }
Exemple #19
0
        //手动调试界面加载
        private void FrmDebug_Load(object sender, EventArgs e)
        {
            TabPagManual_Enter(sender, e);
            CBSpeedLevel.Text = "常速";
            StnChioceCB_Show(sender, e);

            if (StationManage.OpenSevroAllAxis() != 0)
            {
                MessageBoxLog.Show("使能失败");
                return;
            }
            if (worker != null && worker._Config != null)
            {
                checkBox3_safeLight.Checked = worker._Config.tag_PrivateSave.tag_safeLightOffOn;
                checkBox5.Checked           = worker._Config.tag_PrivateSave.tag_safeGateOffOn;
                if (worker._Config.tag_PrivateSave.tag_SuspendType == 0)
                {
                    checkBox_sup.Checked = true;
                }
                else
                {
                    checkBox_sup.Checked = false;
                }
            }
            TB_LeftStationLog.Text  = worker._Config.tag_LeftStationLogIndex.ToString();
            TB_RightStationLog.Text = worker._Config.tag_RightStationLogIndex.ToString();
        }
Exemple #20
0
        /// <summary>
        /// 卡初始化
        /// </summary>
        /// <param name="card"></param>
        /// <param name="axisCount"></param>
        /// <param name="configFileName"></param>
        /// <returns></returns>
        public short _SR_InitCard()
        {
            short returnValue;

            returnValue = (short)adt8940a1m.adt8940a1_initial();
            if (returnValue <= 0)
            {
                string str = "8940控制卡初始化失败!";


                if (returnValue == 0)
                {
                    str = str + "\r\n没有安装ADT卡";
                }
                if (returnValue == -1)
                {
                    str = str + "没有安装端口驱动程序!";
                }
                if (returnValue == -2)
                {
                    str = str + "PCI桥故障!";
                }

                MessageBoxLog.Show(str);
                return(-1);
            }

            return(returnValue);
        }
Exemple #21
0
        /// <summary>
        /// IO输出
        /// </summary>
        /// <param name="io">IO类对象</param>
        /// <param name="ioValue">输出状态</param>
        /// <returns></returns>
        public static short GetOutputIoBit(IOParameter io, short ioValue)
        {
            short shrResult = 0;
            bool  bioValue  = false;

            if (io == null)
            {
                return(shrFail);
            }
            NewCtrlCardBase Base_ = tag_NewCtrlCardBase[(int)io.tag_MotionCardManufacturer];

            if (Base_ == null)
            {
                MessageBoxLog.Show(NewCtrlCardBase.GetManufacturerName((int)io.tag_MotionCardManufacturer) + "控制卡初始化失败!");
                return(shrFail);
            }
            shrResult = Base_.SR_GetOutputBit(io.CardNum, io.IOBit, out bioValue);
            if (shrResult != shrSuccess)
            {
                shrResult = -1;
                return(shrResult);
            }
            if (bioValue)
            {
                shrResult = 1;
            }
            else
            {
                shrResult = 0;
            }
            return(shrResult);
        }
Exemple #22
0
        /// <summary>
        /// 获取单点 输入信号
        /// </summary>
        /// <param name="card"></param>
        /// <param name="ioBit">0开始, 0-15</param>
        /// <param name="bStatus"></param>
        /// <returns></returns>
        public short _SR_GetInputBit(short card, short ioBit, out bool bStatus)
        {
            short  shrResult   = 0;
            int    intValue    = 0;
            ushort ushortValue = 0;
            int    iioBit      = 0;

            bStatus = false;

            shrResult = (short)adtIO3224.adtIO3224_read_in(card, out iioBit);
            int s = iioBit & (1 << ioBit);

            if (shrResult != 0)
            {
                MessageBoxLog.Show("IO3224控制卡初始化失败!");
                CommandResult("GT_GetExtIoValueGts", shrResult);
                return(shrResult);
            }
            if (s > 0)
            {
                bStatus = false;
            }
            else
            {
                bStatus = true;
            }
            return(shrResult);
        }
Exemple #23
0
        private void MenuItem_Save_Click(object sender, EventArgs e)
        {
            if (Global.CConst.UserLevel == Global.CConst.USER_SUPERADMIN || Global.CConst.UserLevel == Global.CConst.USER_ADMINISTOR)
            {
            }
            else
            {
                MessageBoxLog.Show("无权限");
                return;
            }

            if (MessageBoxLog.Show("是否保存", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }
            foreach (PointValueControl pv in tag_PointValueControlList)
            {
                pv.button_save_Click();
            }
            if (!StationManage._Config.Save())
            {
                MessageBoxLog.Show("保存参数异常");
            }
            else
            {
                MessageBoxLog.Show("保存成功");
            }
        }
Exemple #24
0
 //打开使能
 private void OpenSevroBT_Click(object sender, EventArgs e)
 {
     if (CBChoiceAxis.Text == "")
     {
         MessageBoxLog.Show("选择轴位不能为空");
         return;
     }
 }
Exemple #25
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (MessageBoxLog.Show("是否Save", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }
            try
            {
                tag_AxisConfig.intFirstFindOriginDis  = double.Parse(textBox1.Text);
                tag_AxisConfig.intSecondFindOriginDis = double.Parse(textBox2.Text);
                tag_AxisConfig.intThreeFindOriginDis  = double.Parse(textBox3.Text);



                if (checkBox_IoLimtPNHighEnable.Checked == false)
                {
                    tag_AxisConfig.tag_IoLimtPNHighEnable = 0;
                }
                else
                {
                    tag_AxisConfig.tag_IoLimtPNHighEnable = 1;
                }

                if (checkBox_Alarm.Checked == false)
                {
                    tag_AxisConfig.tag_IoAlarmNHighEnable = 0;
                }
                else
                {
                    tag_AxisConfig.tag_IoAlarmNHighEnable = 1;
                }



                if (checkBox_IoLimtNEnable.Checked == false)
                {
                    tag_AxisConfig.tag_IoLimtNEnable = 1;
                }
                else
                {
                    tag_AxisConfig.tag_IoLimtNEnable = 0;
                }
                if (checkBox_IoLimtPEnable.Checked == false)
                {
                    tag_AxisConfig.tag_IoLimtPEnable = 1;
                }
                else
                {
                    tag_AxisConfig.tag_IoLimtPEnable = 0;
                }

                tag_AxisConfig.tag_CC_value  = comboBox_CC_value.SelectedIndex;
                tag_AxisConfig.tag_CC_logic  = comboBox_CC_logic.SelectedIndex;
                tag_AxisConfig.tag_dir_logic = comboBox_dir_logic.SelectedIndex;
            }
            catch
            { }
        }
Exemple #26
0
		private void MenuItem_Save_Click(object sender, EventArgs e)
		{

			if (MessageBoxLog.Show("确定要保存?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
			{
				return;
			}
			tag_Work._Config.Save();
		}
Exemple #27
0
        /// <summary>
        /// 卡初始化
        /// </summary>
        /// <param name="card"></param>4
        /// <param name="axisCount"></param>
        /// <param name="configFileName"></param>
        /// <returns></returns>
        public short _SR_InitCard()
        {
            ushort _num = 0;

            if (tag_isInit == 0)
            {
                short returnValue = LTDMC.dmc_board_init();                //获取卡数量
                tag_isInit    = 1;
                tag_CardCount = returnValue;
                if (returnValue <= 0 || returnValue > 8)
                {
                    string str = "DMC3" + tag_AxisCount + "00控制卡初始化失败!";
                    if (returnValue == 0)
                    {
                        str = str + "\r\n没有安装雷赛卡";
                    }
                    if (returnValue == -1)
                    {
                        str = str + "没有安装端口驱动程序!";
                    }
                    if (returnValue == -2)
                    {
                        str = str + "PCI桥故障!";
                    }

                    MessageBoxLog.Show(str);
                    return(-1);
                }
            }
            short res = LTDMC.dmc_get_CardInfList(ref _num, tag_cardtypes, tag_cardids);

            if (res != 0)
            {
                MessageBoxLog.Show("获取卡信息失败!");
            }
            short i        = 0;
            short retCount = 0;

            while (i < _num)
            {
                short j         = 0;
                uint  TotalAxis = 0;
                LTDMC.dmc_get_total_axes(tag_cardids[i], ref TotalAxis);
                if (TotalAxis == tag_AxisCount)
                {
                    retCount++;
                }
                while (j < TotalAxis)
                {
                    _SR_SetEncPos(i, j, 0);

                    j++;
                }
                i++;
            }
            return(retCount);
        }
Exemple #28
0
        private void button_AddPoint_Click(object sender, EventArgs e)
        {
            int  intVerticalScroll = 0;
            bool blnScroll         = false;

            /*  if (intAxisControlCount < 1)
             * {
             *        MessageBoxLog.Show("轴数量为空,请先配置轴");
             *        return;
             * }*/
            if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
            {
                MessageBoxLog.Show("无权限");
                return;
            }
            if (intPointControlCount >= StationManage.intStationPointCount)
            {
                MessageBoxLog.Show("工位可配点位数已达最大");
                return;
            }

            if (intPointControlCount < 1)
            {
                PointLabel = new PointDetailedSetUILabelControl(_StationM, intAxisControlCount);
                panel_Point.Controls.Add((Control)PointLabel);
                PointLabel.Location = new Point(85, 14);
            }
            if (_StationM.arrPoint.Count < intPointControlCount)
            {
                MessageBoxLog.Show("点位数据计数异常");
                return;
            }
            else if (_StationM.arrPoint.Count <= intPointControlCount)
            {
                _StationM.arrPoint.Add(new PointAggregate(_StationM.strStationName));
            }
            if (panel_Point.VerticalScroll.Value > 0)
            {
                intVerticalScroll = panel_Point.VerticalScroll.Value;
                panel_Point.VerticalScroll.Value = panel_Point.VerticalScroll.Minimum;
                blnScroll = true;
            }
            PointSetControl setC = new PointSetControl();

            panel_Point.Controls.Add((Control)setC);
            setC.Location       = new Point(17, 53 + intPointControlCount * setC.Height + intPointControlCount * 5);
            setC.intAxisCount   = intAxisControlCount;
            setC.PointAggregate = _StationM.arrPoint[intPointControlCount];

            intPointControlCount++;

            if (blnScroll)
            {
                panel_Point.AutoScrollPosition = new Point(panel_Point.HorizontalScroll.Value, intVerticalScroll);
            }
        }
Exemple #29
0
        private void 添加两个点位ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
            {
                MessageBoxLog.Show("无权限");
                return;
            }
            string strStationName = "NewStation";

            if (tag_work.Config.arrWorkStation.Count > 0)
            {
                foreach (StationModule ms in tag_work.Config.arrWorkStation)
                {
                    if (ms.strStationName != "" && ms.strStationName == strStationName)
                    {
                        {
                            MessageBoxLog.Show("已有工位配置");
                            return;
                        }
                    }
                }
            }
            StationModule sm = new StationModule();

            tag_work.Config.arrWorkStation.Add(sm);
            tag_work.Config.arrWorkStation[tag_work.Config.arrWorkStation.Count - 1].strStationName = strStationName;
            PointAggregate pa = new PointAggregate(strStationName, "工位开始");

            sm.arrPoint.Add(pa);
            sm.intUsePointCount++;
            int pointCount = 0;
            int i          = 0;

            try
            {
                pointCount = int.Parse(texB_Count.Text);
            }
            catch (Exception mss)
            {
                LogOutControl.OutLog(mss.Message, 0);
            }
            while (i < pointCount && i < 100)
            {
                i++;
                pa = new PointAggregate(strStationName, "步骤" + i);
                sm.intUsePointCount++;
                sm.arrPoint.Add(pa);
            }

            pa = new PointAggregate(strStationName, "工位结束");
            sm.intUsePointCount++;
            sm.arrPoint.Add(pa);
            tag_work.Config.intUseStationCount++;
            tag_work.Config.Save();
            FrmStationMange_Load(null, null);
        }
Exemple #30
0
 private void 修改名称ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Global.CConst.UserLevel != Global.CConst.USER_SUPERADMIN)
     {
         MessageBoxLog.Show("无权限");
         return;
     }
     trVStation.LabelEdit = true;
     trVStation.SelectedNode.BeginEdit();
 }