#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include "rs274ngc.hh"
#include "rs274ngc_return.hh"
#include "rs274ngc_errors.cc"
Include dependency graph for rs274ngc_pre.cc:
Go to the source code of this file.
Defines | |
#define | DEBUG_EMC |
#define | ERM(error_code) |
#define | ERP(error_code) |
#define | CHK(bad, error_code) |
#define | CHP(try_this) |
#define | G83_RAPID_DELTA 0.010 |
#define | CYCLE_MACRO(call) |
#define | MAX_STACK 5 |
Functions | |
int | arc_data_comp_ijk (int move, int side, double tool_radius, double current_x, double current_y, double end_x, double end_y, double i_number, double j_number, double *center_x, double *center_y, int *turn, double tolerance) |
int | arc_data_comp_r (int move, int side, double tool_radius, double current_x, double current_y, double end_x, double end_y, double big_radius, double *center_x, double *center_y, int *turn) |
int | arc_data_ijk (int move, double current_x, double current_y, double end_x, double end_y, double i_number, double j_number, double *center_x, double *center_y, int *turn, double tolerance) |
int | arc_data_r (int move, double current_x, double current_y, double end_x, double end_y, double radius, double *center_x, double *center_y, int *turn) |
int | check_g_codes (block_pointer block, setup_pointer settings) |
int | check_items (block_pointer block, setup_pointer settings) |
int | check_m_codes (block_pointer block) |
int | check_other_codes (block_pointer block) |
int | close_and_downcase (char *line) |
int | convert_arc (int move, block_pointer block, setup_pointer settings) |
int | convert_arc2 (int move, block_pointer block, setup_pointer settings, double *current1, double *current2, double *current3, double end1, double end2, double end3, double offset1, double offset2) |
int | convert_arc_comp1 (int move, block_pointer block, setup_pointer settings, double end_x, double end_y, double end_z) |
int | convert_arc_comp2 (int move, block_pointer block, setup_pointer settings, double end_x, double end_y, double end_z) |
int | convert_axis_offsets (int g_code, block_pointer block, setup_pointer settings) |
int | convert_comment (char *comment) |
int | convert_control_mode (int g_code, setup_pointer settings) |
int | convert_coordinate_system (int g_code, setup_pointer settings) |
int | convert_cutter_compensation (int g_code, block_pointer block, setup_pointer settings) |
int | convert_cutter_compensation_off (setup_pointer settings) |
int | convert_cutter_compensation_on (int side, block_pointer block, setup_pointer settings) |
int | convert_cycle (int motion, block_pointer block, setup_pointer settings) |
int | convert_cycle_g81 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z) |
int | convert_cycle_g82 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z, double dwell) |
int | convert_cycle_g83 (CANON_PLANE plane, double x, double y, double r, double clear_z, double bottom_z, double delta) |
int | convert_cycle_g84 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z, CANON_DIRECTION direction, CANON_SPEED_FEED_MODE mode) |
int | convert_cycle_g85 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z) |
int | convert_cycle_g86 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z, double dwell, CANON_DIRECTION direction) |
int | convert_cycle_g87 (CANON_PLANE plane, double x, double offset_x, double y, double offset_y, double r, double clear_z, double middle_z, double bottom_z, CANON_DIRECTION direction) |
int | convert_cycle_g88 (CANON_PLANE plane, double x, double y, double bottom_z, double dwell, CANON_DIRECTION direction) |
int | convert_cycle_g89 (CANON_PLANE plane, double x, double y, double clear_z, double bottom_z, double dwell) |
int | convert_cycle_xy (int motion, block_pointer block, setup_pointer settings) |
int | convert_cycle_yz (int motion, block_pointer block, setup_pointer settings) |
int | convert_cycle_zx (int motion, block_pointer block, setup_pointer settings) |
int | convert_distance_mode (int g_code, setup_pointer settings) |
int | convert_dwell (double time) |
int | convert_feed_mode (int g_code, setup_pointer settings) |
int | convert_feed_rate (block_pointer block, setup_pointer settings) |
int | convert_g (block_pointer block, setup_pointer settings) |
int | convert_home (int move, block_pointer block, setup_pointer settings) |
int | convert_length_units (int g_code, setup_pointer settings) |
int | convert_m (block_pointer block, setup_pointer settings) |
int | convert_modal_0 (int code, block_pointer block, setup_pointer settings) |
int | convert_motion (int motion, block_pointer block, setup_pointer settings) |
int | convert_probe (block_pointer block, setup_pointer settings) |
int | convert_retract_mode (int g_code, setup_pointer settings) |
int | convert_setup (block_pointer block, setup_pointer settings) |
int | convert_set_plane (int g_code, setup_pointer settings) |
int | convert_speed (block_pointer block, setup_pointer settings) |
int | convert_stop (block_pointer block, setup_pointer settings) |
int | convert_straight (int move, block_pointer block, setup_pointer settings) |
int | convert_straight_comp1 (int move, block_pointer block, setup_pointer settings, double px, double py, double end_z) |
int | convert_straight_comp2 (int move, block_pointer block, setup_pointer settings, double px, double py, double end_z) |
int | convert_tool_change (setup_pointer settings) |
int | convert_tool_length_offset (int g_code, block_pointer block, setup_pointer settings) |
int | convert_tool_select (block_pointer block, setup_pointer settings) |
int | cycle_feed (CANON_PLANE plane, double end1, double end2, double end3) |
int | cycle_traverse (CANON_PLANE plane, double end1, double end2, double end3) |
int | enhance_block (block_pointer block, setup_pointer settings) |
int | execute_binary (double *left, int operation, double *right) |
int | execute_binary1 (double *left, int operation, double *right) |
int | execute_binary2 (double *left, int operation, double *right) |
int | execute_block (block_pointer block, setup_pointer settings) |
int | execute_unary (double *double_ptr, int operation) |
double | find_arc_length (double x1, double y1, double z1, double center_x, double center_y, int turn, double x2, double y2, double z2) |
int | find_ends (block_pointer block, setup_pointer settings, double *px, double *py, double *pz) |
int | find_relative (double x1, double y1, double z1, double *x2, double *y2, double *z2, setup_pointer settings) |
double | find_straight_length (double x2, double y2, double z2, double x1, double y1, double z1) |
double | find_turn (double x1, double y1, double center_x, double center_y, int turn, double x2, double y2) |
int | init_block (block_pointer block) |
int | inverse_time_rate_arc (double x1, double y1, double z1, double cx, double cy, int turn, double x2, double y2, double z2, block_pointer block, setup_pointer settings) |
int | inverse_time_rate_arc2 (double start_x, double start_y, int turn1, double mid_x, double mid_y, double cx, double cy, int turn2, double end_x, double end_y, double end_z, block_pointer block, setup_pointer settings) |
int | inverse_time_rate_as (double start_x, double start_y, int turn, double mid_x, double mid_y, double end_x, double end_y, double end_z, block_pointer block, setup_pointer settings) |
int | inverse_time_rate_straight (double end_x, double end_y, double end_z, block_pointer block, setup_pointer settings) |
int | parse_line (char *line, block_pointer block, setup_pointer settings) |
int | precedence (int an_operator) |
int | read_a (char *line, int *counter, block_pointer block, double *parameters) |
int | read_atan (char *line, int *counter, double *double_ptr, double *parameters) |
int | read_b (char *line, int *counter, block_pointer block, double *parameters) |
int | read_c (char *line, int *counter, block_pointer block, double *parameters) |
int | read_comment (char *line, int *counter, block_pointer block, double *parameters) |
int | read_d (char *line, int *counter, block_pointer block, double *parameters) |
int | read_f (char *line, int *counter, block_pointer block, double *parameters) |
int | read_g (char *line, int *counter, block_pointer block, double *parameters) |
int | read_h (char *line, int *counter, block_pointer block, double *parameters) |
int | read_i (char *line, int *counter, block_pointer block, double *parameters) |
int | read_integer_unsigned (char *line, int *counter, int *integer_ptr) |
int | read_integer_value (char *line, int *counter, int *integer_ptr, double *parameters) |
int | read_items (block_pointer block, char *line, double *parameters) |
int | read_j (char *line, int *counter, block_pointer block, double *parameters) |
int | read_k (char *line, int *counter, block_pointer block, double *parameters) |
int | read_l (char *line, int *counter, block_pointer block, double *parameters) |
int | read_line_number (char *line, int *counter, block_pointer block) |
int | read_m (char *line, int *counter, block_pointer block, double *parameters) |
int | read_one_item (char *line, int *counter, block_pointer block, double *parameters) |
int | read_operation (char *line, int *counter, int *operation) |
int | read_operation_unary (char *line, int *counter, int *operation) |
int | read_p (char *line, int *counter, block_pointer block, double *parameters) |
int | read_parameter (char *line, int *counter, double *double_ptr, double *parameters) |
int | read_parameter_setting (char *line, int *counter, block_pointer block, double *parameters) |
int | read_q (char *line, int *counter, block_pointer block, double *parameters) |
int | read_r (char *line, int *counter, block_pointer block, double *parameters) |
int | read_real_expression (char *line, int *counter, double *hold2, double *parameters) |
int | read_real_number (char *line, int *counter, double *double_ptr) |
int | read_real_value (char *line, int *counter, double *double_ptr, double *parameters) |
int | read_s (char *line, int *counter, block_pointer block, double *parameters) |
int | read_t (char *line, int *counter, block_pointer block, double *parameters) |
int | read_text (const char *command, FILE *inport, char *raw_line, char *line, int *length) |
int | read_unary (char *line, int *counter, double *double_ptr, double *parameters) |
int | read_x (char *line, int *counter, block_pointer block, double *parameters) |
int | read_y (char *line, int *counter, block_pointer block, double *parameters) |
int | read_z (char *line, int *counter, block_pointer block, double *parameters) |
int | set_probe_data (setup_pointer settings) |
int | write_g_codes (block_pointer block, setup_pointer settings) |
int | write_m_codes (block_pointer block, setup_pointer settings) |
int | write_settings (setup_pointer settings) |
int | rs274ngc_close () |
int | rs274ngc_execute (const char *command) |
int | rs274ngc_exit () |
int | rs274ngc_init () |
int | rs274ngc_load_tool_table () |
int | rs274ngc_open (const char *filename) |
int | rs274ngc_read (const char *command) |
int | rs274ngc_reset () |
int | rs274ngc_restore_parameters (const char *filename) |
int | rs274ngc_save_parameters (const char *filename, const double parameters[]) |
int | rs274ngc_synch () |
void | rs274ngc_active_g_codes (int *codes) |
void | rs274ngc_active_m_codes (int *codes) |
void | rs274ngc_active_settings (double *settings) |
void | rs274ngc_error_text (int error_code, char *error_text, int max_size) |
void | rs274ngc_file_name (char *file_name, int max_size) |
int | rs274ngc_line_length () |
void | rs274ngc_line_text (char *line_text, int max_size) |
int | rs274ngc_sequence_number () |
void | rs274ngc_stack_name (int stack_index, char *function_name, int max_size) |
Variables | |
setup | _setup |
|
Value: if (bad) { \ _setup.stack_index SET_TO 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] SET_TO 0; \ return error_code; \ } else Definition at line 139 of file rs274ngc_pre.cc. Referenced by check_other_codes(), close_and_downcase(), convert_arc_comp2(), convert_cycle_xy(), convert_cycle_yz(), convert_cycle_zx(), convert_straight(), convert_straight_comp1(), convert_straight_comp2(), execute_binary1(), execute_unary(), and rs274ngc_read().
|
|
Value: if ((status SET_TO (try_this)) ISNT RS274NGC_OK) { \ if (_setup.stack_index < 49) \ {strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] SET_TO 0; \ return status;} \ else {return status;} \ } else Definition at line 146 of file rs274ngc_pre.cc. Referenced by convert_arc2(), convert_arc_comp1(), convert_arc_comp2(), convert_cutter_compensation(), convert_g(), convert_m(), convert_modal_0(), convert_motion(), execute_binary(), execute_block(), and read_text().
|
|
Value: for (repeat SET_TO block->l_number; \ repeat > 0; \ repeat--) \ { \ aa SET_TO (aa + aa_increment); \ bb SET_TO (bb + bb_increment); \ cycle_traverse(plane, aa, bb, old_cc); \ if (old_cc ISNT r) \ cycle_traverse(plane, aa, bb, r); \ CHP(call); \ old_cc SET_TO clear_cc; \ } Definition at line 3784 of file rs274ngc_pre.cc. |
|
Definition at line 107 of file rs274ngc_pre.cc. |
|
Value: if (1) { \ _setup.stack_index SET_TO 0; \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] SET_TO 0; \ return error_code; \ } else Definition at line 126 of file rs274ngc_pre.cc. Referenced by close_and_downcase(), convert_coordinate_system(), convert_cycle(), convert_straight_comp1(), convert_straight_comp2(), execute_binary1(), execute_binary2(), execute_unary(), and read_text().
|
|
Value: if (_setup.stack_index < 49) { \ strcpy(_setup.stack[_setup.stack_index++], name); \ _setup.stack[_setup.stack_index][0] SET_TO 0; \ return error_code; \ } else return error_code Definition at line 133 of file rs274ngc_pre.cc. |
|
Definition at line 3290 of file rs274ngc_pre.cc. |
|
Definition at line 10153 of file rs274ngc_pre.cc. |
|
Definition at line 841 of file rs274ngc_pre.cc. Referenced by convert_arc_comp1().
00855 { 00856 static char name[] SET_TO "arc_data_comp_ijk"; 00857 double arc_radius; 00858 double radius2; 00859 00860 *center_x SET_TO (current_x + i_number); 00861 *center_y SET_TO (current_y + j_number); 00862 arc_radius SET_TO hypot(i_number, j_number); 00863 radius2 SET_TO hypot((*center_x - end_x), (*center_y - end_y)); 00864 radius2 SET_TO 00865 (((side IS LEFT ) AND (move IS 30)) OR 00866 ((side IS RIGHT) AND (move IS 20))) ? 00867 (radius2 - tool_radius): (radius2 + tool_radius); 00868 CHK((fabs(arc_radius - radius2) > tolerance), 00869 NCE_RADIUS_TO_END_OF_ARC_DIFFERS_FROM_RADIUS_TO_START); 00870 /* This catches an arc too small for the tool, also */ 00871 if (move IS G_2) 00872 *turn SET_TO -1; 00873 else if (move IS G_3) 00874 *turn SET_TO 1; 00875 else 00876 ERM(NCE_BUG_CODE_NOT_G2_OR_G3); 00877 return RS274NGC_OK; 00878 } |
|
Definition at line 937 of file rs274ngc_pre.cc. Referenced by convert_arc_comp1().
00949 { 00950 static char name[] SET_TO "arc_data_comp_r"; 00951 double abs_radius; /* absolute value of big_radius */ 00952 double alpha; /* direction of line from current to end */ 00953 double distance; /* length of line L from current to end */ 00954 double mid_length; /* length from current point to point P */ 00955 double offset; /* length of line from P to center */ 00956 double radius2; /* distance from center to current point */ 00957 double mid_x; /* x-value of point P */ 00958 double mid_y; /* y-value of point P */ 00959 double theta; /* direction of line from P to center */ 00960 00961 abs_radius SET_TO fabs(big_radius); 00962 CHK(((abs_radius <= tool_radius) AND (((side IS LEFT ) AND (move IS G_3)) OR 00963 ((side IS RIGHT) AND (move IS G_2)))), 00964 NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP); 00965 00966 distance SET_TO hypot((end_x - current_x), (end_y - current_y)); 00967 alpha SET_TO atan2 ((end_y - current_y), (end_x - current_x)); 00968 theta SET_TO (((move IS G_3) AND (big_radius > 0)) OR 00969 ((move IS G_2) AND (big_radius < 0))) ? 00970 (alpha + PI2) : (alpha - PI2); 00971 radius2 SET_TO (((side IS LEFT ) AND (move IS G_3)) OR 00972 ((side IS RIGHT) AND (move IS G_2))) ? 00973 (abs_radius - tool_radius) : (abs_radius + tool_radius); 00974 CHK((distance > (radius2 + abs_radius)), 00975 NCE_RADIUS_TOO_SMALL_TO_REACH_END_POINT); 00976 mid_length SET_TO (((radius2 * radius2) + (distance * distance) - 00977 (abs_radius * abs_radius)) / (2.0 * distance)); 00978 mid_x SET_TO (current_x + (mid_length * cos(alpha))); 00979 mid_y SET_TO (current_y + (mid_length * sin(alpha))); 00980 CHK(((radius2 * radius2) <= (mid_length * mid_length)), 00981 NCE_BUG_IN_TOOL_RADIUS_COMP); 00982 offset SET_TO sqrt((radius2 * radius2) - (mid_length * mid_length)); 00983 *center_x SET_TO mid_x + (offset * cos(theta)); 00984 *center_y SET_TO mid_y + (offset * sin(theta)); 00985 *turn SET_TO (move IS G_2) ? -1 : 1; 00986 00987 return RS274NGC_OK; 00988 } |
|
Definition at line 1019 of file rs274ngc_pre.cc. Referenced by convert_arc_comp2().
01031 { 01032 static char name[] SET_TO "arc_data_ijk"; 01033 double radius; /* radius to current point */ 01034 double radius2; /* radius to end point */ 01035 *center_x SET_TO (current_x + i_number); 01036 *center_y SET_TO (current_y + j_number); 01037 radius SET_TO hypot((*center_x - current_x), (*center_y - current_y)); 01038 radius2 SET_TO hypot((*center_x - end_x), (*center_y - end_y)); 01039 CHK(((radius IS 0.0) OR (radius2 IS 0.0)), NCE_ZERO_RADIUS_ARC); 01040 CHK((fabs(radius - radius2) > tolerance), 01041 NCE_RADIUS_TO_END_OF_ARC_DIFFERS_FROM_RADIUS_TO_START); 01042 if (move IS G_2) 01043 *turn SET_TO -1; 01044 else if (move IS G_3) 01045 *turn SET_TO 1; 01046 else 01047 ERM(NCE_BUG_CODE_NOT_G2_OR_G3); 01048 return RS274NGC_OK; 01049 } |
|
Definition at line 1087 of file rs274ngc_pre.cc. Referenced by convert_arc2(), convert_arc_comp2(), convert_arc_xy(), convert_arc_yz(), and convert_arc_zx().
01097 { 01098 static char name[] SET_TO "arc_data_r"; 01099 double abs_radius; /* absolute value of given radius */ 01100 double half_length; /* distance from M to end point */ 01101 double mid_x; /* first coordinate of M */ 01102 double mid_y; /* second coordinate of M */ 01103 double offset; /* distance from M to center */ 01104 double theta; /* angle of line from M to center */ 01105 double turn2; /* absolute value of half of turn */ 01106 01107 CHK(((end_x IS current_x) AND (end_y IS current_y)), 01108 NCE_CURRENT_POINT_SAME_AS_END_POINT_OF_ARC); 01109 abs_radius SET_TO fabs(radius); 01110 mid_x SET_TO (end_x + current_x)/2.0; 01111 mid_y SET_TO (end_y + current_y)/2.0; 01112 half_length SET_TO hypot((mid_x - end_x), (mid_y - end_y)); 01113 CHK(((half_length/abs_radius) > (1+TINY)), 01114 NCE_ARC_RADIUS_TOO_SMALL_TO_REACH_END_POINT); 01115 if ((half_length/abs_radius) > (1-TINY)) 01116 half_length SET_TO abs_radius; /* allow a small error for semicircle */ 01117 /* check needed before calling asin */ 01118 if (((move IS G_2) AND (radius > 0)) OR 01119 ((move IS G_3) AND (radius < 0))) 01120 theta SET_TO atan2((end_y - current_y), (end_x - current_x)) - PI2; 01121 else 01122 theta SET_TO atan2((end_y - current_y), (end_x - current_x)) + PI2; 01123 01124 turn2 SET_TO asin (half_length/abs_radius); 01125 offset SET_TO abs_radius * cos(turn2); 01126 *center_x SET_TO mid_x + (offset * cos(theta)); 01127 *center_y SET_TO mid_y + (offset * sin(theta)); 01128 *turn SET_TO (move IS G_2) ? -1 : 1; 01129 01130 return RS274NGC_OK; 01131 } |
|
Definition at line 1184 of file rs274ngc_pre.cc. 01187 { 01188 static char name[] SET_TO "check_g_codes"; 01189 int mode0; 01190 int p_int; 01191 01192 mode0 SET_TO block->g_modes[0]; 01193 01194 if (mode0 IS -1) 01195 {} 01196 else if (mode0 IS G_4) 01197 { 01198 CHK((block->p_number IS -1.0), NCE_DWELL_TIME_MISSING_WITH_G4); 01199 } 01200 else if (mode0 IS G_10) 01201 { 01202 p_int SET_TO (int)(block->p_number + 0.0001); 01203 CHK((block->l_number ISNT 2), NCE_LINE_WITH_G10_DOES_NOT_HAVE_L2); 01204 CHK((((block->p_number + 0.0001) - p_int) > 0.0002), 01205 NCE_P_VALUE_NOT_AN_INTEGER_WITH_G10_L2); 01206 CHK(((p_int < 1) OR (p_int > 9)), NCE_P_VALUE_OUT_OF_RANGE_WITH_G10_L2); 01207 } 01208 else if (mode0 IS G_28) 01209 {} 01210 else if (mode0 IS G_30) 01211 {} 01212 else if (mode0 IS G_53) 01213 { 01214 CHK(((block->motion_to_be ISNT G_0) AND (block->motion_to_be ISNT G_1)), 01215 NCE_MUST_USE_G0_OR_G1_WITH_G53); 01216 CHK(((block->g_modes[3] IS G_91) OR 01217 ((block->g_modes[3] ISNT G_90) AND 01218 (settings->distance_mode IS MODE_INCREMENTAL))), 01219 NCE_CANNOT_USE_G53_INCREMENTAL); 01220 } 01221 else if (mode0 IS G_92) 01222 {} 01223 else if ((mode0 IS G_92_1) OR (mode0 IS G_92_2) OR (mode0 IS G_92_3)) 01224 {} 01225 else 01226 ERM(NCE_BUG_BAD_G_CODE_MODAL_GROUP_0); 01227 return RS274NGC_OK; 01228 } |
|
Definition at line 1259 of file rs274ngc_pre.cc. 01262 { 01263 static char name[] SET_TO "check_items"; 01264 int status; 01265 01266 CHP(check_g_codes(block, settings)); 01267 CHP(check_m_codes(block)); 01268 CHP(check_other_codes(block)); 01269 return RS274NGC_OK; 01270 } |
|
Definition at line 1292 of file rs274ngc_pre.cc. 01294 { 01295 static char name[] SET_TO "check_m_codes"; 01296 01297 CHK((block->m_count > MAX_EMS), NCE_TOO_MANY_M_CODES_ON_LINE); 01298 return RS274NGC_OK; 01299 } |
|
Definition at line 1345 of file rs274ngc_pre.cc. 01347 { 01348 static char name[] SET_TO "check_other_codes"; 01349 int motion; 01350 01351 motion SET_TO block->motion_to_be; 01352 #ifdef AA 01353 if (block->a_flag ISNT OFF) 01354 { 01355 CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)), 01356 NCE_CANNOT_PUT_AN_A_IN_CANNED_CYCLE); 01357 } 01358 #endif 01359 #ifdef BB 01360 if (block->b_flag ISNT OFF) 01361 { 01362 CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)), 01363 NCE_CANNOT_PUT_A_B_IN_CANNED_CYCLE); 01364 } 01365 #endif 01366 #ifdef CC 01367 if (block->c_flag ISNT OFF) 01368 { 01369 CHK(((block->g_modes[1] > G_80) AND (block->g_modes[1] < G_90)), 01370 NCE_CANNOT_PUT_A_C_IN_CANNED_CYCLE); 01371 } 01372 #endif 01373 if (block->d_number ISNT -1) 01374 { 01375 CHK(((block->g_modes[7] ISNT G_41) AND (block->g_modes[7] ISNT G_42)), 01376 NCE_D_WORD_WITH_NO_G41_OR_G42); 01377 } 01378 if (block->h_number ISNT -1) 01379 { 01380 CHK((block->g_modes[8] ISNT G_43), NCE_H_WORD_WITH_NO_G43); 01381 } 01382 01383 if (block->i_flag IS ON) /* could still be useless if yz_plane arc */ 01384 { 01385 CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87)), 01386 NCE_I_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT); 01387 } 01388 01389 if (block->j_flag IS ON) /* could still be useless if xz_plane arc */ 01390 { 01391 CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87)), 01392 NCE_J_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT); 01393 } 01394 01395 if (block->k_flag IS ON) /* could still be useless if xy_plane arc */ 01396 { 01397 CHK(((motion ISNT G_2) AND (motion ISNT G_3) AND (motion ISNT G_87)), 01398 NCE_K_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT); 01399 } 01400 01401 if (block->l_number ISNT -1) 01402 { 01403 CHK((((motion < G_81) OR (motion > G_89)) AND 01404 (block->g_modes[0] ISNT G_10)), 01405 NCE_L_WORD_WITH_NO_CANNED_CYCLE_OR_G10); 01406 } 01407 01408 if (block->p_number ISNT -1.0) 01409 { 01410 CHK(((block->g_modes[0] ISNT G_10) AND 01411 (block->g_modes[0] ISNT G_4) AND 01412 (motion ISNT G_82) AND (motion ISNT G_86) AND 01413 (motion ISNT G_88) AND (motion ISNT G_89)), 01414 NCE_P_WORD_WITH_NO_G4_G10_G82_G86_G88_G89); 01415 } 01416 01417 if (block->q_number ISNT -1.0) 01418 { 01419 CHK((motion ISNT G_83), NCE_Q_WORD_WITH_NO_G83); 01420 } 01421 01422 if (block->r_flag IS ON) 01423 { 01424 CHK((((motion ISNT G_2) AND (motion ISNT G_3)) AND 01425 ((motion < G_81) OR (motion > G_89))), 01426 NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_IT); 01427 } 01428 01429 return RS274NGC_OK; 01430 } |
|
Definition at line 1474 of file rs274ngc_pre.cc. Referenced by read_text().
01475 : one line of NC code */ 01476 { 01477 static char name[] SET_TO "close_and_downcase"; 01478 int m; 01479 int n; 01480 int comment; 01481 char item; 01482 comment SET_TO 0; 01483 for (n SET_TO 0, m SET_TO 0; (item SET_TO line[m]) ISNT (char) NULL; m++) 01484 { 01485 if (comment) 01486 { 01487 line[n++] SET_TO item; 01488 if (item IS ')') 01489 { 01490 comment SET_TO 0; 01491 } 01492 else if (item IS '(') 01493 ERM(NCE_NESTED_COMMENT_FOUND); 01494 } 01495 else if ((item IS ' ') OR (item IS '\t') OR (item IS '\r')); 01496 /* don't copy blank or tab or CR */ 01497 else if (item IS '\n') /* don't copy newline */ 01498 { /* but check null follows */ 01499 CHK((line[m+1] ISNT 0), NCE_NULL_MISSING_AFTER_NEWLINE); 01500 } 01501 else if ((64 < item) AND (item < 91)) /* downcase upper case letters */ 01502 { 01503 line[n++] SET_TO (32 + item); 01504 } 01505 else if (item IS '(') /* comment is starting */ 01506 { 01507 comment SET_TO 1; 01508 line[n++] SET_TO item; 01509 } 01510 else 01511 { 01512 line[n++] SET_TO item; /* copy anything else */ 01513 } 01514 } 01515 CHK((comment), NCE_UNCLOSED_COMMENT_FOUND); 01516 line[n] SET_TO 0; 01517 return RS274NGC_OK; 01518 } |
|
Definition at line 1574 of file rs274ngc_pre.cc. 01578 { 01579 static char name[] SET_TO "convert_arc"; 01580 int status; 01581 int first; /* flag set ON if this is first move after comp ON */ 01582 int ijk_flag; /* flag set ON if any of i,j,k present in NC code */ 01583 double end_x; 01584 double end_y; 01585 double end_z; 01586 #ifdef AA 01587 double AA_end; /*AA*/ 01588 #endif 01589 #ifdef BB 01590 double BB_end; /*BB*/ 01591 #endif 01592 #ifdef CC 01593 double CC_end; /*CC*/ 01594 #endif 01595 01596 ijk_flag SET_TO 01597 ((block->i_flag OR block->j_flag) OR block->k_flag) ? ON : OFF; 01598 first SET_TO (settings->program_x IS UNKNOWN); 01599 01600 CHK(((block->r_flag ISNT ON) AND (ijk_flag ISNT ON)), 01601 NCE_R_I_J_K_WORDS_ALL_MISSING_FOR_ARC); 01602 CHK(((block->r_flag IS ON) AND (ijk_flag IS ON)), 01603 NCE_MIXED_RADIUS_IJK_FORMAT_FOR_ARC); 01604 if (settings->feed_mode IS UNITS_PER_MINUTE) 01605 { 01606 CHK((settings->feed_rate IS 0.0), 01607 NCE_CANNOT_MAKE_ARC_WITH_ZERO_FEED_RATE); 01608 } 01609 else if (settings->feed_mode IS INVERSE_TIME) 01610 { 01611 CHK((block->f_number IS -1.0), 01612 NCE_F_WORD_MISSING_WITH_INVERSE_TIME_ARC_MOVE); 01613 } 01614 if (ijk_flag) 01615 { 01616 if (settings->plane IS CANON_PLANE_XY) 01617 { 01618 CHK((block->k_flag), NCE_K_WORD_GIVEN_FOR_ARC_IN_XY_PLANE); 01619 if (block->i_flag IS OFF) /* i or j flag on to get here */ 01620 block->i_number SET_TO 0.0; 01621 else if (block->j_flag IS OFF) 01622 block->j_number SET_TO 0.0; 01623 } 01624 else if (settings->plane IS CANON_PLANE_YZ) 01625 { 01626 CHK((block->i_flag), NCE_I_WORD_GIVEN_FOR_ARC_IN_YZ_PLANE); 01627 if (block->j_flag IS OFF) /* j or k flag on to get here */ 01628 block->j_number SET_TO 0.0; 01629 else if (block->k_flag IS OFF) 01630 block->k_number SET_TO 0.0; 01631 } 01632 else if (settings->plane IS CANON_PLANE_XZ) 01633 { 01634 CHK((block->j_flag), NCE_J_WORD_GIVEN_FOR_ARC_IN_XZ_PLANE); 01635 if (block->i_flag IS OFF) /* i or k flag on to get here */ 01636 block->i_number SET_TO 0.0; 01637 else if (block->k_flag IS OFF) 01638 block->k_number SET_TO 0.0; 01639 } 01640 else 01641 ERM(NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ); 01642 } 01643 else; /* r format arc; no other checks needed specific to this format */ 01644 01645 if (settings->plane IS CANON_PLANE_XY) /* checks for both formats */ 01646 { 01647 CHK(((block->x_flag IS OFF) AND (block->y_flag IS OFF)), 01648 NCE_X_AND_Y_WORDS_MISSING_FOR_ARC_IN_XY_PLANE); 01649 } 01650 else if (settings->plane IS CANON_PLANE_YZ) 01651 { 01652 CHK(((block->y_flag IS OFF) AND (block->z_flag IS OFF)), 01653 NCE_Y_AND_Z_WORDS_MISSING_FOR_ARC_IN_YZ_PLANE); 01654 } 01655 else if (settings->plane IS CANON_PLANE_XZ) 01656 { 01657 CHK(((block->x_flag IS OFF) AND (block->z_flag IS OFF)), 01658 NCE_X_AND_Z_WORDS_MISSING_FOR_ARC_IN_XZ_PLANE); 01659 } 01660 01661 find_ends(block, settings, &end_x, &end_y, 01662 &end_z 01663 #ifdef AA 01664 , &AA_end 01665 #endif 01666 01667 #ifdef BB 01668 , &BB_end 01669 #endif 01670 01671 #ifdef CC 01672 , &CC_end 01673 #endif 01674 ); 01675 settings->motion_mode SET_TO move; 01676 01677 if (settings->plane IS CANON_PLANE_XY) 01678 { 01679 if ((settings->cutter_comp_side IS OFF) OR 01680 (settings->cutter_comp_radius IS 0.0)) 01681 { 01682 status SET_TO 01683 convert_arc2(move, block, settings, 01684 &(settings->current_x), &(settings->current_y), 01685 &(settings->current_z), end_x, end_y, 01686 end_z 01687 #ifdef AA 01688 , AA_end 01689 #endif 01690 01691 #ifdef BB 01692 , BB_end 01693 #endif 01694 01695 #ifdef CC 01696 , CC_end 01697 #endif 01698 , block->i_number, 01699 block->j_number); 01700 CHP(status); 01701 } 01702 else if (first) 01703 { 01704 status SET_TO 01705 convert_arc_comp1(move, block, settings, end_x, end_y, 01706 end_z 01707 #ifdef AA 01708 , AA_end 01709 #endif 01710 01711 #ifdef BB 01712 , BB_end 01713 #endif 01714 01715 #ifdef CC 01716 , CC_end 01717 #endif 01718 ); 01719 CHP(status); 01720 } 01721 else 01722 { 01723 status SET_TO 01724 convert_arc_comp2(move, block, settings, end_x, end_y, 01725 end_z 01726 #ifdef AA 01727 , AA_end 01728 #endif 01729 01730 #ifdef BB 01731 , BB_end 01732 #endif 01733 01734 #ifdef CC 01735 , CC_end 01736 #endif 01737 ); 01738 01739 CHP(status); 01740 } 01741 } 01742 else if (settings->plane IS CANON_PLANE_XZ) 01743 { 01744 status SET_TO 01745 convert_arc2 (move, block, settings, 01746 &(settings->current_z), &(settings->current_x), 01747 &(settings->current_y), end_z, end_x, 01748 end_y 01749 #ifdef AA 01750 , AA_end 01751 #endif 01752 01753 #ifdef BB 01754 , BB_end 01755 #endif 01756 01757 #ifdef CC 01758 , CC_end 01759 #endif 01760 , block->k_number, 01761 block->i_number); 01762 CHP(status); 01763 } 01764 else if (settings->plane IS CANON_PLANE_YZ) 01765 { 01766 status SET_TO 01767 convert_arc2 (move, block, settings, 01768 &(settings->current_y), &(settings->current_z), 01769 &(settings->current_x), end_y, end_z, 01770 end_x 01771 #ifdef AA 01772 , AA_end 01773 #endif 01774 01775 #ifdef BB 01776 , BB_end 01777 #endif 01778 01779 #ifdef CC 01780 , CC_end 01781 #endif 01782 , block->j_number, 01783 block->k_number); 01784 CHP(status); 01785 } 01786 else 01787 ERM(NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ); 01788 return RS274NGC_OK; 01789 } |
|
Definition at line 1811 of file rs274ngc_pre.cc. 01832 { 01833 static char name[] SET_TO "convert_arc2"; 01834 double center1; 01835 double center2; 01836 int status; /* status returned from CHP function call */ 01837 double tolerance; /* tolerance for difference of radii */ 01838 int turn; /* number of full or partial turns CCW in arc */ 01839 01840 tolerance SET_TO (settings->length_units IS CANON_UNITS_INCHES) ? 01841 TOLERANCE_INCH : TOLERANCE_MM; 01842 01843 if (block->r_flag) 01844 { 01845 CHP(arc_data_r(move, *current1, *current2, end1, end2, 01846 block->r_number, ¢er1, ¢er2, &turn)); 01847 } 01848 else 01849 { 01850 CHP(arc_data_ijk(move, *current1, *current2, end1, end2, offset1, 01851 offset2, ¢er1, ¢er2, &turn, tolerance)); 01852 } 01853 01854 if (settings->feed_mode IS INVERSE_TIME) 01855 inverse_time_rate_arc(*current1, *current2, *current3, center1, center2, 01856 turn, end1, end2, end3, block, settings); 01857 ARC_FEED(end1, end2, center1, center2, turn, 01858 end3 01859 #ifdef AA 01860 , AA_end 01861 #else 01862 #ifdef ALL_AXES 01863 , 0 01864 #endif 01865 #endif 01866 #ifdef BB 01867 , BB_end 01868 #else 01869 #ifdef ALL_AXES 01870 , 0 01871 #endif 01872 #endif 01873 #ifdef CC 01874 , CC_end 01875 #else 01876 #ifdef ALL_AXES 01877 , 0 01878 #endif 01879 #endif 01880 ); 01881 *current1 SET_TO end1; 01882 *current2 SET_TO end2; 01883 *current3 SET_TO end3; 01884 #ifdef AA 01885 settings->AA_current SET_TO AA_end; /*AA*/ 01886 #endif 01887 #ifdef BB 01888 settings->BB_current SET_TO BB_end; /*BB*/ 01889 #endif 01890 #ifdef CC 01891 settings->CC_current SET_TO CC_end; /*CC*/ 01892 #endif 01893 return RS274NGC_OK; 01894 } |
|
Definition at line 1924 of file rs274ngc_pre.cc. 01941 { 01942 static char name[] SET_TO "convert_arc_comp1"; 01943 double center_x; 01944 double center_y; 01945 double gamma; /* direction of perpendicular to arc at end */ 01946 int side; /* offset side - right or left */ 01947 int status; /* status returned from CHP function call */ 01948 double tolerance; /* tolerance for difference of radii */ 01949 double tool_radius; 01950 int turn; /* 1 for counterclockwise, -1 for clockwise */ 01951 01952 side SET_TO settings->cutter_comp_side; 01953 tool_radius SET_TO settings->cutter_comp_radius; /* always is positive */ 01954 tolerance SET_TO (settings->length_units IS CANON_UNITS_INCHES) ? 01955 TOLERANCE_INCH : TOLERANCE_MM; 01956 01957 CHK((hypot((end_x - settings->current_x), 01958 (end_y - settings->current_y)) <= tool_radius), 01959 NCE_CUTTER_GOUGING_WITH_CUTTER_RADIUS_COMP); 01960 01961 if (block->r_flag) 01962 { 01963 CHP(arc_data_comp_r(move, side, tool_radius, settings->current_x, 01964 settings->current_y, end_x, end_y, block->r_number, 01965 ¢er_x, ¢er_y, &turn)); 01966 } 01967 else 01968 { 01969 CHP(arc_data_comp_ijk(move, side, tool_radius, settings->current_x, 01970 settings->current_y, end_x, end_y, 01971 block->i_number, block->j_number, 01972 ¢er_x, ¢er_y, &turn, tolerance)); 01973 } 01974 01975 gamma SET_TO 01976 (((side IS LEFT) AND (move IS G_3)) OR 01977 ((side IS RIGHT) AND (move IS G_2))) ? 01978 atan2 ((center_y - end_y), (center_x - end_x)) : 01979 atan2 ((end_y - center_y), (end_x - center_x)); 01980 01981 settings->program_x SET_TO end_x; 01982 settings->program_y SET_TO end_y; 01983 end_x SET_TO (end_x + (tool_radius * cos(gamma))); /* end_x reset actual */ 01984 end_y SET_TO (end_y + (tool_radius * sin(gamma))); /* end_y reset actual */ 01985 01986 if (settings->feed_mode IS INVERSE_TIME) 01987 inverse_time_rate_arc(settings->current_x, settings->current_y, 01988 settings->current_z, center_x, center_y, turn, 01989 end_x, end_y, end_z, block, settings); 01990 ARC_FEED(end_x, end_y, center_x, center_y, turn, 01991 end_z 01992 #ifdef AA 01993 , AA_end 01994 #else 01995 #ifdef ALL_AXES 01996 , 0 01997 #endif 01998 #endif 01999 #ifdef BB 02000 , BB_end 02001 #else 02002 #ifdef ALL_AXES 02003 , 0 02004 #endif 02005 #endif 02006 #ifdef CC 02007 , CC_end 02008 #else 02009 #ifdef ALL_AXES 02010 , 0 02011 #endif 02012 #endif 02013 ); 02014 settings->current_x SET_TO end_x; 02015 settings->current_y SET_TO end_y; 02016 settings->current_z SET_TO end_z; 02017 #ifdef AA 02018 settings->AA_current SET_TO AA_end; /*AA*/ 02019 #endif 02020 #ifdef BB 02021 settings->BB_current SET_TO BB_end; /*BB*/ 02022 #endif 02023 #ifdef CC 02024 settings->CC_current SET_TO CC_end; /*CC*/ 02025 #endif 02026 02027 return RS274NGC_OK; 02028 } |
|
Definition at line 2069 of file rs274ngc_pre.cc. 02086 { 02087 static char name[] SET_TO "convert_arc_comp2"; 02088 double alpha; /* direction of tangent to start of arc */ 02089 double arc_radius; 02090 double beta; /* angle between two tangents above */ 02091 double center_x; /* center of arc */ 02092 double center_y; 02093 double delta; /* direction of radius from start of arc to center of arc */ 02094 double gamma; /* direction of perpendicular to arc at end */ 02095 double mid_x; 02096 double mid_y; 02097 int side; 02098 double small SET_TO TOLERANCE_CONCAVE_CORNER; /* angle for testing corners */ 02099 double start_x; 02100 double start_y; 02101 int status; /* status returned from CHP function call */ 02102 double theta; /* direction of tangent to last cut */ 02103 double tolerance; 02104 double tool_radius; 02105 int turn; /* number of full or partial circles CCW */ 02106 02107 /* find basic arc data: center_x, center_y, and turn */ 02108 02109 start_x SET_TO settings->program_x; 02110 start_y SET_TO settings->program_y; 02111 tolerance SET_TO (settings->length_units IS CANON_UNITS_INCHES) ? 02112 TOLERANCE_INCH : TOLERANCE_MM; 02113 02114 if (block->r_flag) 02115 { 02116 CHP(arc_data_r(move, start_x, start_y, end_x, end_y, 02117 block->r_number, ¢er_x, ¢er_y, &turn)); 02118 } 02119 else 02120 { 02121 CHP(arc_data_ijk(move, start_x, start_y, end_x, end_y, 02122 block->i_number, block->j_number, 02123 ¢er_x, ¢er_y, &turn, tolerance)); 02124 } 02125 02126 /* compute other data */ 02127 side SET_TO settings->cutter_comp_side; 02128 tool_radius SET_TO settings->cutter_comp_radius; /* always is positive */ 02129 arc_radius SET_TO hypot((center_x - end_x), (center_y - end_y)); 02130 theta SET_TO 02131 atan2(settings->current_y - start_y, settings->current_x - start_x); 02132 theta SET_TO (side IS LEFT) ? (theta - PI2) : (theta + PI2); 02133 delta SET_TO atan2(center_y - start_y, center_x - start_x); 02134 alpha SET_TO (move IS G_3) ? (delta - PI2) : (delta + PI2); 02135 beta SET_TO (side IS LEFT) ? (theta - alpha) : (alpha - theta); 02136 beta SET_TO (beta > (1.5 * PI)) ? (beta - TWO_PI) : 02137 (beta < -PI2) ? (beta + TWO_PI) : beta; 02138 02139 if (((side IS LEFT) AND (move IS G_3)) OR 02140 ((side IS RIGHT) AND (move IS G_2))) 02141 { 02142 gamma SET_TO atan2 ((center_y - end_y), (center_x - end_x)); 02143 CHK((arc_radius <= tool_radius), 02144 NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP); 02145 } 02146 else 02147 { 02148 gamma SET_TO atan2 ((end_y - center_y), (end_x - center_x)); 02149 delta SET_TO (delta + PI); 02150 } 02151 02152 settings->program_x SET_TO end_x; 02153 settings->program_y SET_TO end_y; 02154 end_x SET_TO (end_x + (tool_radius * cos(gamma))); /* end_x reset actual */ 02155 end_y SET_TO (end_y + (tool_radius * sin(gamma))); /* end_y reset actual */ 02156 02157 /* check if extra arc needed and insert if so */ 02158 02159 CHK(((beta < -small) OR (beta > (PI + small))), 02160 NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP); 02161 if (beta > small) /* two arcs needed */ 02162 { 02163 mid_x SET_TO (start_x + (tool_radius * cos(delta))); 02164 mid_y SET_TO (start_y + (tool_radius * sin(delta))); 02165 if (settings->feed_mode IS INVERSE_TIME) 02166 inverse_time_rate_arc2(start_x, start_y, (side IS LEFT) ? -1 : 1, 02167 mid_x, mid_y, center_x, center_y, turn, 02168 end_x, end_y, end_z, block, settings); 02169 ARC_FEED(mid_x, mid_y, start_x, start_y, ((side IS LEFT) ? -1 : 1), 02170 settings->current_z 02171 #ifdef AA 02172 , AA_end 02173 #else 02174 #ifdef ALL_AXES 02175 , 0 02176 #endif 02177 #endif 02178 #ifdef BB 02179 , BB_end 02180 #else 02181 #ifdef ALL_AXES 02182 , 0 02183 #endif 02184 #endif 02185 #ifdef CC 02186 , CC_end 02187 #else 02188 #ifdef ALL_AXES 02189 , 0 02190 #endif 02191 #endif 02192 ); 02193 ARC_FEED(end_x, end_y, center_x, center_y, turn, 02194 end_z 02195 #ifdef AA 02196 , AA_end 02197 #else 02198 #ifdef ALL_AXES 02199 , 0 02200 #endif 02201 #endif 02202 #ifdef BB 02203 , BB_end 02204 #else 02205 #ifdef ALL_AXES 02206 , 0 02207 #endif 02208 #endif 02209 #ifdef CC 02210 , CC_end 02211 #else 02212 #ifdef ALL_AXES 02213 , 0 02214 #endif 02215 #endif 02216 ); 02217 } 02218 else /* one arc needed */ 02219 { 02220 if (settings->feed_mode IS INVERSE_TIME) 02221 inverse_time_rate_arc(settings->current_x, settings->current_y, 02222 settings->current_z, center_x, center_y, turn, 02223 end_x, end_y, end_z, block, settings); 02224 ARC_FEED(end_x, end_y, center_x, center_y, turn, 02225 end_z 02226 #ifdef AA 02227 , AA_end 02228 #else 02229 #ifdef ALL_AXES 02230 , 0 02231 #endif 02232 #endif 02233 #ifdef BB 02234 , BB_end 02235 #else 02236 #ifdef ALL_AXES 02237 , 0 02238 #endif 02239 #endif 02240 #ifdef CC 02241 , CC_end 02242 #else 02243 #ifdef ALL_AXES 02244 , 0 02245 #endif 02246 #endif 02247 ); 02248 } 02249 02250 settings->current_x SET_TO end_x; 02251 settings->current_y SET_TO end_y; 02252 settings->current_z SET_TO end_z; 02253 #ifdef AA 02254 settings->AA_current SET_TO AA_end; /*AA*/ 02255 #endif 02256 #ifdef BB 02257 settings->BB_current SET_TO BB_end; /*BB*/ 02258 #endif 02259 #ifdef CC 02260 settings->CC_current SET_TO CC_end; /*CC*/ 02261 #endif 02262 02263 return RS274NGC_OK; 02264 } |
|
Definition at line 2325 of file rs274ngc_pre.cc. 02329 { 02330 static char name[] SET_TO "convert_axis_offsets"; 02331 double * pars; /* short name for settings->parameters */ 02332 02333 CHK((settings->cutter_comp_side ISNT OFF), /* not "IS ON" */ 02334 NCE_CANNOT_CHANGE_AXIS_OFFSETS_WITH_CUTTER_RADIUS_COMP); 02335 pars SET_TO settings->parameters; 02336 if (g_code IS G_92) 02337 { 02338 if (block->x_flag IS ON) 02339 { 02340 settings->axis_offset_x SET_TO 02341 (settings->current_x + settings->axis_offset_x - block->x_number); 02342 settings->current_x SET_TO block->x_number; 02343 } 02344 02345 if (block->y_flag IS ON) 02346 { 02347 settings->axis_offset_y SET_TO 02348 (settings->current_y + settings->axis_offset_y - block->y_number); 02349 settings->current_y SET_TO block->y_number; 02350 } 02351 02352 if (block->z_flag IS ON) 02353 { 02354 settings->axis_offset_z SET_TO 02355 (settings->current_z + settings->axis_offset_z - block->z_number); 02356 settings->current_z SET_TO block->z_number; 02357 } 02358 02359 #ifdef AA 02360 if (block->a_flag IS ON) /*AA*/ 02361 #endif 02362 #ifdef AA 02363 {settings->AA_axis_offset SET_TO (settings->AA_current + /*AA*/ 02364 #endif 02365 #ifdef AA 02366 settings->AA_axis_offset - block->a_number); /*AA*/ 02367 #endif 02368 #ifdef AA 02369 settings->AA_current SET_TO block->a_number;} /*AA*/ 02370 #endif 02371 02372 #ifdef BB 02373 if (block->b_flag IS ON) /*BB*/ 02374 #endif 02375 #ifdef BB 02376 {settings->BB_axis_offset SET_TO (settings->BB_current + /*BB*/ 02377 #endif 02378 #ifdef BB 02379 settings->BB_axis_offset - block->b_number); /*BB*/ 02380 #endif 02381 #ifdef BB 02382 settings->BB_current SET_TO block->b_number;} /*BB*/ 02383 #endif 02384 02385 #ifdef CC 02386 if (block->c_flag IS ON) /*CC*/ 02387 #endif 02388 #ifdef CC 02389 {settings->CC_axis_offset SET_TO (settings->CC_current + /*CC*/ 02390 #endif 02391 #ifdef CC 02392 settings->CC_axis_offset - block->c_number); /*CC*/ 02393 #endif 02394 #ifdef CC 02395 settings->CC_current SET_TO block->c_number;} /*CC*/ 02396 #endif 02397 02398 SET_ORIGIN_OFFSETS(settings->origin_offset_x + settings->axis_offset_x, 02399 settings->origin_offset_y + settings->axis_offset_y, 02400 settings->origin_offset_z + settings->axis_offset_z 02401 #ifdef AA 02402 , (settings->AA_origin_offset + settings->AA_axis_offset) 02403 #else 02404 #ifdef ALL_AXES 02405 , 0 02406 #endif 02407 #endif 02408 #ifdef BB 02409 , (settings->BB_origin_offset + settings->BB_axis_offset) 02410 #else 02411 #ifdef ALL_AXES 02412 , 0 02413 #endif 02414 #endif 02415 #ifdef CC 02416 , (settings->CC_origin_offset + settings->CC_axis_offset) 02417 #else 02418 #ifdef ALL_AXES 02419 , 0 02420 #endif 02421 #endif 02422 ); 02423 pars[5211] SET_TO settings->axis_offset_x; 02424 pars[5212] SET_TO settings->axis_offset_y; 02425 pars[5213] SET_TO settings->axis_offset_z; 02426 #ifdef AA 02427 pars[5214] SET_TO settings->AA_axis_offset; /*AA*/ 02428 #endif 02429 #ifdef BB 02430 pars[5215] SET_TO settings->BB_axis_offset; /*BB*/ 02431 #endif 02432 #ifdef CC 02433 pars[5216] SET_TO settings->CC_axis_offset; /*CC*/ 02434 #endif 02435 02436 } 02437 else if ((g_code IS G_92_1) OR (g_code IS G_92_2)) 02438 { 02439 settings->current_x SET_TO 02440 settings->current_x + settings->axis_offset_x; 02441 settings->current_y SET_TO 02442 settings->current_y + settings->axis_offset_y; 02443 settings->current_z SET_TO 02444 settings->current_z + settings->axis_offset_z; 02445 #ifdef AA 02446 settings->AA_current SET_TO /*AA*/ 02447 #endif 02448 #ifdef AA 02449 (settings->AA_current + settings->AA_axis_offset); /*AA*/ 02450 #endif 02451 #ifdef BB 02452 settings->BB_current SET_TO /*BB*/ 02453 #endif 02454 #ifdef BB 02455 (settings->BB_current + settings->BB_axis_offset); /*BB*/ 02456 #endif 02457 #ifdef CC 02458 settings->CC_current SET_TO /*CC*/ 02459 #endif 02460 #ifdef CC 02461 (settings->CC_current + settings->CC_axis_offset); /*CC*/ 02462 #endif 02463 SET_ORIGIN_OFFSETS(settings->origin_offset_x, 02464 settings->origin_offset_y, 02465 settings->origin_offset_z 02466 #ifdef AA 02467 , settings->AA_origin_offset 02468 #else 02469 #ifdef ALL_AXES 02470 , 0 02471 #endif 02472 #endif 02473 #ifdef BB 02474 , settings->BB_origin_offset 02475 #else 02476 #ifdef ALL_AXES 02477 , 0 02478 #endif 02479 #endif 02480 #ifdef CC 02481 , settings->CC_origin_offset 02482 #else 02483 #ifdef ALL_AXES 02484 , 0 02485 #endif 02486 #endif 02487 ); 02488 settings->axis_offset_x SET_TO 0.0; 02489 settings->axis_offset_y SET_TO 0.0; 02490 settings->axis_offset_z SET_TO 0.0; 02491 #ifdef AA 02492 settings->AA_axis_offset SET_TO 0.0; /*AA*/ 02493 #endif 02494 #ifdef BB 02495 settings->BB_axis_offset SET_TO 0.0; /*BB*/ 02496 #endif 02497 #ifdef CC 02498 settings->CC_axis_offset SET_TO 0.0; /*CC*/ 02499 #endif 02500 if (g_code IS G_92_1) 02501 { 02502 pars[5211] SET_TO 0.0; 02503 pars[5212] SET_TO 0.0; 02504 pars[5213] SET_TO 0.0; 02505 #ifdef AA 02506 pars[5214] SET_TO 0.0; /*AA*/ 02507 #endif 02508 #ifdef BB 02509 pars[5215] SET_TO 0.0; /*BB*/ 02510 #endif 02511 #ifdef CC 02512 pars[5216] SET_TO 0.0; /*CC*/ 02513 #endif 02514 } 02515 } 02516 else if (g_code IS G_92_3) 02517 { 02518 settings->current_x SET_TO 02519 settings->current_x + settings->axis_offset_x - pars[5211]; 02520 settings->current_y SET_TO 02521 settings->current_y + settings->axis_offset_y - pars[5212]; 02522 settings->current_z SET_TO 02523 settings->current_z + settings->axis_offset_z - pars[5213]; 02524 #ifdef AA 02525 settings->AA_current SET_TO /*AA*/ 02526 #endif 02527 #ifdef AA 02528 settings->AA_current + settings->AA_axis_offset - pars[5214]; /*AA*/ 02529 #endif 02530 #ifdef BB 02531 settings->BB_current SET_TO /*BB*/ 02532 #endif 02533 #ifdef BB 02534 settings->BB_current + settings->BB_axis_offset - pars[5215]; /*BB*/ 02535 #endif 02536 #ifdef CC 02537 settings->CC_current SET_TO /*CC*/ 02538 #endif 02539 #ifdef CC 02540 settings->CC_current + settings->CC_axis_offset - pars[5216]; /*CC*/ 02541 #endif 02542 settings->axis_offset_x SET_TO pars[5211]; 02543 settings->axis_offset_y SET_TO pars[5212]; 02544 settings->axis_offset_z SET_TO pars[5213]; 02545 #ifdef AA 02546 settings->AA_axis_offset SET_TO pars[5214]; /*AA*/ 02547 #endif 02548 #ifdef BB 02549 settings->BB_axis_offset SET_TO pars[5215]; /*BB*/ 02550 #endif 02551 #ifdef CC 02552 settings->CC_axis_offset SET_TO pars[5216]; /*CC*/ 02553 #endif 02554 SET_ORIGIN_OFFSETS(settings->origin_offset_x + settings->axis_offset_x, 02555 settings->origin_offset_y + settings->axis_offset_y, 02556 settings->origin_offset_z + settings->axis_offset_z 02557 #ifdef AA 02558 , (settings->AA_origin_offset + settings->AA_axis_offset) 02559 #else 02560 #ifdef ALL_AXES 02561 , 0 02562 #endif 02563 #endif 02564 #ifdef BB 02565 , (settings->BB_origin_offset + settings->BB_axis_offset) 02566 #else 02567 #ifdef ALL_AXES 02568 , 0 02569 #endif 02570 #endif 02571 #ifdef CC 02572 , (settings->CC_origin_offset + settings->CC_axis_offset) 02573 #else 02574 #ifdef ALL_AXES 02575 , 0 02576 #endif 02577 #endif 02578 ); 02579 } 02580 else 02581 ERM(NCE_BUG_CODE_NOT_IN_G92_SERIES); 02582 02583 return RS274NGC_OK; 02584 } |
|
Definition at line 2609 of file rs274ngc_pre.cc. Referenced by execute_block().
02611 { 02612 int m; 02613 int item; 02614 02615 for (m SET_TO 0; ((item SET_TO comment[m]) IS ' ') OR (item IS '\t') ; m++); 02616 if ((item ISNT 'M') AND (item ISNT 'm')) 02617 { 02618 COMMENT(comment); 02619 return RS274NGC_OK; 02620 } 02621 for (m++; ((item SET_TO comment[m]) IS ' ') OR (item IS '\t') ; m++); 02622 if ((item ISNT 'S') AND (item ISNT 's')) 02623 { 02624 COMMENT(comment); 02625 return RS274NGC_OK; 02626 } 02627 for (m++; ((item SET_TO comment[m]) IS ' ') OR (item IS '\t') ; m++); 02628 if ((item ISNT 'G') AND (item ISNT 'g')) 02629 { 02630 COMMENT(comment); 02631 return RS274NGC_OK; 02632 } 02633 for (m++; ((item SET_TO comment[m]) IS ' ') OR (item IS '\t') ; m++); 02634 if (item ISNT ',') 02635 { 02636 COMMENT(comment); 02637 return RS274NGC_OK; 02638 } 02639 MESSAGE(comment + m + 1); 02640 return RS274NGC_OK; 02641 } |
|
Definition at line 2676 of file rs274ngc_pre.cc. 02679 { 02680 static char name[] SET_TO "convert_control_mode"; 02681 if (g_code IS G_61) 02682 { 02683 SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH); 02684 settings->control_mode SET_TO CANON_EXACT_PATH; 02685 } 02686 else if (g_code IS G_61_1) 02687 { 02688 SET_MOTION_CONTROL_MODE(CANON_EXACT_STOP); 02689 settings->control_mode SET_TO CANON_EXACT_STOP; 02690 } 02691 else if (g_code IS G_64) 02692 { 02693 SET_MOTION_CONTROL_MODE(CANON_CONTINUOUS); 02694 settings->control_mode SET_TO CANON_CONTINUOUS; 02695 } 02696 else 02697 ERM(NCE_BUG_CODE_NOT_G61_G61_1_OR_G64); 02698 return RS274NGC_OK; 02699 } |
|
Definition at line 2772 of file rs274ngc_pre.cc. 02775 { 02776 static char name[] SET_TO "convert_coordinate_system"; 02777 int origin; 02778 double x; 02779 double y; 02780 double z; 02781 #ifdef AA 02782 double a; /*AA*/ 02783 #endif 02784 #ifdef BB 02785 double b; /*BB*/ 02786 #endif 02787 #ifdef CC 02788 double c; /*CC*/ 02789 #endif 02790 double * parameters; 02791 02792 parameters SET_TO settings->parameters; 02793 switch(g_code) 02794 { 02795 case 540: 02796 origin SET_TO 1; 02797 break; 02798 case 550: 02799 origin SET_TO 2; 02800 break; 02801 case 560: 02802 origin SET_TO 3; 02803 break; 02804 case 570: 02805 origin SET_TO 4; 02806 break; 02807 case 580: 02808 origin SET_TO 5; 02809 break; 02810 case 590: 02811 origin SET_TO 6; 02812 break; 02813 case 591: 02814 origin SET_TO 7; 02815 break; 02816 case 592: 02817 origin SET_TO 8; 02818 break; 02819 case 593: 02820 origin SET_TO 9; 02821 break; 02822 default: 02823 ERM(NCE_BUG_CODE_NOT_IN_RANGE_G54_TO_G593); 02824 } 02825 02826 if (origin IS settings->origin_index) /* already using this origin */ 02827 { 02828 #ifdef DEBUG_EMC 02829 COMMENT("interpreter: continuing to use same coordinate system"); 02830 #endif 02831 return RS274NGC_OK; 02832 } 02833 02834 settings->origin_index SET_TO origin; 02835 parameters[5220] SET_TO (double)origin; 02836 02837 /* axis offsets could be included in the two set of calculations for 02838 current_x, current_y, etc., but do not need to be because the results 02839 would be the same. They would be added in then subtracted out. */ 02840 settings->current_x SET_TO 02841 (settings->current_x + settings->origin_offset_x); 02842 settings->current_y SET_TO 02843 (settings->current_y + settings->origin_offset_y); 02844 settings->current_z SET_TO 02845 (settings->current_z + settings->origin_offset_z); 02846 #ifdef AA 02847 settings->AA_current SET_TO /*AA*/ 02848 #endif 02849 #ifdef AA 02850 (settings->AA_current + settings->AA_origin_offset); /*AA*/ 02851 #endif 02852 #ifdef BB 02853 settings->BB_current SET_TO /*BB*/ 02854 #endif 02855 #ifdef BB 02856 (settings->BB_current + settings->BB_origin_offset); /*BB*/ 02857 #endif 02858 #ifdef CC 02859 settings->CC_current SET_TO /*CC*/ 02860 #endif 02861 #ifdef CC 02862 (settings->CC_current + settings->CC_origin_offset); /*CC*/ 02863 #endif 02864 02865 x SET_TO parameters[5201 + (origin * 20)]; 02866 y SET_TO parameters[5202 + (origin * 20)]; 02867 z SET_TO parameters[5203 + (origin * 20)]; 02868 #ifdef AA 02869 a SET_TO parameters[5204 + (origin * 20)]; /*AA*/ 02870 #endif 02871 #ifdef BB 02872 b SET_TO parameters[5205 + (origin * 20)]; /*BB*/ 02873 #endif 02874 #ifdef CC 02875 c SET_TO parameters[5206 + (origin * 20)]; /*CC*/ 02876 #endif 02877 02878 settings->origin_offset_x SET_TO x; 02879 settings->origin_offset_y SET_TO y; 02880 settings->origin_offset_z SET_TO z; 02881 #ifdef AA 02882 settings->AA_origin_offset SET_TO a; /*AA*/ 02883 #endif 02884 #ifdef BB 02885 settings->BB_origin_offset SET_TO b; /*BB*/ 02886 #endif 02887 #ifdef CC 02888 settings->CC_origin_offset SET_TO c; /*CC*/ 02889 #endif 02890 02891 settings->current_x SET_TO (settings->current_x - x); 02892 settings->current_y SET_TO (settings->current_y - y); 02893 settings->current_z SET_TO (settings->current_z - z); 02894 #ifdef AA 02895 settings->AA_current SET_TO (settings->AA_current - a); /*AA*/ 02896 #endif 02897 #ifdef BB 02898 settings->BB_current SET_TO (settings->BB_current - b); /*BB*/ 02899 #endif 02900 #ifdef CC 02901 settings->CC_current SET_TO (settings->CC_current - c); /*CC*/ 02902 #endif 02903 02904 SET_ORIGIN_OFFSETS(x + settings->axis_offset_x, 02905 y + settings->axis_offset_y, 02906 z + settings->axis_offset_z 02907 #ifdef AA 02908 , a + settings->AA_axis_offset 02909 #else 02910 #ifdef ALL_AXES 02911 , 0 02912 #endif 02913 #endif 02914 #ifdef BB 02915 , b + settings->BB_axis_offset 02916 #else 02917 #ifdef ALL_AXES 02918 , 0 02919 #endif 02920 #endif 02921 #ifdef CC 02922 , c + settings->CC_axis_offset 02923 #else 02924 #ifdef ALL_AXES 02925 , 0 02926 #endif 02927 #endif 02928 ); 02929 return RS274NGC_OK; 02930 } |
|
Definition at line 2957 of file rs274ngc_pre.cc. 02961 { 02962 static char name[] SET_TO "convert_cutter_compensation"; 02963 int status; 02964 02965 if (g_code IS G_40) 02966 { 02967 CHP(convert_cutter_compensation_off(settings)); 02968 } 02969 else if (g_code IS G_41) 02970 { 02971 CHP(convert_cutter_compensation_on(LEFT, block, settings)); 02972 } 02973 else if (g_code IS G_42) 02974 { 02975 CHP(convert_cutter_compensation_on(RIGHT, block, settings)); 02976 } 02977 else 02978 ERM(NCE_BUG_CODE_NOT_G40_G41_OR_G42); 02979 02980 return RS274NGC_OK; 02981 } |
|
Definition at line 3000 of file rs274ngc_pre.cc. Referenced by convert_cutter_compensation().
03002 { 03003 #ifdef DEBUG_EMC 03004 COMMENT("interpreter: cutter radius compensation off"); 03005 #endif 03006 settings->cutter_comp_side SET_TO OFF; 03007 settings->program_x SET_TO UNKNOWN; 03008 return RS274NGC_OK; 03009 } |
|
Definition at line 3063 of file rs274ngc_pre.cc. 03067 { 03068 static char name[] SET_TO "convert_cutter_compensation_on"; 03069 double radius; 03070 int index; 03071 03072 CHK((settings->plane ISNT CANON_PLANE_XY), 03073 NCE_CANNOT_TURN_CUTTER_RADIUS_COMP_ON_OUT_OF_XY_PLANE); 03074 CHK((settings->cutter_comp_side ISNT OFF), 03075 NCE_CANNOT_TURN_CUTTER_RADIUS_COMP_ON_WHEN_ON); 03076 index SET_TO 03077 (block->d_number ISNT -1) ? block->d_number : settings->current_slot; 03078 radius SET_TO ((settings->tool_table[index].diameter)/2.0); 03079 03080 if (radius < 0.0) /* switch side & make radius positive if radius negative */ 03081 { 03082 radius SET_TO -radius; 03083 if (side IS RIGHT) 03084 side SET_TO LEFT; 03085 else 03086 side SET_TO RIGHT; 03087 } 03088 03089 #ifdef DEBUG_EMC 03090 if (side IS RIGHT) 03091 COMMENT("interpreter: cutter radius compensation on right"); 03092 else 03093 COMMENT("interpreter: cutter radius compensation on left"); 03094 #endif 03095 03096 settings->cutter_comp_radius SET_TO radius; 03097 settings->tool_table_index SET_TO index; 03098 settings->cutter_comp_side SET_TO side; 03099 return RS274NGC_OK; 03100 } |
|
Definition at line 3132 of file rs274ngc_pre.cc. 03136 { 03137 static char name[] SET_TO "convert_cycle"; 03138 CANON_PLANE plane; 03139 int status; 03140 03141 plane SET_TO settings->plane; 03142 if (block->r_flag IS OFF) 03143 { 03144 if (settings->motion_mode IS motion) 03145 block->r_number SET_TO settings->cycle_r; 03146 else 03147 ERM(NCE_R_CLEARANCE_PLANE_UNSPECIFIED_IN_CYCLE); 03148 } 03149 03150 CHK((block->l_number IS 0), NCE_CANNOT_DO_ZERO_REPEATS_OF_CYCLE); 03151 if (block->l_number IS -1) 03152 block->l_number SET_TO 1; 03153 03154 if (plane IS CANON_PLANE_XY) 03155 { 03156 CHP(convert_cycle_xy(motion, block, settings)); 03157 } 03158 else if (plane IS CANON_PLANE_YZ) 03159 { 03160 CHP(convert_cycle_yz(motion, block, settings)); 03161 } 03162 else if (plane IS CANON_PLANE_XZ) 03163 { 03164 CHP(convert_cycle_zx(motion, block, settings)); 03165 } 03166 else 03167 ERM(NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ); 03168 03169 settings->cycle_l SET_TO block->l_number; 03170 settings->cycle_r SET_TO block->r_number; 03171 settings->motion_mode SET_TO motion; 03172 return RS274NGC_OK; 03173 } |
|
Definition at line 3201 of file rs274ngc_pre.cc. 03207 { 03208 static char name[] SET_TO "convert_cycle_g81"; 03209 03210 cycle_feed(plane, x, y, bottom_z); 03211 cycle_traverse(plane, x, y, clear_z); 03212 03213 return RS274NGC_OK; 03214 } |
|
Definition at line 3241 of file rs274ngc_pre.cc. 03248 { 03249 static char name[] SET_TO "convert_cycle_g82"; 03250 03251 cycle_feed(plane, x, y, bottom_z); 03252 DWELL(dwell); 03253 cycle_traverse(plane, x, y, clear_z); 03254 03255 return RS274NGC_OK; 03256 } |
|
Definition at line 3293 of file rs274ngc_pre.cc. 03301 { 03302 static char name[] SET_TO "convert_cycle_g83"; 03303 double current_depth; 03304 double rapid_delta; 03305 03306 rapid_delta SET_TO G83_RAPID_DELTA; 03307 if (_setup.length_units IS CANON_UNITS_MM) 03308 rapid_delta SET_TO (rapid_delta * 25.4); 03309 03310 for (current_depth SET_TO (r - delta); 03311 current_depth > bottom_z; 03312 current_depth SET_TO (current_depth - delta)) 03313 { 03314 cycle_feed(plane, x, y, current_depth); 03315 cycle_traverse(plane, x, y, clear_z); 03316 cycle_traverse(plane, x, y, current_depth + rapid_delta); 03317 } 03318 cycle_feed(plane, x, y, bottom_z); 03319 cycle_traverse(plane, x, y, clear_z); 03320 03321 return RS274NGC_OK; 03322 } |
|
Definition at line 3358 of file rs274ngc_pre.cc. 03366 { 03367 static char name[] SET_TO "convert_cycle_g84"; 03368 03369 CHK((direction ISNT CANON_CLOCKWISE), 03370 NCE_SPINDLE_NOT_TURNING_CLOCKWISE_IN_G84); 03371 START_SPEED_FEED_SYNCH(); 03372 cycle_feed(plane, x, y, bottom_z); 03373 STOP_SPINDLE_TURNING(); 03374 START_SPINDLE_COUNTERCLOCKWISE(); 03375 cycle_feed(plane, x, y, clear_z); 03376 if (mode ISNT CANON_SYNCHED) 03377 STOP_SPEED_FEED_SYNCH(); 03378 STOP_SPINDLE_TURNING(); 03379 START_SPINDLE_CLOCKWISE(); 03380 03381 return RS274NGC_OK; 03382 } |
|
Definition at line 3409 of file rs274ngc_pre.cc. 03415 { 03416 static char name[] SET_TO "convert_cycle_g85"; 03417 03418 cycle_feed(plane, x, y, bottom_z); 03419 cycle_feed(plane, x, y, clear_z); 03420 03421 return RS274NGC_OK; 03422 } |
|
Definition at line 3455 of file rs274ngc_pre.cc. 03463 { 03464 static char name[] SET_TO "convert_cycle_g86"; 03465 03466 CHK(((direction ISNT CANON_CLOCKWISE) AND 03467 (direction ISNT CANON_COUNTERCLOCKWISE)), 03468 NCE_SPINDLE_NOT_TURNING_IN_G86); 03469 03470 cycle_feed(plane, x, y, bottom_z); 03471 DWELL(dwell); 03472 STOP_SPINDLE_TURNING(); 03473 cycle_traverse(plane, x, y, clear_z); 03474 if (direction IS CANON_CLOCKWISE) 03475 START_SPINDLE_CLOCKWISE(); 03476 else 03477 START_SPINDLE_COUNTERCLOCKWISE(); 03478 03479 return RS274NGC_OK; 03480 } |
|
Definition at line 3541 of file rs274ngc_pre.cc. 03552 { 03553 static char name[] SET_TO "convert_cycle_g87"; 03554 03555 CHK(((direction ISNT CANON_CLOCKWISE) AND 03556 (direction ISNT CANON_COUNTERCLOCKWISE)), 03557 NCE_SPINDLE_NOT_TURNING_IN_G87); 03558 03559 cycle_traverse(plane, offset_x, offset_y, r); 03560 STOP_SPINDLE_TURNING(); 03561 ORIENT_SPINDLE(0.0, direction); 03562 cycle_traverse(plane, offset_x, offset_y, bottom_z); 03563 cycle_traverse(plane, x, y, bottom_z); 03564 if (direction IS CANON_CLOCKWISE) 03565 START_SPINDLE_CLOCKWISE(); 03566 else 03567 START_SPINDLE_COUNTERCLOCKWISE(); 03568 cycle_feed(plane, x, y, middle_z); 03569 cycle_feed(plane, x, y, bottom_z); 03570 STOP_SPINDLE_TURNING(); 03571 ORIENT_SPINDLE(0.0, direction); 03572 cycle_traverse(plane, offset_x, offset_y, bottom_z); 03573 cycle_traverse(plane, offset_x, offset_y, clear_z); 03574 cycle_traverse(plane, x, y, clear_z); 03575 if (direction IS CANON_CLOCKWISE) 03576 START_SPINDLE_CLOCKWISE(); 03577 else 03578 START_SPINDLE_COUNTERCLOCKWISE(); 03579 03580 return RS274NGC_OK; 03581 } |
|
Definition at line 3613 of file rs274ngc_pre.cc. 03620 { 03621 static char name[] SET_TO "convert_cycle_g88"; 03622 03623 CHK(((direction ISNT CANON_CLOCKWISE) AND 03624 (direction ISNT CANON_COUNTERCLOCKWISE)), 03625 NCE_SPINDLE_NOT_TURNING_IN_G88); 03626 03627 cycle_feed(plane, x, y, bottom_z); 03628 DWELL(dwell); 03629 STOP_SPINDLE_TURNING(); 03630 PROGRAM_STOP(); /* operator retracts the spindle here */ 03631 if (direction IS CANON_CLOCKWISE) 03632 START_SPINDLE_CLOCKWISE(); 03633 else 03634 START_SPINDLE_COUNTERCLOCKWISE(); 03635 03636 return RS274NGC_OK; 03637 } |
|
Definition at line 3663 of file rs274ngc_pre.cc. 03670 { 03671 static char name[] SET_TO "convert_cycle_g89"; 03672 03673 cycle_feed(plane, x, y, bottom_z); 03674 DWELL(dwell); 03675 cycle_feed(plane, x, y, clear_z); 03676 03677 return RS274NGC_OK; 03678 } |
|
Definition at line 3797 of file rs274ngc_pre.cc. 03801 { 03802 static char name[] SET_TO "convert_cycle_xy"; 03803 double aa; 03804 double aa_increment; 03805 double bb; 03806 double bb_increment; 03807 double cc; 03808 double clear_cc; 03809 double i; 03810 double j; 03811 double k; 03812 double old_cc; 03813 CANON_PLANE plane; 03814 double r; 03815 int repeat; 03816 CANON_MOTION_MODE save_mode; 03817 int status; 03818 03819 plane SET_TO CANON_PLANE_XY; 03820 if (settings->motion_mode ISNT motion) 03821 { 03822 CHK((block->z_flag IS OFF), 03823 NCE_Z_VALUE_UNSPECIFIED_IN_XY_PLANE_CANNED_CYCLE); 03824 } 03825 block->z_number SET_TO 03826 block->z_flag IS ON ? block->z_number : settings->cycle_cc; 03827 old_cc SET_TO settings->current_z; 03828 03829 if (settings->distance_mode IS MODE_ABSOLUTE) 03830 { 03831 aa_increment SET_TO 0.0; 03832 bb_increment SET_TO 0.0; 03833 r SET_TO block->r_number; 03834 cc SET_TO block->z_number; 03835 aa SET_TO block->x_flag IS ON ? block->x_number : settings->current_x; 03836 bb SET_TO block->y_flag IS ON ? block->y_number : settings->current_y; 03837 } 03838 else if (settings->distance_mode IS MODE_INCREMENTAL) 03839 { 03840 aa_increment SET_TO block->x_number; 03841 bb_increment SET_TO block->y_number; 03842 r SET_TO (block->r_number + old_cc); 03843 cc SET_TO (r + block->z_number); /* [NCMS, page 98] */ 03844 aa SET_TO settings->current_x; 03845 bb SET_TO settings->current_y; 03846 } 03847 else 03848 ERM(NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91); 03849 CHK((r < cc), NCE_R_LESS_THAN_Z_IN_CYCLE_IN_XY_PLANE); 03850 03851 if (old_cc < r) 03852 { 03853 STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, r 03854 #ifdef AA 03855 , settings->AA_current 03856 #else 03857 #ifdef ALL_AXES 03858 , 0 03859 #endif 03860 #endif 03861 #ifdef BB 03862 , settings->BB_current 03863 #else 03864 #ifdef ALL_AXES 03865 , 0 03866 #endif 03867 #endif 03868 #ifdef CC 03869 , settings->CC_current 03870 #else 03871 #ifdef ALL_AXES 03872 , 0 03873 #endif 03874 #endif 03875 ); 03876 old_cc SET_TO r; 03877 } 03878 clear_cc SET_TO (settings->retract_mode IS R_PLANE) ? r : old_cc; 03879 03880 save_mode SET_TO GET_EXTERNAL_MOTION_CONTROL_MODE(); 03881 if (save_mode ISNT CANON_EXACT_PATH) 03882 SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH); 03883 03884 switch(motion) 03885 { 03886 case G_81: 03887 CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_XY, aa, bb, clear_cc, cc)) 03888 break; 03889 case G_82: 03890 CHK(((settings->motion_mode ISNT G_82) AND (block->p_number IS -1.0)), 03891 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82); 03892 block->p_number SET_TO 03893 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 03894 CYCLE_MACRO(convert_cycle_g82 (CANON_PLANE_XY, aa, bb, clear_cc, cc, 03895 block->p_number)) 03896 settings->cycle_p SET_TO block->p_number; 03897 break; 03898 case G_83: 03899 CHK(((settings->motion_mode ISNT G_83) AND (block->q_number IS -1.0)), 03900 NCE_Q_WORD_MISSING_WITH_G83); 03901 block->q_number SET_TO 03902 block->q_number IS -1.0 ? settings->cycle_q : block->q_number; 03903 CYCLE_MACRO(convert_cycle_g83 (CANON_PLANE_XY, aa, bb, r, clear_cc, cc, 03904 block->q_number)) 03905 settings->cycle_q SET_TO block->q_number; 03906 break; 03907 case G_84: 03908 CYCLE_MACRO(convert_cycle_g84 (CANON_PLANE_XY, aa, bb, clear_cc, cc, 03909 settings->spindle_turning, settings->speed_feed_mode)) 03910 break; 03911 case G_85: 03912 CYCLE_MACRO(convert_cycle_g85 (CANON_PLANE_XY, aa, bb, clear_cc, cc)) 03913 break; 03914 case G_86: 03915 CHK(((settings->motion_mode ISNT G_86) AND (block->p_number IS -1.0)), 03916 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86); 03917 block->p_number SET_TO 03918 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 03919 CYCLE_MACRO(convert_cycle_g86 (CANON_PLANE_XY, aa, bb, clear_cc, cc, 03920 block->p_number, settings->spindle_turning)) 03921 settings->cycle_p SET_TO block->p_number; 03922 break; 03923 case G_87: 03924 if (settings->motion_mode ISNT G_87) 03925 { 03926 CHK((block->i_flag IS OFF), NCE_I_WORD_MISSING_WITH_G87); 03927 CHK((block->j_flag IS OFF), NCE_J_WORD_MISSING_WITH_G87); 03928 CHK((block->k_flag IS OFF), NCE_K_WORD_MISSING_WITH_G87); 03929 } 03930 i SET_TO block->i_flag IS ON ? block->i_number : settings->cycle_i; 03931 j SET_TO block->j_flag IS ON ? block->j_number : settings->cycle_j; 03932 k SET_TO block->k_flag IS ON ? block->k_number : settings->cycle_k; 03933 settings->cycle_i SET_TO i; 03934 settings->cycle_j SET_TO j; 03935 settings->cycle_k SET_TO k; 03936 if (settings->distance_mode IS MODE_INCREMENTAL) 03937 { 03938 k SET_TO (cc + k); /* k always absolute in function call below */ 03939 } 03940 CYCLE_MACRO(convert_cycle_g87 (CANON_PLANE_XY, aa, (aa + i), bb, 03941 (bb + j), r, clear_cc, k, cc, settings->spindle_turning)) 03942 break; 03943 case G_88: 03944 CHK(((settings->motion_mode ISNT G_88) AND (block->p_number IS -1.0)), 03945 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88); 03946 block->p_number SET_TO 03947 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 03948 CYCLE_MACRO(convert_cycle_g88 (CANON_PLANE_XY, aa, bb, cc, 03949 block->p_number, settings->spindle_turning)) 03950 settings->cycle_p SET_TO block->p_number; 03951 break; 03952 case G_89: 03953 CHK(((settings->motion_mode ISNT G_89) AND (block->p_number IS -1.0)), 03954 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89); 03955 block->p_number SET_TO 03956 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 03957 CYCLE_MACRO(convert_cycle_g89 (CANON_PLANE_XY, aa, bb, clear_cc, cc, 03958 block->p_number)) 03959 settings->cycle_p SET_TO block->p_number; 03960 break; 03961 default: 03962 ERM(NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 03963 } 03964 settings->current_x SET_TO aa; /* CYCLE_MACRO updates aa and bb */ 03965 settings->current_y SET_TO bb; 03966 settings->current_z SET_TO clear_cc; 03967 settings->cycle_cc SET_TO block->z_number; 03968 03969 if (save_mode ISNT CANON_EXACT_PATH) 03970 SET_MOTION_CONTROL_MODE(save_mode); 03971 03972 return RS274NGC_OK; 03973 } |
|
Definition at line 4024 of file rs274ngc_pre.cc. 04028 { 04029 static char name[] SET_TO "convert_cycle_yz"; 04030 double aa; 04031 double aa_increment; 04032 double bb; 04033 double bb_increment; 04034 double cc; 04035 double clear_cc; 04036 double i; 04037 double j; 04038 double k; 04039 double old_cc; 04040 CANON_PLANE plane; 04041 double r; 04042 int repeat; 04043 CANON_MOTION_MODE save_mode; 04044 int status; 04045 04046 plane SET_TO CANON_PLANE_YZ; 04047 if (settings->motion_mode ISNT motion) 04048 { 04049 CHK((block->x_flag IS OFF), 04050 NCE_X_VALUE_UNSPECIFIED_IN_YZ_PLANE_CANNED_CYCLE); 04051 } 04052 block->x_number SET_TO 04053 block->x_flag IS ON ? block->x_number : settings->cycle_cc; 04054 old_cc SET_TO settings->current_x; 04055 04056 if (settings->distance_mode IS MODE_ABSOLUTE) 04057 { 04058 aa_increment SET_TO 0.0; 04059 bb_increment SET_TO 0.0; 04060 r SET_TO block->r_number; 04061 cc SET_TO block->x_number; 04062 aa SET_TO block->y_flag IS ON ? block->y_number : settings->current_y; 04063 bb SET_TO block->z_flag IS ON ? block->z_number : settings->current_z; 04064 } 04065 else if (settings->distance_mode IS MODE_INCREMENTAL) 04066 { 04067 aa_increment SET_TO block->y_number; 04068 bb_increment SET_TO block->z_number; 04069 r SET_TO (block->r_number + old_cc); 04070 cc SET_TO (r + block->x_number); /* [NCMS, page 98] */ 04071 aa SET_TO settings->current_y; 04072 bb SET_TO settings->current_z; 04073 } 04074 else 04075 ERM(NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91); 04076 CHK((r < cc), NCE_R_LESS_THAN_X_IN_CYCLE_IN_YZ_PLANE); 04077 04078 if (old_cc < r) 04079 { 04080 STRAIGHT_TRAVERSE(r, settings->current_y, settings->current_z 04081 #ifdef AA 04082 , settings->AA_current 04083 #else 04084 #ifdef ALL_AXES 04085 , 0 04086 #endif 04087 #endif 04088 #ifdef BB 04089 , settings->BB_current 04090 #else 04091 #ifdef ALL_AXES 04092 , 0 04093 #endif 04094 #endif 04095 #ifdef CC 04096 , settings->CC_current 04097 #else 04098 #ifdef ALL_AXES 04099 , 0 04100 #endif 04101 #endif 04102 ); 04103 old_cc SET_TO r; 04104 } 04105 clear_cc SET_TO (settings->retract_mode IS R_PLANE) ? r : old_cc; 04106 04107 save_mode = GET_EXTERNAL_MOTION_CONTROL_MODE(); 04108 if (save_mode ISNT CANON_EXACT_PATH) 04109 SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH); 04110 04111 switch(motion) 04112 { 04113 case G_81: 04114 CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_YZ, aa, bb, clear_cc, cc)) 04115 break; 04116 case G_82: 04117 CHK(((settings->motion_mode ISNT G_82) AND (block->p_number IS -1.0)), 04118 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82); 04119 block->p_number SET_TO 04120 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04121 CYCLE_MACRO(convert_cycle_g82 (CANON_PLANE_YZ, aa, bb, clear_cc, cc, 04122 block->p_number)) 04123 settings->cycle_p SET_TO block->p_number; 04124 break; 04125 case G_83: 04126 CHK(((settings->motion_mode ISNT G_83) AND (block->q_number IS -1.0)), 04127 NCE_Q_WORD_MISSING_WITH_G83); 04128 block->q_number SET_TO 04129 block->q_number IS -1.0 ? settings->cycle_q : block->q_number; 04130 CYCLE_MACRO(convert_cycle_g83 (CANON_PLANE_YZ, aa, bb, r, clear_cc, cc, 04131 block->q_number)) 04132 settings->cycle_q SET_TO block->q_number; 04133 break; 04134 case G_84: 04135 CYCLE_MACRO(convert_cycle_g84 (CANON_PLANE_YZ, aa, bb, clear_cc, cc, 04136 settings->spindle_turning, settings->speed_feed_mode)) 04137 break; 04138 case G_85: 04139 CYCLE_MACRO(convert_cycle_g85 (CANON_PLANE_YZ, aa, bb, clear_cc, cc)) 04140 break; 04141 case G_86: 04142 CHK(((settings->motion_mode ISNT G_86) AND (block->p_number IS -1.0)), 04143 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86); 04144 block->p_number SET_TO 04145 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04146 CYCLE_MACRO(convert_cycle_g86 (CANON_PLANE_YZ, aa, bb, clear_cc, cc, 04147 block->p_number, settings->spindle_turning)) 04148 settings->cycle_p SET_TO block->p_number; 04149 break; 04150 case G_87: 04151 if (settings->motion_mode ISNT G_87) 04152 { 04153 CHK((block->i_flag IS OFF), NCE_I_WORD_MISSING_WITH_G87); 04154 CHK((block->j_flag IS OFF), NCE_J_WORD_MISSING_WITH_G87); 04155 CHK((block->k_flag IS OFF), NCE_K_WORD_MISSING_WITH_G87); 04156 } 04157 i SET_TO block->i_flag IS ON ? block->i_number : settings->cycle_i; 04158 j SET_TO block->j_flag IS ON ? block->j_number : settings->cycle_j; 04159 k SET_TO block->k_flag IS ON ? block->k_number : settings->cycle_k; 04160 settings->cycle_i SET_TO i; 04161 settings->cycle_j SET_TO j; 04162 settings->cycle_k SET_TO k; 04163 if (settings->distance_mode IS MODE_INCREMENTAL) 04164 { 04165 i SET_TO (cc + i); /* i always absolute in function call below */ 04166 } 04167 CYCLE_MACRO(convert_cycle_g87 (CANON_PLANE_YZ, aa, (aa + j), bb, 04168 (bb + k), r, clear_cc, i, cc, settings->spindle_turning)) 04169 break; 04170 case G_88: 04171 CHK(((settings->motion_mode ISNT G_88) AND (block->p_number IS -1.0)), 04172 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88); 04173 block->p_number SET_TO 04174 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04175 CYCLE_MACRO(convert_cycle_g88 (CANON_PLANE_YZ, aa, bb, cc, 04176 block->p_number, settings->spindle_turning)) 04177 settings->cycle_p SET_TO block->p_number; 04178 break; 04179 case G_89: 04180 CHK(((settings->motion_mode ISNT G_89) AND (block->p_number IS -1.0)), 04181 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89); 04182 block->p_number SET_TO 04183 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04184 CYCLE_MACRO(convert_cycle_g89 (CANON_PLANE_YZ, aa, bb, clear_cc, cc, 04185 block->p_number)) 04186 settings->cycle_p SET_TO block->p_number; 04187 break; 04188 default: 04189 ERM(NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 04190 } 04191 settings->current_y SET_TO aa; /* CYCLE_MACRO updates aa and bb */ 04192 settings->current_z SET_TO bb; 04193 settings->current_x SET_TO clear_cc; 04194 settings->cycle_cc SET_TO block->x_number; 04195 04196 if (save_mode ISNT CANON_EXACT_PATH) 04197 SET_MOTION_CONTROL_MODE(save_mode); 04198 04199 return RS274NGC_OK; 04200 } |
|
Definition at line 4259 of file rs274ngc_pre.cc. 04263 { 04264 static char name[] SET_TO "convert_cycle_zx"; 04265 double aa; 04266 double aa_increment; 04267 double bb; 04268 double bb_increment; 04269 double cc; 04270 double clear_cc; 04271 double i; 04272 double j; 04273 double k; 04274 double old_cc; 04275 CANON_PLANE plane; 04276 double r; 04277 int repeat; 04278 CANON_MOTION_MODE save_mode; 04279 int status; 04280 04281 plane SET_TO CANON_PLANE_XZ; 04282 if (settings->motion_mode ISNT motion) 04283 { 04284 CHK((block->y_flag IS OFF), 04285 NCE_Y_VALUE_UNSPECIFIED_IN_XZ_PLANE_CANNED_CYCLE); 04286 } 04287 block->y_number SET_TO 04288 block->y_flag IS ON ? block->y_number : settings->cycle_cc; 04289 old_cc SET_TO settings->current_y; 04290 04291 if (settings->distance_mode IS MODE_ABSOLUTE) 04292 { 04293 aa_increment SET_TO 0.0; 04294 bb_increment SET_TO 0.0; 04295 r SET_TO block->r_number; 04296 cc SET_TO block->y_number; 04297 aa SET_TO block->z_flag IS ON ? block->z_number : settings->current_z; 04298 bb SET_TO block->x_flag IS ON ? block->x_number : settings->current_x; 04299 } 04300 else if (settings->distance_mode IS MODE_INCREMENTAL) 04301 { 04302 aa_increment SET_TO block->z_number; 04303 bb_increment SET_TO block->x_number; 04304 r SET_TO (block->r_number + old_cc); 04305 cc SET_TO (r + block->y_number); /* [NCMS, page 98] */ 04306 aa SET_TO settings->current_z; 04307 bb SET_TO settings->current_x; 04308 } 04309 else 04310 ERM(NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91); 04311 CHK((r < cc), NCE_R_LESS_THAN_Y_IN_CYCLE_IN_XZ_PLANE); 04312 04313 if (old_cc < r) 04314 { 04315 STRAIGHT_TRAVERSE(settings->current_x, r, settings->current_z 04316 #ifdef AA 04317 , settings->AA_current 04318 #else 04319 #ifdef ALL_AXES 04320 , 0 04321 #endif 04322 #endif 04323 #ifdef BB 04324 , settings->BB_current 04325 #else 04326 #ifdef ALL_AXES 04327 , 0 04328 #endif 04329 #endif 04330 #ifdef CC 04331 , settings->CC_current 04332 #else 04333 #ifdef ALL_AXES 04334 , 0 04335 #endif 04336 #endif 04337 ); 04338 old_cc SET_TO r; 04339 } 04340 clear_cc SET_TO (settings->retract_mode IS R_PLANE) ? r : old_cc; 04341 04342 save_mode = GET_EXTERNAL_MOTION_CONTROL_MODE(); 04343 if (save_mode ISNT CANON_EXACT_PATH) 04344 SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH); 04345 04346 switch(motion) 04347 { 04348 case G_81: 04349 CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_XZ, aa, bb, clear_cc, cc)) 04350 break; 04351 case G_82: 04352 CHK(((settings->motion_mode ISNT G_82) AND (block->p_number IS -1.0)), 04353 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82); 04354 block->p_number SET_TO 04355 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04356 CYCLE_MACRO(convert_cycle_g82 (CANON_PLANE_XZ, aa, bb, clear_cc, cc, 04357 block->p_number)) 04358 settings->cycle_p SET_TO block->p_number; 04359 break; 04360 case G_83: 04361 CHK(((settings->motion_mode ISNT G_83) AND (block->q_number IS -1.0)), 04362 NCE_Q_WORD_MISSING_WITH_G83); 04363 block->q_number SET_TO 04364 block->q_number IS -1.0 ? settings->cycle_q : block->q_number; 04365 CYCLE_MACRO(convert_cycle_g83 (CANON_PLANE_XZ, aa, bb, r, clear_cc, cc, 04366 block->q_number)) 04367 settings->cycle_q SET_TO block->q_number; 04368 break; 04369 case G_84: 04370 CYCLE_MACRO(convert_cycle_g84 (CANON_PLANE_XZ, aa, bb, clear_cc, cc, 04371 settings->spindle_turning, settings->speed_feed_mode)) 04372 break; 04373 case G_85: 04374 CYCLE_MACRO(convert_cycle_g85 (CANON_PLANE_XZ, aa, bb, clear_cc, cc)) 04375 break; 04376 case G_86: 04377 CHK(((settings->motion_mode ISNT G_86) AND (block->p_number IS -1.0)), 04378 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86); 04379 block->p_number SET_TO 04380 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04381 CYCLE_MACRO(convert_cycle_g86 (CANON_PLANE_XZ, aa, bb, clear_cc, cc, 04382 block->p_number, settings->spindle_turning)) 04383 settings->cycle_p SET_TO block->p_number; 04384 break; 04385 case G_87: 04386 if (settings->motion_mode ISNT G_87) 04387 { 04388 CHK((block->i_flag IS OFF), NCE_I_WORD_MISSING_WITH_G87); 04389 CHK((block->j_flag IS OFF), NCE_J_WORD_MISSING_WITH_G87); 04390 CHK((block->k_flag IS OFF), NCE_K_WORD_MISSING_WITH_G87); 04391 } 04392 i SET_TO block->i_flag IS ON ? block->i_number : settings->cycle_i; 04393 j SET_TO block->j_flag IS ON ? block->j_number : settings->cycle_j; 04394 k SET_TO block->k_flag IS ON ? block->k_number : settings->cycle_k; 04395 settings->cycle_i SET_TO i; 04396 settings->cycle_j SET_TO j; 04397 settings->cycle_k SET_TO k; 04398 if (settings->distance_mode IS MODE_INCREMENTAL) 04399 { 04400 j SET_TO (cc + j); /* j always absolute in function call below */ 04401 } 04402 CYCLE_MACRO(convert_cycle_g87 (CANON_PLANE_XZ, aa, (aa + k), bb, 04403 (bb + i), r, clear_cc, j, cc, settings->spindle_turning)) 04404 break; 04405 case G_88: 04406 CHK(((settings->motion_mode ISNT G_88) AND (block->p_number IS -1.0)), 04407 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88); 04408 block->p_number SET_TO 04409 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04410 CYCLE_MACRO(convert_cycle_g88 (CANON_PLANE_XZ, aa, bb, cc, 04411 block->p_number, settings->spindle_turning)) 04412 settings->cycle_p SET_TO block->p_number; 04413 break; 04414 case G_89: 04415 CHK(((settings->motion_mode ISNT G_89) AND (block->p_number IS -1.0)), 04416 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89); 04417 block->p_number SET_TO 04418 block->p_number IS -1.0 ? settings->cycle_p : block->p_number; 04419 CYCLE_MACRO(convert_cycle_g89 (CANON_PLANE_XZ, aa, bb, clear_cc, cc, 04420 block->p_number)) 04421 settings->cycle_p SET_TO block->p_number; 04422 break; 04423 default: 04424 ERM(NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 04425 } 04426 settings->current_z SET_TO aa; /* CYCLE_MACRO updates aa and bb */ 04427 settings->current_x SET_TO bb; 04428 settings->current_y SET_TO clear_cc; 04429 settings->cycle_cc SET_TO block->y_number; 04430 04431 if (save_mode ISNT CANON_EXACT_PATH) 04432 SET_MOTION_CONTROL_MODE(save_mode); 04433 04434 return RS274NGC_OK; 04435 } |
|
Definition at line 4459 of file rs274ngc_pre.cc. 04462 { 04463 static char name[] SET_TO "convert_distance_mode"; 04464 if (g_code IS G_90) 04465 { 04466 if (settings->distance_mode ISNT MODE_ABSOLUTE) 04467 { 04468 #ifdef DEBUG_EMC 04469 COMMENT("interpreter: distance mode changed to absolute"); 04470 #endif 04471 settings->distance_mode SET_TO MODE_ABSOLUTE; 04472 } 04473 } 04474 else if (g_code IS G_91) 04475 { 04476 if (settings->distance_mode ISNT MODE_INCREMENTAL) 04477 { 04478 #ifdef DEBUG_EMC 04479 COMMENT("interpreter: distance mode changed to incremental"); 04480 #endif 04481 settings->distance_mode SET_TO MODE_INCREMENTAL; 04482 } 04483 } 04484 else 04485 ERM(NCE_BUG_CODE_NOT_G90_OR_G91); 04486 return RS274NGC_OK; 04487 } |
|
Definition at line 4502 of file rs274ngc_pre.cc. Referenced by convert_g().
04504 { 04505 DWELL(time); 04506 return RS274NGC_OK; 04507 } |
|
Definition at line 4531 of file rs274ngc_pre.cc. 04534 { 04535 static char name[] SET_TO "convert_feed_mode"; 04536 if (g_code IS G_93) 04537 { 04538 #ifdef DEBUG_EMC 04539 COMMENT("interpreter: feed mode set to inverse time"); 04540 #endif 04541 settings->feed_mode SET_TO INVERSE_TIME; 04542 } 04543 else if (g_code IS G_94) 04544 { 04545 #ifdef DEBUG_EMC 04546 COMMENT("interpreter: feed mode set to units per minute"); 04547 #endif 04548 settings->feed_mode SET_TO UNITS_PER_MINUTE; 04549 } 04550 else 04551 ERM(NCE_BUG_CODE_NOT_G93_OR_G94); 04552 return RS274NGC_OK; 04553 } |
|
Definition at line 4572 of file rs274ngc_pre.cc. 04575 { 04576 SET_FEED_RATE(block->f_number); 04577 settings->feed_rate SET_TO block->f_number; 04578 return RS274NGC_OK; 04579 } |
|
Definition at line 4637 of file rs274ngc_pre.cc. 04640 { 04641 static char name[] SET_TO "convert_g"; 04642 int status; 04643 04644 if (block->g_modes[0] IS G_4) 04645 { 04646 CHP(convert_dwell(block->p_number)); 04647 } 04648 if (block->g_modes[2] ISNT -1) 04649 { 04650 CHP(convert_set_plane(block->g_modes[2], settings)); 04651 } 04652 if (block->g_modes[6] ISNT -1) 04653 { 04654 CHP(convert_length_units(block->g_modes[6], settings)); 04655 } 04656 if (block->g_modes[7] ISNT -1) 04657 { 04658 CHP(convert_cutter_compensation(block->g_modes[7], block, settings)); 04659 } 04660 if (block->g_modes[8] ISNT -1) 04661 { 04662 CHP(convert_tool_length_offset(block->g_modes[8], block, settings)); 04663 } 04664 if (block->g_modes[12] ISNT -1) 04665 { 04666 CHP(convert_coordinate_system(block->g_modes[12], settings)); 04667 } 04668 if (block->g_modes[13] ISNT -1) 04669 { 04670 CHP(convert_control_mode(block->g_modes[13], settings)); 04671 } 04672 if (block->g_modes[3] ISNT -1) 04673 { 04674 CHP(convert_distance_mode(block->g_modes[3], settings)); 04675 } 04676 if (block->g_modes[10] ISNT -1) 04677 { 04678 CHP(convert_retract_mode(block->g_modes[10], settings)); 04679 } 04680 if (block->g_modes[0] ISNT -1) 04681 { 04682 CHP(convert_modal_0(block->g_modes[0], block, settings)); 04683 } 04684 if (block->motion_to_be ISNT -1) 04685 { 04686 CHP(convert_motion(block->motion_to_be, block, settings)); 04687 } 04688 return RS274NGC_OK; 04689 } |
|
Definition at line 4721 of file rs274ngc_pre.cc. 04725 { 04726 static char name[] SET_TO "convert_home"; 04727 double end_x; 04728 double end_y; 04729 double end_z; 04730 #ifdef AA 04731 double AA_end; /*AA*/ 04732 #endif 04733 #ifdef AA 04734 double AA_end2; /*AA*/ 04735 #endif 04736 #ifdef BB 04737 double BB_end; /*BB*/ 04738 #endif 04739 #ifdef BB 04740 double BB_end2; /*BB*/ 04741 #endif 04742 #ifdef CC 04743 double CC_end; /*CC*/ 04744 #endif 04745 #ifdef CC 04746 double CC_end2; /*CC*/ 04747 #endif 04748 double * parameters; 04749 04750 parameters SET_TO settings->parameters; 04751 find_ends(block, settings, &end_x, &end_y, 04752 &end_z 04753 #ifdef AA 04754 , &AA_end 04755 #endif 04756 04757 #ifdef BB 04758 , &BB_end 04759 #endif 04760 04761 #ifdef CC 04762 , &CC_end 04763 #endif 04764 ); 04765 04766 CHK((settings->cutter_comp_side ISNT OFF), 04767 NCE_CANNOT_USE_G28_OR_G30_WITH_CUTTER_RADIUS_COMP); 04768 STRAIGHT_TRAVERSE(end_x, end_y, end_z 04769 #ifdef AA 04770 , AA_end 04771 #else 04772 #ifdef ALL_AXES 04773 , 0 04774 #endif 04775 #endif 04776 #ifdef BB 04777 , BB_end 04778 #else 04779 #ifdef ALL_AXES 04780 , 0 04781 #endif 04782 #endif 04783 #ifdef CC 04784 , CC_end 04785 #else 04786 #ifdef ALL_AXES 04787 , 0 04788 #endif 04789 #endif 04790 ); 04791 if (move IS G_28) 04792 { 04793 find_relative 04794 (parameters[5161], parameters[5162], parameters[5163], 04795 #ifdef AA 04796 parameters[5164], /*AA*/ 04797 #endif 04798 #ifdef BB 04799 parameters[5165], /*BB*/ 04800 #endif 04801 #ifdef CC 04802 parameters[5166], /*CC*/ 04803 #endif 04804 &end_x, &end_y, &end_z 04805 #ifdef AA 04806 , &AA_end2 04807 #endif 04808 04809 #ifdef BB 04810 , &BB_end2 04811 #endif 04812 04813 #ifdef CC 04814 , &CC_end2 04815 #endif 04816 , settings); 04817 } 04818 else if (move IS G_30) 04819 { 04820 find_relative 04821 (parameters[5181], parameters[5182], parameters[5183], 04822 #ifdef AA 04823 parameters[5184], /*AA*/ 04824 #endif 04825 #ifdef BB 04826 parameters[5185], /*BB*/ 04827 #endif 04828 #ifdef CC 04829 parameters[5186], /*CC*/ 04830 #endif 04831 &end_x, &end_y, &end_z 04832 #ifdef AA 04833 , &AA_end2 04834 #endif 04835 04836 #ifdef BB 04837 , &BB_end2 04838 #endif 04839 04840 #ifdef CC 04841 , &CC_end2 04842 #endif 04843 , settings); 04844 } 04845 else 04846 ERM(NCE_BUG_CODE_NOT_G28_OR_G30); 04847 STRAIGHT_TRAVERSE(end_x, end_y, end_z 04848 #ifdef AA 04849 , AA_end 04850 #else 04851 #ifdef ALL_AXES 04852 , 0 04853 #endif 04854 #endif 04855 #ifdef BB 04856 , BB_end 04857 #else 04858 #ifdef ALL_AXES 04859 , 0 04860 #endif 04861 #endif 04862 #ifdef CC 04863 , CC_end 04864 #else 04865 #ifdef ALL_AXES 04866 , 0 04867 #endif 04868 #endif 04869 ); 04870 settings->current_x SET_TO end_x; 04871 settings->current_y SET_TO end_y; 04872 settings->current_z SET_TO end_z; 04873 #ifdef AA 04874 settings->AA_current SET_TO AA_end2; /*AA*/ 04875 #endif 04876 #ifdef BB 04877 settings->BB_current SET_TO BB_end2; /*BB*/ 04878 #endif 04879 #ifdef CC 04880 settings->CC_current SET_TO CC_end2; /*CC*/ 04881 #endif 04882 return RS274NGC_OK; 04883 } |
|
Definition at line 4927 of file rs274ngc_pre.cc. 04930 { 04931 static char name[] SET_TO "convert_length_units"; 04932 CHK((settings->cutter_comp_side ISNT OFF), 04933 NCE_CANNOT_CHANGE_UNITS_WITH_CUTTER_RADIUS_COMP); 04934 if (g_code IS G_20) 04935 { 04936 USE_LENGTH_UNITS(CANON_UNITS_INCHES); 04937 if (settings->length_units ISNT CANON_UNITS_INCHES) 04938 { 04939 settings->length_units SET_TO CANON_UNITS_INCHES; 04940 settings->current_x SET_TO (settings->current_x * INCH_PER_MM); 04941 settings->current_y SET_TO (settings->current_y * INCH_PER_MM); 04942 settings->current_z SET_TO (settings->current_z * INCH_PER_MM); 04943 settings->axis_offset_x SET_TO 04944 (settings->axis_offset_x * INCH_PER_MM); 04945 settings->axis_offset_y SET_TO 04946 (settings->axis_offset_y * INCH_PER_MM); 04947 settings->axis_offset_z SET_TO 04948 (settings->axis_offset_z * INCH_PER_MM); 04949 settings->origin_offset_x SET_TO 04950 (settings->origin_offset_x * INCH_PER_MM); 04951 settings->origin_offset_y SET_TO 04952 (settings->origin_offset_y * INCH_PER_MM); 04953 settings->origin_offset_z SET_TO 04954 (settings->origin_offset_z * INCH_PER_MM); 04955 } 04956 } 04957 else if (g_code IS G_21) 04958 { 04959 USE_LENGTH_UNITS(CANON_UNITS_MM); 04960 if (settings->length_units ISNT CANON_UNITS_MM) 04961 { 04962 settings->length_units SET_TO CANON_UNITS_MM; 04963 settings->current_x SET_TO (settings->current_x * MM_PER_INCH); 04964 settings->current_y SET_TO (settings->current_y * MM_PER_INCH); 04965 settings->current_z SET_TO (settings->current_z * MM_PER_INCH); 04966 settings->axis_offset_x SET_TO 04967 (settings->axis_offset_x * MM_PER_INCH); 04968 settings->axis_offset_y SET_TO 04969 (settings->axis_offset_y * MM_PER_INCH); 04970 settings->axis_offset_z SET_TO 04971 (settings->axis_offset_z * MM_PER_INCH); 04972 settings->origin_offset_x SET_TO 04973 (settings->origin_offset_x * MM_PER_INCH); 04974 settings->origin_offset_y SET_TO 04975 (settings->origin_offset_y * MM_PER_INCH); 04976 settings->origin_offset_z SET_TO 04977 (settings->origin_offset_z * MM_PER_INCH); 04978 } 04979 } 04980 else 04981 ERM(NCE_BUG_CODE_NOT_G20_OR_G21); 04982 return RS274NGC_OK; 04983 } |
|
Definition at line 5013 of file rs274ngc_pre.cc. 05016 { 05017 static char name[] SET_TO "convert_m"; 05018 int status; 05019 05020 if (block->m_modes[6] ISNT -1) 05021 { 05022 CHP(convert_tool_change(settings)); 05023 } 05024 05025 if (block->m_modes[7] IS 3) 05026 { 05027 START_SPINDLE_CLOCKWISE(); 05028 settings->spindle_turning SET_TO CANON_CLOCKWISE; 05029 } 05030 else if (block->m_modes[7] IS 4) 05031 { 05032 START_SPINDLE_COUNTERCLOCKWISE(); 05033 settings->spindle_turning SET_TO CANON_COUNTERCLOCKWISE; 05034 } 05035 else if (block->m_modes[7] IS 5) 05036 { 05037 STOP_SPINDLE_TURNING(); 05038 settings->spindle_turning SET_TO CANON_STOPPED; 05039 } 05040 05041 if (block->m_modes[8] IS 7) 05042 { 05043 MIST_ON(); 05044 settings->mist SET_TO ON; 05045 } 05046 else if (block->m_modes[8] IS 8) 05047 { 05048 FLOOD_ON(); 05049 settings->flood SET_TO ON; 05050 } 05051 else if (block->m_modes[8] IS 9) 05052 { 05053 MIST_OFF(); 05054 settings->mist SET_TO OFF; 05055 FLOOD_OFF(); 05056 settings->flood SET_TO OFF; 05057 } 05058 05059 /* No axis clamps in this version 05060 if (block->m_modes[2] IS 26) 05061 { 05062 #ifdef DEBUG_EMC 05063 COMMENT("interpreter: automatic A-axis clamping turned on"); 05064 #endif 05065 settings->a_axis_clamping SET_TO ON; 05066 } 05067 else if (block->m_modes[2] IS 27) 05068 { 05069 #ifdef DEBUG_EMC 05070 COMMENT("interpreter: automatic A-axis clamping turned off"); 05071 #endif 05072 settings->a_axis_clamping SET_TO OFF; 05073 } 05074 */ 05075 05076 if (block->m_modes[9] IS 48) 05077 { 05078 ENABLE_FEED_OVERRIDE(); 05079 ENABLE_SPEED_OVERRIDE(); 05080 settings->feed_override SET_TO ON; 05081 settings->speed_override SET_TO ON; 05082 } 05083 else if (block->m_modes[9] IS 49) 05084 { 05085 DISABLE_FEED_OVERRIDE(); 05086 DISABLE_SPEED_OVERRIDE(); 05087 settings->feed_override SET_TO OFF; 05088 settings->speed_override SET_TO OFF; 05089 } 05090 05091 return RS274NGC_OK; 05092 } |
|
Definition at line 5119 of file rs274ngc_pre.cc. 05123 { 05124 static char name[] SET_TO "convert_modal_0"; 05125 int status; 05126 05127 if (code IS G_10) 05128 { 05129 CHP(convert_setup(block, settings)); 05130 } 05131 else if ((code IS G_28) OR (code IS G_30)) 05132 { 05133 CHP(convert_home(code, block, settings)); 05134 } 05135 else if ((code IS G_92) OR (code IS G_92_1) OR 05136 (code IS G_92_2) OR (code IS G_92_3)) 05137 { 05138 CHP(convert_axis_offsets(code, block, settings)); 05139 } 05140 else if ((code IS G_4) OR (code IS G_53)); /* handled elsewhere */ 05141 else 05142 ERM(NCE_BUG_CODE_NOT_G4_G10_G28_G30_G53_OR_G92_SERIES); 05143 return RS274NGC_OK; 05144 } |
|
Definition at line 5169 of file rs274ngc_pre.cc. 05173 { 05174 static char name[] SET_TO "convert_motion"; 05175 int status; 05176 05177 if ((motion IS G_0) OR (motion IS G_1)) 05178 { 05179 CHP(convert_straight(motion, block, settings)); 05180 } 05181 else if ((motion IS G_3) OR (motion IS G_2)) 05182 { 05183 CHP(convert_arc(motion, block, settings)); 05184 } 05185 else if (motion IS G_38_2) 05186 { 05187 CHP(convert_probe(block, settings)); 05188 } 05189 else if (motion IS G_80) 05190 { 05191 #ifdef DEBUG_EMC 05192 COMMENT("interpreter: motion mode set to none"); 05193 #endif 05194 settings->motion_mode SET_TO G_80; 05195 } 05196 else if ((motion > G_80) AND (motion < G_90)) 05197 { 05198 CHP(convert_cycle(motion, block, settings)); 05199 } 05200 else 05201 ERM(NCE_BUG_UNKNOWN_MOTION_CODE); 05202 05203 return RS274NGC_OK; 05204 } |
|
Definition at line 5243 of file rs274ngc_pre.cc. 05246 { 05247 static char name[] SET_TO "convert_probe"; 05248 double distance; 05249 double end_x; 05250 double end_y; 05251 double end_z; 05252 #ifdef AA 05253 double AA_end; /*AA*/ 05254 #endif 05255 #ifdef BB 05256 double BB_end; /*BB*/ 05257 #endif 05258 #ifdef CC 05259 double CC_end; /*CC*/ 05260 #endif 05261 05262 CHK((((block->x_flag IS OFF) AND (block->y_flag IS OFF)) AND 05263 (block->z_flag IS OFF)), NCE_X_Y_AND_Z_WORDS_ALL_MISSING_WITH_G38_2); 05264 CHK((settings->feed_mode IS INVERSE_TIME), 05265 NCE_CANNOT_PROBE_IN_INVERSE_TIME_FEED_MODE); 05266 CHK((settings->cutter_comp_side ISNT OFF), 05267 NCE_CANNOT_PROBE_WITH_CUTTER_RADIUS_COMP_ON); 05268 CHK((settings->feed_rate IS 0.0), NCE_CANNOT_PROBE_WITH_ZERO_FEED_RATE); 05269 find_ends(block, settings, &end_x, &end_y, 05270 &end_z 05271 #ifdef AA 05272 , &AA_end 05273 #endif 05274 05275 #ifdef BB 05276 , &BB_end 05277 #endif 05278 05279 #ifdef CC 05280 , &CC_end 05281 #endif 05282 ); 05283 if (0 05284 #ifdef AA 05285 OR (AA_end ISNT settings->AA_current) /*AA*/ 05286 #endif 05287 #ifdef BB 05288 OR (BB_end ISNT settings->BB_current) /*BB*/ 05289 #endif 05290 #ifdef CC 05291 OR (CC_end ISNT settings->CC_current) /*CC*/ 05292 #endif 05293 ) 05294 ERM(NCE_CANNOT_MOVE_ROTARY_AXES_DURING_PROBING); 05295 distance SET_TO sqrt(pow((settings->current_x - end_x), 2) + 05296 pow((settings->current_y - end_y), 2) + 05297 pow((settings->current_z - end_z), 2)); 05298 CHK((distance < ((settings->length_units IS CANON_UNITS_MM) ? 0.254 : 0.01)), 05299 NCE_START_POINT_TOO_CLOSE_TO_PROBE_POINT); 05300 TURN_PROBE_ON(); 05301 STRAIGHT_PROBE(end_x, end_y, end_z 05302 #ifdef AA 05303 , AA_end 05304 #else 05305 #ifdef ALL_AXES 05306 , 0 05307 #endif 05308 #endif 05309 #ifdef BB 05310 , BB_end 05311 #else 05312 #ifdef ALL_AXES 05313 , 0 05314 #endif 05315 #endif 05316 #ifdef CC 05317 , CC_end 05318 #else 05319 #ifdef ALL_AXES 05320 , 0 05321 #endif 05322 #endif 05323 ); 05324 TURN_PROBE_OFF(); 05325 settings->motion_mode SET_TO G_38_2; 05326 settings->probe_flag SET_TO ON; 05327 return RS274NGC_OK; 05328 } |
|
Definition at line 5351 of file rs274ngc_pre.cc. 05354 { 05355 static char name[] SET_TO "convert_retract_mode"; 05356 if (g_code IS G_98) 05357 { 05358 #ifdef DEBUG_EMC 05359 COMMENT("interpreter: retract mode set to old_z"); 05360 #endif 05361 settings->retract_mode SET_TO OLD_Z; 05362 } 05363 else if (g_code IS G_99) 05364 { 05365 #ifdef DEBUG_EMC 05366 COMMENT("interpreter: retract mode set to r_plane"); 05367 #endif 05368 settings->retract_mode SET_TO R_PLANE; 05369 } 05370 else 05371 ERM(NCE_BUG_CODE_NOT_G98_OR_G99); 05372 return RS274NGC_OK; 05373 } |
|
Definition at line 5588 of file rs274ngc_pre.cc. 05591 { 05592 static char name[] SET_TO "convert_set_plane"; 05593 if (g_code IS G_17) 05594 { 05595 SELECT_PLANE(CANON_PLANE_XY); 05596 settings->plane SET_TO CANON_PLANE_XY; 05597 } 05598 else if (g_code IS G_18) 05599 { 05600 CHK((settings->cutter_comp_side ISNT OFF), 05601 NCE_CANNOT_USE_XZ_PLANE_WITH_CUTTER_RADIUS_COMP); 05602 SELECT_PLANE(CANON_PLANE_XZ); 05603 settings->plane SET_TO CANON_PLANE_XZ; 05604 } 05605 else if (g_code IS G_19) 05606 { 05607 CHK((settings->cutter_comp_side ISNT OFF), 05608 NCE_CANNOT_USE_YZ_PLANE_WITH_CUTTER_RADIUS_COMP); 05609 SELECT_PLANE(CANON_PLANE_YZ); 05610 settings->plane SET_TO CANON_PLANE_YZ; 05611 } 05612 else 05613 ERM(NCE_BUG_CODE_NOT_G17_G18_OR_G19); 05614 return RS274NGC_OK; 05615 } |
|
Definition at line 5403 of file rs274ngc_pre.cc. Referenced by convert_modal_0().
05406 { 05407 static char name[] SET_TO "convert_setup"; 05408 double x; 05409 double y; 05410 double z; 05411 #ifdef AA 05412 double a; /*AA*/ 05413 #endif 05414 #ifdef BB 05415 double b; /*BB*/ 05416 #endif 05417 #ifdef CC 05418 double c; /*CC*/ 05419 #endif 05420 double * parameters; 05421 int p_int; 05422 05423 parameters SET_TO settings->parameters; 05424 p_int SET_TO (int)(block->p_number + 0.0001); 05425 05426 if (block->x_flag IS ON) 05427 { 05428 x SET_TO block->x_number; 05429 parameters[5201 + (p_int * 20)] SET_TO x; 05430 } 05431 else 05432 x SET_TO parameters[5201 + (p_int * 20)]; 05433 05434 if (block->y_flag IS ON) 05435 { 05436 y SET_TO block->y_number; 05437 parameters[5202 + (p_int * 20)] SET_TO y; 05438 } 05439 else 05440 y SET_TO parameters[5202 + (p_int * 20)]; 05441 if (block->z_flag IS ON) 05442 { 05443 z SET_TO block->z_number; 05444 parameters[5203 + (p_int * 20)] SET_TO z; 05445 } 05446 else 05447 z SET_TO parameters[5203 + (p_int * 20)]; 05448 05449 #ifdef AA 05450 if (block->a_flag IS ON) 05451 { 05452 a SET_TO block->a_number; 05453 parameters[5204 + (p_int * 20)] SET_TO a; 05454 } 05455 else 05456 a SET_TO parameters[5204 + (p_int * 20)]; 05457 #endif 05458 05459 #ifdef BB 05460 if (block->b_flag IS ON) 05461 { 05462 b SET_TO block->b_number; 05463 parameters[5205 + (p_int * 20)] SET_TO b; 05464 } 05465 else 05466 b SET_TO parameters[5205 + (p_int * 20)]; 05467 #endif 05468 05469 #ifdef CC 05470 if (block->c_flag IS ON) 05471 { 05472 c SET_TO block->c_number; 05473 parameters[5206 + (p_int * 20)] SET_TO c; 05474 } 05475 else 05476 c SET_TO parameters[5206 + (p_int * 20)]; 05477 #endif 05478 05479 /* axis offsets could be included in the two sets of calculations for 05480 current_x, current_y, etc., but do not need to be because the results 05481 would be the same. They would be added in then subtracted out. */ 05482 if (p_int IS settings->origin_index) /* system is currently used */ 05483 { 05484 settings->current_x SET_TO 05485 (settings->current_x + settings->origin_offset_x); 05486 settings->current_y SET_TO 05487 (settings->current_y + settings->origin_offset_y); 05488 settings->current_z SET_TO 05489 (settings->current_z + settings->origin_offset_z); 05490 #ifdef AA 05491 settings->AA_current SET_TO /*AA*/ 05492 #endif 05493 #ifdef AA 05494 (settings->AA_current + settings->AA_origin_offset); /*AA*/ 05495 #endif 05496 #ifdef BB 05497 settings->BB_current SET_TO /*BB*/ 05498 #endif 05499 #ifdef BB 05500 (settings->BB_current + settings->BB_origin_offset); /*BB*/ 05501 #endif 05502 #ifdef CC 05503 settings->CC_current SET_TO /*CC*/ 05504 #endif 05505 #ifdef CC 05506 (settings->CC_current + settings->CC_origin_offset); /*CC*/ 05507 #endif 05508 05509 settings->origin_offset_x SET_TO x; 05510 settings->origin_offset_y SET_TO y; 05511 settings->origin_offset_z SET_TO z; 05512 #ifdef AA 05513 settings->AA_origin_offset SET_TO a; /*AA*/ 05514 #endif 05515 #ifdef BB 05516 settings->BB_origin_offset SET_TO b; /*BB*/ 05517 #endif 05518 #ifdef CC 05519 settings->CC_origin_offset SET_TO c; /*CC*/ 05520 #endif 05521 05522 settings->current_x SET_TO (settings->current_x - x); 05523 settings->current_y SET_TO (settings->current_y - y); 05524 settings->current_z SET_TO (settings->current_z - z); 05525 #ifdef AA 05526 settings->AA_current SET_TO (settings->AA_current - a); /*AA*/ 05527 #endif 05528 #ifdef BB 05529 settings->BB_current SET_TO (settings->BB_current - b); /*BB*/ 05530 #endif 05531 #ifdef CC 05532 settings->CC_current SET_TO (settings->CC_current - c); /*CC*/ 05533 #endif 05534 05535 SET_ORIGIN_OFFSETS(x + settings->axis_offset_x, 05536 y + settings->axis_offset_y, 05537 z + settings->axis_offset_z 05538 #ifdef AA 05539 , a + settings->AA_axis_offset 05540 #else 05541 #ifdef ALL_AXES 05542 , 0 05543 #endif 05544 #endif 05545 #ifdef BB 05546 , b + settings->BB_axis_offset 05547 #else 05548 #ifdef ALL_AXES 05549 , 0 05550 #endif 05551 #endif 05552 #ifdef CC 05553 , c + settings->CC_axis_offset 05554 #else 05555 #ifdef ALL_AXES 05556 , 0 05557 #endif 05558 #endif 05559 ); 05560 } 05561 #ifdef DEBUG_EMC 05562 else 05563 COMMENT("interpreter: setting coordinate system origin"); 05564 #endif 05565 return RS274NGC_OK; 05566 } |
|
Definition at line 5632 of file rs274ngc_pre.cc. 05635 { 05636 SET_SPINDLE_SPEED(block->s_number); 05637 settings->speed SET_TO block->s_number; 05638 return RS274NGC_OK; 05639 } |
|
Definition at line 5704 of file rs274ngc_pre.cc. 05707 { 05708 static char name[] SET_TO "convert_stop"; 05709 int index; 05710 char * line; 05711 int length; 05712 05713 if (block->m_modes[4] IS 0) 05714 { 05715 PROGRAM_STOP(); 05716 } 05717 else if (block->m_modes[4] IS 60) 05718 { 05719 PALLET_SHUTTLE(); 05720 PROGRAM_STOP(); 05721 } 05722 else if (block->m_modes[4] IS 1) 05723 { 05724 OPTIONAL_PROGRAM_STOP(); 05725 } 05726 else if ((block->m_modes[4] IS 2) OR (block->m_modes[4] IS 30)) 05727 { /* reset stuff here */ 05728 /*1*/ 05729 settings->current_x SET_TO settings->current_x 05730 + settings->origin_offset_x + settings->axis_offset_x; 05731 settings->current_y SET_TO settings->current_y 05732 + settings->origin_offset_y + settings->axis_offset_y; 05733 settings->current_z SET_TO settings->current_z 05734 + settings->origin_offset_z + settings->axis_offset_z; 05735 #ifdef AA 05736 settings->AA_current SET_TO settings->AA_current /*AA*/ 05737 #endif 05738 #ifdef AA 05739 + settings->AA_origin_offset + settings->AA_axis_offset; /*AA*/ 05740 #endif 05741 #ifdef BB 05742 settings->BB_current SET_TO settings->BB_current /*BB*/ 05743 #endif 05744 #ifdef BB 05745 + settings->BB_origin_offset + settings->BB_axis_offset; /*BB*/ 05746 #endif 05747 #ifdef CC 05748 settings->CC_current SET_TO settings->CC_current /*CC*/ 05749 #endif 05750 #ifdef CC 05751 + settings->CC_origin_offset + settings->CC_axis_offset; /*CC*/ 05752 #endif 05753 05754 settings->origin_index SET_TO 1; 05755 settings->parameters[5220] SET_TO 1.0; 05756 settings->origin_offset_x SET_TO settings->parameters[5221]; 05757 settings->origin_offset_y SET_TO settings->parameters[5222]; 05758 settings->origin_offset_z SET_TO settings->parameters[5223]; 05759 #ifdef AA 05760 settings->AA_origin_offset SET_TO settings->parameters[5224]; /*AA*/ 05761 #endif 05762 #ifdef BB 05763 settings->BB_origin_offset SET_TO settings->parameters[5225]; /*BB*/ 05764 #endif 05765 #ifdef CC 05766 settings->CC_origin_offset SET_TO settings->parameters[5226]; /*CC*/ 05767 #endif 05768 05769 settings->axis_offset_x SET_TO 0; 05770 settings->axis_offset_x SET_TO 0; 05771 settings->axis_offset_x SET_TO 0; 05772 #ifdef AA 05773 settings->AA_axis_offset SET_TO 0; /*AA*/ 05774 #endif 05775 #ifdef BB 05776 settings->BB_axis_offset SET_TO 0; /*BB*/ 05777 #endif 05778 #ifdef CC 05779 settings->CC_axis_offset SET_TO 0; /*CC*/ 05780 #endif 05781 05782 settings->current_x SET_TO settings->current_x - 05783 settings->origin_offset_x; 05784 settings->current_y SET_TO settings->current_y - 05785 settings->origin_offset_y; 05786 settings->current_z SET_TO settings->current_z - 05787 settings->origin_offset_z; 05788 #ifdef AA 05789 settings->AA_current SET_TO settings->AA_current - /*AA*/ 05790 #endif 05791 #ifdef AA 05792 settings->AA_origin_offset; /*AA*/ 05793 #endif 05794 #ifdef BB 05795 settings->BB_current SET_TO settings->BB_current - /*BB*/ 05796 #endif 05797 #ifdef BB 05798 settings->BB_origin_offset; /*BB*/ 05799 #endif 05800 #ifdef CC 05801 settings->CC_current SET_TO settings->CC_current - /*CC*/ 05802 #endif 05803 #ifdef CC 05804 settings->CC_origin_offset; /*CC*/ 05805 #endif 05806 05807 SET_ORIGIN_OFFSETS(settings->origin_offset_x, 05808 settings->origin_offset_y, 05809 settings->origin_offset_z 05810 #ifdef AA 05811 , settings->AA_origin_offset 05812 #else 05813 #ifdef ALL_AXES 05814 , 0 05815 #endif 05816 #endif 05817 #ifdef BB 05818 , settings->BB_origin_offset 05819 #else 05820 #ifdef ALL_AXES 05821 , 0 05822 #endif 05823 #endif 05824 #ifdef CC 05825 , settings->CC_origin_offset 05826 #else 05827 #ifdef ALL_AXES 05828 , 0 05829 #endif 05830 #endif 05831 ); 05832 05833 /*2*/ if (settings->plane ISNT CANON_PLANE_XY) 05834 { 05835 SELECT_PLANE(CANON_PLANE_XY); 05836 settings->plane SET_TO CANON_PLANE_XY; 05837 } 05838 05839 /*3*/ settings->distance_mode SET_TO MODE_ABSOLUTE; 05840 05841 /*4*/ settings->feed_mode SET_TO UNITS_PER_MINUTE; 05842 05843 /*5*/ if (settings->feed_override ISNT ON) 05844 { 05845 ENABLE_FEED_OVERRIDE(); 05846 settings->feed_override SET_TO ON; 05847 } 05848 if (settings->speed_override ISNT ON) 05849 { 05850 ENABLE_SPEED_OVERRIDE(); 05851 settings->speed_override SET_TO ON; 05852 } 05853 05854 /*6*/ settings->cutter_comp_side SET_TO OFF; 05855 settings->program_x SET_TO UNKNOWN; 05856 05857 /*7*/ STOP_SPINDLE_TURNING(); 05858 settings->spindle_turning SET_TO CANON_STOPPED; 05859 05860 /*8*/ settings->motion_mode SET_TO G_1; 05861 05862 /*9*/ if (settings->mist IS ON) 05863 { 05864 MIST_OFF(); 05865 settings->mist SET_TO OFF; 05866 } 05867 if (settings->flood IS ON) 05868 { 05869 FLOOD_OFF(); 05870 settings->flood SET_TO OFF; 05871 } 05872 05873 if (block->m_modes[4] IS 30) 05874 PALLET_SHUTTLE(); 05875 PROGRAM_END(); 05876 if (_setup.percent_flag IS ON) 05877 { 05878 CHK((_setup.file_pointer IS NULL), NCE_UNABLE_TO_OPEN_FILE); 05879 line SET_TO _setup.linetext; 05880 for(; ;) /* check for ending percent sign and comment if missing */ 05881 { 05882 if (fgets(line, RS274NGC_TEXT_SIZE, _setup.file_pointer) IS NULL) 05883 { 05884 COMMENT 05885 ("interpreter: percent sign missing from end of file"); 05886 break; 05887 } 05888 length SET_TO strlen(line); 05889 if (length IS (RS274NGC_TEXT_SIZE - 1)) 05890 { // line is too long. need to finish reading the line 05891 for(;fgetc(_setup.file_pointer) ISNT '\n';); 05892 continue; 05893 } 05894 for(index SET_TO (length -1); // index set on last char 05895 (index >= 0) AND (isspace(line[index])); 05896 index--); 05897 if (line[index] IS '%') // found line with % at end 05898 { 05899 for(index--; (index >= 0)AND(isspace(line[index])); index--); 05900 if (index IS -1) // found line with only percent sign 05901 break; 05902 } 05903 } 05904 } 05905 return RS274NGC_EXIT; 05906 } 05907 else 05908 ERM(NCE_BUG_CODE_NOT_M0_M1_M2_M30_M60); 05909 return RS274NGC_OK; 05910 } |
|
Definition at line 5954 of file rs274ngc_pre.cc. Referenced by convert_motion().
05958 { 05959 static char name[] SET_TO "convert_straight"; 05960 double end_x; 05961 double end_y; 05962 double end_z; 05963 #ifdef AA 05964 double AA_end; /*AA*/ 05965 #endif 05966 #ifdef BB 05967 double BB_end; /*BB*/ 05968 #endif 05969 #ifdef CC 05970 double CC_end; /*CC*/ 05971 #endif 05972 int status; 05973 05974 if (move IS G_1) 05975 { 05976 if (settings->feed_mode IS UNITS_PER_MINUTE) 05977 { 05978 CHK((settings->feed_rate IS 0.0), 05979 NCE_CANNOT_DO_G1_WITH_ZERO_FEED_RATE); 05980 } 05981 else if (settings->feed_mode IS INVERSE_TIME) 05982 { 05983 CHK((block->f_number IS -1.0), 05984 NCE_F_WORD_MISSING_WITH_INVERSE_TIME_G1_MOVE); 05985 } 05986 } 05987 05988 settings->motion_mode SET_TO move; 05989 find_ends(block, settings, &end_x, &end_y, 05990 &end_z 05991 #ifdef AA 05992 , &AA_end 05993 #endif 05994 05995 #ifdef BB 05996 , &BB_end 05997 #endif 05998 05999 #ifdef CC 06000 , &CC_end 06001 #endif 06002 ); 06003 if ((settings->cutter_comp_side ISNT OFF) AND /* NOT "IS ON" */ 06004 (settings->cutter_comp_radius > 0.0)) /* radius always is >= 0 */ 06005 { 06006 CHK((block->g_modes[0] IS G_53), 06007 NCE_CANNOT_USE_G53_WITH_CUTTER_RADIUS_COMP); 06008 if (settings->program_x IS UNKNOWN) 06009 { 06010 status SET_TO 06011 convert_straight_comp1(move, block, settings, end_x, end_y, 06012 end_z 06013 #ifdef AA 06014 , AA_end 06015 #endif 06016 06017 #ifdef BB 06018 , BB_end 06019 #endif 06020 06021 #ifdef CC 06022 , CC_end 06023 #endif 06024 ); 06025 CHP(status); 06026 } 06027 else 06028 { 06029 status SET_TO 06030 convert_straight_comp2 (move, block, settings, end_x, end_y, 06031 end_z 06032 #ifdef AA 06033 , AA_end 06034 #endif 06035 06036 #ifdef BB 06037 , BB_end 06038 #endif 06039 06040 #ifdef CC 06041 , CC_end 06042 #endif 06043 ); 06044 CHP(status); 06045 } 06046 } 06047 else if (move IS G_0) 06048 { 06049 STRAIGHT_TRAVERSE(end_x, end_y, end_z 06050 #ifdef AA 06051 , AA_end 06052 #else 06053 #ifdef ALL_AXES 06054 , 0 06055 #endif 06056 #endif 06057 #ifdef BB 06058 , BB_end 06059 #else 06060 #ifdef ALL_AXES 06061 , 0 06062 #endif 06063 #endif 06064 #ifdef CC 06065 , CC_end 06066 #else 06067 #ifdef ALL_AXES 06068 , 0 06069 #endif 06070 #endif 06071 ); 06072 settings->current_x SET_TO end_x; 06073 settings->current_y SET_TO end_y; 06074 } 06075 else if (move IS G_1) 06076 { 06077 if (settings->feed_mode IS INVERSE_TIME) 06078 inverse_time_rate_straight 06079 (end_x, end_y, end_z 06080 #ifdef AA 06081 , AA_end 06082 #endif 06083 06084 #ifdef BB 06085 , BB_end 06086 #endif 06087 06088 #ifdef CC 06089 , CC_end 06090 #endif 06091 , block, settings); 06092 STRAIGHT_FEED(end_x, end_y, end_z 06093 #ifdef AA 06094 , AA_end 06095 #else 06096 #ifdef ALL_AXES 06097 , 0 06098 #endif 06099 #endif 06100 #ifdef BB 06101 , BB_end 06102 #else 06103 #ifdef ALL_AXES 06104 , 0 06105 #endif 06106 #endif 06107 #ifdef CC 06108 , CC_end 06109 #else 06110 #ifdef ALL_AXES 06111 , 0 06112 #endif 06113 #endif 06114 ); 06115 settings->current_x SET_TO end_x; 06116 settings->current_y SET_TO end_y; 06117 } 06118 else 06119 ERM(NCE_BUG_CODE_NOT_G0_OR_G1); 06120 06121 settings->current_z SET_TO end_z; 06122 #ifdef AA 06123 settings->AA_current SET_TO AA_end; /*AA*/ 06124 #endif 06125 #ifdef BB 06126 settings->BB_current SET_TO BB_end; /*BB*/ 06127 #endif 06128 #ifdef CC 06129 settings->CC_current SET_TO CC_end; /*CC*/ 06130 #endif 06131 return RS274NGC_OK; 06132 } |
|
Definition at line 6170 of file rs274ngc_pre.cc. 06187 { 06188 static char name[] SET_TO "convert_straight_comp1"; 06189 double alpha; 06190 double cx; /* first current point x then end point x */ 06191 double cy; /* first current point y then end point y */ 06192 double distance; 06193 double radius; 06194 int side; 06195 double theta; 06196 06197 side SET_TO settings->cutter_comp_side; 06198 cx SET_TO settings->current_x; 06199 cy SET_TO settings->current_y; 06200 06201 radius SET_TO settings->cutter_comp_radius; /* always will be positive */ 06202 distance SET_TO hypot((px - cx), (py -cy)); 06203 06204 CHK(((side ISNT LEFT) AND (side ISNT RIGHT)),NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT); 06205 CHK((distance <= radius), NCE_CUTTER_GOUGING_WITH_CUTTER_RADIUS_COMP); 06206 06207 theta SET_TO acos(radius/distance); 06208 alpha SET_TO (side IS LEFT) ? (atan2((cy - py), (cx - px)) - theta) : 06209 (atan2((cy - py), (cx - px)) + theta); 06210 cx SET_TO (px + (radius * cos(alpha))); /* reset to end location */ 06211 cy SET_TO (py + (radius * sin(alpha))); 06212 if (move IS G_0) 06213 STRAIGHT_TRAVERSE(cx, cy, end_z 06214 #ifdef AA 06215 , AA_end 06216 #else 06217 #ifdef ALL_AXES 06218 , 0 06219 #endif 06220 #endif 06221 #ifdef BB 06222 , BB_end 06223 #else 06224 #ifdef ALL_AXES 06225 , 0 06226 #endif 06227 #endif 06228 #ifdef CC 06229 , CC_end 06230 #else 06231 #ifdef ALL_AXES 06232 , 0 06233 #endif 06234 #endif 06235 ); 06236 else if (move IS G_1) 06237 { 06238 if (settings->feed_mode IS INVERSE_TIME) 06239 inverse_time_rate_straight 06240 (cx, cy, end_z 06241 #ifdef AA 06242 , AA_end 06243 #endif 06244 06245 #ifdef BB 06246 , BB_end 06247 #endif 06248 06249 #ifdef CC 06250 , CC_end 06251 #endif 06252 , block, settings); 06253 STRAIGHT_FEED(cx, cy, end_z 06254 #ifdef AA 06255 , AA_end 06256 #else 06257 #ifdef ALL_AXES 06258 , 0 06259 #endif 06260 #endif 06261 #ifdef BB 06262 , BB_end 06263 #else 06264 #ifdef ALL_AXES 06265 , 0 06266 #endif 06267 #endif 06268 #ifdef CC 06269 , CC_end 06270 #else 06271 #ifdef ALL_AXES 06272 , 0 06273 #endif 06274 #endif 06275 ); 06276 } 06277 else 06278 ERM(NCE_BUG_CODE_NOT_G0_OR_G1); 06279 06280 settings->current_x SET_TO cx; 06281 settings->current_y SET_TO cy; 06282 settings->program_x SET_TO px; 06283 settings->program_y SET_TO py; 06284 return RS274NGC_OK; 06285 } |
|
Definition at line 6359 of file rs274ngc_pre.cc. 06376 { 06377 static char name[] SET_TO "convert_straight_comp2"; 06378 double alpha; 06379 double beta; 06380 double end_x; /* x-coordinate of actual end point */ 06381 double end_y; /* y-coordinate of actual end point */ 06382 double gamma; 06383 double mid_x; /* x-coordinate of end of added arc, if needed */ 06384 double mid_y; /* y-coordinate of end of added arc, if needed */ 06385 double radius; 06386 int side; 06387 double small SET_TO TOLERANCE_CONCAVE_CORNER; /* radians, testing corners */ 06388 double start_x, start_y; /* programmed beginning point */ 06389 double theta; 06390 06391 start_x SET_TO settings->program_x; 06392 start_y SET_TO settings->program_y; 06393 if ((py IS start_y) AND (px IS start_x)) /* no XY motion */ 06394 { 06395 end_x SET_TO settings->current_x; 06396 end_y SET_TO settings->current_y; 06397 if (move IS G_0) 06398 STRAIGHT_TRAVERSE(end_x, end_y, end_z 06399 #ifdef AA 06400 , AA_end 06401 #else 06402 #ifdef ALL_AXES 06403 , 0 06404 #endif 06405 #endif 06406 #ifdef BB 06407 , BB_end 06408 #else 06409 #ifdef ALL_AXES 06410 , 0 06411 #endif 06412 #endif 06413 #ifdef CC 06414 , CC_end 06415 #else 06416 #ifdef ALL_AXES 06417 , 0 06418 #endif 06419 #endif 06420 ); 06421 else if (move IS G_1) 06422 { 06423 if (settings->feed_mode IS INVERSE_TIME) 06424 inverse_time_rate_straight 06425 (end_x, end_y, end_z 06426 #ifdef AA 06427 , AA_end 06428 #endif 06429 06430 #ifdef BB 06431 , BB_end 06432 #endif 06433 06434 #ifdef CC 06435 , CC_end 06436 #endif 06437 , block, settings); 06438 STRAIGHT_FEED(end_x, end_y, end_z 06439 #ifdef AA 06440 , AA_end 06441 #else 06442 #ifdef ALL_AXES 06443 , 0 06444 #endif 06445 #endif 06446 #ifdef BB 06447 , BB_end 06448 #else 06449 #ifdef ALL_AXES 06450 , 0 06451 #endif 06452 #endif 06453 #ifdef CC 06454 , CC_end 06455 #else 06456 #ifdef ALL_AXES 06457 , 0 06458 #endif 06459 #endif 06460 ); 06461 } 06462 else 06463 ERM(NCE_BUG_CODE_NOT_G0_OR_G1); 06464 } 06465 else 06466 { 06467 side SET_TO settings->cutter_comp_side; 06468 radius SET_TO settings->cutter_comp_radius; /* will always be positive */ 06469 theta SET_TO atan2(settings->current_y - start_y, 06470 settings->current_x - start_x); 06471 alpha SET_TO atan2(py - start_y, px - start_x); 06472 06473 if (side IS LEFT) 06474 { 06475 if (theta < alpha) 06476 theta SET_TO (theta + TWO_PI); 06477 beta SET_TO ((theta - alpha) - PI2); 06478 gamma SET_TO PI2; 06479 } 06480 else if (side IS RIGHT) 06481 { 06482 if (alpha < theta) 06483 alpha SET_TO (alpha + TWO_PI); 06484 beta SET_TO ((alpha - theta) - PI2); 06485 gamma SET_TO -PI2; 06486 } 06487 else 06488 ERM(NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT); 06489 end_x SET_TO (px + (radius * cos(alpha + gamma))); 06490 end_y SET_TO (py + (radius * sin(alpha + gamma))); 06491 mid_x SET_TO (start_x + (radius * cos(alpha + gamma))); 06492 mid_y SET_TO (start_y + (radius * sin(alpha + gamma))); 06493 06494 CHK(((beta < -small) OR (beta > (PI + small))), 06495 NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP); 06496 if (move IS G_0) 06497 STRAIGHT_TRAVERSE(end_x, end_y, end_z 06498 #ifdef AA 06499 , AA_end 06500 #else 06501 #ifdef ALL_AXES 06502 , 0 06503 #endif 06504 #endif 06505 #ifdef BB 06506 , BB_end 06507 #else 06508 #ifdef ALL_AXES 06509 , 0 06510 #endif 06511 #endif 06512 #ifdef CC 06513 , CC_end 06514 #else 06515 #ifdef ALL_AXES 06516 , 0 06517 #endif 06518 #endif 06519 ); 06520 else if (move IS G_1) 06521 { 06522 if (beta > small) /* ARC NEEDED */ 06523 { 06524 if (settings->feed_mode IS INVERSE_TIME) 06525 inverse_time_rate_as(start_x, start_y, (side IS LEFT) ? -1 : 1, 06526 mid_x, mid_y, end_x, end_y, 06527 end_z 06528 #ifdef AA 06529 , AA_end 06530 #endif 06531 06532 #ifdef BB 06533 , BB_end 06534 #endif 06535 06536 #ifdef CC 06537 , CC_end 06538 #endif 06539 , 06540 block, settings); 06541 ARC_FEED(mid_x,mid_y,start_x, start_y,((side IS LEFT) ? -1 : 1), 06542 settings->current_z 06543 #ifdef AA 06544 , AA_end 06545 #else 06546 #ifdef ALL_AXES 06547 , 0 06548 #endif 06549 #endif 06550 #ifdef BB 06551 , BB_end 06552 #else 06553 #ifdef ALL_AXES 06554 , 0 06555 #endif 06556 #endif 06557 #ifdef CC 06558 , CC_end 06559 #else 06560 #ifdef ALL_AXES 06561 , 0 06562 #endif 06563 #endif 06564 ); 06565 STRAIGHT_FEED(end_x, end_y, end_z 06566 #ifdef AA 06567 , AA_end 06568 #else 06569 #ifdef ALL_AXES 06570 , 0 06571 #endif 06572 #endif 06573 #ifdef BB 06574 , BB_end 06575 #else 06576 #ifdef ALL_AXES 06577 , 0 06578 #endif 06579 #endif 06580 #ifdef CC 06581 , CC_end 06582 #else 06583 #ifdef ALL_AXES 06584 , 0 06585 #endif 06586 #endif 06587 ); 06588 } 06589 else 06590 { 06591 if (settings->feed_mode IS INVERSE_TIME) 06592 inverse_time_rate_straight 06593 (end_x,end_y,end_z 06594 #ifdef AA 06595 , AA_end 06596 #endif 06597 06598 #ifdef BB 06599 , BB_end 06600 #endif 06601 06602 #ifdef CC 06603 , CC_end 06604 #endif 06605 , block, settings); 06606 STRAIGHT_FEED(end_x, end_y, end_z 06607 #ifdef AA 06608 , AA_end 06609 #else 06610 #ifdef ALL_AXES 06611 , 0 06612 #endif 06613 #endif 06614 #ifdef BB 06615 , BB_end 06616 #else 06617 #ifdef ALL_AXES 06618 , 0 06619 #endif 06620 #endif 06621 #ifdef CC 06622 , CC_end 06623 #else 06624 #ifdef ALL_AXES 06625 , 0 06626 #endif 06627 #endif 06628 ); 06629 } 06630 } 06631 else 06632 ERM(NCE_BUG_CODE_NOT_G0_OR_G1); 06633 } 06634 06635 settings->current_x SET_TO end_x; 06636 settings->current_y SET_TO end_y; 06637 settings->program_x SET_TO px; 06638 settings->program_y SET_TO py; 06639 return RS274NGC_OK; 06640 } |
|
Definition at line 6701 of file rs274ngc_pre.cc. Referenced by convert_m().
06703 { 06704 static char name[] SET_TO "convert_tool_change"; 06705 06706 CHANGE_TOOL(settings->selected_tool_slot); 06707 settings->current_slot SET_TO settings->selected_tool_slot; 06708 settings->spindle_turning SET_TO CANON_STOPPED; 06709 06710 return RS274NGC_OK; 06711 } |
|
Definition at line 6744 of file rs274ngc_pre.cc. 06748 { 06749 static char name[] SET_TO "convert_tool_length_offset"; 06750 int index; 06751 double offset; 06752 06753 if (g_code IS G_49) 06754 { 06755 USE_TOOL_LENGTH_OFFSET(0.0); 06756 settings->current_z SET_TO (settings->current_z + 06757 settings->tool_length_offset); 06758 settings->tool_length_offset SET_TO 0.0; 06759 settings->length_offset_index SET_TO 0; 06760 } 06761 else if (g_code IS G_43) 06762 { 06763 index SET_TO block->h_number; 06764 CHK((index IS -1), NCE_OFFSET_INDEX_MISSING); 06765 offset SET_TO settings->tool_table[index].length; 06766 USE_TOOL_LENGTH_OFFSET(offset); 06767 settings->current_z SET_TO 06768 (settings->current_z + settings->tool_length_offset - offset); 06769 settings->tool_length_offset SET_TO offset; 06770 settings->length_offset_index SET_TO index; 06771 } 06772 else 06773 ERM(NCE_BUG_CODE_NOT_G43_OR_G49); 06774 return RS274NGC_OK; 06775 } |
|
Definition at line 6803 of file rs274ngc_pre.cc. 06806 { 06807 static char name[] SET_TO "convert_tool_select"; 06808 06809 CHK((block->t_number > settings->tool_max), 06810 NCE_SELECTED_TOOL_SLOT_NUMBER_TOO_LARGE); 06811 SELECT_TOOL(block->t_number); 06812 settings->selected_tool_slot SET_TO block->t_number; 06813 return RS274NGC_OK; 06814 } |
|
Definition at line 6841 of file rs274ngc_pre.cc. 06846 { 06847 static char name[] SET_TO "cycle_feed"; 06848 06849 if (plane IS CANON_PLANE_XY) 06850 STRAIGHT_FEED(end1, end2, end3 06851 #ifdef AA 06852 , _setup.AA_current 06853 #else 06854 #ifdef ALL_AXES 06855 , 0 06856 #endif 06857 #endif 06858 #ifdef BB 06859 , _setup.BB_current 06860 #else 06861 #ifdef ALL_AXES 06862 , 0 06863 #endif 06864 #endif 06865 #ifdef CC 06866 , _setup.CC_current 06867 #else 06868 #ifdef ALL_AXES 06869 , 0 06870 #endif 06871 #endif 06872 ); 06873 else if (plane IS CANON_PLANE_YZ) 06874 STRAIGHT_FEED(end3, end1, end2 06875 #ifdef AA 06876 , _setup.AA_current 06877 #else 06878 #ifdef ALL_AXES 06879 , 0 06880 #endif 06881 #endif 06882 #ifdef BB 06883 , _setup.BB_current 06884 #else 06885 #ifdef ALL_AXES 06886 , 0 06887 #endif 06888 #endif 06889 #ifdef CC 06890 , _setup.CC_current 06891 #else 06892 #ifdef ALL_AXES 06893 , 0 06894 #endif 06895 #endif 06896 ); 06897 else /* if (plane IS CANON_PLANE_XZ) */ 06898 STRAIGHT_FEED(end2, end3, end1 06899 #ifdef AA 06900 , _setup.AA_current 06901 #else 06902 #ifdef ALL_AXES 06903 , 0 06904 #endif 06905 #endif 06906 #ifdef BB 06907 , _setup.BB_current 06908 #else 06909 #ifdef ALL_AXES 06910 , 0 06911 #endif 06912 #endif 06913 #ifdef CC 06914 , _setup.CC_current 06915 #else 06916 #ifdef ALL_AXES 06917 , 0 06918 #endif 06919 #endif 06920 ); 06921 06922 return RS274NGC_OK; 06923 } |
|
Definition at line 6950 of file rs274ngc_pre.cc. 06955 { 06956 static char name[] SET_TO "cycle_traverse"; 06957 if (plane IS CANON_PLANE_XY) 06958 STRAIGHT_TRAVERSE(end1, end2, end3 06959 #ifdef AA 06960 , _setup.AA_current 06961 #else 06962 #ifdef ALL_AXES 06963 , 0 06964 #endif 06965 #endif 06966 #ifdef BB 06967 , _setup.BB_current 06968 #else 06969 #ifdef ALL_AXES 06970 , 0 06971 #endif 06972 #endif 06973 #ifdef CC 06974 , _setup.CC_current 06975 #else 06976 #ifdef ALL_AXES 06977 , 0 06978 #endif 06979 #endif 06980 ); 06981 else if (plane IS CANON_PLANE_YZ) 06982 STRAIGHT_TRAVERSE(end3, end1, end2 06983 #ifdef AA 06984 , _setup.AA_current 06985 #else 06986 #ifdef ALL_AXES 06987 , 0 06988 #endif 06989 #endif 06990 #ifdef BB 06991 , _setup.BB_current 06992 #else 06993 #ifdef ALL_AXES 06994 , 0 06995 #endif 06996 #endif 06997 #ifdef CC 06998 , _setup.CC_current 06999 #else 07000 #ifdef ALL_AXES 07001 , 0 07002 #endif 07003 #endif 07004 ); 07005 else /* if (plane IS CANON_PLANE_XZ) */ 07006 STRAIGHT_TRAVERSE(end2, end3, end1 07007 #ifdef AA 07008 , _setup.AA_current 07009 #else 07010 #ifdef ALL_AXES 07011 , 0 07012 #endif 07013 #endif 07014 #ifdef BB 07015 , _setup.BB_current 07016 #else 07017 #ifdef ALL_AXES 07018 , 0 07019 #endif 07020 #endif 07021 #ifdef CC 07022 , _setup.CC_current 07023 #else 07024 #ifdef ALL_AXES 07025 , 0 07026 #endif 07027 #endif 07028 ); 07029 return RS274NGC_OK; 07030 } |
|
Definition at line 7068 of file rs274ngc_pre.cc. 07071 { 07072 static char name[] SET_TO "enhance_block"; 07073 int axis_flag; 07074 int mode_zero_covets_axes; 07075 07076 axis_flag SET_TO ((block->x_flag IS ON) OR 07077 (block->y_flag IS ON) OR 07078 #ifdef AA 07079 (block->a_flag IS ON) OR /*AA*/ 07080 #endif 07081 #ifdef BB 07082 (block->b_flag IS ON) OR /*BB*/ 07083 #endif 07084 #ifdef CC 07085 (block->c_flag IS ON) OR /*CC*/ 07086 #endif 07087 (block->z_flag IS ON)); 07088 mode_zero_covets_axes SET_TO ((block->g_modes[0] IS G_10) OR 07089 (block->g_modes[0] IS G_28) OR 07090 (block->g_modes[0] IS G_30) OR 07091 (block->g_modes[0] IS G_92)); 07092 07093 if (block->g_modes[1] ISNT -1) 07094 { 07095 if (block->g_modes[1] IS G_80) 07096 { 07097 CHK((axis_flag AND (NOT mode_zero_covets_axes)), 07098 NCE_CANNOT_USE_AXIS_VALUES_WITH_G80); 07099 CHK(((NOT axis_flag) AND (block->g_modes[0] IS G_92)), 07100 NCE_ALL_AXES_MISSING_WITH_G92); 07101 } 07102 else 07103 { 07104 CHK(mode_zero_covets_axes, 07105 NCE_CANNOT_USE_TWO_G_CODES_THAT_BOTH_USE_AXIS_VALUES); 07106 CHK((NOT axis_flag), NCE_ALL_AXES_MISSING_WITH_MOTION_CODE); 07107 } 07108 block->motion_to_be SET_TO block->g_modes[1]; 07109 } 07110 else if (mode_zero_covets_axes) 07111 { /* other 3 can get by without axes but not G92 */ 07112 CHK(((NOT axis_flag) AND (block->g_modes[0] IS G_92)), 07113 NCE_ALL_AXES_MISSING_WITH_G92); 07114 } 07115 else if (axis_flag) 07116 { 07117 CHK(((settings->motion_mode IS -1) OR (settings->motion_mode IS G_80)), 07118 NCE_CANNOT_USE_AXIS_VALUES_WITHOUT_A_G_CODE_THAT_USES_THEM); 07119 block->motion_to_be SET_TO settings->motion_mode; 07120 } 07121 return RS274NGC_OK; 07122 } |
|
Definition at line 7142 of file rs274ngc_pre.cc. 07146 { 07147 static char name[] SET_TO "execute_binary"; 07148 int status; 07149 07150 if (operation < AND2) 07151 CHP(execute_binary1(left, operation, right)); 07152 else 07153 CHP(execute_binary2(left, operation, right)); 07154 return RS274NGC_OK; 07155 } |
|
Definition at line 7178 of file rs274ngc_pre.cc. Referenced by execute_binary().
07182 { 07183 static char name[] SET_TO "execute_binary1"; 07184 switch (operation) 07185 { 07186 case DIVIDED_BY: 07187 CHK((*right IS 0.0), NCE_ATTEMPT_TO_DIVIDE_BY_ZERO); 07188 *left SET_TO (*left / *right); 07189 break; 07190 case MODULO: /* always calculates a positive answer */ 07191 *left SET_TO fmod(*left, *right); 07192 if (*left < 0.0) 07193 { 07194 *left SET_TO (*left + fabs(*right)); 07195 } 07196 break; 07197 case POWER: 07198 CHK(((*left < 0.0) AND (floor(*right) ISNT *right)), 07199 NCE_ATTEMPT_TO_RAISE_NEGATIVE_TO_NON_INTEGER_POWER); 07200 *left SET_TO pow(*left, *right); 07201 break; 07202 case TIMES: 07203 *left SET_TO (*left * *right); 07204 break; 07205 default: 07206 ERM(NCE_BUG_UNKNOWN_OPERATION); 07207 } 07208 return RS274NGC_OK; 07209 } |
|
Definition at line 7235 of file rs274ngc_pre.cc. Referenced by execute_binary().
07239 { 07240 static char name[] SET_TO "execute_binary2"; 07241 switch (operation) 07242 { 07243 case AND2: 07244 *left SET_TO ((*left IS 0.0) OR (*right IS 0.0)) ? 0.0 : 1.0; 07245 break; 07246 case EXCLUSIVE_OR: 07247 *left SET_TO (((*left IS 0.0) AND (*right ISNT 0.0)) OR 07248 ((*left ISNT 0.0) AND (*right IS 0.0))) ? 1.0 : 0.0; 07249 break; 07250 case MINUS: 07251 *left SET_TO (*left - *right); 07252 break; 07253 case NON_EXCLUSIVE_OR: 07254 *left SET_TO ((*left ISNT 0.0) OR (*right ISNT 0.0)) ? 1.0 : 0.0; 07255 break; 07256 case PLUS: 07257 *left SET_TO (*left + *right); 07258 break; 07259 default: 07260 ERM(NCE_BUG_UNKNOWN_OPERATION); 07261 } 07262 return RS274NGC_OK; 07263 } |
|
Definition at line 7313 of file rs274ngc_pre.cc. 07316 { 07317 static char name[] SET_TO "execute_block"; 07318 int status; 07319 07320 if (block->comment[0] ISNT 0) 07321 { 07322 CHP(convert_comment(block->comment)); 07323 } 07324 if (block->g_modes[5] ISNT -1) 07325 { 07326 CHP(convert_feed_mode(block->g_modes[5], settings)); 07327 } 07328 if (block->f_number > -1.0) 07329 { 07330 if (settings->feed_mode IS INVERSE_TIME); /* handle elsewhere */ 07331 else 07332 { 07333 CHP(convert_feed_rate(block, settings)); 07334 } 07335 } 07336 if (block->s_number > -1.0) 07337 { 07338 CHP(convert_speed(block, settings)); 07339 } 07340 if (block->t_number ISNT -1) 07341 { 07342 CHP(convert_tool_select(block, settings)); 07343 } 07344 CHP(convert_m(block, settings)); 07345 CHP(convert_g(block, settings)); 07346 if (block->m_modes[4] ISNT -1) /* converts m0, m1, m2, m30, or m60 */ 07347 { 07348 status SET_TO convert_stop(block, settings); 07349 if (status IS RS274NGC_EXIT) 07350 return RS274NGC_EXIT; 07351 else if (status ISNT RS274NGC_OK) 07352 ERP(status); 07353 } 07354 return ((settings->probe_flag IS ON) ? RS274NGC_EXECUTE_FINISH: RS274NGC_OK); 07355 } |
|
Definition at line 7387 of file rs274ngc_pre.cc. 07390 { 07391 static char name[] SET_TO "execute_unary"; 07392 switch (operation) 07393 { 07394 case ABS: 07395 if (*double_ptr < 0.0) 07396 *double_ptr SET_TO (-1.0 * *double_ptr); 07397 break; 07398 case ACOS: 07399 CHK(((*double_ptr < -1.0) OR (*double_ptr > 1.0)), 07400 NCE_ARGUMENT_TO_ACOS_OUT_OF_RANGE); 07401 *double_ptr SET_TO acos(*double_ptr); 07402 *double_ptr SET_TO ((*double_ptr * 180.0)/ PI); 07403 break; 07404 case ASIN: 07405 CHK(((*double_ptr < -1.0) OR (*double_ptr > 1.0)), 07406 NCE_ARGUMENT_TO_ASIN_OUT_OF_RANGE); 07407 *double_ptr SET_TO asin(*double_ptr); 07408 *double_ptr SET_TO ((*double_ptr * 180.0)/ PI); 07409 break; 07410 case COS: 07411 *double_ptr SET_TO cos((*double_ptr * PI)/180.0); 07412 break; 07413 case EXP: 07414 *double_ptr SET_TO exp(*double_ptr); 07415 break; 07416 case FIX: 07417 *double_ptr SET_TO floor(*double_ptr); 07418 break; 07419 case FUP: 07420 *double_ptr SET_TO ceil(*double_ptr); 07421 break; 07422 case LN: 07423 CHK((*double_ptr <= 0.0), NCE_ZERO_OR_NEGATIVE_ARGUMENT_TO_LN); 07424 *double_ptr SET_TO log(*double_ptr); 07425 break; 07426 case ROUND: 07427 *double_ptr SET_TO (double) 07428 ((int) (*double_ptr + ((*double_ptr < 0.0) ? -0.5 : 0.5))); 07429 break; 07430 case SIN: 07431 *double_ptr SET_TO sin((*double_ptr * PI)/180.0); 07432 break; 07433 case SQRT: 07434 CHK((*double_ptr < 0.0), NCE_NEGATIVE_ARGUMENT_TO_SQRT); 07435 *double_ptr SET_TO sqrt(*double_ptr); 07436 break; 07437 case TAN: 07438 *double_ptr SET_TO tan((*double_ptr * PI)/180.0); 07439 break; 07440 default: 07441 ERM(NCE_BUG_UNKNOWN_OPERATION); 07442 } 07443 return RS274NGC_OK; 07444 } |
|
Definition at line 7481 of file rs274ngc_pre.cc. 07491 { 07492 double radius; 07493 double theta; /* amount of turn of arc in radians */ 07494 07495 radius SET_TO hypot((center_x - x1), (center_y - y1)); 07496 theta SET_TO find_turn(x1, y1, center_x, center_y, turn, x2, y2); 07497 if (z2 IS z1) 07498 return (radius * fabs(theta)); 07499 else 07500 return hypot((radius * theta), (z2 - z1)); 07501 } |
|
Definition at line 7543 of file rs274ngc_pre.cc. 07559 { 07560 int mode; 07561 int middle; 07562 int comp; 07563 07564 mode SET_TO settings->distance_mode; 07565 middle SET_TO (settings->program_x ISNT UNKNOWN); 07566 comp SET_TO (settings->cutter_comp_side ISNT OFF); 07567 07568 if (block->g_modes[0] IS G_53) /* distance mode is absolute in this case */ 07569 { 07570 #ifdef DEBUG_EMC 07571 COMMENT("interpreter: offsets temporarily suspended"); 07572 #endif 07573 *px SET_TO (block->x_flag IS ON) ? (block->x_number - 07574 (settings->origin_offset_x + settings->axis_offset_x)) : 07575 settings->current_x; 07576 *py SET_TO (block->y_flag IS ON) ? (block->y_number - 07577 (settings->origin_offset_y + settings->axis_offset_y)) : 07578 settings->current_y; 07579 *pz SET_TO (block->z_flag IS ON) ? (block->z_number - 07580 (settings->tool_length_offset + settings->origin_offset_z 07581 + settings->axis_offset_z)) : settings->current_z; 07582 #ifdef AA 07583 *AA_p SET_TO (block->a_flag IS ON) ? (block->a_number - /*AA*/ 07584 #endif 07585 #ifdef AA 07586 (settings->AA_origin_offset + settings->AA_axis_offset)) : /*AA*/ 07587 #endif 07588 #ifdef AA 07589 settings->AA_current; /*AA*/ 07590 #endif 07591 #ifdef BB 07592 *BB_p SET_TO (block->b_flag IS ON) ? (block->b_number - /*BB*/ 07593 #endif 07594 #ifdef BB 07595 (settings->BB_origin_offset + settings->BB_axis_offset)) : /*BB*/ 07596 #endif 07597 #ifdef BB 07598 settings->BB_current; /*BB*/ 07599 #endif 07600 #ifdef CC 07601 *CC_p SET_TO (block->c_flag IS ON) ? (block->c_number - /*CC*/ 07602 #endif 07603 #ifdef CC 07604 (settings->tool_length_offset + settings->CC_origin_offset /*CC*/ 07605 #endif 07606 #ifdef CC 07607 + settings->CC_axis_offset)) : settings->CC_current; /*CC*/ 07608 #endif 07609 } 07610 else if (mode IS MODE_ABSOLUTE) 07611 { 07612 *px SET_TO (block->x_flag IS ON) ? block->x_number : 07613 (comp AND middle) ? settings->program_x : 07614 settings->current_x ; 07615 07616 *py SET_TO (block->y_flag IS ON) ? block->y_number : 07617 (comp AND middle) ? settings->program_y : 07618 settings->current_y ; 07619 07620 *pz SET_TO (block->z_flag IS ON) ? block->z_number : 07621 settings->current_z ; 07622 #ifdef AA 07623 *AA_p SET_TO (block->a_flag IS ON) ? block->a_number : /*AA*/ 07624 #endif 07625 #ifdef AA 07626 settings->AA_current ; /*AA*/ 07627 #endif 07628 #ifdef BB 07629 *BB_p SET_TO (block->b_flag IS ON) ? block->b_number : /*BB*/ 07630 #endif 07631 #ifdef BB 07632 settings->BB_current ; /*BB*/ 07633 #endif 07634 #ifdef CC 07635 *CC_p SET_TO (block->c_flag IS ON) ? block->c_number : /*CC*/ 07636 #endif 07637 #ifdef CC 07638 settings->CC_current ; /*CC*/ 07639 #endif 07640 } 07641 else /* mode is MODE_INCREMENTAL */ 07642 { 07643 *px SET_TO (block->x_flag IS ON) 07644 ? ((comp AND middle) ? (block->x_number + settings->program_x) 07645 : (block->x_number + settings->current_x)) 07646 : ((comp AND middle) ? settings->program_x 07647 : settings->current_x); 07648 07649 *py SET_TO (block->y_flag IS ON) 07650 ? ((comp AND middle) ? (block->y_number + settings->program_y) 07651 : (block->y_number + settings->current_y)) 07652 : ((comp AND middle) ? settings->program_y 07653 : settings->current_y); 07654 07655 *pz SET_TO (block->z_flag IS ON) ? 07656 (settings->current_z + block->z_number) : settings->current_z; 07657 #ifdef AA 07658 *AA_p SET_TO (block->a_flag IS ON) ? /*AA*/ 07659 #endif 07660 #ifdef AA 07661 (settings->AA_current + block->a_number) : settings->AA_current; /*AA*/ 07662 #endif 07663 #ifdef BB 07664 *BB_p SET_TO (block->b_flag IS ON) ? /*BB*/ 07665 #endif 07666 #ifdef BB 07667 (settings->BB_current + block->b_number) : settings->BB_current; /*BB*/ 07668 #endif 07669 #ifdef CC 07670 *CC_p SET_TO (block->c_flag IS ON) ? /*CC*/ 07671 #endif 07672 #ifdef CC 07673 (settings->CC_current + block->c_number) : settings->CC_current; /*CC*/ 07674 #endif 07675 } 07676 return RS274NGC_OK; 07677 } |
|
Definition at line 7701 of file rs274ngc_pre.cc. 07727 { 07728 *x2 SET_TO (x1 - (settings->origin_offset_x + settings->axis_offset_x)); 07729 *y2 SET_TO (y1 - (settings->origin_offset_y + settings->axis_offset_y)); 07730 *z2 SET_TO (z1 - (settings->tool_length_offset + 07731 settings->origin_offset_z + settings->axis_offset_z)); 07732 #ifdef AA 07733 *AA_2 SET_TO (AA_1 - (settings->AA_origin_offset + /*AA*/ 07734 #endif 07735 #ifdef AA 07736 settings->AA_axis_offset)); /*AA*/ 07737 #endif 07738 #ifdef BB 07739 *BB_2 SET_TO (BB_1 - (settings->BB_origin_offset + /*BB*/ 07740 #endif 07741 #ifdef BB 07742 settings->BB_axis_offset)); /*BB*/ 07743 #endif 07744 #ifdef CC 07745 *CC_2 SET_TO (CC_1 - (settings->CC_origin_offset + /*CC*/ 07746 #endif 07747 #ifdef CC 07748 settings->CC_axis_offset)); /*CC*/ 07749 #endif 07750 return RS274NGC_OK; 07751 } |
|
Definition at line 7786 of file rs274ngc_pre.cc. 07812 { 07813 if ((x1 ISNT x2) OR (y1 ISNT y2) OR (z1 ISNT z2) OR 07814 (1 07815 #ifdef AA 07816 AND (AA_2 IS AA_1) /*AA*/ 07817 #endif 07818 #ifdef BB 07819 AND (BB_2 IS BB_1) /*BB*/ 07820 #endif 07821 #ifdef CC 07822 AND (CC_2 IS CC_1) /*CC*/ 07823 #endif 07824 )) /* straight line */ 07825 return sqrt(pow((x2 - x1),2) + pow((y2 - y1),2) + pow((z2 - z1),2)); 07826 else 07827 return sqrt(0 + 07828 #ifdef AA 07829 pow((AA_2 - AA_1), 2) + /*AA*/ 07830 #endif 07831 #ifdef BB 07832 pow((BB_2 - BB_1), 2) + /*BB*/ 07833 #endif 07834 #ifdef CC 07835 pow((CC_2 - CC_1), 2) + /*CC*/ 07836 #endif 07837 0); 07838 } |
|
Definition at line 7854 of file rs274ngc_pre.cc. 07862 { 07863 double alpha; /* angle of first radius */ 07864 double beta; /* angle of second radius */ 07865 double theta; /* amount of turn of arc CCW - negative if CW */ 07866 07867 if (turn IS 0) 07868 return 0.0; 07869 alpha SET_TO atan2((y1 - center_y), (x1 - center_x)); 07870 beta SET_TO atan2((y2 - center_y), (x2 - center_x)); 07871 if (turn > 0) 07872 { 07873 if (beta <= alpha) 07874 beta SET_TO (beta + TWO_PI); 07875 theta SET_TO ((beta - alpha) + ((turn - 1) * TWO_PI)); 07876 } 07877 else /* turn < 0 */ 07878 { 07879 if (alpha <= beta) 07880 alpha SET_TO (alpha + TWO_PI); 07881 theta SET_TO ((beta - alpha) + ((turn + 1) * TWO_PI)); 07882 } 07883 return (theta); 07884 } |
|
Definition at line 7924 of file rs274ngc_pre.cc. 07926 { 07927 int n; 07928 #ifdef AA 07929 block->a_flag SET_TO OFF; /*AA*/ 07930 #endif 07931 #ifdef BB 07932 block->b_flag SET_TO OFF; /*BB*/ 07933 #endif 07934 #ifdef CC 07935 block->c_flag SET_TO OFF; /*CC*/ 07936 #endif 07937 block->comment[0] SET_TO 0; 07938 block->d_number SET_TO -1; 07939 block->f_number SET_TO -1.0; 07940 for (n SET_TO 0; n < 14; n++) 07941 { 07942 block->g_modes[n] SET_TO -1; 07943 } 07944 block->h_number SET_TO -1; 07945 block->i_flag SET_TO OFF; 07946 block->j_flag SET_TO OFF; 07947 block->k_flag SET_TO OFF; 07948 block->l_number SET_TO -1; 07949 block->line_number SET_TO -1; 07950 block->motion_to_be SET_TO -1; 07951 block->m_count SET_TO 0; 07952 for (n SET_TO 0; n < 10; n++) 07953 { 07954 block->m_modes[n] SET_TO -1; 07955 } 07956 block->p_number SET_TO -1.0; 07957 block->q_number SET_TO -1.0; 07958 block->r_flag SET_TO OFF; 07959 block->s_number SET_TO -1.0; 07960 block->t_number SET_TO -1; 07961 block->x_flag SET_TO OFF; 07962 block->y_flag SET_TO OFF; 07963 block->z_flag SET_TO OFF; 07964 07965 return RS274NGC_OK; 07966 } |
|
Definition at line 7987 of file rs274ngc_pre.cc. Referenced by convert_arc_comp1(), and convert_arc_comp2().
07999 { 08000 double length; 08001 double rate; 08002 08003 length SET_TO find_arc_length (x1, y1, z1, cx, cy, turn, x2, y2, z2); 08004 rate SET_TO MAX(0.1, (length * block->f_number)); 08005 SET_FEED_RATE (rate); 08006 settings->feed_rate SET_TO rate; 08007 08008 return RS274NGC_OK; 08009 } |
|
Definition at line 8034 of file rs274ngc_pre.cc. Referenced by convert_arc_comp2().
08048 { 08049 double length; 08050 double rate; 08051 08052 length SET_TO (find_arc_length (settings->current_x, settings->current_y, 08053 settings->current_z, start_x, start_y, 08054 turn1, mid_x, mid_y, settings->current_z) + 08055 find_arc_length(mid_x, mid_y, settings->current_z, 08056 cx, cy, turn2, end_x, end_y, end_z)); 08057 rate SET_TO MAX(0.1, (length * block->f_number)); 08058 SET_FEED_RATE (rate); 08059 settings->feed_rate SET_TO rate; 08060 08061 return RS274NGC_OK; 08062 } |
|
Definition at line 8087 of file rs274ngc_pre.cc. Referenced by convert_straight_comp2().
08107 { 08108 double length; 08109 double rate; 08110 08111 length SET_TO (find_arc_length (settings->current_x, settings->current_y, 08112 settings->current_z, start_x, start_y, 08113 turn, mid_x, mid_y, settings->current_z) + 08114 find_straight_length(end_x, end_y, 08115 end_z 08116 #ifdef AA 08117 , AA_end 08118 #endif 08119 08120 #ifdef BB 08121 , BB_end 08122 #endif 08123 08124 #ifdef CC 08125 , CC_end 08126 #endif 08127 , mid_x, mid_y, 08128 settings->current_z 08129 #ifdef AA 08130 , AA_end 08131 #endif 08132 08133 #ifdef BB 08134 , BB_end 08135 #endif 08136 08137 #ifdef CC 08138 , CC_end 08139 #endif 08140 )); 08141 rate SET_TO MAX(0.1, (length * block->f_number)); 08142 SET_FEED_RATE (rate); 08143 settings->feed_rate SET_TO rate; 08144 08145 return RS274NGC_OK; 08146 } |
|
Definition at line 8166 of file rs274ngc_pre.cc. 08181 { 08182 static char name[] SET_TO "inverse_time_rate_straight"; 08183 double length; 08184 double rate; 08185 08186 length SET_TO find_straight_length 08187 (end_x, end_y, end_z 08188 #ifdef AA 08189 , AA_end 08190 #endif 08191 08192 #ifdef BB 08193 , BB_end 08194 #endif 08195 08196 #ifdef CC 08197 , CC_end 08198 #endif 08199 , settings->current_x, 08200 settings->current_y, settings->current_z 08201 08202 #ifdef AA 08203 , settings->AA_current 08204 #endif 08205 08206 #ifdef BB 08207 , settings->BB_current 08208 #endif 08209 08210 #ifdef CC 08211 , settings->CC_current 08212 #endif 08213 ); 08214 rate SET_TO MAX(0.1, (length * block->f_number)); 08215 SET_FEED_RATE (rate); 08216 settings->feed_rate SET_TO rate; 08217 08218 return RS274NGC_OK; 08219 } |
|
Definition at line 8242 of file rs274ngc_pre.cc. 08246 { 08247 static char name[] SET_TO "parse_line"; 08248 int status; 08249 08250 CHP(init_block (block)); 08251 CHP(read_items(block, line, settings->parameters)); 08252 CHP(enhance_block(block, settings)); 08253 CHP(check_items (block, settings)); 08254 return RS274NGC_OK; 08255 } |
|
Definition at line 8273 of file rs274ngc_pre.cc. 08275 { 08276 if (an_operator IS RIGHT_BRACKET) 08277 return 1; 08278 else if (an_operator IS POWER) 08279 return 4; 08280 else if (an_operator >= AND2) 08281 return 2; 08282 else 08283 return 3; 08284 } |
|
Definition at line 8325 of file rs274ngc_pre.cc. 08326 : line of RS274/NGC code being processed */ 08327 int * counter, /* pointer to a counter for position on the line */ 08328 block_pointer block, /* pointer to a block being filled from the line */ 08329 double * parameters) /* array of system parameters */ 08330 { 08331 static char name[] SET_TO "read_a"; 08332 double value; 08333 int status; 08334 08335 CHK((line[*counter] ISNT 'a'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08336 *counter SET_TO (*counter + 1); 08337 #ifdef AA 08338 CHK((block->a_flag ISNT OFF), NCE_MULTIPLE_A_WORDS_ON_ONE_LINE); /*AA*/ 08339 #endif 08340 CHP(read_real_value(line, counter, &value, parameters)); 08341 #ifdef AA 08342 block->a_flag SET_TO ON; 08343 block->a_number SET_TO value; 08344 #else 08345 #ifdef AXIS_ERROR 08346 ERM(NCE_CANNOT_USE_A_WORD); 08347 #endif /* ifdef AXIS_ERROR */ 08348 #endif /* ifdef AA */ 08349 return RS274NGC_OK; 08350 } |
|
Definition at line 8388 of file rs274ngc_pre.cc. 08389 : line of RS274/NGC code being processed */ 08390 int * counter, /* pointer to a counter for position on line */ 08391 double * double_ptr, /* pointer to double to be read */ 08392 double * parameters) /* array of system parameters */ 08393 { 08394 static char name[] SET_TO "read_atan"; 08395 double argument2; 08396 int status; 08397 08398 CHK((line [*counter] ISNT '/'), NCE_SLASH_MISSING_AFTER_FIRST_ATAN_ARGUMENT); 08399 *counter SET_TO (*counter + 1); 08400 CHK((line[*counter] ISNT '['), 08401 NCE_LEFT_BRACKET_MISSING_AFTER_SLASH_WITH_ATAN); 08402 CHP(read_real_expression (line, counter, &argument2, parameters)); 08403 *double_ptr SET_TO atan2(*double_ptr, argument2); /* value in radians */ 08404 *double_ptr SET_TO ((*double_ptr * 180.0)/PI); /* convert to degrees */ 08405 return RS274NGC_OK; 08406 } |
|
Definition at line 8447 of file rs274ngc_pre.cc. 08448 : line of RS274/NGC code being processed */ 08449 int * counter, /* pointer to a counter for position on the line */ 08450 block_pointer block, /* pointer to a block being filled from the line */ 08451 double * parameters) /* array of system parameters */ 08452 { 08453 static char name[] SET_TO "read_b"; 08454 double value; 08455 int status; 08456 08457 CHK((line[*counter] ISNT 'b'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08458 *counter SET_TO (*counter + 1); 08459 #ifdef BB 08460 CHK((block->b_flag ISNT OFF), NCE_MULTIPLE_B_WORDS_ON_ONE_LINE); /*BB*/ 08461 #endif 08462 CHP(read_real_value(line, counter, &value, parameters)); 08463 #ifdef BB 08464 block->b_flag SET_TO ON; 08465 block->b_number SET_TO value; 08466 #else 08467 #ifdef AXIS_ERROR 08468 ERM(NCE_CANNOT_USE_B_WORD); 08469 #endif /* ifdef AXIS_ERROR */ 08470 #endif /* ifdef BB */ 08471 return RS274NGC_OK; 08472 } |
|
Definition at line 8513 of file rs274ngc_pre.cc. 08514 : line of RS274/NGC code being processed */ 08515 int * counter, /* pointer to a counter for position on the line */ 08516 block_pointer block, /* pointer to a block being filled from the line */ 08517 double * parameters) /* array of system parameters */ 08518 { 08519 static char name[] SET_TO "read_c"; 08520 double value; 08521 int status; 08522 08523 CHK((line[*counter] ISNT 'c'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08524 *counter SET_TO (*counter + 1); 08525 #ifdef CC 08526 CHK((block->c_flag ISNT OFF), NCE_MULTIPLE_C_WORDS_ON_ONE_LINE); /*CC*/ 08527 #endif 08528 CHP(read_real_value(line, counter, &value, parameters)); 08529 #ifdef CC 08530 block->c_flag SET_TO ON; 08531 block->c_number SET_TO value; 08532 #else 08533 #ifdef AXIS_ERROR 08534 ERM(NCE_CANNOT_USE_C_WORD); 08535 #endif /* ifdef AXIS_ERROR */ 08536 #endif /* ifdef CC */ 08537 return RS274NGC_OK; 08538 } |
|
Definition at line 8574 of file rs274ngc_pre.cc. 08575 : line of RS274 code being processed */ 08576 int * counter, /* pointer to a counter for position on the line */ 08577 block_pointer block, /* pointer to a block being filled from the line */ 08578 double * parameters) /* array of system parameters */ 08579 { 08580 static char name[] SET_TO "read_comment"; 08581 int n; 08582 08583 CHK((line[*counter] ISNT '('), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08584 (*counter)++; 08585 for (n SET_TO 0; line[*counter] ISNT ')' ; (*counter)++, n++) 08586 { 08587 block->comment[n] SET_TO line[*counter]; 08588 } 08589 block->comment[n] SET_TO 0; 08590 (*counter)++; 08591 return RS274NGC_OK; 08592 } |
|
Definition at line 8627 of file rs274ngc_pre.cc. 08628 : line of RS274 code being processed */ 08629 int * counter, /* pointer to a counter for position on the line */ 08630 block_pointer block, /* pointer to a block being filled from the line */ 08631 double * parameters) /* array of system parameters */ 08632 { 08633 static char name[] SET_TO "read_d"; 08634 int value; 08635 int status; 08636 08637 CHK((line[*counter] ISNT 'd'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08638 *counter SET_TO (*counter + 1); 08639 CHK((block->d_number > -1), NCE_MULTIPLE_D_WORDS_ON_ONE_LINE); 08640 CHP(read_integer_value(line, counter, &value, parameters)); 08641 CHK((value < 0), NCE_NEGATIVE_D_WORD_TOOL_RADIUS_INDEX_USED); 08642 CHK((value > _setup.tool_max), NCE_TOOL_RADIUS_INDEX_TOO_BIG); 08643 block->d_number SET_TO value; 08644 return RS274NGC_OK; 08645 } |
|
Definition at line 8679 of file rs274ngc_pre.cc. 08680 : line of RS274 code being processed */ 08681 int * counter, /* pointer to a counter for position on the line */ 08682 block_pointer block, /* pointer to a block being filled from the line */ 08683 double * parameters) /* array of system parameters */ 08684 { 08685 static char name[] SET_TO "read_f"; 08686 double value; 08687 int status; 08688 08689 CHK((line[*counter] ISNT 'f'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08690 *counter SET_TO (*counter + 1); 08691 CHK((block->f_number > -1.0), NCE_MULTIPLE_F_WORDS_ON_ONE_LINE); 08692 CHP(read_real_value(line, counter, &value, parameters)); 08693 CHK((value < 0.0), NCE_NEGATIVE_F_WORD_USED); 08694 block->f_number SET_TO value; 08695 return RS274NGC_OK; 08696 } |
|
Definition at line 8747 of file rs274ngc_pre.cc. 08748 : line of RS274/NGC code being processed */ 08749 int * counter, /* pointer to a counter for position on the line */ 08750 block_pointer block, /* pointer to a block being filled from the line */ 08751 double * parameters) /* array of system parameters */ 08752 { 08753 static char name[] SET_TO "read_g"; 08754 double value_read; 08755 int value; 08756 int mode; 08757 int status; 08758 08759 CHK((line[*counter] ISNT 'g'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08760 *counter SET_TO (*counter + 1); 08761 CHP(read_real_value(line, counter, &value_read, parameters)); 08762 value_read SET_TO (10.0 * value_read); 08763 value SET_TO (int)floor(value_read); 08764 08765 if ((value_read - value) > 0.999) 08766 value SET_TO (int)ceil(value_read); 08767 else if ((value_read - value) > 0.001) 08768 ERM(NCE_G_CODE_OUT_OF_RANGE); 08769 08770 CHK((value > 999), NCE_G_CODE_OUT_OF_RANGE); 08771 CHK((value < 0), NCE_NEGATIVE_G_CODE_USED); 08772 mode SET_TO _gees[value]; 08773 CHK((mode IS -1), NCE_UNKNOWN_G_CODE_USED); 08774 CHK((block->g_modes[mode] ISNT -1), 08775 NCE_TWO_G_CODES_USED_FROM_SAME_MODAL_GROUP); 08776 block->g_modes[mode] SET_TO value; 08777 return RS274NGC_OK; 08778 } |
|
Definition at line 8810 of file rs274ngc_pre.cc. 08811 : line of RS274/NGC code being processed */ 08812 int * counter, /* pointer to a counter for position on the line */ 08813 block_pointer block, /* pointer to a block being filled from the line */ 08814 double * parameters) /* array of system parameters */ 08815 { 08816 static char name[] SET_TO "read_h"; 08817 int value; 08818 int status; 08819 08820 CHK((line[*counter] ISNT 'h'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08821 *counter SET_TO (*counter + 1); 08822 CHK((block->h_number > -1), NCE_MULTIPLE_H_WORDS_ON_ONE_LINE); 08823 CHP(read_integer_value(line, counter, &value, parameters)); 08824 CHK((value < 0), NCE_NEGATIVE_H_WORD_TOOL_LENGTH_OFFSET_INDEX_USED); 08825 CHK((value > _setup.tool_max), NCE_TOOL_LENGTH_OFFSET_INDEX_TOO_BIG); 08826 block->h_number SET_TO value; 08827 return RS274NGC_OK; 08828 } |
|
Definition at line 8863 of file rs274ngc_pre.cc. 08864 : line of RS274 code being processed */ 08865 int * counter, /* pointer to a counter for position on the line */ 08866 block_pointer block, /* pointer to a block being filled from the line */ 08867 double * parameters) /* array of system parameters */ 08868 { 08869 static char name[] SET_TO "read_i"; 08870 double value; 08871 int status; 08872 08873 CHK((line[*counter] ISNT 'i'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 08874 *counter SET_TO (*counter + 1); 08875 CHK((block->i_flag ISNT OFF), NCE_MULTIPLE_I_WORDS_ON_ONE_LINE); 08876 CHP(read_real_value(line, counter, &value, parameters)); 08877 block->i_flag SET_TO ON; 08878 block->i_number SET_TO value; 08879 return RS274NGC_OK; 08880 } |
|
Definition at line 8905 of file rs274ngc_pre.cc. 08906 : line of RS274 code being processed */ 08907 int * counter, /* pointer to a counter for position on the line */ 08908 int * integer_ptr) /* pointer to the value being read */ 08909 { 08910 static char name[] SET_TO "read_integer_unsigned"; 08911 int n; 08912 char c; 08913 08914 for (n SET_TO *counter; ; n++) 08915 { 08916 c SET_TO line[n]; 08917 if ((c < 48) OR (c > 57)) 08918 break; 08919 } 08920 CHK((n IS *counter), NCE_BAD_FORMAT_UNSIGNED_INTEGER); 08921 if (sscanf(line + *counter, "%d", integer_ptr) IS 0) 08922 ERM(NCE_SSCANF_FAILED); 08923 *counter SET_TO n; 08924 return RS274NGC_OK; 08925 } |
|
Definition at line 8961 of file rs274ngc_pre.cc. 08962 : line of RS274/NGC code being processed */ 08963 int * counter, /* pointer to a counter for position on the line */ 08964 int * integer_ptr, /* pointer to the value being read */ 08965 double * parameters) /* array of system parameters */ 08966 { 08967 static char name[] SET_TO "read_integer_value"; 08968 double float_value; 08969 int status; 08970 08971 CHP(read_real_value(line, counter, &float_value, parameters)); 08972 *integer_ptr SET_TO (int)floor(float_value); 08973 if ((float_value - *integer_ptr) > 0.9999) 08974 { 08975 *integer_ptr SET_TO (int)ceil(float_value); 08976 } 08977 else if ((float_value - *integer_ptr) > 0.0001) 08978 ERM(NCE_NON_INTEGER_VALUE_FOR_INTEGER); 08979 return RS274NGC_OK; 08980 } |
|
Definition at line 9000 of file rs274ngc_pre.cc. 09002 : line of RS274/NGC code being processed */ 09003 double * parameters) /* array of system parameters */ 09004 { 09005 static char name[] SET_TO "read_items"; 09006 int counter; 09007 int length; 09008 int status; 09009 09010 length SET_TO strlen(line); 09011 counter SET_TO 0; 09012 09013 if (line[counter] IS '/') /* skip the slash character if first */ 09014 counter++; 09015 if (line[counter] IS 'n') 09016 { 09017 CHP(read_line_number(line, &counter, block)); 09018 } 09019 for ( ; counter < length; ) 09020 { 09021 CHP(read_one_item (line, &counter, block, parameters)); 09022 } 09023 return RS274NGC_OK; 09024 } |
|
Definition at line 9059 of file rs274ngc_pre.cc. 09060 : line of RS274 code being processed */ 09061 int * counter, /* pointer to a counter for position on the line */ 09062 block_pointer block, /* pointer to a block being filled from the line */ 09063 double * parameters) /* array of system parameters */ 09064 { 09065 static char name[] SET_TO "read_j"; 09066 double value; 09067 int status; 09068 09069 CHK((line[*counter] ISNT 'j'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09070 *counter SET_TO (*counter + 1); 09071 CHK((block->j_flag ISNT OFF), NCE_MULTIPLE_J_WORDS_ON_ONE_LINE); 09072 CHP(read_real_value(line, counter, &value, parameters)); 09073 block->j_flag SET_TO ON; 09074 block->j_number SET_TO value; 09075 return RS274NGC_OK; 09076 } |
|
Definition at line 9111 of file rs274ngc_pre.cc. 09112 : line of RS274 code being processed */ 09113 int * counter, /* pointer to a counter for position on the line */ 09114 block_pointer block, /* pointer to a block being filled from the line */ 09115 double * parameters) /* array of system parameters */ 09116 { 09117 static char name[] SET_TO "read_k"; 09118 double value; 09119 int status; 09120 09121 CHK((line[*counter] ISNT 'k'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09122 *counter SET_TO (*counter + 1); 09123 CHK((block->k_flag ISNT OFF), NCE_MULTIPLE_K_WORDS_ON_ONE_LINE); 09124 CHP(read_real_value(line, counter, &value, parameters)); 09125 block->k_flag SET_TO ON; 09126 block->k_number SET_TO value; 09127 return RS274NGC_OK; 09128 } |
|
Definition at line 9161 of file rs274ngc_pre.cc. 09162 : line of RS274/NGC code being processed */ 09163 int * counter, /* pointer to a counter for position on the line */ 09164 block_pointer block, /* pointer to a block being filled from the line */ 09165 double * parameters) /* array of system parameters */ 09166 { 09167 static char name[] SET_TO "read_l"; 09168 int value; 09169 int status; 09170 09171 CHK((line[*counter] ISNT 'l'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09172 *counter SET_TO (*counter + 1); 09173 CHK((block->l_number > -1), NCE_MULTIPLE_L_WORDS_ON_ONE_LINE); 09174 CHP(read_integer_value(line, counter, &value, parameters)); 09175 CHK((value < 0), NCE_NEGATIVE_L_WORD_USED); 09176 block->l_number SET_TO value; 09177 return RS274NGC_OK; 09178 } |
|
Definition at line 9209 of file rs274ngc_pre.cc. 09210 : line of RS274 code being processed */ 09211 int * counter, /* pointer to a counter for position on the line */ 09212 block_pointer block) /* pointer to a block being filled from the line */ 09213 { 09214 static char name[] SET_TO "read_line_number"; 09215 int value; 09216 int status; 09217 09218 CHK((line[*counter] ISNT 'n'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09219 *counter SET_TO (*counter + 1); 09220 CHP(read_integer_unsigned(line, counter, &value)); 09221 CHK((value > 99999), NCE_LINE_NUMBER_GREATER_THAN_99999); 09222 block->line_number SET_TO value; 09223 return RS274NGC_OK; 09224 } |
|
Definition at line 9260 of file rs274ngc_pre.cc. 09261 : line of RS274 code being processed */ 09262 int * counter, /* pointer to a counter for position on the line */ 09263 block_pointer block, /* pointer to a block being filled from the line */ 09264 double * parameters) /* array of system parameters */ 09265 { 09266 static char name[] SET_TO "read_m"; 09267 int value; 09268 int mode; 09269 int status; 09270 09271 CHK((line[*counter] ISNT 'm'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09272 *counter SET_TO (*counter + 1); 09273 CHP(read_integer_value(line, counter, &value, parameters)); 09274 CHK((value < 0), NCE_NEGATIVE_M_CODE_USED); 09275 CHK((value > 99), NCE_M_CODE_GREATER_THAN_99); 09276 mode SET_TO _ems[value]; 09277 CHK((mode IS -1), NCE_UNKNOWN_M_CODE_USED); 09278 CHK((block->m_modes[mode] ISNT -1), 09279 NCE_TWO_M_CODES_USED_FROM_SAME_MODAL_GROUP); 09280 block->m_modes[mode] SET_TO value; 09281 block->m_count++; 09282 return RS274NGC_OK; 09283 } |
|
Definition at line 9330 of file rs274ngc_pre.cc. 09331 : line of RS274/NGC code being processed */ 09332 int * counter, /* pointer to a counter for position on the line */ 09333 block_pointer block, /* pointer to a block being filled from the line */ 09334 double * parameters) /* array of system parameters */ 09335 { 09336 static char name[] SET_TO "read_one_item"; 09337 int status; 09338 read_function_pointer function_pointer; 09339 char letter; 09340 09341 letter SET_TO line[*counter]; /* check if in array range */ 09342 CHK(((letter < 0) OR (letter > 'z')), NCE_BAD_CHARACTER_USED); 09343 function_pointer SET_TO _readers[letter]; 09344 CHK((function_pointer IS 0), NCE_BAD_CHARACTER_USED); 09345 CHP(function_pointer(line, counter, block, parameters)); 09346 return RS274NGC_OK; 09347 } |
|
Definition at line 9378 of file rs274ngc_pre.cc. 09379 : line of RS274/NGC code being processed */ 09380 int * counter, /* pointer to a counter for position on the line */ 09381 int * operation) /* pointer to operation to be read */ 09382 { 09383 static char name[] SET_TO "read_operation"; 09384 char c; 09385 09386 c SET_TO line[*counter]; 09387 *counter SET_TO (*counter + 1); 09388 switch(c) 09389 { 09390 case '+': 09391 *operation SET_TO PLUS; 09392 break; 09393 case '-': 09394 *operation SET_TO MINUS; 09395 break; 09396 case '/': 09397 *operation SET_TO DIVIDED_BY; 09398 break; 09399 case '*': 09400 if(line[*counter] IS '*') 09401 { 09402 *operation SET_TO POWER; 09403 *counter SET_TO (*counter + 1); 09404 } 09405 else 09406 *operation SET_TO TIMES; 09407 break; 09408 case ']': 09409 *operation SET_TO RIGHT_BRACKET; 09410 break; 09411 case 'a': 09412 if((line[*counter] IS 'n') AND (line[(*counter)+1] IS 'd')) 09413 { 09414 *operation SET_TO AND2; 09415 *counter SET_TO (*counter + 2); 09416 } 09417 else 09418 ERM(NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_A); 09419 break; 09420 case 'm': 09421 if((line[*counter] IS 'o') AND (line[(*counter)+1] IS 'd')) 09422 { 09423 *operation SET_TO MODULO; 09424 *counter SET_TO (*counter + 2); 09425 } 09426 else 09427 ERM(NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_M); 09428 break; 09429 case 'o': 09430 if(line[*counter] IS 'r') 09431 { 09432 *operation SET_TO NON_EXCLUSIVE_OR; 09433 *counter SET_TO (*counter + 1); 09434 } 09435 else 09436 ERM(NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_O); 09437 break; 09438 case 'x': 09439 if((line[*counter] IS 'o') AND (line[(*counter)+1] IS 'r')) 09440 { 09441 *operation SET_TO EXCLUSIVE_OR; 09442 *counter SET_TO (*counter + 2); 09443 } 09444 else 09445 ERM(NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_X); 09446 break; 09447 case 0: 09448 ERM(NCE_UNCLOSED_EXPRESSION); 09449 default: 09450 ERM(NCE_UNKNOWN_OPERATION); 09451 } 09452 return RS274NGC_OK; 09453 } |
|
Definition at line 9488 of file rs274ngc_pre.cc. 09489 : line of RS274/NGC code being processed */ 09490 int * counter, /* pointer to a counter for position on the line */ 09491 int * operation) /* pointer to operation to be read */ 09492 { 09493 static char name[] SET_TO "read_operation_unary"; 09494 char c; 09495 09496 c SET_TO line[*counter]; 09497 *counter SET_TO (*counter + 1); 09498 switch (c) 09499 { 09500 case 'a': 09501 if((line[*counter] IS 'b') AND (line[(*counter)+1] IS 's')) 09502 { 09503 *operation SET_TO ABS; 09504 *counter SET_TO (*counter + 2); 09505 } 09506 else if(strncmp((line + *counter), "cos", 3) IS 0) 09507 { 09508 *operation SET_TO ACOS; 09509 *counter SET_TO (*counter + 3); 09510 } 09511 else if(strncmp((line + *counter), "sin", 3) IS 0) 09512 { 09513 *operation SET_TO ASIN; 09514 *counter SET_TO (*counter + 3); 09515 } 09516 else if(strncmp((line + *counter), "tan", 3) IS 0) 09517 { 09518 *operation SET_TO ATAN; 09519 *counter SET_TO (*counter + 3); 09520 } 09521 else 09522 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_A); 09523 break; 09524 case 'c': 09525 if((line[*counter] IS 'o') AND (line[(*counter)+1] IS 's')) 09526 { 09527 *operation SET_TO COS; 09528 *counter SET_TO (*counter + 2); 09529 } 09530 else 09531 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_C); 09532 break; 09533 case 'e': 09534 if((line[*counter] IS 'x') AND (line[(*counter)+1] IS 'p')) 09535 { 09536 *operation SET_TO EXP; 09537 *counter SET_TO (*counter + 2); 09538 } 09539 else 09540 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_E); 09541 break; 09542 case 'f': 09543 if((line[*counter] IS 'i') AND (line[(*counter)+1] IS 'x')) 09544 { 09545 *operation SET_TO FIX; 09546 *counter SET_TO (*counter + 2); 09547 } 09548 else if((line[*counter] IS 'u') AND (line[(*counter)+1] IS 'p')) 09549 { 09550 *operation SET_TO FUP; 09551 *counter SET_TO (*counter + 2); 09552 } 09553 else 09554 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_F); 09555 break; 09556 case 'l': 09557 if(line[*counter] IS 'n') 09558 { 09559 *operation SET_TO LN; 09560 *counter SET_TO (*counter + 1); 09561 } 09562 else 09563 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_L); 09564 break; 09565 case 'r': 09566 if(strncmp((line + *counter), "ound", 4) IS 0) 09567 { 09568 *operation SET_TO ROUND; 09569 *counter SET_TO (*counter + 4); 09570 } 09571 else 09572 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_R); 09573 break; 09574 case 's': 09575 if((line[*counter] IS 'i') AND (line[(*counter)+1] IS 'n')) 09576 { 09577 *operation SET_TO SIN; 09578 *counter SET_TO (*counter + 2); 09579 } 09580 else if(strncmp((line + *counter), "qrt", 3) IS 0) 09581 { 09582 *operation SET_TO SQRT; 09583 *counter SET_TO (*counter + 3); 09584 } 09585 else 09586 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_S); 09587 break; 09588 case 't': 09589 if((line[*counter] IS 'a') AND (line[(*counter)+1] IS 'n')) 09590 { 09591 *operation SET_TO TAN; 09592 *counter SET_TO (*counter + 2); 09593 } 09594 else 09595 ERM(NCE_UNKNOWN_WORD_STARTING_WITH_T); 09596 break; 09597 default: 09598 ERM(NCE_UNKNOWN_WORD_WHERE_UNARY_OPERATION_COULD_BE); 09599 } 09600 return RS274NGC_OK; 09601 } |
|
Definition at line 9635 of file rs274ngc_pre.cc. 09636 : line of RS274/NGC code being processed */ 09637 int * counter, /* pointer to a counter for position on the line */ 09638 block_pointer block, /* pointer to a block being filled from the line */ 09639 double * parameters) /* array of system parameters */ 09640 { 09641 static char name[] SET_TO "read_p"; 09642 double value; 09643 int status; 09644 09645 CHK((line[*counter] ISNT 'p'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09646 *counter SET_TO (*counter + 1); 09647 CHK((block->p_number > -1.0), NCE_MULTIPLE_P_WORDS_ON_ONE_LINE); 09648 CHP(read_real_value(line, counter, &value, parameters)); 09649 CHK((value < 0.0), NCE_NEGATIVE_P_WORD_USED); 09650 block->p_number SET_TO value; 09651 return RS274NGC_OK; 09652 } |
|
Definition at line 9691 of file rs274ngc_pre.cc. 09692 : line of RS274/NGC code being processed */ 09693 int * counter, /* pointer to a counter for position on the line */ 09694 double * double_ptr, /* pointer to double to be read */ 09695 double * parameters) /* array of system parameters */ 09696 { 09697 static char name[] SET_TO "read_parameter"; 09698 int index; 09699 int status; 09700 09701 CHK((line[*counter] ISNT '#'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09702 *counter SET_TO (*counter + 1); 09703 CHP(read_integer_value(line, counter, &index, parameters)); 09704 CHK(((index < 1) OR (index >= RS274NGC_MAX_PARAMETERS)), 09705 NCE_PARAMETER_NUMBER_OUT_OF_RANGE); 09706 *double_ptr SET_TO parameters[index]; 09707 return RS274NGC_OK; 09708 } |
|
Definition at line 9777 of file rs274ngc_pre.cc. 09778 : line of RS274/NGC code being processed */ 09779 int * counter, /* pointer to a counter for position on the line */ 09780 block_pointer block, /* pointer to a block being filled from the line */ 09781 double * parameters) /* array of system parameters */ 09782 { 09783 static char name[] SET_TO "read_parameter_setting"; 09784 int index; 09785 double value; 09786 int status; 09787 09788 CHK((line[*counter] ISNT '#'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09789 *counter SET_TO (*counter + 1); 09790 CHP(read_integer_value(line, counter, &index, parameters)); 09791 CHK(((index < 1) OR (index >= RS274NGC_MAX_PARAMETERS)), 09792 NCE_PARAMETER_NUMBER_OUT_OF_RANGE); 09793 CHK((line[*counter] ISNT '='), NCE_EQUAL_SIGN_MISSING_IN_PARAMETER_SETTING); 09794 *counter SET_TO (*counter + 1); 09795 CHP(read_real_value(line, counter, &value, parameters)); 09796 _setup.parameter_numbers[_setup.parameter_occurrence] SET_TO index; 09797 _setup.parameter_values[_setup.parameter_occurrence] SET_TO value; 09798 _setup.parameter_occurrence++; 09799 return RS274NGC_OK; 09800 } |
|
Definition at line 9833 of file rs274ngc_pre.cc. 09834 : line of RS274/NGC code being processed */ 09835 int * counter, /* pointer to a counter for position on the line */ 09836 block_pointer block, /* pointer to a block being filled from the line */ 09837 double * parameters) /* array of system parameters */ 09838 { 09839 static char name[] SET_TO "read_q"; 09840 double value; 09841 int status; 09842 09843 CHK((line[*counter] ISNT 'q'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09844 *counter SET_TO (*counter + 1); 09845 CHK((block->q_number > -1.0), NCE_MULTIPLE_Q_WORDS_ON_ONE_LINE); 09846 CHP(read_real_value(line, counter, &value, parameters)); 09847 CHK((value <= 0.0), NCE_NEGATIVE_OR_ZERO_Q_VALUE_USED); 09848 block->q_number SET_TO value; 09849 return RS274NGC_OK; 09850 } |
|
Definition at line 9887 of file rs274ngc_pre.cc. 09888 : line of RS274 code being processed */ 09889 int * counter, /* pointer to a counter for position on the line */ 09890 block_pointer block, /* pointer to a block being filled from the line */ 09891 double * parameters) /* array of system parameters */ 09892 { 09893 static char name[] SET_TO "read_r"; 09894 double value; 09895 int status; 09896 09897 CHK((line[*counter] ISNT 'r'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 09898 *counter SET_TO (*counter + 1); 09899 CHK((block->r_flag ISNT OFF), NCE_MULTIPLE_R_WORDS_ON_ONE_LINE); 09900 CHP(read_real_value(line, counter, &value, parameters)); 09901 block->r_flag SET_TO ON; 09902 block->r_number SET_TO value; 09903 return RS274NGC_OK; 09904 } |
|
Definition at line 10155 of file rs274ngc_pre.cc. 10156 : line of RS274/NGC code being processed */ 10157 int * counter, /* pointer to a counter for position on the line */ 10158 double * value, /* pointer to double to be computed */ 10159 double * parameters) /* array of system parameters */ 10160 { 10161 static char name[] SET_TO "read_real_expression"; 10162 double values[MAX_STACK]; 10163 int operators[MAX_STACK]; 10164 int stack_index; 10165 int status; 10166 10167 CHK((line[*counter] ISNT '['), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10168 *counter SET_TO (*counter + 1); 10169 CHP(read_real_value(line, counter, values, parameters)); 10170 CHP(read_operation(line, counter, operators)); 10171 stack_index SET_TO 1; 10172 for(; operators[0] ISNT RIGHT_BRACKET ;) 10173 { 10174 CHP(read_real_value(line, counter, values+stack_index, parameters)); 10175 CHP(read_operation(line, counter, operators+stack_index)); 10176 if (precedence(operators[stack_index]) > 10177 precedence(operators[stack_index - 1])) 10178 stack_index++; 10179 else /* precedence of latest operator is <= previous precedence */ 10180 { 10181 for (;precedence(operators[stack_index]) <= 10182 precedence(operators[stack_index - 1]); ) 10183 { 10184 CHP(execute_binary((values + stack_index - 1), 10185 operators[stack_index -1], 10186 (values + stack_index))); 10187 operators[stack_index - 1] SET_TO operators[stack_index]; 10188 if ((stack_index > 1) AND 10189 (precedence(operators[stack_index - 1]) <= 10190 precedence(operators[stack_index - 2]))) 10191 stack_index--; 10192 else 10193 break; 10194 } 10195 } 10196 } 10197 *value SET_TO values[0]; 10198 return RS274NGC_OK; 10199 } |
|
Definition at line 10239 of file rs274ngc_pre.cc. 10240 : line of RS274/NGC code being processed */ 10241 int * counter, /* pointer to a counter for position on the line */ 10242 double * double_ptr) /* pointer to double to be read */ 10243 { 10244 static char name[] SET_TO "read_real_number"; 10245 char c; /* for character being processed */ 10246 int flag_digit; /* set to ON if digit found */ 10247 int flag_point; /* set to ON if decimal point found */ 10248 int n; /* for indexing line */ 10249 10250 n SET_TO *counter; 10251 flag_point SET_TO OFF; 10252 flag_digit SET_TO OFF; 10253 10254 /* check first character */ 10255 c SET_TO line[n]; 10256 if (c IS '+') 10257 { 10258 *counter SET_TO (*counter + 1); /* skip plus sign */ 10259 n++; 10260 } 10261 else if (c IS '-') 10262 { 10263 n++; 10264 } 10265 else if ((c ISNT '.') AND ((c < 48) OR (c > 57))) 10266 ERM(NCE_BAD_NUMBER_FORMAT); 10267 10268 /* check out rest of characters (must be digit or decimal point) */ 10269 for (; (c SET_TO line[n]) ISNT (char) NULL; n++) 10270 { 10271 if (( 47 < c) AND ( c < 58)) 10272 { 10273 flag_digit SET_TO ON; 10274 } 10275 else if (c IS '.') 10276 { 10277 if (flag_point IS OFF) 10278 { 10279 flag_point SET_TO ON; 10280 } 10281 else 10282 break; /* two decimal points, error appears on reading next item */ 10283 } 10284 else 10285 break; 10286 } 10287 10288 CHK((flag_digit IS OFF), NCE_NO_DIGITS_FOUND_WHERE_REAL_NUMBER_SHOULD_BE); 10289 line[n] SET_TO (char) NULL; /* temporary string termination for sscanf */ 10290 if (sscanf(line + *counter, "%lf", double_ptr) IS 0) 10291 { 10292 line[n] SET_TO c; 10293 ERM(NCE_SSCANF_FAILED); 10294 } 10295 else 10296 { 10297 line[n] SET_TO c; 10298 *counter SET_TO n; 10299 } 10300 return RS274NGC_OK; 10301 } |
|
Definition at line 10350 of file rs274ngc_pre.cc. 10351 : line of RS274/NGC code being processed */ 10352 int * counter, /* pointer to a counter for position on the line */ 10353 double * double_ptr, /* pointer to double to be read */ 10354 double * parameters) /* array of system parameters */ 10355 { 10356 static char name[] SET_TO "read_real_value"; 10357 char c; 10358 int status; 10359 10360 c SET_TO line[*counter]; 10361 CHK((c IS 0), NCE_NO_CHARACTERS_FOUND_IN_READING_REAL_VALUE); 10362 if (c IS '[') 10363 CHP(read_real_expression (line, counter, double_ptr, parameters)); 10364 else if (c IS '#') 10365 CHP(read_parameter(line, counter, double_ptr, parameters)); 10366 else if ((c >= 'a') AND (c <= 'z')) 10367 CHP(read_unary(line, counter, double_ptr, parameters)); 10368 else 10369 CHP(read_real_number(line, counter, double_ptr)); 10370 10371 return RS274NGC_OK; 10372 } |
|
Definition at line 10524 of file rs274ngc_pre.cc. 10525 : line of RS274NGC code being processed */ 10526 int * counter, /* pointer to a counter for position on the line */ 10527 block_pointer block, /* pointer to a block being filled from the line */ 10528 double * parameters) /* array of system parameters */ 10529 { 10530 static char name[] SET_TO "read_s"; 10531 double value; 10532 int status; 10533 10534 CHK((line[*counter] ISNT 's'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10535 *counter SET_TO (*counter + 1); 10536 CHK((block->s_number > -1.0), NCE_MULTIPLE_S_WORDS_ON_ONE_LINE); 10537 CHP(read_real_value(line, counter, &value, parameters)); 10538 CHK((value < 0.0), NCE_NEGATIVE_SPINDLE_SPEED_USED); 10539 block->s_number SET_TO value; 10540 return RS274NGC_OK; 10541 } |
|
Definition at line 10574 of file rs274ngc_pre.cc. 10575 : line of RS274/NGC code being processed */ 10576 int * counter, /* pointer to a counter for position on the line */ 10577 block_pointer block, /* pointer to a block being filled from the line */ 10578 double * parameters) /* array of system parameters */ 10579 { 10580 static char name[] SET_TO "read_t"; 10581 int value; 10582 int status; 10583 10584 CHK((line[*counter] ISNT 't'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10585 *counter SET_TO (*counter + 1); 10586 CHK((block->t_number > -1), NCE_MULTIPLE_T_WORDS_ON_ONE_LINE); 10587 CHP(read_integer_value(line, counter, &value, parameters)); 10588 CHK((value < 0), NCE_NEGATIVE_TOOL_ID_USED); 10589 block->t_number SET_TO value; 10590 return RS274NGC_OK; 10591 } |
|
Definition at line 10658 of file rs274ngc_pre.cc. Referenced by rs274ngc_read().
10664 { 10665 static char name[] SET_TO "read_text"; 10666 int status; /* used in CHP */ 10667 int index; 10668 10669 10670 if (command IS NULL) 10671 { 10672 if(fgets(raw_line, RS274NGC_TEXT_SIZE, inport) IS NULL) 10673 { 10674 if (_setup.percent_flag IS ON) 10675 ERM(NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN); 10676 else 10677 ERM(NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN_OR_PROGRAM_END); 10678 } 10679 _setup.sequence_number++; 10680 if (strlen(raw_line) IS (RS274NGC_TEXT_SIZE - 1)) 10681 { // line is too long. need to finish reading the line to recover 10682 for(;fgetc(inport) ISNT '\n';){} // could also look for EOF 10683 ERM(NCE_COMMAND_TOO_LONG); 10684 } 10685 for(index SET_TO (strlen(raw_line) -1); // index set on last char 10686 (index >= 0) AND (isspace(raw_line[index])); 10687 index--) 10688 { // remove space at end of raw_line, especially CR & LF 10689 raw_line[index] SET_TO 0; 10690 } 10691 strcpy(line, raw_line); 10692 CHP(close_and_downcase(line)); 10693 if ((line[0] IS '%') AND (line[1] IS 0) AND (_setup.percent_flag IS ON)) 10694 return RS274NGC_ENDFILE; 10695 } 10696 else 10697 { 10698 CHK((strlen(command) >= RS274NGC_TEXT_SIZE), NCE_COMMAND_TOO_LONG); 10699 strcpy(raw_line, command); 10700 strcpy(line, command); 10701 CHP(close_and_downcase(line)); 10702 } 10703 _setup.parameter_occurrence SET_TO 0; /* initialize parameter buffer */ 10704 if ((line[0] IS 0) OR ((line[0] IS '/') AND (line[1] IS 0))) 10705 *length SET_TO 0; 10706 else 10707 *length SET_TO strlen(line); 10708 10709 return ((line[0] IS '/')? RS274NGC_EXECUTE_FINISH : RS274NGC_OK); 10710 } |
|
Definition at line 10741 of file rs274ngc_pre.cc. 10742 : line of RS274/NGC code being processed */ 10743 int * counter, /* pointer to a counter for position on the line */ 10744 double * double_ptr, /* pointer to double to be read */ 10745 double * parameters) /* array of system parameters */ 10746 { 10747 static char name[] SET_TO "read_unary"; 10748 int operation; 10749 int status; 10750 10751 CHP(read_operation_unary (line, counter, &operation)); 10752 CHK((line[*counter] ISNT '['), 10753 NCE_LEFT_BRACKET_MISSING_AFTER_UNARY_OPERATION_NAME); 10754 CHP(read_real_expression (line, counter, double_ptr, parameters)); 10755 10756 if (operation IS ATAN) 10757 CHP(read_atan(line, counter, double_ptr, parameters)); 10758 else 10759 CHP(execute_unary(double_ptr, operation)); 10760 return RS274NGC_OK; 10761 } |
|
Definition at line 10796 of file rs274ngc_pre.cc. 10797 : line of RS274 code being processed */ 10798 int * counter, /* pointer to a counter for position on the line */ 10799 block_pointer block, /* pointer to a block being filled from the line */ 10800 double * parameters) /* array of system parameters */ 10801 { 10802 static char name[] SET_TO "read_x"; 10803 double value; 10804 int status; 10805 10806 CHK((line[*counter] ISNT 'x'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10807 *counter SET_TO (*counter + 1); 10808 CHK((block->x_flag ISNT OFF), NCE_MULTIPLE_X_WORDS_ON_ONE_LINE); 10809 CHP(read_real_value(line, counter, &value, parameters)); 10810 block->x_flag SET_TO ON; 10811 block->x_number SET_TO value; 10812 return RS274NGC_OK; 10813 } |
|
Definition at line 10848 of file rs274ngc_pre.cc. 10849 : line of RS274 code being processed */ 10850 int * counter, /* pointer to a counter for position on the line */ 10851 block_pointer block, /* pointer to a block being filled from the line */ 10852 double * parameters) /* array of system parameters */ 10853 { 10854 static char name[] SET_TO "read_y"; 10855 double value; 10856 int status; 10857 10858 CHK((line[*counter] ISNT 'y'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10859 *counter SET_TO (*counter + 1); 10860 CHK((block->y_flag ISNT OFF), NCE_MULTIPLE_Y_WORDS_ON_ONE_LINE); 10861 CHP(read_real_value(line, counter, &value, parameters)); 10862 block->y_flag SET_TO ON; 10863 block->y_number SET_TO value; 10864 return RS274NGC_OK; 10865 } |
|
Definition at line 10900 of file rs274ngc_pre.cc. 10901 : line of RS274 code being processed */ 10902 int * counter, /* pointer to a counter for position on the line */ 10903 block_pointer block, /* pointer to a block being filled from the line */ 10904 double * parameters) /* array of system parameters */ 10905 { 10906 static char name[] SET_TO "read_z"; 10907 double value; 10908 int status; 10909 10910 CHK((line[*counter] ISNT 'z'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED); 10911 *counter SET_TO (*counter + 1); 10912 CHK((block->z_flag ISNT OFF), NCE_MULTIPLE_Z_WORDS_ON_ONE_LINE); 10913 CHP(read_real_value(line, counter, &value, parameters)); 10914 block->z_flag SET_TO ON; 10915 block->z_number SET_TO value; 10916 return RS274NGC_OK; 10917 } |
|
Definition at line 11940 of file rs274ngc_pre.cc. Referenced by emcTaskUpdate(), and main().
11942 { 11943 int n; 11944 11945 for (n SET_TO 0; n < RS274NGC_ACTIVE_G_CODES; n++) 11946 { 11947 codes[n] SET_TO _setup.active_g_codes[n]; 11948 } 11949 } |
|
Definition at line 11965 of file rs274ngc_pre.cc. Referenced by emcTaskUpdate(), and main().
11967 { 11968 int n; 11969 11970 for (n SET_TO 0; n < RS274NGC_ACTIVE_M_CODES; n++) 11971 { 11972 codes[n] SET_TO _setup.active_m_codes[n]; 11973 } 11974 } |
|
Definition at line 11990 of file rs274ngc_pre.cc. Referenced by emcTaskUpdate(), and main().
11992 { 11993 int n; 11994 11995 for (n SET_TO 0; n < RS274NGC_ACTIVE_SETTINGS; n++) 11996 { 11997 settings[n] SET_TO _setup.active_settings[n]; 11998 } 11999 } |
|
Definition at line 11144 of file rs274ngc_pre.cc. 11145 { 11146 if (_setup.file_pointer ISNT NULL) 11147 { 11148 fclose(_setup.file_pointer); 11149 _setup.file_pointer SET_TO NULL; 11150 } 11151 rs274ngc_reset(); 11152 11153 return RS274NGC_OK; 11154 } |
|
Definition at line 12020 of file rs274ngc_pre.cc. Referenced by waitFlag().
12024 { 12025 if (((error_code >= RS274NGC_MIN_ERROR) AND 12026 (error_code <= RS274NGC_MAX_ERROR)) AND 12027 (strlen(_rs274ngc_errors[error_code]) < ((size_t) max_size) )) 12028 { 12029 strcpy(error_text, _rs274ngc_errors[error_code]); 12030 } 12031 else 12032 error_text[0] SET_TO 0; 12033 } |
|
Definition at line 11179 of file rs274ngc_pre.cc. Referenced by emcTaskPlanExecute(), emcTaskPlanInit(), interpret_from_file(), and interpret_from_keyboard().
11183 { 11184 static char name[] SET_TO "rs274ngc_execute"; 11185 int status; 11186 int n; 11187 11188 #ifndef NOT_OLD_EMC_INTERP_COMPATIBLE 11189 if(NULL != command) 11190 { 11191 status = rs274ngc_read(command); 11192 } 11193 #endif 11194 11195 for (n SET_TO 0; n < _setup.parameter_occurrence; n++) 11196 { // copy parameter settings from parameter buffer into parameter table 11197 _setup.parameters[_setup.parameter_numbers[n]] 11198 SET_TO _setup.parameter_values[n]; 11199 } 11200 if (_setup.line_length ISNT 0) /* line not blank */ 11201 { 11202 status SET_TO execute_block (&(_setup.block1), &_setup); 11203 write_g_codes(&(_setup.block1), &_setup); 11204 write_m_codes(&(_setup.block1), &_setup); 11205 write_settings(&_setup); 11206 if ((status ISNT RS274NGC_OK) AND 11207 (status ISNT RS274NGC_EXECUTE_FINISH) AND 11208 (status ISNT RS274NGC_EXIT)) 11209 ERP(status); 11210 } 11211 else /* blank line is OK */ 11212 status SET_TO RS274NGC_OK; 11213 return status; 11214 } |
|
Definition at line 11233 of file rs274ngc_pre.cc. 11234 { 11235 char file_name[RS274NGC_TEXT_SIZE]; 11236 11237 GET_EXTERNAL_PARAMETER_FILE_NAME(file_name, (RS274NGC_TEXT_SIZE - 1)); 11238 rs274ngc_save_parameters 11239 (((file_name[0] IS 0) ? RS274NGC_PARAMETER_FILE_NAME_DEFAULT : file_name), 11240 _setup.parameters); 11241 rs274ngc_reset(); 11242 11243 return RS274NGC_OK; 11244 } |
|
Definition at line 12052 of file rs274ngc_pre.cc. Referenced by main(), and rs274ngc_file().
12053 : to copy file name into */ 12054 int max_size) /* maximum number of characters to copy */ 12055 { 12056 if (strlen(_setup.filename) < ((size_t) max_size) ) 12057 strcpy(file_name, _setup.filename); 12058 else 12059 file_name[0] SET_TO 0; 12060 } |
|
Definition at line 11273 of file rs274ngc_pre.cc. 11274 { 11275 static char name[] SET_TO "rs274ngc_init"; 11276 int k; // starting index in parameters of origin offsets 11277 int status; 11278 char filename[RS274NGC_TEXT_SIZE]; 11279 double * pars; // short name for _setup.parameters 11280 11281 INIT_CANON(); 11282 _setup.length_units SET_TO GET_EXTERNAL_LENGTH_UNIT_TYPE(); 11283 USE_LENGTH_UNITS(_setup.length_units); 11284 GET_EXTERNAL_PARAMETER_FILE_NAME(filename, RS274NGC_TEXT_SIZE); 11285 if (filename[0] IS 0) 11286 strcpy(filename, RS274NGC_PARAMETER_FILE_NAME_DEFAULT); 11287 CHP(rs274ngc_restore_parameters(filename)); 11288 pars SET_TO _setup.parameters; 11289 _setup.origin_index SET_TO (int)(pars[5220] + 0.0001); 11290 CHK(((_setup.origin_index < 1) OR (_setup.origin_index > 9)), 11291 NCE_COORDINATE_SYSTEM_INDEX_PARAMETER_5220_OUT_OF_RANGE); 11292 k SET_TO (5200 + (_setup.origin_index * 20)); 11293 SET_ORIGIN_OFFSETS((pars[k + 1] + pars[5211]), 11294 (pars[k + 2] + pars[5212]), 11295 (pars[k + 3] + pars[5213]) 11296 #ifdef AA 11297 , (pars[k + 4] + pars[5214]) 11298 #else 11299 #ifdef ALL_AXES 11300 , 0 11301 #endif 11302 #endif 11303 #ifdef BB 11304 , (pars[k + 5] + pars[5215]) 11305 #else 11306 #ifdef ALL_AXES 11307 , 0 11308 #endif 11309 #endif 11310 #ifdef CC 11311 , (pars[k + 6] + pars[5216]) 11312 #else 11313 #ifdef ALL_AXES 11314 , 0 11315 #endif 11316 #endif 11317 ); 11318 SET_FEED_REFERENCE(CANON_XYZ); 11319 #ifdef AA 11320 _setup.AA_axis_offset SET_TO pars[5214]; /*AA*/ 11321 #endif 11322 //_setup.Aa_current set in rs274ngc_synch 11323 #ifdef AA 11324 _setup.AA_origin_offset SET_TO pars[k + 4]; /*AA*/ 11325 #endif 11326 //_setup.active_g_codes initialized below 11327 //_setup.active_m_codes initialized below 11328 //_setup.active_settings initialized below 11329 _setup.axis_offset_x SET_TO pars[5211]; 11330 _setup.axis_offset_y SET_TO pars[5212]; 11331 _setup.axis_offset_z SET_TO pars[5213]; 11332 #ifdef BB 11333 _setup.BB_axis_offset SET_TO pars[5215]; /*BB*/ 11334 #endif 11335 //_setup.Bb_current set in rs274ngc_synch 11336 #ifdef BB 11337 _setup.BB_origin_offset SET_TO pars[k + 5]; /*BB*/ 11338 #endif 11339 //_setup.block1 does not need initialization 11340 _setup.blocktext[0] SET_TO 0; 11341 #ifdef CC 11342 _setup.CC_axis_offset SET_TO pars[5216]; /*CC*/ 11343 #endif 11344 //_setup.Cc_current set in rs274ngc_synch 11345 #ifdef CC 11346 _setup.CC_origin_offset SET_TO pars[k + 6]; /*CC*/ 11347 #endif 11348 //_setup.current_slot set in rs274ngc_synch 11349 //_setup.current_x set in rs274ngc_synch 11350 //_setup.current_y set in rs274ngc_synch 11351 //_setup.current_z set in rs274ngc_synch 11352 _setup.cutter_comp_side SET_TO OFF; 11353 //_setup.cycle values do not need initialization 11354 _setup.distance_mode SET_TO MODE_ABSOLUTE; 11355 _setup.feed_mode SET_TO UNITS_PER_MINUTE; 11356 _setup.feed_override SET_TO ON; 11357 //_setup.feed_rate set in rs274ngc_synch 11358 _setup.filename[0] SET_TO 0; 11359 _setup.file_pointer SET_TO NULL; 11360 //_setup.flood set in rs274ngc_synch 11361 _setup.length_offset_index SET_TO 1; 11362 //_setup.length_units set in rs274ngc_synch 11363 _setup.line_length SET_TO 0; 11364 _setup.linetext[0] SET_TO 0; 11365 //_setup.mist set in rs274ngc_synch 11366 _setup.motion_mode SET_TO G_80; 11367 //_setup.origin_index set above 11368 _setup.origin_offset_x SET_TO pars[k + 1]; 11369 _setup.origin_offset_y SET_TO pars[k + 2]; 11370 _setup.origin_offset_z SET_TO pars[k + 3]; 11371 //_setup.parameters set above 11372 //_setup.parameter_occurrence does not need initialization 11373 //_setup.parameter_numbers does not need initialization 11374 //_setup.parameter_values does not need initialization 11375 //_setup.percent_flag does not need initialization 11376 //_setup.plane set in rs274ngc_synch 11377 _setup.probe_flag SET_TO OFF; 11378 _setup.program_x SET_TO UNKNOWN; /* for cutter comp */ 11379 _setup.program_y SET_TO UNKNOWN; /* for cutter comp */ 11380 //_setup.retract_mode does not need initialization 11381 //_setup.selected_tool_slot set in rs274ngc_synch 11382 _setup.sequence_number SET_TO 0; /*DOES THIS NEED TO BE AT TOP? */ 11383 //_setup.speed set in rs274ngc_synch 11384 _setup.speed_feed_mode SET_TO CANON_INDEPENDENT; 11385 _setup.speed_override SET_TO ON; 11386 //_setup.spindle_turning set in rs274ngc_synch 11387 //_setup.stack does not need initialization 11388 //_setup.stack_index does not need initialization 11389 _setup.tool_length_offset SET_TO 0.0; 11390 //_setup.tool_max set in rs274ngc_synch 11391 //_setup.tool_table set in rs274ngc_synch 11392 _setup.tool_table_index SET_TO 1; 11393 //_setup.traverse_rate set in rs274ngc_synch 11394 11395 write_g_codes((block_pointer)NULL, &_setup); 11396 write_m_codes((block_pointer)NULL, &_setup); 11397 write_settings(&_setup); 11398 11399 // Synch rest of settings to external world 11400 rs274ngc_synch(); 11401 11402 return RS274NGC_OK; 11403 } |
|
Definition at line 12074 of file rs274ngc_pre.cc. 12075 { 12076 return _setup.line_length; 12077 } |
|
Definition at line 12095 of file rs274ngc_pre.cc. Referenced by print_nc_line_number(), and rs274ngc_command().
12096 : to copy line into */ 12097 int max_size) /* maximum number of characters to copy */ 12098 { 12099 int n; 12100 char * the_text; 12101 12102 the_text SET_TO _setup.linetext; 12103 for (n SET_TO 0; n < (max_size - 1); n++) 12104 { 12105 if (the_text[n] ISNT 0) 12106 line_text[n] SET_TO the_text[n]; 12107 else 12108 break; 12109 } 12110 line_text[n] SET_TO 0; 12111 } |
|
Definition at line 11429 of file rs274ngc_pre.cc. 11430 { 11431 static char name[] SET_TO "rs274ngc_load_tool_table"; 11432 int n; 11433 11434 CHK((_setup.tool_max > CANON_TOOL_MAX), NCE_TOOL_MAX_TOO_LARGE); 11435 for (n SET_TO 0; n <= _setup.tool_max; n++) 11436 { 11437 _setup.tool_table[n] SET_TO GET_EXTERNAL_TOOL_TABLE(n); 11438 } 11439 for(; n <= CANON_TOOL_MAX; n++) 11440 { 11441 _setup.tool_table[n].id SET_TO 0; 11442 _setup.tool_table[n].length SET_TO 0; 11443 _setup.tool_table[n].diameter SET_TO 0; 11444 } 11445 11446 return RS274NGC_OK; 11447 } |
|
Definition at line 11495 of file rs274ngc_pre.cc. Referenced by emcTaskPlanOpen(), emcTaskPlanRead(), interpret_from_file(), and main().
11496 : the name of the input NC-program file */ 11497 { 11498 static char name[] SET_TO "rs274ngc_open"; 11499 char * line; 11500 int index; 11501 int length; 11502 11503 CHK((_setup.file_pointer ISNT NULL), NCE_A_FILE_IS_ALREADY_OPEN); 11504 CHK((strlen(filename) > (RS274NGC_TEXT_SIZE - 1)), NCE_FILE_NAME_TOO_LONG); 11505 _setup.file_pointer SET_TO fopen(filename, "r"); 11506 CHK((_setup.file_pointer IS NULL), NCE_UNABLE_TO_OPEN_FILE); 11507 line SET_TO _setup.linetext; 11508 for(index SET_TO -1; index IS -1;) /* skip blank lines */ 11509 { 11510 CHK((fgets(line, RS274NGC_TEXT_SIZE, _setup.file_pointer) IS NULL), 11511 NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN); 11512 length SET_TO strlen(line); 11513 if (length IS (RS274NGC_TEXT_SIZE - 1)) 11514 { // line is too long. need to finish reading the line to recover 11515 for(;fgetc(_setup.file_pointer) ISNT '\n';); // could look for EOF 11516 ERM(NCE_COMMAND_TOO_LONG); 11517 } 11518 for(index SET_TO (length -1); // index set on last char 11519 (index >= 0) AND (isspace(line[index])); 11520 index--); 11521 } 11522 if(line[index] IS '%') 11523 { 11524 for(index--; (index >= 0) AND (isspace(line[index])); index--); 11525 if (index IS -1) 11526 { 11527 _setup.percent_flag SET_TO ON; 11528 _setup.sequence_number=1; // We have already read the first line 11529 // and we are not going back to it. 11530 } 11531 else 11532 { 11533 fseek(_setup.file_pointer, 0, SEEK_SET); 11534 _setup.percent_flag SET_TO OFF; 11535 _setup.sequence_number=0; // Going back to line 0 11536 } 11537 } 11538 else 11539 { 11540 fseek(_setup.file_pointer, 0, SEEK_SET); 11541 _setup.percent_flag SET_TO OFF; 11542 _setup.sequence_number=0; // Going back to line 0 11543 } 11544 strcpy(_setup.filename, filename); 11545 rs274ngc_reset(); 11546 return RS274NGC_OK; 11547 } |
|
Definition at line 11580 of file rs274ngc_pre.cc. 11582 { 11583 static char name[] SET_TO "rs274ngc_read"; 11584 int status; 11585 int read_status; 11586 11587 if (_setup.probe_flag IS ON) 11588 { 11589 CHK((GET_EXTERNAL_QUEUE_EMPTY() IS 0), 11590 NCE_QUEUE_IS_NOT_EMPTY_AFTER_PROBING); 11591 set_probe_data(&_setup); 11592 _setup.probe_flag SET_TO OFF; 11593 } 11594 CHK(((command IS NULL) AND (_setup.file_pointer IS NULL)), 11595 NCE_FILE_NOT_OPEN); 11596 read_status SET_TO read_text(command, _setup.file_pointer, _setup.linetext, 11597 _setup.blocktext, &_setup.line_length); 11598 if ((read_status IS RS274NGC_EXECUTE_FINISH) OR 11599 (read_status IS RS274NGC_OK)) 11600 { 11601 if (_setup.line_length ISNT 0) 11602 { 11603 CHP(parse_line(_setup.blocktext, &(_setup.block1), &_setup)); 11604 } 11605 } 11606 else if (read_status IS RS274NGC_ENDFILE); 11607 else 11608 ERP(read_status); 11609 return read_status; 11610 } |
|
Definition at line 11643 of file rs274ngc_pre.cc. |
|
Definition at line 11689 of file rs274ngc_pre.cc. Referenced by rs274ngc_init().
11691 { 11692 static char name[] SET_TO "rs274ngc_restore_parameters"; 11693 FILE * infile; 11694 char line[256]; 11695 int variable; 11696 double value; 11697 int required; // number of next required parameter 11698 int index; // index into _required_parameters 11699 double * pars; // short name for _setup.parameters 11700 int k; 11701 11702 // open original for reading 11703 infile SET_TO fopen(filename, "r"); 11704 CHK((infile IS NULL), NCE_UNABLE_TO_OPEN_FILE); 11705 11706 pars SET_TO _setup.parameters; 11707 k SET_TO 0; 11708 index SET_TO 0; 11709 required SET_TO _required_parameters[index++]; 11710 while (feof(infile) IS 0) 11711 { 11712 if (fgets(line, 256, infile) IS NULL) 11713 { 11714 break; 11715 } 11716 11717 // try for a variable-value match in the file 11718 if (sscanf(line, "%d %lf", &variable, &value) IS 2) 11719 { 11720 CHK(((variable <= 0) OR (variable >= RS274NGC_MAX_PARAMETERS)), 11721 NCE_PARAMETER_NUMBER_OUT_OF_RANGE); 11722 for (; k < RS274NGC_MAX_PARAMETERS; k++) 11723 { 11724 if (k > variable) 11725 ERM(NCE_PARAMETER_FILE_OUT_OF_ORDER); 11726 else if (k IS variable) 11727 { 11728 pars[k] SET_TO value; 11729 if (k IS required) 11730 required SET_TO _required_parameters[index++]; 11731 k++; 11732 break; 11733 } 11734 else // if (k < variable) 11735 { 11736 if (k IS required) 11737 ERM(NCE_REQUIRED_PARAMETER_MISSING); 11738 else 11739 pars[k] SET_TO 0; 11740 } 11741 } 11742 } 11743 } 11744 fclose(infile); 11745 CHK((required ISNT RS274NGC_MAX_PARAMETERS), NCE_REQUIRED_PARAMETER_MISSING); 11746 for (; k < RS274NGC_MAX_PARAMETERS; k++) 11747 { 11748 pars[k] SET_TO 0; 11749 } 11750 return RS274NGC_OK; 11751 } |
|
Definition at line 11787 of file rs274ngc_pre.cc. Referenced by rs274ngc_exit().
11790 { 11791 static char name[] SET_TO "rs274ngc_save_parameters"; 11792 FILE * infile; 11793 FILE * outfile; 11794 char line[256]; 11795 int variable; 11796 double value; 11797 int required; // number of next required parameter 11798 int index; // index into _required_parameters 11799 int k; 11800 11801 // rename as .bak 11802 strcpy(line, filename); 11803 strcat(line, RS274NGC_PARAMETER_FILE_BACKUP_SUFFIX); 11804 CHK((rename(filename, line) ISNT 0), NCE_CANNOT_CREATE_BACKUP_FILE); 11805 11806 // open backup for reading 11807 infile SET_TO fopen(line, "r"); 11808 CHK((infile IS NULL), NCE_CANNOT_OPEN_BACKUP_FILE); 11809 11810 // open original for writing 11811 outfile SET_TO fopen(filename, "w"); 11812 CHK((outfile IS NULL), NCE_CANNOT_OPEN_VARIABLE_FILE); 11813 11814 k SET_TO 0; 11815 index SET_TO 0; 11816 required SET_TO _required_parameters[index++]; 11817 while (feof(infile) IS 0) 11818 { 11819 if (fgets(line, 256, infile) IS NULL) 11820 { 11821 break; 11822 } 11823 // try for a variable-value match 11824 if (sscanf(line, "%d %lf", &variable, &value) IS 2) 11825 { 11826 CHK(((variable <= 0) OR (variable >= RS274NGC_MAX_PARAMETERS)), 11827 NCE_PARAMETER_NUMBER_OUT_OF_RANGE); 11828 for (; k < RS274NGC_MAX_PARAMETERS; k++) 11829 { 11830 if (k > variable) 11831 ERM(NCE_PARAMETER_FILE_OUT_OF_ORDER); 11832 else if (k IS variable) 11833 { 11834 sprintf(line, "%d\t%f\n", k, parameters[k]); 11835 fputs(line, outfile); 11836 if (k IS required) 11837 required SET_TO _required_parameters[index++]; 11838 k++; 11839 break; 11840 } 11841 else if (k IS required) // know (k < variable) 11842 { 11843 sprintf(line, "%d\t%f\n", k, parameters[k]); 11844 fputs(line, outfile); 11845 required SET_TO _required_parameters[index++]; 11846 } 11847 } 11848 } 11849 } 11850 fclose(infile); 11851 for (; k < RS274NGC_MAX_PARAMETERS; k++) 11852 { 11853 if (k IS required) 11854 { 11855 sprintf(line, "%d\t%f\n", k, parameters[k]); 11856 fputs(line, outfile); 11857 required SET_TO _required_parameters[index++]; 11858 } 11859 } 11860 fclose(outfile); 11861 11862 return RS274NGC_OK; 11863 } |
|
Definition at line 12127 of file rs274ngc_pre.cc. 12128 { 12129 return _setup.sequence_number; 12130 } |
|
Definition at line 12156 of file rs274ngc_pre.cc. Referenced by waitFlag().
12158 : to copy function name into */ 12159 int max_size) /* maximum number of characters to copy */ 12160 { 12161 int n; 12162 char * the_name; 12163 12164 if ((stack_index > -1) AND (stack_index < 20)) 12165 { 12166 the_name SET_TO _setup.stack[stack_index]; 12167 for (n SET_TO 0; n < (max_size - 1); n++) 12168 { 12169 if (the_name[n] ISNT 0) 12170 function_name[n] SET_TO the_name[n]; 12171 else 12172 break; 12173 } 12174 function_name[n] SET_TO 0; 12175 } 12176 else 12177 function_name[0] SET_TO 0; 12178 } |
|
Definition at line 11884 of file rs274ngc_pre.cc. 11885 { 11886 _setup.control_mode SET_TO GET_EXTERNAL_MOTION_CONTROL_MODE(); 11887 #ifdef AA 11888 _setup.AA_current SET_TO GET_EXTERNAL_POSITION_A(); /*AA*/ 11889 #endif 11890 #ifdef BB 11891 _setup.BB_current SET_TO GET_EXTERNAL_POSITION_B(); /*BB*/ 11892 #endif 11893 #ifdef CC 11894 _setup.CC_current SET_TO GET_EXTERNAL_POSITION_C(); /*CC*/ 11895 #endif 11896 _setup.current_slot SET_TO GET_EXTERNAL_TOOL_SLOT(); 11897 _setup.current_x SET_TO GET_EXTERNAL_POSITION_X(); 11898 _setup.current_y SET_TO GET_EXTERNAL_POSITION_Y(); 11899 _setup.current_z SET_TO GET_EXTERNAL_POSITION_Z(); 11900 _setup.feed_rate SET_TO GET_EXTERNAL_FEED_RATE(); 11901 _setup.flood SET_TO (GET_EXTERNAL_FLOOD() ISNT 0) ? ON : OFF; 11902 _setup.length_units SET_TO GET_EXTERNAL_LENGTH_UNIT_TYPE(); 11903 _setup.mist SET_TO (GET_EXTERNAL_MIST() ISNT 0) ? ON : OFF; 11904 _setup.plane SET_TO GET_EXTERNAL_PLANE(); 11905 _setup.selected_tool_slot SET_TO GET_EXTERNAL_TOOL_SLOT(); 11906 _setup.speed SET_TO GET_EXTERNAL_SPEED(); 11907 _setup.spindle_turning SET_TO GET_EXTERNAL_SPINDLE(); 11908 _setup.tool_max SET_TO GET_EXTERNAL_TOOL_MAX(); 11909 _setup.traverse_rate SET_TO GET_EXTERNAL_TRAVERSE_RATE(); 11910 11911 rs274ngc_load_tool_table(); /* must set _setup.tool_max first */ 11912 11913 return RS274NGC_OK; 11914 } |
|
Definition at line 10933 of file rs274ngc_pre.cc. Referenced by rs274ngc_execute(), and rs274ngc_read().
10935 { 10936 static char name[] SET_TO "set_probe_data"; 10937 10938 settings->current_x SET_TO GET_EXTERNAL_POSITION_X(); 10939 settings->current_y SET_TO GET_EXTERNAL_POSITION_Y(); 10940 settings->current_z SET_TO GET_EXTERNAL_POSITION_Z(); 10941 #ifdef AA 10942 settings->AA_current SET_TO GET_EXTERNAL_POSITION_A(); /*AA*/ 10943 #endif 10944 #ifdef BB 10945 settings->BB_current SET_TO GET_EXTERNAL_POSITION_B(); /*BB*/ 10946 #endif 10947 #ifdef CC 10948 settings->CC_current SET_TO GET_EXTERNAL_POSITION_C(); /*CC*/ 10949 #endif 10950 settings->parameters[5061] SET_TO GET_EXTERNAL_PROBE_POSITION_X(); 10951 settings->parameters[5062] SET_TO GET_EXTERNAL_PROBE_POSITION_Y(); 10952 settings->parameters[5063] SET_TO GET_EXTERNAL_PROBE_POSITION_Z(); 10953 #ifdef AA 10954 settings->parameters[5064] SET_TO GET_EXTERNAL_PROBE_POSITION_A(); /*AA*/ 10955 #endif 10956 #ifdef BB 10957 settings->parameters[5065] SET_TO GET_EXTERNAL_PROBE_POSITION_B(); /*BB*/ 10958 #endif 10959 #ifdef CC 10960 settings->parameters[5066] SET_TO GET_EXTERNAL_PROBE_POSITION_C(); /*CC*/ 10961 #endif 10962 settings->parameters[5067] SET_TO GET_EXTERNAL_PROBE_VALUE(); 10963 return RS274NGC_OK; 10964 } |
|
Definition at line 11010 of file rs274ngc_pre.cc. Referenced by rs274ngc_init().
11013 { 11014 int * gez; 11015 11016 gez SET_TO settings->active_g_codes; 11017 gez[0] SET_TO settings->sequence_number; 11018 gez[1] SET_TO settings->motion_mode; 11019 gez[2] SET_TO ((block IS NULL) ? -1 : block->g_modes[0]); 11020 gez[3] SET_TO 11021 (settings->plane IS CANON_PLANE_XY) ? G_17 : 11022 (settings->plane IS CANON_PLANE_XZ) ? G_18 : G_19; 11023 gez[4] SET_TO 11024 (settings->cutter_comp_side IS RIGHT) ? G_42 : 11025 (settings->cutter_comp_side IS LEFT) ? G_41 : G_40; 11026 gez[5] SET_TO 11027 (settings->length_units IS CANON_UNITS_INCHES) ? G_20 : G_21; 11028 gez[6] SET_TO 11029 (settings->distance_mode IS MODE_ABSOLUTE) ? G_90 : G_91; 11030 gez[7] SET_TO 11031 (settings->feed_mode IS INVERSE_TIME) ? G_93 : G_94; 11032 gez[8] SET_TO 11033 (settings->origin_index < 7) ? (530 + (10 * settings->origin_index)) : 11034 (584 + settings->origin_index); 11035 gez[9] SET_TO 11036 (settings->tool_length_offset IS 0.0) ? G_49 : G_43; 11037 gez[10] SET_TO 11038 (settings->retract_mode IS OLD_Z) ? G_98 : G_99; 11039 gez[11] SET_TO 11040 (settings->control_mode IS CANON_CONTINUOUS) ? G_64 : 11041 (settings->control_mode IS CANON_EXACT_PATH) ? G_61 : G_61_1; 11042 11043 return RS274NGC_OK; 11044 } |
|
Definition at line 11064 of file rs274ngc_pre.cc. Referenced by rs274ngc_init().
11067 { 11068 int * emz; 11069 11070 emz SET_TO settings->active_m_codes; 11071 emz[0] SET_TO settings->sequence_number; /* 0 seq number */ 11072 emz[1] SET_TO 11073 (block IS NULL) ? -1 : block->m_modes[4]; /* 1 stopping */ 11074 emz[2] SET_TO 11075 (settings->spindle_turning IS CANON_STOPPED) ? 5 : /* 2 spindle */ 11076 (settings->spindle_turning IS CANON_CLOCKWISE) ? 3 : 4; 11077 emz[3] SET_TO /* 3 tool change */ 11078 (block IS NULL) ? -1 : block->m_modes[6]; 11079 emz[4] SET_TO /* 4 mist */ 11080 (settings->mist IS ON) ? 7 : 11081 (settings->flood IS ON) ? -1 : 9; 11082 emz[5] SET_TO /* 5 flood */ 11083 (settings->flood IS ON) ? 8 : -1; 11084 emz[6] SET_TO /* 6 overrides */ 11085 (settings->feed_override IS ON) ? 48 : 49; 11086 11087 return RS274NGC_OK; 11088 } |
|
Definition at line 11106 of file rs274ngc_pre.cc. Referenced by rs274ngc_init().
11108 { 11109 double * vals; 11110 11111 vals SET_TO settings->active_settings; 11112 vals[0] SET_TO settings->sequence_number; /* 0 sequence number */ 11113 vals[1] SET_TO settings->feed_rate; /* 1 feed rate */ 11114 vals[2] SET_TO settings->speed; /* 2 spindle speed */ 11115 11116 return RS274NGC_OK; 11117 } |
|
Definition at line 800 of file rs274ngc_pre.cc. |