⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rs274ngc_pre.cc

📁 数控系统中的解释器源代码
💻 CC
📖 第 1 页 / 共 5 页
字号:
    {}  else if (mode0 IS G_53)    {      CHK(((block->motion_to_be ISNT G_0) AND (block->motion_to_be ISNT G_1)),          NCE_MUST_USE_G0_OR_G1_WITH_G53);      CHK(((block->g_modes[3] IS G_91) OR				(block->block_distance_mode IS MODE_INCREMENTAL) OR           ((block->g_modes[3] ISNT G_90) AND            (settings->distance_mode IS MODE_INCREMENTAL))),          NCE_CANNOT_USE_G53_INCREMENTAL);    }  else if (mode0 IS G_92)    {}  else if ((mode0 IS G_92_1) OR (mode0 IS G_92_2) OR (mode0 IS G_92_3))    {}  //added by wpin   #ifdef LATHE_FLAG  else if (mode0 IS G_23)  	{  			CHK((block->l_number IS -1), NCE_NO_L_WORD_WITH_G23);   	  	}  else if(mode0 IS G_26)  	{		//settings->sequence_number=settings->SpeCycle.RetNumber;  	}#endif  //added end  else    ERM(NCE_BUG_BAD_G_CODE_MODAL_GROUP_0);    return RS274NGC_OK;}/****************************************************************************//* check_itemsReturned Value: int   If any one of check_g_codes, check_m_codes, and check_other_codes   returns an error code, this returns that code.   Otherwise, it returns RS274NGC_OK.Side effects: noneCalled by: parse_lineThis runs checks on a block of RS274 code.The functions named read_XXXX check for errors which would foul up thereading. This function checks for additional logical errors.A block has an array of g_codes, which are initialized to -1(meaning no code). This calls check_g_codes to check the g_codes.A block has an array of m_codes, which are initialized to -1(meaning no code). This calls check_m_codes to check the m_codes.Items in the block which are not m or g codes are checked bycheck_other_codes.*/static int check_items(   /* ARGUMENTS                        */ block_pointer block,     /* pointer to a block to be checked */ setup_pointer settings)  /* pointer to machine settings      */{  static char name[] SET_TO "check_items";  int status;  CHP(check_g_codes(block, settings));  CHP(check_m_codes(block));  CHP(check_other_codes(block));  return RS274NGC_OK;}/****************************************************************************//* check_m_codesReturned Value: int   If any of the following errors occur, this returns the error code shown.   Otherwise, it returns RS274NGC_OK.   1. There are too many m codes in the block: NCE_TOO_MANY_M_CODES_ON_LINESide effects: noneCalled by: check_itemsThis runs checks on m_codes from a block of RS274/NGC instructions.The read_m function checks for errors which would foul up thereading. This function checks for additional errors in m_codes.*/static int check_m_codes( /* ARGUMENTS                        */ block_pointer block)     /* pointer to a block to be checked */{  static char name[] SET_TO "check_m_codes";  CHK((block->m_count > MAX_EMS), NCE_TOO_MANY_M_CODES_ON_LINE);  return RS274NGC_OK;}/****************************************************************************//* check_other_codesReturned Value: int   If any of the following errors occur, this returns the error code shown.   Otherwise, it returns RS274NGC_OK.   1. An A-axis value is given with a canned cycle (g80 to g89):      NCE_CANNOT_PUT_AN_A_IN_CANNED_CYCLE   2. A B-axis value is given with a canned cycle (g80 to g89):      NCE_CANNOT_PUT_A_B_IN_CANNED_CYCLE   3. A C-axis value is given with a canned cycle (g80 to g89):      NCE_CANNOT_PUT_A_C_IN_CANNED_CYCLE   4. A d word is in a block with no cutter_radius_compensation_on command:      NCE_D_WORD_WITH_NO_G41_OR_G42   5. An h_number is in a block with no tool length offset setting:      NCE_H_WORD_WITH_NO_G43   6. An i_number is in a block with no G code that uses it:      NCE_I_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT   7. A j_number is in a block with no G code that uses it:      NCE_J_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT   8. A k_number is in a block with no G code that uses it:      NCE_K_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT   9. A l_number is in a block with no G code that uses it:      NCE_L_WORD_WITH_NO_CANNED_CYCLE_OR_G10  10. A p_number is in a block with no G code that uses it:      NCE_P_WORD_WITH_NO_G4_G10_G82_G86_G88_G89  11. A q_number is in a block with no G code that uses it:      NCE_Q_WORD_WITH_NO_G83  12. An r_number is in a block with no G code that uses it:      NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_ITSide effects: noneCalled by: check_itemsThis runs checks on codes from a block of RS274/NGC code which arenot m or g codes.The functions named read_XXXX check for errors which would foul up thereading. This function checks for additional logical errors in codes.*/static int check_other_codes( /* ARGUMENTS                               */ block_pointer block)    /* pointer to a block of RS274/NGC instructions */{  static char name[] SET_TO "check_other_codes";  int motion;  motion SET_TO block->motion_to_be;#ifdef AA  if (block->a_flag ISNT OFF)    {      CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)),          NCE_CANNOT_PUT_AN_A_IN_CANNED_CYCLE);    }#endif#ifdef BB  if (block->b_flag ISNT OFF)    {      CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)),          NCE_CANNOT_PUT_A_B_IN_CANNED_CYCLE);    }#endif#ifdef CC  if (block->c_flag ISNT OFF)    {      CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)),          NCE_CANNOT_PUT_A_C_IN_CANNED_CYCLE);    }#endif	if (block->d_number ISNT -1)    {      CHK(((block->g_modes[7] ISNT G_41) AND (block->g_modes[7] ISNT G_42) 	  	),//added by wpin          NCE_D_WORD_WITH_NO_G41_OR_G42);    }    if (block->h_number ISNT -1)    {      CHK((block->g_modes[8] ISNT G_43), NCE_H_WORD_WITH_NO_G43);    }#ifdef LATHE_FLAG  if (block->i_flag IS ON) /* could still be useless if yz_plane arc */    {      CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87)      AND (motion ISNT G_71 ) AND (motion ISNT G_72 ) AND (motion ISNT G_73 ) AND (block->g_modes[11] ISNT G_51)     ),          NCE_I_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT);    }#else	if (block->i_flag IS ON) /* could still be useless if yz_plane arc */    {      CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87) AND (block->g_modes[11] ISNT G_51)),          NCE_I_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT);    }#endif   if (block->j_flag IS ON) /* could still be useless if xz_plane arc */    {      CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87) AND (block->g_modes[11] ISNT G_51)),          NCE_J_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT);    }#ifdef LATHE_FLAG  if (block->k_flag IS ON) /* could still be useless if xy_plane arc */    {      CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87)			AND (motion ISNT G_71 ) AND (motion ISNT G_72 ) AND (motion ISNT G_73 )AND (motion ISNT G_33) AND (block->g_modes[11] ISNT G_51)           ),          NCE_K_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT);    }#else  if (block->k_flag IS ON) /* could still be useless if xy_plane arc */    {      CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87) AND (block->g_modes[11] ISNT G_51)),          NCE_K_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT);    }#endif   if (block->l_number ISNT -1)    {    #ifdef LATHE_FLAG	CHK((((motion < G_81) OR (motion > G_89)) AND           (block->g_modes[0] ISNT G_10) AND 		   (motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_71 ) AND 		   (motion ISNT G_72 ) AND (motion ISNT G_73 )  AND (motion ISNT G_70 ) 		   AND (block->g_modes[0] ISNT G_23) ),          NCE_L_WORD_WITH_NO_CANNED_CYCLE_OR_G10);	   #else   CHK((((motion < G_81) OR (motion > G_89)) AND           (block->g_modes[0] ISNT G_10) AND 		   (motion ISNT G_2) AND (motion ISNT G_3) ),//added by wpin,for helix L number          NCE_L_WORD_WITH_NO_CANNED_CYCLE_OR_G10);   #endif         }  if (block->p_number ISNT -1.0)    {      CHK(((block->g_modes[0] ISNT G_10) AND           (block->g_modes[0] ISNT G_4) AND           (motion ISNT G_82) AND (motion ISNT G_86) AND           (motion ISNT G_88) AND (motion ISNT G_89)  AND (block->g_modes[11] ISNT G_51)),          NCE_P_WORD_WITH_NO_G4_G10_G82_G86_G88_G89);	   if (block->g_modes[11] ISNT G_51)	  	CHK((block->p_number < 0.0), NCE_NEGATIVE_P_WORD_USED);    }  if (block->q_number ISNT -1.0)    {      CHK((motion ISNT G_83), NCE_Q_WORD_WITH_NO_G83);    }  if (block->r_flag IS ON)    {      CHK((((motion ISNT G_2) AND (motion ISNT G_3)) AND (motion ISNT G_71) AND (motion ISNT G_72) AND (motion ISNT G_73)  AND (block->g_modes[16] ISNT G_68) AND           ((motion < G_81) OR (motion > G_89))),          NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_IT);    }  #ifdef LATHE_FLAG  //add by wp for threading  if (motion == G_33) {     //printf("\nG33 f=%f\n", block->f_number);    CHK((block->k_flag == OFF),	NCE_K_WORD_MISSING_WITH_G33);    CHK((block->f_number != -1), NCE_F_WORD_USED_WITH_G33);  }  if (motion IS G_71 OR motion IS G_72 OR motion IS G_73 ) {  		CHK(isMDI, NCE_PROF_MOTION_USED_IN_MDI);	CHK((block->l_number IS -1),NCE_NO_L_WORD_WITH_PROF);  	}  if (motion IS G_70  ) {	CHK(isMDI, NCE_PROF_MOTION_USED_IN_MDI);  	}  #endif  return RS274NGC_OK;}/****************************************************************************//* close_and_downcaseReturned Value: int   If any of the following errors occur, this returns the error code shown.   Otherwise, it returns RS274NGC_OK.   1. A left parenthesis is found inside a parentheses comment:      NCE_NESTED_COMMENT_FOUND   2. The line ends before an open parentheses comment is closed:      NCE_UNCLOSED_COMMENT_FOUND   3. A newline character is found that is not followed by null:      NCE_NULL_MISSING_AFTER_NEWLINESide effects: See belowCalled by:  read_textTo simplify handling upper case letters, spaces, and tabs, thisfunction removes spaces and and tabs and downcases everything on aline which is not part of a parentheses delimited comment. If theRS274NGC_FILE_DELIMITERS is OFF, the '%' sign is deleted here. There are two methods of handling comments. The first method is to read thecomment into a string, the second is to skip reading the comments. The default method is to read the comments. For the second method, change the READ_FULL_COMMENT #define in rs275ngc.hh to OFFParentheses delimited comments are left unchanged in place. Parentheses comments are anything enclosed in parentheses. Nested parentheses comments,indicated by a left parenthesis inside a comment, are illegalSemi-colon ';' comments are anything following a semi-colon ';'. There areno restricti

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -