コード例 #1
0
 private void 单轴连续启动ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (X轴运动检测 == 0 || Y轴运动检测 == 0 || Z轴运动检测 == 0 || U轴运动检测 == 0)
     {
         MessageBox.Show("其它轴在运行中!", "提示");
         return;//退出当前if程序
     }
     else if (Radio单轴T形连续运动.Checked == false & Radio单轴S形连续运动.Checked == false)
     {
         MessageBox.Show("没有选择连续运动!", "提示");
         return;//退出当前if程序
     }
     if (Radio设置T形速度.Checked)
     {
         for (ushort 轴号 = 0; 轴号 < 6; 轴号++)
         {
             Dmc2610.d2610_set_profile(轴号, Min_Vel起始速度, Max_Vel运行速度, Tacc加速时间, Tdec减速时间);// '以T形速度模式运动函数
             La速度方式.Text = "设置T形速度";
         }
     }
     if (Radio设置S形速度.Checked)
     {
         for (ushort 轴号 = 0; 轴号 < 6; 轴号++)
         {
             Dmc2610.d2610_set_s_profile(轴号, Min_Vel起始速度, Max_Vel运行速度, Tacc加速时间, Tdec减速时间, Sacc加速脉冲, Sdec减速脉冲);// '以S形速度模式运动函数
             La速度方式.Text = "设置S形速度";
         }
     }
     if (Radio单轴T形连续运动.Checked)
     {
         for (ushort 多轴连续 = 0; 多轴连续 < 6; 多轴连续++)
         {
             Dmc2610.d2610_t_vmove(多轴连续, 0);//'指定轴以T形速度曲线加速到高速,并持续运行下去,0负方向,1正方向
             La运行方式.Text = "多轴T形连续运动负";
         }
     }
     if (Radio单轴S形连续运动.Checked)
     {
         for (ushort 多轴连续 = 0; 多轴连续 < 6; 多轴连续++)
         {
             Dmc2610.d2610_s_vmove(多轴连续, 1);// '指定轴以S形速度曲线加速到高速,并持续运行下去,0负方向,1代表正方向
             La运行方式.Text = "多轴S形连续运动正";
         }
     }
 }
コード例 #2
0
        private void But单轴启动_Click(object sender, EventArgs e)
        {
            //************设定指定运行单轴改变速度上限,及变速使能。************************
            Dmc2610.d2610_variety_speed_range(nAxis轴号[0], 1, 35889.9);// '设定指定单轴改变速度上限,及变速使能。
            if (变速数据 > 1000)
            {
                HScrollBar1.Value = 1000;
            }
            //***************设定曲线的起始速度、运行速度、加速时间, 减速时间**************************
            if (Radio设置T形速度.Checked)                                                                 //'设定T形曲线的起始速度、运行速度、加速时间, 减速时间
            {
                Dmc2610.d2610_set_profile(nAxis轴号[0], Min_Vel起始速度, Max_Vel运行速度, Tacc加速时间, Tdec减速时间); // '以T形速度模式运动函数
                La速度方式.Text = "设置T形速度";
            }

            if (Radio设置S形速度.Checked)                                                                                       //'设定S形曲线运动的Min_Vel起始速度, Max_Vel运行速度, Tacc加速时间, Tdec减速时间,加减速脉冲。
            {
                Dmc2610.d2610_set_s_profile(nAxis轴号[0], Min_Vel起始速度, Max_Vel运行速度, Tacc加速时间, Tdec减速时间, Sacc加速脉冲, Sdec减速脉冲); // '以S形速度模式运动函数
                La速度方式.Text = "设置S形速度";
            }
            if (Radio多轴插补速度.Checked != false)//Radio多轴插补速度不等于false
            {
                MessageBox.Show("没有选择设置T形或S形速度", "提示");
                return;//退出当前if程序
            }
            //'############各轴运行方式##########
            if (nNum插补轴数 >= 2)
            {
                MessageBox.Show("单轴运行不能同时选择两个以上轴!", "提示");
                return;//退出当前程序
            }
            if (Radio圆弧插补.Checked || Radio两轴直线插补.Checked || Radio三轴直线插补.Checked || Radio四轴直线插补.Checked || radio六轴直线插补.Checked != false)
            {
                //if ((CheckX轴.Checked & CheckY轴.Checked == true) || (CheckX轴.Checked & CheckZ轴.Checked == true) || (CheckX轴.Checked & CheckU轴.Checked == true)
                //    || (CheckY轴.Checked & CheckZ轴.Checked == true) || (CheckY轴.Checked & CheckU轴.Checked == true) || (CheckZ轴.Checked & CheckU轴.Checked == true)
                //    || (CheckA轴.Checked & CheckB轴.Checked == true) || (CheckX轴.Checked & CheckA轴.Checked == true) || (CheckX轴.Checked & CheckB轴.Checked == true)
                //    || (CheckA轴.Checked & CheckU轴.Checked == true) || (CheckZ轴.Checked & CheckA轴.Checked == true) || (CheckZ轴.Checked & CheckB轴.Checked == true))
                MessageBox.Show("没有选择单轴运动!", "提示");
                return; //退出当前程序
                //Application.Exit();///退出整个程序
            }

            if (X轴运动检测 == 0 || Y轴运动检测 == 0 || Z轴运动检测 == 0 || U轴运动检测 == 0 || A轴运动检测 == 0 || B轴运动检测 == 0)
            {
                MessageBox.Show("其它轴在运行中!", "提示");
                return; //退出当前if程序
            }
            //if (CheckX轴.Checked == false &CheckY轴.Checked == false & CheckZ轴.Checked == false
            //    & CheckU轴.Checked == false & CheckA轴.Checked == false & CheckB轴.Checked == false)// '轴没有选择判断检测
            if (nNum插补轴数 < 1) // '判断检测轴有没有选择
            {
                MessageBox.Show("轴没有选择!", "提示");
            }
            else if (Radio单轴T形位置运动对.Checked)
            {
                if (radio相对模式.Checked)
                {
                    Dmc2610.d2610_t_pmove(nAxis轴号[0], Dist位置设定[0], 0); // '指定轴以对称T形速度曲线做定长位移运动,0相对位移,1绝对位移
                    La运行方式.Text = "单轴T形位置运动对";
                }
                if (radio绝对模式.Checked)
                {
                    Dmc2610.d2610_t_pmove(nAxis轴号[0], Dist位置设定[0], 1);// '指定轴以对称T形速度曲线做定长位移运动,0相对位移,1绝对位移
                    La运行方式.Text = "单轴T形位置运动对";
                }
            }
            else if (Radio单轴T形位置运动非.Checked)
            {
                Dmc2610.d2610_ex_t_pmove(nAxis轴号[0], Dist位置设定[0], 模式); // '指定轴以非对称T形速度曲线做定长位移运动,模式:0相对位移,1绝对位移
                La运行方式.Text = "单轴T形位置运动非";
            }
            else if (Radio单轴S形位置运动对.Checked)
            {
                Dmc2610.d2610_s_pmove(nAxis轴号[0], Dist位置设定[0], 模式); // '指定轴以对称S形速度曲线做定长位移运动,模式:0相对位移,1绝对位移
                La运行方式.Text = "单轴S形位置运动对";
            }
            else if (Radio单轴S形位置运动非.Checked)
            {
                Dmc2610.d2610_ex_s_pmove(nAxis轴号[0], Dist位置设定[0], 模式); // '指定轴以非对称S形速度曲线做定长位移运,模式:0相对位移,1绝对位移
                La运行方式.Text = "单轴S形位置运动非";
            }
            else if (Radio单轴T形连续运动.Checked)
            {
                Dmc2610.d2610_t_vmove(nAxis轴号[0], 模式); // '指定轴以T形速度曲线加速到高速,并持续运行下去,模式:0负方向,1正方向
                La运行方式.Text = "单轴T形连续运动";
            }
            else if (Radio单轴S形连续运动.Checked)
            {
                Dmc2610.d2610_s_vmove(nAxis轴号[0], 模式);  //'指定轴以S形速度曲线加速到高速,并持续运行下去,模式:0负方向,1正方向
                La运行方式.Text = "单轴S形连续运动";
            }
        }