if (wether_link == 0 || machine_origin == 0 || motion_1.Visible == false)
return;
for (int i = 0; i < 3; i = i + 1)//运动值
{
LTSMC.smc_get_encoder_unit(CardNum, axis_all[i], ref pos0[i]);//当前编码器位置
pos0[i] = pos0[i] / (fp / lp_PKM);
}
forward_instantaneous.foward_get_posture(pos0[0], pos0[1], pos0[2]);
GX_position.Text = forward_instantaneous.instantaneous_Gx.ToString("F8"); //F8代表显示小数点后8位
GY_position.Text = forward_instantaneous.instantaneous_Gy.ToString("F8");
GZ_position.Text = forward_instantaneous.instantaneous_Gz.ToString("F8"); //轨迹末端点位置
PKMA_position.Text = forward_instantaneous.instantaneous_psi.ToString("F8");
PKMB_position.Text = forward_instantaneous.instantaneous_theta.ToString("F8");
PKMZ_position.Text = forward_instantaneous.instantaneous_z.ToString("F8");
if (LTSMC.smc_check_done(CardNum, 1) == 0) //检查连续插补的运行状态
{ textBox_1.Text = "运行中"; }
else
{ textBox_1.Text = "无运行"; }
LTSMC.smc_read_current_speed_unit(CardNum, axis_all[0], ref vel[0]);//当前速度
vel[0] = vel[0] / (fp / lp_PKM);
textBox_vel1.Text = vel[0].ToString();
LTSMC.smc_get_position_unit(CardNum, axis_all[0], ref pos[0]);//当前指令位置
pos[0] = pos[0] / (fp / lp_PKM);
textBox_pos1.Text = pos[0].ToString();
textBox_7.Text = pos0[0].ToString();
//
if (LTSMC.smc_check_done(CardNum, 2) == 0)
{
textBox_2.Text = "运行中";
}
else
{ textBox_2.Text = "无运行"; }
LTSMC.smc_read_current_speed_unit(CardNum, axis_all[1], ref vel[1]);//当前速度
vel[1] = vel[1] / (fp / lp_PKM);
textBox_vel2.Text = vel[1].ToString();
LTSMC.smc_get_position_unit(CardNum, axis_all[1], ref pos[1]);//当前指令位置
pos[1] = pos[1] / (fp / lp_PKM);
textBox_pos2.Text = pos[1].ToString();
textBox_8.Text = pos0[1].ToString();
//
if (LTSMC.smc_check_done(CardNum, 3) == 0)
{
textBox_3.Text = "运行中";
}
else
{ textBox_3.Text = "无运行"; }
LTSMC.smc_read_current_speed_unit(CardNum, axis_all[2], ref vel[2]);//当前速度
vel[2] = vel[2] / (fp / lp_PKM);
textBox_vel3.Text = vel[2].ToString();
LTSMC.smc_get_position_unit(CardNum, axis_all[2], ref pos[2]);//当前指令位置
pos[2] = pos[2] / (fp / lp_PKM);
textBox_pos3.Text = pos[2].ToString();
textBox_9.Text = pos0[2].ToString();
//
原文:https://www.cnblogs.com/charles48789982/p/14331925.html