📄 nccodeparse.cpp
字号:
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionB;
}
else
{
//x轴方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 -= abs(ye);
JP2 -= abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionA;
}
}
else
{
//y方向进给.
if(ye>0)
{
y_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y+");
}
if(ye<0)
{
y_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y-");
}
//计算偏差.
if(ye != 0)
{
JE--;
JP1 += abs(xe);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionA;
}
intersectionA:
if(JE==0)
{
goto end_x;
}
else
{
if(JP2>=0)
{
if(JP1<0)
{
//y方向进给.
if(ye>0)
{
y_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y+");
}
if(ye<0)
{
y_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y-");
}
//计算偏差.
if(ye != 0)
{
JE--;
JP1 += abs(xe);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionA;
}
else
{
//x方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 -= abs(ye);
JP2 -= abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionB;
}
}
else
{
// z轴方向进给.
if(ze>0)
{
z_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z+");
}
if(ze<0)
{
z_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z-");
}
//计算偏差.
if(ze != 0)
{
JE--;
JP2 += abs(xe);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionB;
}
}
intersectionB:
if(JE==0)
goto end_x;
else
goto begin_x;
end_x:
return 0;
}
// 当y轴为长轴时.
if(abs(ye)>=abs(xe) && abs(ye)>=abs(ze) && !bHaveInterpolation)
{
bHaveInterpolation = true;
begin_y:
if(JP1>=0)
{
if(JP2<0)
{
//z轴方向进给.
if(ze>0)
{
z_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z+");
}
if(ze<0)
{
z_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z-");
}
//计算偏差.
if(ze != 0)
{
JE--;
JP2 += abs(ye);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionD;
}
else
{
//y轴方向进给.
if(ye>0)
{
y_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y+");
}
if(ye<0)
{
y_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y-");
}
//计算偏差.
if(ye != 0)
{
JE--;
JP1 -= abs(xe);
JP2 -= abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionC;
}
}
else
{
//x方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 += abs(ye);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionC;
}
intersectionC:
if(JE==0)
{
goto end_y;
}
else
{
if(JP2>=0)
{
if(JP1<0)
{
//y方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 += abs(ye);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionC;
}
else
{
//y方向进给.
if(ye>0)
{
y_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y+");
}
if(ye<0)
{
y_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y-");
}
//计算偏差.
if(ye != 0)
{
JE--;
JP1 -= abs(xe);
JP2 -= abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionD;
}
}
else
{
// z轴方向进给.
if(ze>0)
{
z_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z+");
}
if(ze<0)
{
z_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z-");
}
//计算偏差.
if(ze != 0)
{
JE--;
JP2 += abs(ye);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionD;
}
}
intersectionD:
if(JE==0)
goto end_y;
else
goto begin_y;
end_y:
return 0;
}
//当z轴为长轴时.
if(abs(ze)>=abs(xe) && abs(ze)>=abs(ye) && !bHaveInterpolation)
{
begin_z:
if(JP1>=0)
{
if(JP2<0)
{
//y轴方向进给.
if(ye>0)
{
y_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y+");
}
if(ye<0)
{
y_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Y-");
}
//计算偏差.
if(ye != 0)
{
JE--;
JP2 += abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionF;
}
else
{
//z轴方向进给.
if(ze>0)
{
z_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z+");
}
if(ze<0)
{
z_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("Z-");
}
//计算偏差.
if(ze != 0)
{
JE--;
JP1 -= abs(xe);
JP2 -= abs(ye);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionE;
}
}
else
{
//x方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 += abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
// char a[120];
// sprintf(a,"%f,%f,%f",x_fStep,y_fStep,z_fStep);
// AfxMessageBox(_T(a));
}
goto intersectionE;
}
intersectionE:
if(JE==0)
{
goto end_z;
}
else
{
if(JP2>=0)
{
if(JP1<0)
{
//x方向进给.
if(xe>0)
{
x_iStep+=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X+");
}
if(xe<0)
{
x_iStep-=1;
m_ArrayForwardDirection_CodeLineInterpolation.Add("X-");
}
//计算偏差.
if(xe != 0)
{
JE--;
JP1 += abs(ze);
// x_fStep = m_fScale*x_iStep;
// y_fStep = m_fScale*y_iStep;
// z_fStep = m_fScale*z_iStep;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -