本文整理汇总了C#中DataStore.ImmediateAdd方法的典型用法代码示例。如果您正苦于以下问题:C# DataStore.ImmediateAdd方法的具体用法?C# DataStore.ImmediateAdd怎么用?C# DataStore.ImmediateAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore.ImmediateAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: G_Check
public bool G_Check(string g_str, int row_index, ref DataStore step_compile_data, ref ModalCode_Fanuc_M modal_state)
{
_errorMessage = "";
if(satisfactoryG_M.IndexOf(g_str) == -1)
{
_errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
return false;
}
else
{
try
{
float g_value = (float)Convert.ToDouble(g_str.Trim('G'));
if(g_value < 10f)
g_str = "G0" + g_value.ToString();
}
catch
{
_errorMessage = "(Line:" + row_index + "): " + "系统中不存在该G指令: " + g_str;
return false;
}
int modal_index = modal_state.ModalIndex(g_str);
//立即执行G代码(非模态G代码)
if(modal_index == -1)
{
switch(g_str)
{
case "G04":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.Pause);
break;
case "G28":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.AutoReturnRP);
break;
default:
//Todo: 有很多未完成的功能
_errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持该G代码: " + g_str;
return false;
}
}
//模态代码
else
{//1 level
switch(modal_index)
{
case 0:
if(g_str == "G00")
step_compile_data.motion_type = (int)MotionType.DryRunning;
else if(g_str == "G01")
step_compile_data.motion_type = (int)MotionType.Line;
else if(g_str == "G02")
step_compile_data.motion_type = (int)MotionType.Circular02;
else
step_compile_data.motion_type = (int)MotionType.Circular03;
break;
case 1:
if(g_str != "G94")
{
_errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G94(每分钟进给),暂不支持" + g_str;
return false;
}
break;
case 2:
_errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持09组G代码";
return false;
case 3:
if(g_str != "G17")
{
_errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G17(XY平面选择),暂不支持" + g_str;
return false;
}
break;
case 4:
if(g_str != "G21")
{
_errorMessage = "(Line:" + row_index + "): " + "目前系统只支持G21(公制输入),暂不支持" + g_str;
return false;
}
break;
case 5:
_errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持10组固定循环G代码";
return false;
case 6:
//G90、G91 绝对、增量
//Todo:
break;
case 7:
//G40, G41, G42 刀具半径补偿
//Todo: 坐标会发生一些变化
if(g_str == "G40")
step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationCancel);
else if(g_str == "G41")
step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationLeft);
else
step_compile_data.ImmediateAdd((char)ImmediateMotionType.RadiusCompensationRight);
break;
case 8:
_errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持11组比例缩放G代码";
return false;
case 9:
_errorMessage = "(Line:" + row_index + "): " + "目前系统暂不支持04组存储形成检测功能G代码";
//.........这里部分代码省略.........
示例2: M_Check
public bool M_Check(string m_str, int row_index, ref DataStore step_compile_data)
{
_errorMessage = "";
if(satisfactoryM.IndexOf(m_str) == -1)
{
_errorMessage = "(Line:" + row_index + "): " + "系统中不存在该M指令: " + m_str;
return false;
}
else
{
try
{
float m_value = (float)Convert.ToDouble(m_str.Trim('M'));
if(m_value < 10f)
m_str = "M0" + m_value.ToString();
}
catch
{
_errorMessage = "(Line:" + row_index + "): " + "系统中不存在该M指令: " + m_str;
return false;
}
switch(m_str)
{
case "M00":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M00);
break;
case "M01":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M01);
break;
case "M02":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M02);
break;
case "M03":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M03);
break;
case "M04":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M04);
break;
case "M05":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M05);
break;
case "M06":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M06);
break;
case "M08":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M08);
break;
case "M09":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M09);
break;
case "M30":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M30);
break;
case "M99":
step_compile_data.ImmediateAdd((char)ImmediateMotionType.M99);
break;
default:
_errorMessage = "(Line:" + row_index + "): " + "系统暂不支持该M指令: " + m_str;
return false;
}
return true;
}
}