Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

rs274ngc_pre.cc File Reference

#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:

Include dependency graph

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 ()
 close the currently open NC code file. More...

int rs274ngc_execute (const char *command)
 execute a line of NC code. More...

int rs274ngc_exit ()
 stop running. More...

int rs274ngc_init ()
 get ready to run. More...

int rs274ngc_load_tool_table ()
 load a tool table. More...

int rs274ngc_open (const char *filename)
 open a file of NC code. More...

int rs274ngc_read (const char *command)
 read the mdi or the next line of the open NC code file. More...

int rs274ngc_reset ()
 reset yourself. More...

int rs274ngc_restore_parameters (const char *filename)
 restore interpreter variables from a file. More...

int rs274ngc_save_parameters (const char *filename, const double parameters[])
 save interpreter variables to file. More...

int rs274ngc_synch ()
 synchronize your internal model with the external world. More...

void rs274ngc_active_g_codes (int *codes)
 copy active G codes into array [0]..[11]. More...

void rs274ngc_active_m_codes (int *codes)
 copy active M codes into array [0]..[6]. More...

void rs274ngc_active_settings (double *settings)
 copy active F, S settings into array [0]..[2]. More...

void rs274ngc_error_text (int error_code, char *error_text, int max_size)
 copy the text of the error message whose number is error_code into the error_text array, but stop at max_size if the text is longer. More...

void rs274ngc_file_name (char *file_name, int max_size)
 copy the name of the currently open file into the file_name array, but stop at max_size if the name is longer. More...

int rs274ngc_line_length ()
 return the length of the most recently read line. More...

void rs274ngc_line_text (char *line_text, int max_size)
 copy the text of the most recently read line into the line_text array, but stop at max_size if the text is longer. More...

int rs274ngc_sequence_number ()
 return the current sequence number (how many lines read). More...

void rs274ngc_stack_name (int stack_index, char *function_name, int max_size)
 copy the function name from the stack_index'th position of the function call stack at the time of the most recent error into the function name string, but stop at max_size if the name is longer. More...


Variables

const int _gees []
const int _ems []
const int _required_parameters []
const read_function_pointer _readers []
setup _setup


Define Documentation

#define DEBUG_EMC
 

rs274ngc.cc

This rs274ngc.cc file contains the source code for (1) the kernel of several rs274ngc interpreters and (2) two of the four sets of interface functions declared in canon.hh: 1. interface functions to call to tell the interpreter what to do. These all return a status value. 2. interface functions to call to get information from the interpreter.

Kernel functions call each other. A few kernel functions are called by interface functions.

Interface function names all begin with "rs274ngc_".

Error handling is by returning a status value of either a non-error code (RS274NGC_OK, RS274NGC_EXIT, etc.) or some specific error code from each function where there is a possibility of error. If an error occurs, processing is always stopped, and control is passed back up through the function call hierarchy to an interface function; the error code is also passed back up. The stack of functions called is also recorded. The external program calling an interface function may then handle the error further as it sees fit.

Since returned values are usually used as just described to handle the possibility of errors, an alternative method of passing calculated values is required. In general, if function A needs a value for variable V calculated by function B, this is handled by passing a pointer to V from A to B, and B calculates and sets V.

There are a lot of functions named read_XXXX. All such functions read characters from a string using a counter. They all reset the counter to point at the character in the string following the last one used by the function. The counter is passed around from function to function by using pointers to it. The first character read by each of these functions is expected to be a member of some set of characters (often a specific character), and each function checks the first character.

This version of the interpreter not saving input lines. A list of all lines will be needed in future versions to implement loops, and probably for other purposes.

This version does not use any additional memory as it runs. No memory is allocated by the source code.

This version does not suppress superfluous commands, such as a command to start the spindle when the spindle is already turning, or a command to turn on flood coolant, when flood coolant is already on. When the interpreter is being used for direct control of the machining center, suppressing superfluous commands might confuse the user and could be dangerous, but when it is used to translate from one file to another, suppression can produce more concise output. Future versions might include an option for suppressing superfluous commands.

This file has been arranged typographically so that it may be used for compiling fifteen different executables. The file may be compiled as is for a six-axis interpreter. The file may be pre-preprocessed into "pre.cc" by "prepre" (a lex-based pre-processor). All fifteen executables may be compiled from the pre.cc file. The special typography items are:

1. Any line with the comment /^AA^/, /^BB^/, or /^CC^/ at the end (where ^ is replaced by *).

2. Calls to the canonical functions STRAIGHT_FEED, STRAIGHT_TRAVERSE, STRAIGHT_PROBE, and ARC_FEED. These are always set on two lines with the rotary axes on the second line:

3. Calls to the canonical function SET_ORIGIN_OFFSETS. These are always set on six lines, with one argument per line.

4. Anywhere else AA, BB, or CC appears followed by an underscore.

The pre-preprocessor looks for these items of typography and, in the output file (pre.cc), resets them appropriately marked with ifdef and endif. The rest of the text is put into the output file unchanged.

The compiler flags are:

1. -DAA to have an A-axis

2. -DBB to have a B-axis

3. -DCC to have a C-axis

4. -DALL_AXES to have a 3-, 4-, or 5-axis interpreter use all three rotary axes in canonical function calls. In those calls, the value for a rotary axis not compiled into an interpreter is always zero.

5. -DAXIS_ERROR to have a 3-, 4-, or 5-axis interpreter signal an error if the input RS274 code has a value for an axis not compiled in. If this flag is not used, the interpreter will read and ignore values for axes not compiled in.

Definition at line 107 of file rs274ngc_pre.cc.

Referenced by convert_cutter_compensation_on().

#define ERM error_code   
 

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
The _setup model includes a stack array for the names of function calls. This stack is written into if an error occurs. Just before each function returns an error code, it writes its name in the next available string, initializes the following string, and increments the array index. The following four macros do the work.

The size of the stack array is 50. An error in the middle of a very complex expression would cause the ERP and CHP macros to write past the bounds of the array if a check were not provided. No real program would contain such a thing, but the check is included to make the macros totally crash-proof. If the function call stack is deeper than 49, the top of the stack will be missing.

Definition at line 126 of file rs274ngc_pre.cc.

Referenced by arc_data_comp_ijk(), arc_data_ijk(), check_g_codes(), close_and_downcase(), convert_arc(), convert_axis_offsets(), convert_control_mode(), convert_coordinate_system(), convert_cutter_compensation(), convert_cycle(), convert_cycle_xy(), convert_cycle_yz(), convert_cycle_zx(), convert_distance_mode(), convert_feed_mode(), convert_home(), convert_length_units(), convert_modal_0(), convert_motion(), convert_probe(), convert_retract_mode(), convert_set_plane(), convert_stop(), convert_straight(), convert_straight_comp1(), convert_straight_comp2(), convert_tool_length_offset(), execute_binary1(), execute_binary2(), execute_unary(), read_a(), read_b(), read_c(), read_g(), read_integer_unsigned(), read_integer_value(), read_operation(), read_operation_unary(), read_real_number(), read_text(), rs274ngc_open(), rs274ngc_restore_parameters(), and rs274ngc_save_parameters().

#define ERP error_code   
 

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.

Referenced by execute_block(), rs274ngc_execute(), and rs274ngc_read().

#define CHK bad,
error_code   
 

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 arc_data_comp_ijk(), arc_data_comp_r(), arc_data_ijk(), arc_data_r(), check_g_codes(), check_m_codes(), check_other_codes(), close_and_downcase(), convert_arc(), convert_arc_comp1(), convert_arc_comp2(), convert_axis_offsets(), convert_cutter_compensation_on(), convert_cycle(), convert_cycle_g84(), convert_cycle_g86(), convert_cycle_g87(), convert_cycle_g88(), convert_cycle_xy(), convert_cycle_yz(), convert_cycle_zx(), convert_home(), convert_length_units(), convert_probe(), convert_set_plane(), convert_stop(), convert_straight(), convert_straight_comp1(), convert_straight_comp2(), convert_tool_length_offset(), convert_tool_select(), enhance_block(), execute_binary1(), execute_unary(), read_a(), read_atan(), read_b(), read_c(), read_comment(), read_d(), read_f(), read_g(), read_h(), read_i(), read_integer_unsigned(), read_j(), read_k(), read_l(), read_line_number(), read_m(), read_one_item(), read_p(), read_parameter(), read_parameter_setting(), read_q(), read_r(), read_real_expression(), read_real_number(), read_real_value(), read_s(), read_t(), read_text(), read_unary(), read_x(), read_y(), read_z(), rs274ngc_init(), rs274ngc_load_tool_table(), rs274ngc_open(), rs274ngc_read(), rs274ngc_restore_parameters(), and rs274ngc_save_parameters().

#define CHP try_this   
 

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 check_items(), convert_arc(), convert_arc2(), convert_arc_comp1(), convert_arc_comp2(), convert_cutter_compensation(), convert_cycle(), convert_g(), convert_m(), convert_modal_0(), convert_motion(), convert_straight(), execute_binary(), execute_block(), parse_line(), read_a(), read_atan(), read_b(), read_c(), read_d(), read_f(), read_g(), read_h(), read_i(), read_integer_value(), read_items(), read_j(), read_k(), read_l(), read_line_number(), read_m(), read_one_item(), read_p(), read_parameter(), read_parameter_setting(), read_q(), read_r(), read_real_expression(), read_real_value(), read_s(), read_t(), read_text(), read_unary(), read_x(), read_y(), read_z(), rs274ngc_init(), and rs274ngc_read().

#define G83_RAPID_DELTA   0.010
 

convert_cycle_g83

Returned Value: int (RS274NGC_OK)

Side effects: See below

Called by: convert_cycle_xy convert_cycle_yz convert_cycle_zx

For the XY plane, this implements the following RS274/NGC cycle, which is usually peck drilling: 1. Move the z-axis only at the current feed rate downward by delta or to the specified bottom_z, whichever is less deep. 2. Rapid back out to the clear_z. 3. Rapid back down to the current hole bottom, backed off a bit. 4. Repeat steps 1, 2, and 3 until the specified bottom_z is reached. 5. Retract the z-axis at traverse rate to clear_z.

CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.

The rapid out and back in causes any long stringers (which are common when drilling in aluminum) to be cut off and clears chips from the hole.

For the XZ and YZ planes, this makes analogous motions.

Definition at line 3290 of file rs274ngc_pre.cc.

Referenced by convert_cycle_g83().

#define CYCLE_MACRO call   
 

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;                                \
     }
convert_cycle_xy

Returned Value: int If any of the specific functions called returns an error code, this returns that code. If any of the following errors occur, this returns the error code shown. Otherwise, it returns RS274NGC_OK. 1. The z-value is not given the first time this code is called after some other motion mode has been in effect: NCE_Z_VALUE_UNSPECIFIED_IN_XY_PLANE_CANNED_CYCLE 2. The r clearance plane is below the bottom_z: NCE_R_LESS_THAN_Z_IN_CYCLE_IN_XY_PLANE 3. the distance mode is neither absolute or incremental: NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91 4. G82, G86, G88, or G89 is called when it is not already in effect, and no p number is in the block: NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88 NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89 5. G83 is called when it is not already in effect, and no q number is in the block: NCE_Q_WORD_MISSING_WITH_G83 6. G87 is called when it is not already in effect, and any of the i number, j number, or k number is missing: NCE_I_WORD_MISSING_WITH_G87 NCE_J_WORD_MISSING_WITH_G87 NCE_K_WORD_MISSING_WITH_G87 7. the G code is not between G_81 and G_89. NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED

Side effects: A number of moves are made to execute the g-code

Called by: convert_cycle

The function does not require that any of x,y,z, or r be specified in the block, except that if the last motion mode command executed was not the same as this one, the r-value and z-value must be specified.

This function is handling the repeat feature of RS274/NGC, wherein the L word represents the number of repeats [NCMS, page 99]. We are not allowing L=0, contrary to the manual. We are allowing L > 1 in absolute distance mode to mean "do the same thing in the same place several times", as provided in the manual, although this seems abnormal.

In incremental distance mode, x, y, and r values are treated as increments to the current position and z as an increment from r. In absolute distance mode, x, y, r, and z are absolute. In g87, i and j will always be increments, regardless of the distance mode setting, as implied in [NCMS, page 98], but k (z-value of top of counterbore) will be an absolute z-value in absolute distance mode, and an increment (from bottom z) in incremental distance mode.

If the r position of a cycle is above the current_z position, this retracts the z-axis to the r position before moving parallel to the XY plane.

In the code for this function, there is a nearly identical "for" loop in every case of the switch. The loop is the done with a compiler macro, "CYCLE_MACRO" so that the code is easy to read, automatically kept identical from case to case and, and much shorter than it would be without the macro. The loop could be put outside the switch, but then the switch would run every time around the loop, not just once, as it does here. The loop could also be placed in the called functions, but then it would not be clear that all the loops are the same, and it would be hard to keep them the same when the code is modified. The macro would be very awkward as a regular function because it would have to be passed all of the arguments used by any of the specific cycles, and, if another switch in the function is to be avoided, it would have to passed a function pointer, but the different cycle functions have different arguments so the type of the pointer could not be declared unless the cycle functions were re-written to take the same arguments (in which case most of them would have several unused arguments).

The motions within the CYCLE_MACRO (but outside a specific cycle) are a straight traverse parallel to the selected plane to the given position in the plane and a straight traverse of the third axis only (if needed) to the r position.

The CYCLE_MACRO is defined here but is also used in convert_cycle_yz and convert_cycle_zx. The variables aa, bb, and cc are used in CYCLE_MACRO and in the other two functions just mentioned. Those variables represent the first axis of the selected plane, the second axis of the selected plane, and third axis which is perpendicular to the selected plane. In this function aa represents x, bb represents y, and cc represents z. This usage makes it possible to have only one version of each of the cycle functions. The cycle_traverse and cycle_feed functions help accomplish this.

The height of the retract move at the end of each repeat of a cycle is determined by the setting of the retract_mode: either to the r position (if the retract_mode is R_PLANE) or to the original z-position (if that is above the r position and the retract_mode is not R_PLANE). This is a slight departure from [NCMS, page 98], which does not require checking that the original z-position is above r.

The rotary axes may not move during a canned cycle.

Definition at line 3784 of file rs274ngc_pre.cc.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

#define MAX_STACK   5
 

The following version is stack-based and fully general. It is the classical stack-based version with left-to-right evaluation of operations of the same precedence. Separate stacks are used for operations and values, and the stacks are made with arrays rather than lists, but those are implementation details. Pushing and popping are implemented by increasing or decreasing the stack index.

Additional levels of precedence may be defined easily by changing the precedence function. The size of MAX_STACK should always be at least as large as the number of precedence levels used. We are currently using four precedence levels (for right-bracket, plus-like operations, times-like operations, and power).

Definition at line 10153 of file rs274ngc_pre.cc.

Referenced by read_real_expression().


Function Documentation

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
[static]
 

tolerance of differing radii

Parameters:
move  ARGUMENTS
side  either G_2 (cw arc) or G_3 (ccw arc)
tool_radius  either RIGHT or LEFT
current_x  radius of the tool
current_y  first coordinate of current point
end_x  second coordinate of current point
end_y  first coordinate of arc end point
i_number  second coordinate of arc end point
j_number  first coordinate offset of center from current
center_x  second coordinate offset of center from current
center_y  pointer to first coordinate of center of arc
turn  pointer to second coordinate of center of arc
tolerance  pointer to number of full or partial circles CCW

Definition at line 841 of file rs274ngc_pre.cc.

References AND, CHK, ERM, G_2, G_3, LEFT, NCE_BUG_CODE_NOT_G2_OR_G3, NCE_RADIUS_TO_END_OF_ARC_DIFFERS_FROM_RADIUS_TO_START, RIGHT, RS274NGC_OK, and SET_TO.

Referenced by convert_arc_comp1().

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
[static]
 

pointer to number of full or partial circles CCW

Parameters:
move  ARGUMENTS
side  either G_2 (cw arc) or G_3 (ccw arc)
tool_radius  either RIGHT or LEFT
current_x  radius of the tool
current_y  first coordinate of current point
end_x  second coordinate of current point
end_y  first coordinate of arc end point
big_radius  second coordinate of arc end point
center_x  radius of arc
center_y  pointer to first coordinate of center of arc
turn  pointer to second coordinate of center of arc

Definition at line 937 of file rs274ngc_pre.cc.

References CHK, G_2, G_3, LEFT, NCE_BUG_IN_TOOL_RADIUS_COMP, NCE_RADIUS_TOO_SMALL_TO_REACH_END_POINT, NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP, PI2, RIGHT, RS274NGC_OK, and SET_TO.

Referenced by convert_arc_comp1().

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
[static]
 

tolerance of differing radii

Parameters:
move  ARGUMENTS
current_x  either G_2 (cw arc) or G_3 (ccw arc)
current_y  first coordinate of current point
end_x  second coordinate of current point
end_y  first coordinate of arc end point
i_number  second coordinate of arc end point
j_number  first coordinate offset of center from current
center_x  second coordinate offset of center from current
center_y  pointer to first coordinate of center of arc
turn  pointer to second coordinate of center of arc
tolerance  pointer to no. of full or partial circles CCW

Definition at line 1019 of file rs274ngc_pre.cc.

References CHK, ERM, G_2, G_3, NCE_BUG_CODE_NOT_G2_OR_G3, NCE_RADIUS_TO_END_OF_ARC_DIFFERS_FROM_RADIUS_TO_START, NCE_ZERO_RADIUS_ARC, RS274NGC_OK, and SET_TO.

Referenced by convert_arc2(), and convert_arc_comp2().

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
[static]
 

pointer to no. of full or partial circles CCW

Parameters:
move  ARGUMENTS
current_x  either G_2 (cw arc) or G_3 (ccw arc)
current_y  first coordinate of current point
end_x  second coordinate of current point
end_y  first coordinate of arc end point
radius  second coordinate of arc end point
center_x  radius of arc
center_y  pointer to first coordinate of center of arc
turn  pointer to second coordinate of center of arc

Definition at line 1087 of file rs274ngc_pre.cc.

References AND, CHK, G_2, G_3, NCE_ARC_RADIUS_TOO_SMALL_TO_REACH_END_POINT, NCE_CURRENT_POINT_SAME_AS_END_POINT_OF_ARC, PI2, RS274NGC_OK, SET_TO, and TINY.

Referenced by convert_arc2(), and convert_arc_comp2().

int check_g_codes block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block to be checked

Definition at line 1184 of file rs274ngc_pre.cc.

References CHK, ERM, G_0, G_1, G_10, G_28, G_30, G_4, G_53, G_90, G_91, G_92, G_92_1, G_92_2, G_92_3, ISNT, MODE_INCREMENTAL, NCE_BUG_BAD_G_CODE_MODAL_GROUP_0, NCE_CANNOT_USE_G53_INCREMENTAL, NCE_DWELL_TIME_MISSING_WITH_G4, NCE_LINE_WITH_G10_DOES_NOT_HAVE_L2, NCE_MUST_USE_G0_OR_G1_WITH_G53, NCE_P_VALUE_NOT_AN_INTEGER_WITH_G10_L2, NCE_P_VALUE_OUT_OF_RANGE_WITH_G10_L2, OR, RS274NGC_OK, and SET_TO.

Referenced by check_items().

int check_items block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block to be checked

Definition at line 1259 of file rs274ngc_pre.cc.

References check_g_codes(), check_m_codes(), check_other_codes(), CHP, and RS274NGC_OK.

Referenced by parse_line().

int check_m_codes block_pointer    block [static]
 

pointer to a block to be checked

Parameters:
block  ARGUMENTS

Definition at line 1292 of file rs274ngc_pre.cc.

References CHK, MAX_EMS, NCE_TOO_MANY_M_CODES_ON_LINE, and RS274NGC_OK.

Referenced by check_items().

int check_other_codes block_pointer    block [static]
 

pointer to a block of RS274/NGC instructions

Parameters:
block  ARGUMENTS

Definition at line 1345 of file rs274ngc_pre.cc.

References CHK, G_10, G_2, G_3, G_4, G_41, G_42, G_43, G_80, G_82, G_83, G_86, G_87, G_88, G_89, G_90, ISNT, NCE_CANNOT_PUT_A_B_IN_CANNED_CYCLE, NCE_CANNOT_PUT_A_C_IN_CANNED_CYCLE, NCE_CANNOT_PUT_AN_A_IN_CANNED_CYCLE, NCE_D_WORD_WITH_NO_G41_OR_G42, NCE_H_WORD_WITH_NO_G43, NCE_I_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT, NCE_J_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT, NCE_K_WORD_WITH_NO_G2_OR_G3_OR_G87_TO_USE_IT, NCE_L_WORD_WITH_NO_CANNED_CYCLE_OR_G10, NCE_P_WORD_WITH_NO_G4_G10_G82_G86_G88_G89, NCE_Q_WORD_WITH_NO_G83, NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_IT, OFF, ON, and RS274NGC_OK.

Referenced by check_items().

int close_and_downcase char *    line [static]
 

string: one line of NC code

Parameters:
line  ARGUMENTS

Definition at line 1474 of file rs274ngc_pre.cc.

References AND, CHK, ERM, ISNT, NCE_NESTED_COMMENT_FOUND, NCE_NULL_MISSING_AFTER_NEWLINE, NCE_UNCLOSED_COMMENT_FOUND, OR, RS274NGC_OK, and SET_TO.

Referenced by read_text().

int convert_arc int    move,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
move  ARGUMENTS
block  either G_2 (cw arc) or G_3 (ccw arc)
settings  pointer to a block of RS274 instructions

Definition at line 1574 of file rs274ngc_pre.cc.

References CANON_PLANE_XY, CANON_PLANE_XZ, CANON_PLANE_YZ, CHK, CHP, convert_arc2(), convert_arc_comp1(), convert_arc_comp2(), ERM, find_ends(), INVERSE_TIME, ISNT, NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ, NCE_CANNOT_MAKE_ARC_WITH_ZERO_FEED_RATE, NCE_F_WORD_MISSING_WITH_INVERSE_TIME_ARC_MOVE, NCE_I_WORD_GIVEN_FOR_ARC_IN_YZ_PLANE, NCE_J_WORD_GIVEN_FOR_ARC_IN_XZ_PLANE, NCE_K_WORD_GIVEN_FOR_ARC_IN_XY_PLANE, NCE_MIXED_RADIUS_IJK_FORMAT_FOR_ARC, NCE_R_I_J_K_WORDS_ALL_MISSING_FOR_ARC, NCE_X_AND_Y_WORDS_MISSING_FOR_ARC_IN_XY_PLANE, NCE_X_AND_Z_WORDS_MISSING_FOR_ARC_IN_XZ_PLANE, NCE_Y_AND_Z_WORDS_MISSING_FOR_ARC_IN_YZ_PLANE, OFF, ON, RS274NGC_OK, SET_TO, UNITS_PER_MINUTE, and UNKNOWN.

Referenced by convert_motion().

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
[static]
 

offset of center from current2

Parameters:
move  ARGUMENTS
block  either G_2 (cw arc) or G_3 (ccw arc)
settings  pointer to a block of RS274 instructions
current1  pointer to machine settings
current2  pointer to current value of coordinate 1
current3  pointer to current value of coordinate 2
end1  pointer to current value of coordinate 3
end2  coordinate 1 value at end of arc
end3  coordinate 2 value at end of arc
offset1  coordinate 3 value at end of arc
offset2  offset of center from current1

Definition at line 1811 of file rs274ngc_pre.cc.

References arc_data_ijk(), arc_data_r(), ARC_FEED(), CANON_UNITS_INCHES, CHP, INVERSE_TIME, inverse_time_rate_arc(), RS274NGC_OK, SET_TO, TOLERANCE_INCH, and TOLERANCE_MM.

Referenced by convert_arc().

int convert_arc_comp1 int    move,
block_pointer    block,
setup_pointer    settings,
double    end_x,
double    end_y,
double    end_z
[static]
 

convert_arc_comp1

Returned Value: int If arc_data_comp_ijk or arc_data_comp_r returns an error code, this returns that code. Otherwise, it returns RS274NGC_OK.

Side effects: This executes an arc command at feed rate. It also updates the setting of the position of the tool point to the end point of the move.

Called by: convert_arc.

This function converts a helical or circular arc, generating only one arc. The axis must be parallel to the z-axis. This is called when cutter radius compensation is on and this is the first cut after the turning on.

The arc which is generated is derived from a second arc which passes through the programmed end point and is tangent to the cutter at its current location. The generated arc moves the tool so that it stays tangent to the second arc throughout the move.

Parameters:
move  ARGUMENTS
block  either G_2 (cw arc) or G_3 (ccw arc)
settings  pointer to a block of RS274/NGC instructions
end_x  pointer to machine settings
end_y  x-value at end of programmed (then actual) arc
end_z  y-value at end of programmed (then actual) arc z-value at end of arc

Definition at line 1924 of file rs274ngc_pre.cc.

References AND, arc_data_comp_ijk(), arc_data_comp_r(), ARC_FEED(), CANON_UNITS_INCHES, CHK, CHP, setup_struct::current_x, setup_struct::current_y, setup_struct::current_z, setup_struct::cutter_comp_radius, setup_struct::cutter_comp_side, setup_struct::feed_mode, G_2, G_3, block_struct::i_number, INVERSE_TIME, inverse_time_rate_arc(), block_struct::j_number, LEFT, setup_struct::length_units, NCE_CUTTER_GOUGING_WITH_CUTTER_RADIUS_COMP, setup_struct::program_x, setup_struct::program_y, block_struct::r_flag, block_struct::r_number, RIGHT, RS274NGC_OK, SET_TO, TOLERANCE_INCH, and TOLERANCE_MM.

Referenced by convert_arc().

int convert_arc_comp2 int    move,
block_pointer    block,
setup_pointer    settings,
double    end_x,
double    end_y,
double    end_z
[static]
 

convert_arc_comp2

Returned Value: int If arc_data_ijk or arc_data_r returns an error code, this returns that code. If any of the following errors occurs, this returns the error code shown. Otherwise, it returns RS274NGC_OK. 1. A concave corner is found: NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP 2. The tool will not fit inside an arc: NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP

Side effects: This executes an arc command feed rate. If needed, at also generates an arc to go around a convex corner. It also updates the setting of the position of the tool point to the end point of the move. If inverse time feed rate mode is in effect, the feed rate is reset.

Called by: convert_arc.

This function converts a helical or circular arc. The axis must be parallel to the z-axis. This is called when cutter radius compensation is on and this is not the first cut after the turning on.

If one or more rotary axes is moved in this block and an extra arc is required to go around a sharp corner, all the rotary axis motion occurs on the main arc and none on the extra arc. An alternative might be to distribute the rotary axis motion over the extra arc and the programmed arc in proportion to their lengths.

If the Z-axis is moved in this block and an extra arc is required to go around a sharp corner, all the Z-axis motion occurs on the main arc and none on the extra arc. An alternative might be to distribute the Z-axis motion over the extra arc and the main arc in proportion to their lengths.

Parameters:
move  ARGUMENTS
block  either G_2 (cw arc) or G_3 (ccw arc)
settings  pointer to a block of RS274/NGC instructions
end_x  pointer to machine settings
end_y  x-value at end of programmed (then actual) arc
end_z  y-value at end of programmed (then actual) arc z-value at end of arc

Definition at line 2069 of file rs274ngc_pre.cc.

References AND, arc_data_ijk(), arc_data_r(), ARC_FEED(), CANON_UNITS_INCHES, CHK, CHP, setup_struct::current_x, setup_struct::current_y, setup_struct::current_z, setup_struct::cutter_comp_radius, setup_struct::cutter_comp_side, setup_struct::feed_mode, G_2, G_3, block_struct::i_number, INVERSE_TIME, inverse_time_rate_arc(), inverse_time_rate_arc2(), block_struct::j_number, LEFT, setup_struct::length_units, NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP, NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP, PI, PI2, setup_struct::program_x, setup_struct::program_y, block_struct::r_flag, block_struct::r_number, RIGHT, RS274NGC_OK, SET_TO, TOLERANCE_CONCAVE_CORNER, TOLERANCE_INCH, TOLERANCE_MM, and TWO_PI.

Referenced by convert_arc().

int convert_axis_offsets int    g_code,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
block  g_code being executed (must be in G_92 series)
settings  pointer to a block of RS274/NGC instructions

Definition at line 2325 of file rs274ngc_pre.cc.

References CHK, ERM, G_92, G_92_1, G_92_2, G_92_3, ISNT, NCE_BUG_CODE_NOT_IN_G92_SERIES, NCE_CANNOT_CHANGE_AXIS_OFFSETS_WITH_CUTTER_RADIUS_COMP, OFF, ON, OR, RS274NGC_OK, SET_ORIGIN_OFFSETS(), and SET_TO.

Referenced by convert_modal_0().

int convert_comment char *    comment [static]
 

string with comment

Parameters:
comment  ARGUMENTS

Definition at line 2609 of file rs274ngc_pre.cc.

References AND, COMMENT(), ISNT, MESSAGE(), OR, and RS274NGC_OK.

Referenced by execute_block().

int convert_control_mode int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code being executed (G_61, G61_1, OR G_64)

Definition at line 2676 of file rs274ngc_pre.cc.

References CANON_CONTINUOUS, CANON_EXACT_PATH, CANON_EXACT_STOP, ERM, G_61, G_61_1, G_64, NCE_BUG_CODE_NOT_G61_G61_1_OR_G64, RS274NGC_OK, and SET_MOTION_CONTROL_MODE().

Referenced by convert_g().

int convert_coordinate_system int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code called (must be one listed above)

Definition at line 2772 of file rs274ngc_pre.cc.

References COMMENT(), ERM, NCE_BUG_CODE_NOT_IN_RANGE_G54_TO_G593, RS274NGC_OK, SET_ORIGIN_OFFSETS(), and SET_TO.

Referenced by convert_g().

int convert_cutter_compensation int    g_code,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
block  must be G_40, G_41, or G_42
settings  pointer to a block of RS274 instructions

Definition at line 2957 of file rs274ngc_pre.cc.

References CHP, convert_cutter_compensation_off(), convert_cutter_compensation_on(), ERM, G_40, G_41, G_42, LEFT, NCE_BUG_CODE_NOT_G40_G41_OR_G42, RIGHT, and RS274NGC_OK.

Referenced by convert_g().

int convert_cutter_compensation_off setup_pointer    settings [static]
 

pointer to machine settings

Parameters:
settings  ARGUMENTS

Definition at line 3000 of file rs274ngc_pre.cc.

References COMMENT(), OFF, RS274NGC_OK, and UNKNOWN.

Referenced by convert_cutter_compensation().

int convert_cutter_compensation_on int    side,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
side  ARGUMENTS
block  side of path cutter is on (LEFT or RIGHT)
settings  pointer to a block of RS274 instructions

Definition at line 3063 of file rs274ngc_pre.cc.

References CANON_PLANE_XY, CHK, COMMENT(), DEBUG_EMC, ISNT, LEFT, NCE_CANNOT_TURN_CUTTER_RADIUS_COMP_ON_OUT_OF_XY_PLANE, NCE_CANNOT_TURN_CUTTER_RADIUS_COMP_ON_WHEN_ON, OFF, RIGHT, RS274NGC_OK, and SET_TO.

Referenced by convert_cutter_compensation().

int convert_cycle int    motion,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
motion  ARGUMENTS
block  a g-code between G_81 and G_89, a canned cycle
settings  pointer to a block of RS274 instructions

Definition at line 3132 of file rs274ngc_pre.cc.

References CANON_PLANE, CANON_PLANE_XY, CANON_PLANE_XZ, CANON_PLANE_YZ, CHK, CHP, convert_cycle_xy(), convert_cycle_yz(), convert_cycle_zx(), ERM, NCE_BUG_PLANE_NOT_XY_YZ_OR_XZ, NCE_CANNOT_DO_ZERO_REPEATS_OF_CYCLE, NCE_R_CLEARANCE_PLANE_UNSPECIFIED_IN_CYCLE, OFF, and RS274NGC_OK.

Referenced by convert_motion().

int convert_cycle_g81 CANON_PLANE    plane,
double    x,
double    y,
double    clear_z,
double    bottom_z
[static]
 

value of z at bottom of cycle

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane

Definition at line 3201 of file rs274ngc_pre.cc.

References CANON_PLANE, cycle_feed(), cycle_traverse(), and RS274NGC_OK.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g82 CANON_PLANE    plane,
double    x,
double    y,
double    clear_z,
double    bottom_z,
double    dwell
[static]
 

dwell time

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane
dwell  value of z at bottom of cycle

Definition at line 3241 of file rs274ngc_pre.cc.

References CANON_PLANE, cycle_feed(), cycle_traverse(), DWELL(), and RS274NGC_OK.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g83 CANON_PLANE    plane,
double    x,
double    y,
double    r,
double    clear_z,
double    bottom_z,
double    delta
[static]
 

size of z-axis feed increment

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
r  y-value where cycle is executed
clear_z  initial z-value
bottom_z  z-value of clearance plane
delta  value of z at bottom of cycle

Definition at line 3293 of file rs274ngc_pre.cc.

References CANON_PLANE, CANON_UNITS_MM, cycle_feed(), cycle_traverse(), G83_RAPID_DELTA, setup_struct::length_units, RS274NGC_OK, and SET_TO.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

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
[static]
 

the speed-feed mode at outset

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane
direction  value of z at bottom of cycle
mode  direction spindle turning at outset

Definition at line 3358 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_DIRECTION, CANON_PLANE, CANON_SPEED_FEED_MODE, CANON_SYNCHED, CHK, cycle_feed(), ISNT, NCE_SPINDLE_NOT_TURNING_CLOCKWISE_IN_G84, RS274NGC_OK, START_SPEED_FEED_SYNCH(), START_SPINDLE_CLOCKWISE(), START_SPINDLE_COUNTERCLOCKWISE(), STOP_SPEED_FEED_SYNCH(), and STOP_SPINDLE_TURNING().

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g85 CANON_PLANE    plane,
double    x,
double    y,
double    clear_z,
double    bottom_z
[static]
 

value of z at bottom of cycle

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane

Definition at line 3409 of file rs274ngc_pre.cc.

References CANON_PLANE, cycle_feed(), and RS274NGC_OK.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g86 CANON_PLANE    plane,
double    x,
double    y,
double    clear_z,
double    bottom_z,
double    dwell,
CANON_DIRECTION    direction
[static]
 

direction spindle turning at outset

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane
dwell  value of z at bottom of cycle
direction  dwell time

Definition at line 3455 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE, CANON_DIRECTION, CANON_PLANE, CHK, cycle_feed(), cycle_traverse(), DWELL(), ISNT, NCE_SPINDLE_NOT_TURNING_IN_G86, RS274NGC_OK, START_SPINDLE_CLOCKWISE(), START_SPINDLE_COUNTERCLOCKWISE(), and STOP_SPINDLE_TURNING().

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

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
[static]
 

direction spindle turning at outset

Parameters:
plane  ARGUMENTS
x  selected plane
offset_x  x-value where cycle is executed
y  x-axis offset position
offset_y  y-value where cycle is executed
r  y-axis offset position
clear_z  z_value of r_plane
middle_z  z-value of clearance plane
bottom_z  z-value of top of back bore
direction  value of z at bottom of cycle

Definition at line 3541 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE, CANON_DIRECTION, CANON_PLANE, CHK, cycle_feed(), cycle_traverse(), ISNT, NCE_SPINDLE_NOT_TURNING_IN_G87, ORIENT_SPINDLE(), RS274NGC_OK, START_SPINDLE_CLOCKWISE(), START_SPINDLE_COUNTERCLOCKWISE(), and STOP_SPINDLE_TURNING().

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g88 CANON_PLANE    plane,
double    x,
double    y,
double    bottom_z,
double    dwell,
CANON_DIRECTION    direction
[static]
 

direction spindle turning at outset

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
bottom_z  y-value where cycle is executed
dwell  value of z at bottom of cycle
direction  dwell time

Definition at line 3613 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE, CANON_DIRECTION, CANON_PLANE, CHK, cycle_feed(), DWELL(), ISNT, NCE_SPINDLE_NOT_TURNING_IN_G88, PROGRAM_STOP(), RS274NGC_OK, START_SPINDLE_CLOCKWISE(), START_SPINDLE_COUNTERCLOCKWISE(), and STOP_SPINDLE_TURNING().

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_g89 CANON_PLANE    plane,
double    x,
double    y,
double    clear_z,
double    bottom_z,
double    dwell
[static]
 

dwell time

Parameters:
plane  ARGUMENTS
x  selected plane
y  x-value where cycle is executed
clear_z  y-value where cycle is executed
bottom_z  z-value of clearance plane
dwell  value of z at bottom of cycle

Definition at line 3663 of file rs274ngc_pre.cc.

References CANON_PLANE, cycle_feed(), DWELL(), and RS274NGC_OK.

Referenced by convert_cycle_xy(), convert_cycle_yz(), and convert_cycle_zx().

int convert_cycle_xy int    motion,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
motion  ARGUMENTS
block  a g-code between G_81 and G_89, a canned cycle
settings  pointer to a block of RS274 instructions

Definition at line 3797 of file rs274ngc_pre.cc.

References CANON_EXACT_PATH, CANON_MOTION_MODE, CANON_PLANE, CANON_PLANE_XY, CHK, convert_cycle_g81(), convert_cycle_g82(), convert_cycle_g83(), convert_cycle_g84(), convert_cycle_g85(), convert_cycle_g86(), convert_cycle_g87(), convert_cycle_g88(), convert_cycle_g89(), CYCLE_MACRO, ERM, G_81, G_82, G_83, G_84, G_85, G_86, G_87, G_88, G_89, GET_EXTERNAL_MOTION_CONTROL_MODE(), ISNT, MODE_ABSOLUTE, MODE_INCREMENTAL, NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89, NCE_I_WORD_MISSING_WITH_G87, NCE_J_WORD_MISSING_WITH_G87, NCE_K_WORD_MISSING_WITH_G87, NCE_Q_WORD_MISSING_WITH_G83, NCE_R_LESS_THAN_Z_IN_CYCLE_IN_XY_PLANE, NCE_Z_VALUE_UNSPECIFIED_IN_XY_PLANE_CANNED_CYCLE, OFF, ON, R_PLANE, RS274NGC_OK, SET_MOTION_CONTROL_MODE(), SET_TO, and STRAIGHT_TRAVERSE().

Referenced by convert_cycle().

int convert_cycle_yz int    motion,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
motion  ARGUMENTS
block  a g-code between G_81 and G_89, a canned cycle
settings  pointer to a block of RS274/NGC instructions

Definition at line 4024 of file rs274ngc_pre.cc.

References CANON_EXACT_PATH, CANON_MOTION_MODE, CANON_PLANE, CANON_PLANE_YZ, CHK, convert_cycle_g81(), convert_cycle_g82(), convert_cycle_g83(), convert_cycle_g84(), convert_cycle_g85(), convert_cycle_g86(), convert_cycle_g87(), convert_cycle_g88(), convert_cycle_g89(), CYCLE_MACRO, ERM, G_81, G_82, G_83, G_84, G_85, G_86, G_87, G_88, G_89, GET_EXTERNAL_MOTION_CONTROL_MODE(), ISNT, MODE_ABSOLUTE, MODE_INCREMENTAL, NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89, NCE_I_WORD_MISSING_WITH_G87, NCE_J_WORD_MISSING_WITH_G87, NCE_K_WORD_MISSING_WITH_G87, NCE_Q_WORD_MISSING_WITH_G83, NCE_R_LESS_THAN_X_IN_CYCLE_IN_YZ_PLANE, NCE_X_VALUE_UNSPECIFIED_IN_YZ_PLANE_CANNED_CYCLE, OFF, ON, R_PLANE, RS274NGC_OK, SET_MOTION_CONTROL_MODE(), SET_TO, and STRAIGHT_TRAVERSE().

Referenced by convert_cycle().

int convert_cycle_zx int    motion,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
motion  ARGUMENTS
block  a g-code between G_81 and G_89, a canned cycle
settings  pointer to a block of RS274 instructions

Definition at line 4259 of file rs274ngc_pre.cc.

References CANON_EXACT_PATH, CANON_MOTION_MODE, CANON_PLANE, CANON_PLANE_XZ, CHK, convert_cycle_g81(), convert_cycle_g82(), convert_cycle_g83(), convert_cycle_g84(), convert_cycle_g85(), convert_cycle_g86(), convert_cycle_g87(), convert_cycle_g88(), convert_cycle_g89(), CYCLE_MACRO, ERM, G_81, G_82, G_83, G_84, G_85, G_86, G_87, G_88, G_89, GET_EXTERNAL_MOTION_CONTROL_MODE(), ISNT, MODE_ABSOLUTE, MODE_INCREMENTAL, NCE_BUG_DISTANCE_MODE_NOT_G90_OR_G91, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88, NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89, NCE_I_WORD_MISSING_WITH_G87, NCE_J_WORD_MISSING_WITH_G87, NCE_K_WORD_MISSING_WITH_G87, NCE_Q_WORD_MISSING_WITH_G83, NCE_R_LESS_THAN_Y_IN_CYCLE_IN_XZ_PLANE, NCE_Y_VALUE_UNSPECIFIED_IN_XZ_PLANE_CANNED_CYCLE, OFF, ON, R_PLANE, RS274NGC_OK, SET_MOTION_CONTROL_MODE(), SET_TO, and STRAIGHT_TRAVERSE().

Referenced by convert_cycle().

int convert_distance_mode int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code being executed (must be G_90 or G_91)

Definition at line 4459 of file rs274ngc_pre.cc.

References COMMENT(), ERM, G_90, G_91, ISNT, MODE_ABSOLUTE, MODE_INCREMENTAL, NCE_BUG_CODE_NOT_G90_OR_G91, and RS274NGC_OK.

Referenced by convert_g().

int convert_dwell double    time [static]
 

time in seconds to dwell

Parameters:
time  ARGUMENTS

Definition at line 4502 of file rs274ngc_pre.cc.

References DWELL(), and RS274NGC_OK.

Referenced by convert_g().

int convert_feed_mode int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code being executed (must be G_93 or G_94)

Definition at line 4531 of file rs274ngc_pre.cc.

References COMMENT(), ERM, G_93, G_94, INVERSE_TIME, NCE_BUG_CODE_NOT_G93_OR_G94, RS274NGC_OK, and UNITS_PER_MINUTE.

Referenced by execute_block().

int convert_feed_rate block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274 instructions

Definition at line 4572 of file rs274ngc_pre.cc.

References RS274NGC_OK, and SET_FEED_RATE().

Referenced by execute_block().

int convert_g block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 4637 of file rs274ngc_pre.cc.

References CHP, convert_control_mode(), convert_coordinate_system(), convert_cutter_compensation(), convert_distance_mode(), convert_dwell(), convert_length_units(), convert_modal_0(), convert_motion(), convert_retract_mode(), convert_set_plane(), convert_tool_length_offset(), G_4, ISNT, and RS274NGC_OK.

Referenced by execute_block().

int convert_home int    move,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
move  ARGUMENTS
block  G code, must be G_28 or G_30
settings  pointer to a block of RS274 instructions

Definition at line 4721 of file rs274ngc_pre.cc.

References CHK, ERM, find_ends(), find_relative(), G_28, G_30, ISNT, NCE_BUG_CODE_NOT_G28_OR_G30, NCE_CANNOT_USE_G28_OR_G30_WITH_CUTTER_RADIUS_COMP, OFF, RS274NGC_OK, and STRAIGHT_TRAVERSE().

Referenced by convert_modal_0().

int convert_length_units int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code being executed (must be G_20 or G_21)

Definition at line 4927 of file rs274ngc_pre.cc.

References CANON_UNITS_INCHES, CANON_UNITS_MM, CHK, ERM, G_20, G_21, INCH_PER_MM, ISNT, MM_PER_INCH, NCE_BUG_CODE_NOT_G20_OR_G21, NCE_CANNOT_CHANGE_UNITS_WITH_CUTTER_RADIUS_COMP, OFF, RS274NGC_OK, SET_TO, and USE_LENGTH_UNITS().

Referenced by convert_g().

int convert_m block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 5013 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_COUNTERCLOCKWISE, CANON_STOPPED, CHP, convert_tool_change(), DISABLE_FEED_OVERRIDE(), DISABLE_SPEED_OVERRIDE(), ENABLE_FEED_OVERRIDE(), ENABLE_SPEED_OVERRIDE(), FLOOD_OFF(), FLOOD_ON(), ISNT, MIST_OFF(), MIST_ON(), OFF, ON, RS274NGC_OK, START_SPINDLE_CLOCKWISE(), START_SPINDLE_COUNTERCLOCKWISE(), and STOP_SPINDLE_TURNING().

Referenced by execute_block().

int convert_modal_0 int    code,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
code  ARGUMENTS
block  G code, must be from group 0
settings  pointer to a block of RS274/NGC instructions

Definition at line 5119 of file rs274ngc_pre.cc.

References CHP, convert_axis_offsets(), convert_home(), convert_setup(), ERM, G_10, G_28, G_30, G_4, G_53, G_92, G_92_1, G_92_2, G_92_3, NCE_BUG_CODE_NOT_G4_G10_G28_G30_G53_OR_G92_SERIES, OR, and RS274NGC_OK.

Referenced by convert_g().

int convert_motion int    motion,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
motion  ARGUMENTS
block  g_code for a line, arc, canned cycle
settings  pointer to a block of RS274 instructions

Definition at line 5169 of file rs274ngc_pre.cc.

References AND, CHP, COMMENT(), convert_arc(), convert_cycle(), convert_probe(), convert_straight(), ERM, G_0, G_1, G_2, G_3, G_38_2, G_80, G_90, NCE_BUG_UNKNOWN_MOTION_CODE, OR, and RS274NGC_OK.

Referenced by convert_g().

int convert_probe block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274 instructions

Definition at line 5243 of file rs274ngc_pre.cc.

References CANON_UNITS_MM, CHK, ERM, find_ends(), G_38_2, INVERSE_TIME, ISNT, NCE_CANNOT_MOVE_ROTARY_AXES_DURING_PROBING, NCE_CANNOT_PROBE_IN_INVERSE_TIME_FEED_MODE, NCE_CANNOT_PROBE_WITH_CUTTER_RADIUS_COMP_ON, NCE_CANNOT_PROBE_WITH_ZERO_FEED_RATE, NCE_START_POINT_TOO_CLOSE_TO_PROBE_POINT, NCE_X_Y_AND_Z_WORDS_ALL_MISSING_WITH_G38_2, OFF, ON, OR, RS274NGC_OK, STRAIGHT_PROBE(), TURN_PROBE_OFF(), and TURN_PROBE_ON().

Referenced by convert_motion().

int convert_retract_mode int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  g_code being executed (must be G_98 or G_99)

Definition at line 5351 of file rs274ngc_pre.cc.

References COMMENT(), ERM, G_98, G_99, NCE_BUG_CODE_NOT_G98_OR_G99, OLD_Z, R_PLANE, and RS274NGC_OK.

Referenced by convert_g().

int convert_setup block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 5403 of file rs274ngc_pre.cc.

References COMMENT(), ON, RS274NGC_OK, SET_ORIGIN_OFFSETS(), and SET_TO.

Referenced by convert_modal_0().

int convert_set_plane int    g_code,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
settings  must be G_17, G_18, or G_19

Definition at line 5588 of file rs274ngc_pre.cc.

References CANON_PLANE_XY, CANON_PLANE_XZ, CANON_PLANE_YZ, CHK, ERM, G_17, G_18, G_19, ISNT, NCE_BUG_CODE_NOT_G17_G18_OR_G19, NCE_CANNOT_USE_XZ_PLANE_WITH_CUTTER_RADIUS_COMP, NCE_CANNOT_USE_YZ_PLANE_WITH_CUTTER_RADIUS_COMP, OFF, RS274NGC_OK, and SELECT_PLANE().

Referenced by convert_g().

int convert_speed block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274 instructions

Definition at line 5632 of file rs274ngc_pre.cc.

References RS274NGC_OK, and SET_SPINDLE_SPEED().

Referenced by execute_block().

int convert_stop block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 5704 of file rs274ngc_pre.cc.

References AND, CANON_PLANE_XY, CANON_STOPPED, CHK, ENABLE_FEED_OVERRIDE(), ENABLE_SPEED_OVERRIDE(), ERM, setup_struct::file_pointer, FLOOD_OFF(), G_1, IS, ISNT, setup_struct::linetext, MIST_OFF(), MODE_ABSOLUTE, NCE_BUG_CODE_NOT_M0_M1_M2_M30_M60, NCE_UNABLE_TO_OPEN_FILE, OFF, ON, OPTIONAL_PROGRAM_STOP(), OR, PALLET_SHUTTLE(), setup_struct::percent_flag, PROGRAM_END(), PROGRAM_STOP(), RS274NGC_EXIT, RS274NGC_OK, RS274NGC_TEXT_SIZE, SELECT_PLANE(), SET_ORIGIN_OFFSETS(), SET_TO, STOP_SPINDLE_TURNING(), UNITS_PER_MINUTE, and UNKNOWN.

Referenced by execute_block().

int convert_straight int    move,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
move  ARGUMENTS
block  either G_0 or G_1
settings  pointer to a block of RS274 instructions

Definition at line 5954 of file rs274ngc_pre.cc.

References CHK, CHP, convert_straight_comp1(), convert_straight_comp2(), ERM, find_ends(), G_0, G_1, G_53, INVERSE_TIME, inverse_time_rate_straight(), ISNT, NCE_BUG_CODE_NOT_G0_OR_G1, NCE_CANNOT_DO_G1_WITH_ZERO_FEED_RATE, NCE_CANNOT_USE_G53_WITH_CUTTER_RADIUS_COMP, NCE_F_WORD_MISSING_WITH_INVERSE_TIME_G1_MOVE, OFF, RS274NGC_OK, STRAIGHT_FEED(), STRAIGHT_TRAVERSE(), UNITS_PER_MINUTE, and UNKNOWN.

Referenced by convert_motion().

int convert_straight_comp1 int    move,
block_pointer    block,
setup_pointer    settings,
double    px,
double    py,
double    end_z
[static]
 

convert_straight_comp1

Returned Value: int If any of the following errors occur, this returns the error shown. Otherwise, it returns RS274NGC_OK. 1. The side is not RIGHT or LEFT: NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT 2. The destination tangent point is not more than a tool radius away (indicating gouging): NCE_CUTTER_GOUGING_WITH_CUTTER_RADIUS_COMP 3. The value of move is not G_0 or G_1 NCE_BUG_CODE_NOT_G0_OR_G1

Side effects: This executes a STRAIGHT_MOVE command at cutting feed rate or a STRAIGHT_TRAVERSE command. It also updates the setting of the position of the tool point to the end point of the move and updates the programmed point. If INVERSE_TIME feed rate mode is in effect, it resets the feed rate.

Called by: convert_straight.

This is called if cutter radius compensation is on and settings->program_x is UNKNOWN, indicating that this is the first move after cutter radius compensation is turned on.

The algorithm used here for determining the path is to draw a straight line from the destination point which is tangent to a circle whose center is at the current point and whose radius is the radius of the cutter. The destination point of the cutter tip is then found as the center of a circle of the same radius tangent to the tangent line at the destination point.

Parameters:
move  ARGUMENTS
block  either G_0 or G_1
settings  pointer to a block of RS274 instructions
px  pointer to machine settings
py  X coordinate of end point
end_z  Y coordinate of end point Z coordinate of end point

Definition at line 6170 of file rs274ngc_pre.cc.

References CHK, setup_struct::current_x, setup_struct::current_y, setup_struct::cutter_comp_radius, setup_struct::cutter_comp_side, ERM, setup_struct::feed_mode, G_0, G_1, INVERSE_TIME, inverse_time_rate_straight(), ISNT, LEFT, NCE_BUG_CODE_NOT_G0_OR_G1, NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT, NCE_CUTTER_GOUGING_WITH_CUTTER_RADIUS_COMP, setup_struct::program_x, setup_struct::program_y, RIGHT, RS274NGC_OK, SET_TO, STRAIGHT_FEED(), and STRAIGHT_TRAVERSE().

Referenced by convert_straight().

int convert_straight_comp2 int    move,
block_pointer    block,
setup_pointer    settings,
double    px,
double    py,
double    end_z
[static]
 

convert_straight_comp2

Returned Value: int If any of the following errors occur, this returns the error shown. Otherwise, it returns RS274NGC_OK. 1. The compensation side is not RIGHT or LEFT: NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT 2. A concave corner is found: NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP

Side effects: This executes a STRAIGHT_FEED command at cutting feed rate or a STRAIGHT_TRAVERSE command. It also generates an ARC_FEED to go around a corner, if necessary. It also updates the setting of the position of the tool point to the end point of the move and updates the programmed point. If INVERSE_TIME feed mode is in effect, it also calls SET_FEED_RATE and resets the feed rate in the machine model.

Called by: convert_straight.

This is called if cutter radius compensation is on and settings->program_x is not UNKNOWN, indicating that this is not the first move after cutter radius compensation is turned on.

The algorithm used here is: 1. Determine the direction of the last motion. This is done by finding the direction of the line from the last programmed point to the current tool tip location. This line is a radius of the tool and is perpendicular to the direction of motion since the cutter is tangent to that direction. 2. Determine the direction of the programmed motion. 3. If there is a convex corner, insert an arc to go around the corner. 4. Find the destination point for the tool tip. The tool will be tangent to the line from the last programmed point to the present programmed point at the present programmed point. 5. Go in a straight line from the current tool tip location to the destination tool tip location.

This uses an angle tolerance of TOLERANCE_CONCAVE_CORNER (0.01 radian) to determine if: 1) an illegal concave corner exists (tool will not fit into corner), 2) no arc is required to go around the corner (i.e. the current line is in the same direction as the end of the previous move), or 3) an arc is required to go around a convex corner and start off in a new direction.

If a rotary axis is moved in this block and an extra arc is required to go around a sharp corner, all the rotary axis motion occurs on the arc. An alternative might be to distribute the rotary axis motion over the arc and the straight move in proportion to their lengths.

If the Z-axis is moved in this block and an extra arc is required to go around a sharp corner, all the Z-axis motion occurs on the straight line and none on the extra arc. An alternative might be to distribute the Z-axis motion over the extra arc and the straight line in proportion to their lengths.

This handles inverse time feed rates by computing the length of the compensated path.

This handles the case of there being no XY motion.

This handles G0 moves. Where an arc is inserted to round a corner in a G1 move, no arc is inserted for a G0 move; a STRAIGHT_TRAVERSE is made from the current point to the end point. The end point for a G0 move is the same as the end point for a G1 move, however.

Parameters:
move  ARGUMENTS
block  either G_0 or G_1
settings  pointer to a block of RS274 instructions
px  pointer to machine settings
py  X coordinate of programmed end point
end_z  Y coordinate of programmed end point Z coordinate of end point

Definition at line 6359 of file rs274ngc_pre.cc.

References AND, ARC_FEED(), CHK, setup_struct::current_x, setup_struct::current_y, setup_struct::current_z, setup_struct::cutter_comp_radius, setup_struct::cutter_comp_side, ERM, setup_struct::feed_mode, G_0, G_1, INVERSE_TIME, inverse_time_rate_as(), inverse_time_rate_straight(), LEFT, NCE_BUG_CODE_NOT_G0_OR_G1, NCE_BUG_SIDE_NOT_RIGHT_OR_LEFT, NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP, PI, PI2, setup_struct::program_x, setup_struct::program_y, RIGHT, RS274NGC_OK, SET_TO, STRAIGHT_FEED(), STRAIGHT_TRAVERSE(), TOLERANCE_CONCAVE_CORNER, and TWO_PI.

Referenced by convert_straight().

int convert_tool_change setup_pointer    settings [static]
 

pointer to machine settings

Parameters:
settings  ARGUMENTS

Definition at line 6701 of file rs274ngc_pre.cc.

References CANON_STOPPED, CHANGE_TOOL(), and RS274NGC_OK.

Referenced by convert_m().

int convert_tool_length_offset int    g_code,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
g_code  ARGUMENTS
block  g_code being executed (must be G_43 or G_49)
settings  pointer to a block of RS274/NGC instructions

Definition at line 6744 of file rs274ngc_pre.cc.

References CHK, ERM, G_43, G_49, NCE_BUG_CODE_NOT_G43_OR_G49, NCE_OFFSET_INDEX_MISSING, RS274NGC_OK, SET_TO, and USE_TOOL_LENGTH_OFFSET().

Referenced by convert_g().

int convert_tool_select block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274 instructions

Definition at line 6803 of file rs274ngc_pre.cc.

References CHK, NCE_SELECTED_TOOL_SLOT_NUMBER_TOO_LARGE, RS274NGC_OK, and SELECT_TOOL().

Referenced by execute_block().

int cycle_feed CANON_PLANE    plane,
double    end1,
double    end2,
double    end3
[static]
 

third coordinate value

Parameters:
plane  ARGUMENTS
end1  currently selected plane
end2  first coordinate value
end3  second coordinate value

Definition at line 6841 of file rs274ngc_pre.cc.

References CANON_PLANE, CANON_PLANE_XY, CANON_PLANE_YZ, RS274NGC_OK, and STRAIGHT_FEED().

Referenced by convert_cycle_g81(), convert_cycle_g82(), convert_cycle_g83(), convert_cycle_g84(), convert_cycle_g85(), convert_cycle_g86(), convert_cycle_g87(), convert_cycle_g88(), and convert_cycle_g89().

int cycle_traverse CANON_PLANE    plane,
double    end1,
double    end2,
double    end3
[static]
 

third coordinate value

Parameters:
plane  ARGUMENTS
end1  currently selected plane
end2  first coordinate value
end3  second coordinate value

Definition at line 6950 of file rs274ngc_pre.cc.

References CANON_PLANE, CANON_PLANE_XY, CANON_PLANE_YZ, RS274NGC_OK, and STRAIGHT_TRAVERSE().

Referenced by convert_cycle_g81(), convert_cycle_g82(), convert_cycle_g83(), convert_cycle_g86(), and convert_cycle_g87().

int enhance_block block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block to be checked

Definition at line 7068 of file rs274ngc_pre.cc.

References CHK, G_10, G_28, G_30, G_80, G_92, ISNT, NCE_ALL_AXES_MISSING_WITH_G92, NCE_ALL_AXES_MISSING_WITH_MOTION_CODE, NCE_CANNOT_USE_AXIS_VALUES_WITH_G80, NCE_CANNOT_USE_AXIS_VALUES_WITHOUT_A_G_CODE_THAT_USES_THEM, NCE_CANNOT_USE_TWO_G_CODES_THAT_BOTH_USE_AXIS_VALUES, NOT, ON, RS274NGC_OK, and SET_TO.

Referenced by parse_line().

int execute_binary double *    left,
int    operation,
double *    right
[static]
 

execute binary

Returned value: int If execute_binary1 or execute_binary2 returns an error code, this returns that code. Otherwise, it returns RS274NGC_OK.

Side effects: The value of left is set to the result of applying the operation to left and right.

Called by: read_real_expression

This just calls either execute_binary1 or execute_binary2.

Definition at line 7142 of file rs274ngc_pre.cc.

References AND2, CHP, execute_binary1(), execute_binary2(), and RS274NGC_OK.

Referenced by read_real_expression().

int execute_binary1 double *    left,
int    operation,
double *    right
[static]
 

pointer to the right operand

Parameters:
left  ARGUMENTS
operation  pointer to the left operand
right  integer code for the operation

Definition at line 7178 of file rs274ngc_pre.cc.

References CHK, DIVIDED_BY, ERM, ISNT, MODULO, NCE_ATTEMPT_TO_DIVIDE_BY_ZERO, NCE_ATTEMPT_TO_RAISE_NEGATIVE_TO_NON_INTEGER_POWER, NCE_BUG_UNKNOWN_OPERATION, POWER, RS274NGC_OK, SET_TO, and TIMES.

Referenced by execute_binary().

int execute_binary2 double *    left,
int    operation,
double *    right
[static]
 

pointer to the right operand

Parameters:
left  ARGUMENTS
operation  pointer to the left operand
right  integer code for the operation

Definition at line 7235 of file rs274ngc_pre.cc.

References AND2, ERM, EXCLUSIVE_OR, ISNT, MINUS, NCE_BUG_UNKNOWN_OPERATION, NON_EXCLUSIVE_OR, PLUS, RS274NGC_OK, and SET_TO.

Referenced by execute_binary().

int execute_block block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 7313 of file rs274ngc_pre.cc.

References CHP, convert_comment(), convert_feed_mode(), convert_feed_rate(), convert_g(), convert_m(), convert_speed(), convert_stop(), convert_tool_select(), ERP, INVERSE_TIME, ISNT, ON, RS274NGC_EXECUTE_FINISH, RS274NGC_EXIT, and RS274NGC_OK.

Referenced by rs274ngc_execute().

int execute_unary double *    double_ptr,
int    operation
[static]
 

integer code for the operation

Parameters:
double_ptr  ARGUMENTS
operation  pointer to the operand

Definition at line 7387 of file rs274ngc_pre.cc.

References ABS, ACOS, ASIN, CHK, COS, ERM, EXP, FIX, FUP, LN, NCE_ARGUMENT_TO_ACOS_OUT_OF_RANGE, NCE_ARGUMENT_TO_ASIN_OUT_OF_RANGE, NCE_BUG_UNKNOWN_OPERATION, NCE_NEGATIVE_ARGUMENT_TO_SQRT, NCE_ZERO_OR_NEGATIVE_ARGUMENT_TO_LN, PI, ROUND, RS274NGC_OK, SET_TO, SIN, SQRT, and TAN.

Referenced by read_unary().

double find_arc_length double    x1,
double    y1,
double    z1,
double    center_x,
double    center_y,
int    turn,
double    x2,
double    y2,
double    z2
[static]
 

Z-coordinate of end point

Parameters:
x1  ARGUMENTS
y1  X-coordinate of start point
z1  Y-coordinate of start point
center_x  Z-coordinate of start point
center_y  X-coordinate of arc center
turn  Y-coordinate of arc center
x2  no. of full or partial circles CCW
y2  X-coordinate of end point
z2  Y-coordinate of end point

Definition at line 7481 of file rs274ngc_pre.cc.

References find_turn().

Referenced by inverse_time_rate_arc(), inverse_time_rate_arc2(), and inverse_time_rate_as().

int find_ends block_pointer    block,
setup_pointer    settings,
double *    px,
double *    py,
double *    pz
[static]
 

find_ends

Returned Value: int (RS274NGC_OK)

Side effects: The values of px, py, pz, aa_p, bb_p, and cc_p are set

Called by: convert_arc convert_home convert_probe convert_straight

This finds the coordinates of a point, "end", in the currently active coordinate system, and sets the values of the pointers to the coordinates (which are the arguments to the function).

In all cases, if no value for the coodinate is given in the block, the current value for the coordinate is used. When cutter radius compensation is on, this function is called before compensation calculations are performed, so the current value of the programmed point is used, not the current value of the actual current_point.

There are three cases for when the coordinate is included in the block:

1. G_53 is active. This means to interpret the coordinates as machine coordinates. That is accomplished by adding the two offsets to the coordinate given in the block.

2. Absolute coordinate mode is in effect. The coordinate in the block is used.

3. Incremental coordinate mode is in effect. The coordinate in the block plus either (i) the programmed current position - when cutter radius compensation is in progress, or (2) the actual current position.

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions
px  pointer to machine settings
py  pointer to end_x
pz  pointer to end_y pointer to end_z

Definition at line 7543 of file rs274ngc_pre.cc.

References setup_struct::axis_offset_x, setup_struct::axis_offset_y, setup_struct::axis_offset_z, COMMENT(), setup_struct::current_x, setup_struct::current_y, setup_struct::current_z, setup_struct::cutter_comp_side, setup_struct::distance_mode, G_53, block_struct::g_modes, ISNT, MODE_ABSOLUTE, OFF, ON, setup_struct::origin_offset_x, setup_struct::origin_offset_y, setup_struct::origin_offset_z, setup_struct::program_x, setup_struct::program_y, RS274NGC_OK, SET_TO, setup_struct::tool_length_offset, UNKNOWN, block_struct::x_flag, block_struct::x_number, block_struct::y_flag, block_struct::y_number, block_struct::z_flag, and block_struct::z_number.

Referenced by convert_arc(), convert_home(), convert_probe(), and convert_straight().

int find_relative double    x1,
double    y1,
double    z1,
double *    x2,
double *    y2,
double *    z2,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
x1  ARGUMENTS
y1  absolute x position
z1  absolute y position
x2  absolute z position
y2  pointer to relative x
z2  pointer to relative y
settings  pointer to relative z

Definition at line 7701 of file rs274ngc_pre.cc.

References RS274NGC_OK, and SET_TO.

Referenced by convert_home().

double find_straight_length double    x2,
double    y2,
double    z2,
double    x1,
double    y1,
double    z1
[static]
 

find_straight_length

Returned Value: double (length of path between start and end points)

Side effects: none

Called by: inverse_time_rate_straight inverse_time_rate_as

This calculates a number to use in feed rate calculations when inverse time feed mode is used, for a motion in which X,Y,Z,A,B, and C each change linearly or not at all from their initial value to their end value.

This is used when the feed_reference mode is CANON_XYZ, which is always in rs274NGC.

If any of the X, Y, or Z axes move or the A-axis, B-axis, and C-axis do not move, this is the length of the path relative to the XYZ axes from the first point to the second, and any rotary axis motion is ignored. The length is the simple Euclidean distance.

The formula for the Euclidean distance "length" of a move involving only the A, B and C axes is based on a conversation with Jim Frohardt at Boeing, who says that the Fanuc controller on their 5-axis machine interprets the feed rate this way. Note that if only one rotary axis moves, this formula returns the absolute value of that axis move, which is what is desired.

Parameters:
x2  ARGUMENTS
y2  X-coordinate of end point
z2  Y-coordinate of end point
x1  Z-coordinate of end point
y1  X-coordinate of start point
z1  Y-coordinate of start point Z-coordinate of start point

Definition at line 7786 of file rs274ngc_pre.cc.

References AND, ISNT, and OR.

Referenced by inverse_time_rate_as(), and inverse_time_rate_straight().

double find_turn double    x1,
double    y1,
double    center_x,
double    center_y,
int    turn,
double    x2,
double    y2
[static]
 

Y-coordinate of end point

Parameters:
x1  ARGUMENTS
y1  X-coordinate of start point
center_x  Y-coordinate of start point
center_y  X-coordinate of arc center
turn  Y-coordinate of arc center
x2  no. of full or partial circles CCW
y2  X-coordinate of end point

Definition at line 7854 of file rs274ngc_pre.cc.

References SET_TO, and TWO_PI.

Referenced by find_arc_length().

int init_block block_pointer    block [static]
 

pointer to a block to be initialized or reset

Parameters:
block  ARGUMENTS

Definition at line 7924 of file rs274ngc_pre.cc.

References OFF, and RS274NGC_OK.

Referenced by parse_line().

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
[static]
 

pointer to machine settings

Parameters:
x1  ARGUMENTS
y1  x coord of start point of arc
z1  y coord of start point of arc
cx  z coord of start point of arc
cy  x coord of center of arc
turn  y coord of center of arc
x2  turn of arc
y2  x coord of end point of arc
z2  y coord of end point of arc
block  z coord of end point of arc
settings  pointer to a block of RS274 instructions

Definition at line 7987 of file rs274ngc_pre.cc.

References find_arc_length(), MAX, RS274NGC_OK, and SET_FEED_RATE().

Referenced by convert_arc2(), convert_arc_comp1(), and convert_arc_comp2().

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
[static]
 

pointer to machine settings

Parameters:
start_x  ARGUMENTS
start_y  x coord of last program point, extra arc center x
turn1  y coord of last program point, extra arc center y
mid_x  turn of extra arc
mid_y  x coord of end point of extra arc
cx  y coord of end point of extra arc
cy  x coord of center of main arc
turn2  y coord of center of main arc
end_x  turn of main arc
end_y  x coord of end point of main arc
end_z  y coord of end point of main arc
block  z coord of end point of main arc
settings  pointer to a block of RS274 instructions

Definition at line 8034 of file rs274ngc_pre.cc.

References find_arc_length(), MAX, RS274NGC_OK, SET_FEED_RATE(), and SET_TO.

Referenced by convert_arc_comp2().

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
[static]
 

pointer to machine settings

Parameters:
start_x  ARGUMENTS
start_y  x coord of last program point, extra arc center x
turn  y coord of last program point, extra arc center y
mid_x  turn of extra arc
mid_y  x coord of end point of extra arc
end_x  y coord of end point of extra arc
end_y  x coord of end point of straight line
end_z  y coord of end point of straight line
block  z coord of end point of straight line
settings  pointer to a block of RS274 instructions

Definition at line 8087 of file rs274ngc_pre.cc.

References find_arc_length(), find_straight_length(), MAX, RS274NGC_OK, SET_FEED_RATE(), and SET_TO.

Referenced by convert_straight_comp2().

int inverse_time_rate_straight double    end_x,
double    end_y,
double    end_z,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
end_x  ARGUMENTS
end_y  x coordinate of end point of straight line
end_z  y coordinate of end point of straight line
block  z coordinate of end point of straight line
settings  pointer to a block of RS274 instructions

Definition at line 8166 of file rs274ngc_pre.cc.

References find_straight_length(), MAX, RS274NGC_OK, and SET_FEED_RATE().

Referenced by convert_straight(), convert_straight_comp1(), and convert_straight_comp2().

int parse_line char *    line,
block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
line  ARGUMENTS
block  array holding a line of RS274 code
settings  pointer to a block to be filled

Definition at line 8242 of file rs274ngc_pre.cc.

References check_items(), CHP, enhance_block(), init_block(), read_items(), and RS274NGC_OK.

Referenced by rs274ngc_read().

int precedence int    an_operator [static]
 

precedence

Returned Value: int This returns an integer representing the precedence level of an_operator

Side Effects: None

Called by: read_real_expression

To add additional levels of operator precedence, edit this function.

Parameters:
an_operator  ARGUMENTS

Definition at line 8273 of file rs274ngc_pre.cc.

References AND2, POWER, and RIGHT_BRACKET.

Referenced by read_real_expression().

int read_a char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8325 of file rs274ngc_pre.cc.

References CHK, CHP, ERM, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_CANNOT_USE_A_WORD, NCE_MULTIPLE_A_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_atan char *    line,
int *    counter,
double *    double_ptr,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
double_ptr  pointer to a counter for position on line
parameters  pointer to double to be read

Definition at line 8388 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_LEFT_BRACKET_MISSING_AFTER_SLASH_WITH_ATAN, NCE_SLASH_MISSING_AFTER_FIRST_ATAN_ARGUMENT, PI, read_real_expression(), RS274NGC_OK, and SET_TO.

Referenced by read_unary().

int read_b char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8447 of file rs274ngc_pre.cc.

References CHK, CHP, ERM, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_CANNOT_USE_B_WORD, NCE_MULTIPLE_B_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_c char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8513 of file rs274ngc_pre.cc.

References CHK, CHP, ERM, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_CANNOT_USE_C_WORD, NCE_MULTIPLE_C_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_comment char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8574 of file rs274ngc_pre.cc.

References CHK, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, and RS274NGC_OK.

int read_d char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8627 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_D_WORDS_ON_ONE_LINE, NCE_NEGATIVE_D_WORD_TOOL_RADIUS_INDEX_USED, NCE_TOOL_RADIUS_INDEX_TOO_BIG, read_integer_value(), RS274NGC_OK, SET_TO, and setup_struct::tool_max.

int read_f char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8679 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_F_WORDS_ON_ONE_LINE, NCE_NEGATIVE_F_WORD_USED, read_real_value(), RS274NGC_OK, and SET_TO.

int read_g char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8747 of file rs274ngc_pre.cc.

References _gees, CHK, CHP, ERM, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_G_CODE_OUT_OF_RANGE, NCE_NEGATIVE_G_CODE_USED, NCE_TWO_G_CODES_USED_FROM_SAME_MODAL_GROUP, NCE_UNKNOWN_G_CODE_USED, read_real_value(), RS274NGC_OK, and SET_TO.

int read_h char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8810 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_H_WORDS_ON_ONE_LINE, NCE_NEGATIVE_H_WORD_TOOL_LENGTH_OFFSET_INDEX_USED, NCE_TOOL_LENGTH_OFFSET_INDEX_TOO_BIG, read_integer_value(), RS274NGC_OK, SET_TO, and setup_struct::tool_max.

int read_i char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 8863 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_I_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_integer_unsigned char *    line,
int *    counter,
int *    integer_ptr
[static]
 

pointer to the value being read

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
integer_ptr  pointer to a counter for position on the line

Definition at line 8905 of file rs274ngc_pre.cc.

References CHK, ERM, NCE_BAD_FORMAT_UNSIGNED_INTEGER, NCE_SSCANF_FAILED, and RS274NGC_OK.

Referenced by read_line_number().

int read_integer_value char *    line,
int *    counter,
int *    integer_ptr,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
integer_ptr  pointer to a counter for position on the line
parameters  pointer to the value being read

Definition at line 8961 of file rs274ngc_pre.cc.

References CHP, ERM, NCE_NON_INTEGER_VALUE_FOR_INTEGER, read_real_value(), RS274NGC_OK, and SET_TO.

Referenced by read_d(), read_h(), read_l(), read_m(), read_parameter(), read_parameter_setting(), and read_t().

int read_items block_pointer    block,
char *    line,
double *    parameters
[static]
 

array of system parameters

Parameters:
block  ARGUMENTS
line  pointer to a block being filled from the line
parameters  string: line of RS274/NGC code being processed

Definition at line 9000 of file rs274ngc_pre.cc.

References CHP, read_line_number(), read_one_item(), and RS274NGC_OK.

Referenced by parse_line().

int read_j char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9059 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_J_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_k char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9111 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_K_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_l char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9161 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_L_WORDS_ON_ONE_LINE, NCE_NEGATIVE_L_WORD_USED, read_integer_value(), RS274NGC_OK, and SET_TO.

int read_line_number char *    line,
int *    counter,
block_pointer    block
[static]
 

pointer to a block being filled from the line

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line

Definition at line 9209 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_LINE_NUMBER_GREATER_THAN_99999, read_integer_unsigned(), RS274NGC_OK, and SET_TO.

Referenced by read_items().

int read_m char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9260 of file rs274ngc_pre.cc.

References _ems, CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_M_CODE_GREATER_THAN_99, NCE_NEGATIVE_M_CODE_USED, NCE_TWO_M_CODES_USED_FROM_SAME_MODAL_GROUP, NCE_UNKNOWN_M_CODE_USED, read_integer_value(), RS274NGC_OK, and SET_TO.

int read_one_item char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9330 of file rs274ngc_pre.cc.

References _readers, CHK, CHP, NCE_BAD_CHARACTER_USED, read_function_pointer, and RS274NGC_OK.

Referenced by read_items().

int read_operation char *    line,
int *    counter,
int *    operation
[static]
 

pointer to operation to be read

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
operation  pointer to a counter for position on the line

Definition at line 9378 of file rs274ngc_pre.cc.

References AND, AND2, DIVIDED_BY, ERM, EXCLUSIVE_OR, MINUS, MODULO, NCE_UNCLOSED_EXPRESSION, NCE_UNKNOWN_OPERATION, NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_A, NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_M, NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_O, NCE_UNKNOWN_OPERATION_NAME_STARTING_WITH_X, NON_EXCLUSIVE_OR, PLUS, POWER, RIGHT_BRACKET, RS274NGC_OK, SET_TO, and TIMES.

Referenced by read_real_expression().

int read_operation_unary char *    line,
int *    counter,
int *    operation
[static]
 

pointer to operation to be read

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
operation  pointer to a counter for position on the line

Definition at line 9488 of file rs274ngc_pre.cc.

References ABS, ACOS, AND, ASIN, ATAN, COS, ERM, EXP, FIX, FUP, LN, NCE_UNKNOWN_WORD_STARTING_WITH_A, NCE_UNKNOWN_WORD_STARTING_WITH_C, NCE_UNKNOWN_WORD_STARTING_WITH_E, NCE_UNKNOWN_WORD_STARTING_WITH_F, NCE_UNKNOWN_WORD_STARTING_WITH_L, NCE_UNKNOWN_WORD_STARTING_WITH_R, NCE_UNKNOWN_WORD_STARTING_WITH_S, NCE_UNKNOWN_WORD_STARTING_WITH_T, NCE_UNKNOWN_WORD_WHERE_UNARY_OPERATION_COULD_BE, ROUND, RS274NGC_OK, SET_TO, SIN, SQRT, and TAN.

Referenced by read_unary().

int read_p char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9635 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_P_WORDS_ON_ONE_LINE, NCE_NEGATIVE_P_WORD_USED, read_real_value(), RS274NGC_OK, and SET_TO.

int read_parameter char *    line,
int *    counter,
double *    double_ptr,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
double_ptr  pointer to a counter for position on the line
parameters  pointer to double to be read

Definition at line 9691 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_PARAMETER_NUMBER_OUT_OF_RANGE, read_integer_value(), RS274NGC_MAX_PARAMETERS, RS274NGC_OK, and SET_TO.

Referenced by read_real_value().

int read_parameter_setting char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9777 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_EQUAL_SIGN_MISSING_IN_PARAMETER_SETTING, NCE_PARAMETER_NUMBER_OUT_OF_RANGE, setup_struct::parameter_numbers, setup_struct::parameter_occurrence, setup_struct::parameter_values, read_integer_value(), read_real_value(), RS274NGC_MAX_PARAMETERS, RS274NGC_OK, and SET_TO.

int read_q char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9833 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_Q_WORDS_ON_ONE_LINE, NCE_NEGATIVE_OR_ZERO_Q_VALUE_USED, read_real_value(), RS274NGC_OK, and SET_TO.

int read_r char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 9887 of file rs274ngc_pre.cc.

References AND2, CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_R_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RIGHT_BRACKET, RS274NGC_OK, and SET_TO.

int read_real_expression char *    line,
int *    counter,
double *    value,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
value  pointer to a counter for position on the line
parameters  pointer to double to be computed

Definition at line 10155 of file rs274ngc_pre.cc.

References CHK, CHP, execute_binary(), ISNT, MAX_STACK, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, precedence(), read_operation(), read_real_value(), RIGHT_BRACKET, RS274NGC_OK, and SET_TO.

Referenced by read_atan(), read_real_value(), and read_unary().

int read_real_number char *    line,
int *    counter,
double *    double_ptr
[static]
 

pointer to double to be read

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
double_ptr  pointer to a counter for position on the line

Definition at line 10239 of file rs274ngc_pre.cc.

References AND, CHK, ERM, ISNT, NCE_BAD_NUMBER_FORMAT, NCE_NO_DIGITS_FOUND_WHERE_REAL_NUMBER_SHOULD_BE, NCE_SSCANF_FAILED, OFF, ON, RS274NGC_OK, and SET_TO.

Referenced by read_real_value().

int read_real_value char *    line,
int *    counter,
double *    double_ptr,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
double_ptr  pointer to a counter for position on the line
parameters  pointer to double to be read

Definition at line 10350 of file rs274ngc_pre.cc.

References AND, AND2, CHK, CHP, NCE_NO_CHARACTERS_FOUND_IN_READING_REAL_VALUE, read_parameter(), read_real_expression(), read_real_number(), read_unary(), RIGHT_BRACKET, and RS274NGC_OK.

Referenced by read_a(), read_b(), read_c(), read_f(), read_g(), read_i(), read_integer_value(), read_j(), read_k(), read_p(), read_parameter_setting(), read_q(), read_r(), read_real_expression(), read_s(), read_x(), read_y(), and read_z().

int read_s char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 10524 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_S_WORDS_ON_ONE_LINE, NCE_NEGATIVE_SPINDLE_SPEED_USED, read_real_value(), RS274NGC_OK, and SET_TO.

int read_t char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 10574 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_T_WORDS_ON_ONE_LINE, NCE_NEGATIVE_TOOL_ID_USED, read_integer_value(), RS274NGC_OK, and SET_TO.

int read_text const char *    command,
FILE *    inport,
char *    raw_line,
char *    line,
int *    length
[static]
 

a pointer to an integer to be set

Parameters:
command  ARGUMENTS
inport  a string which may have input text, or null
raw_line  a file pointer for an input file, or null
line  array to write raw input line into
length  array for input line to be processed in

Definition at line 10658 of file rs274ngc_pre.cc.

References AND, CHK, CHP, close_and_downcase(), ERM, IS, ISNT, NCE_COMMAND_TOO_LONG, NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN, NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN_OR_PROGRAM_END, ON, OR, setup_struct::parameter_occurrence, setup_struct::percent_flag, RS274NGC_ENDFILE, RS274NGC_EXECUTE_FINISH, RS274NGC_OK, RS274NGC_TEXT_SIZE, setup_struct::sequence_number, and SET_TO.

Referenced by rs274ngc_read().

int read_unary char *    line,
int *    counter,
double *    double_ptr,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274/NGC code being processed
double_ptr  pointer to a counter for position on the line
parameters  pointer to double to be read

Definition at line 10741 of file rs274ngc_pre.cc.

References ATAN, CHK, CHP, execute_unary(), ISNT, NCE_LEFT_BRACKET_MISSING_AFTER_UNARY_OPERATION_NAME, read_atan(), read_operation_unary(), read_real_expression(), and RS274NGC_OK.

Referenced by read_real_value().

int read_x char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 10796 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_X_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_y char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 10848 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_Y_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int read_z char *    line,
int *    counter,
block_pointer    block,
double *    parameters
[static]
 

array of system parameters

Parameters:
line  ARGUMENTS
counter  string: line of RS274 code being processed
block  pointer to a counter for position on the line
parameters  pointer to a block being filled from the line

Definition at line 10900 of file rs274ngc_pre.cc.

References CHK, CHP, ISNT, NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED, NCE_MULTIPLE_Z_WORDS_ON_ONE_LINE, OFF, ON, read_real_value(), RS274NGC_OK, and SET_TO.

int set_probe_data setup_pointer    settings [static]
 

pointer to machine settings

Parameters:
settings  ARGUMENTS

Definition at line 10933 of file rs274ngc_pre.cc.

References GET_EXTERNAL_POSITION_X(), GET_EXTERNAL_POSITION_Y(), GET_EXTERNAL_POSITION_Z(), GET_EXTERNAL_PROBE_POSITION_X(), GET_EXTERNAL_PROBE_POSITION_Y(), GET_EXTERNAL_PROBE_POSITION_Z(), GET_EXTERNAL_PROBE_VALUE(), and RS274NGC_OK.

Referenced by rs274ngc_read().

int write_g_codes block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 11010 of file rs274ngc_pre.cc.

References CANON_CONTINUOUS, CANON_EXACT_PATH, CANON_PLANE_XY, CANON_PLANE_XZ, CANON_UNITS_INCHES, G_17, G_18, G_19, G_20, G_21, G_40, G_41, G_42, G_43, G_49, G_61, G_61_1, G_64, G_90, G_91, G_93, G_94, G_98, G_99, INVERSE_TIME, LEFT, MODE_ABSOLUTE, OLD_Z, RIGHT, RS274NGC_OK, and SET_TO.

Referenced by rs274ngc_execute(), and rs274ngc_init().

int write_m_codes block_pointer    block,
setup_pointer    settings
[static]
 

pointer to machine settings

Parameters:
block  ARGUMENTS
settings  pointer to a block of RS274/NGC instructions

Definition at line 11064 of file rs274ngc_pre.cc.

References CANON_CLOCKWISE, CANON_STOPPED, ON, and RS274NGC_OK.

Referenced by rs274ngc_execute(), and rs274ngc_init().

int write_settings setup_pointer    settings [static]
 

pointer to machine settings

Parameters:
settings  ARGUMENTS

Definition at line 11106 of file rs274ngc_pre.cc.

References RS274NGC_OK.

Referenced by rs274ngc_execute(), and rs274ngc_init().

int rs274ngc_close  
 

close the currently open NC code file.

rs274ngc_close

Returned Value: int (RS274NGC_OK)

Side Effects: The NC-code file is closed if open. The _setup world model is reset.

Called By: external programs

Definition at line 11144 of file rs274ngc_pre.cc.

References setup_struct::file_pointer, ISNT, RS274NGC_OK, and rs274ngc_reset().

int rs274ngc_execute const char *    command = 0
 

execute a line of NC code.

NO ARGUMENTS

Definition at line 11179 of file rs274ngc_pre.cc.

References setup_struct::block1, ERP, execute_block(), ISNT, setup_struct::line_length, setup_struct::parameter_numbers, setup_struct::parameter_occurrence, setup_struct::parameter_values, setup_struct::parameters, RS274NGC_EXECUTE_FINISH, RS274NGC_EXIT, RS274NGC_OK, rs274ngc_read(), write_g_codes(), write_m_codes(), and write_settings().

Referenced by interpret_from_file(), and interpret_from_keyboard().

int rs274ngc_exit  
 

stop running.

NO ARGUMENTS

Definition at line 11233 of file rs274ngc_pre.cc.

References GET_EXTERNAL_PARAMETER_FILE_NAME(), setup_struct::parameters, RS274NGC_OK, RS274NGC_PARAMETER_FILE_NAME_DEFAULT, rs274ngc_reset(), rs274ngc_save_parameters(), and RS274NGC_TEXT_SIZE.

int rs274ngc_init  
 

get ready to run.

NO ARGUMENTS

Definition at line 11273 of file rs274ngc_pre.cc.

References setup_struct::axis_offset_x, setup_struct::axis_offset_y, setup_struct::axis_offset_z, setup_struct::blocktext, CANON_INDEPENDENT, CANON_XYZ, CHK, CHP, setup_struct::cutter_comp_side, setup_struct::distance_mode, setup_struct::feed_mode, setup_struct::feed_override, setup_struct::file_pointer, setup_struct::filename, G_80, GET_EXTERNAL_LENGTH_UNIT_TYPE(), GET_EXTERNAL_PARAMETER_FILE_NAME(), INIT_CANON(), setup_struct::length_offset_index, setup_struct::length_units, setup_struct::line_length, setup_struct::linetext, MODE_ABSOLUTE, setup_struct::motion_mode, NCE_COORDINATE_SYSTEM_INDEX_PARAMETER_5220_OUT_OF_RANGE, OFF, ON, setup_struct::origin_index, setup_struct::origin_offset_x, setup_struct::origin_offset_y, setup_struct::origin_offset_z, setup_struct::parameters, setup_struct::probe_flag, setup_struct::program_x, setup_struct::program_y, RS274NGC_OK, RS274NGC_PARAMETER_FILE_NAME_DEFAULT, rs274ngc_restore_parameters(), rs274ngc_synch(), RS274NGC_TEXT_SIZE, setup_struct::sequence_number, SET_FEED_REFERENCE(), SET_ORIGIN_OFFSETS(), SET_TO, setup_struct::speed_feed_mode, setup_struct::speed_override, setup_struct::tool_length_offset, setup_struct::tool_table_index, UNITS_PER_MINUTE, UNKNOWN, USE_LENGTH_UNITS(), write_g_codes(), write_m_codes(), and write_settings().

int rs274ngc_load_tool_table  
 

load a tool table.

NO ARGUMENTS

Definition at line 11429 of file rs274ngc_pre.cc.

References CANON_TOOL_MAX, CHK, CANON_TOOL_TABLE::diameter, GET_EXTERNAL_TOOL_TABLE(), CANON_TOOL_TABLE::id, CANON_TOOL_TABLE::length, NCE_TOOL_MAX_TOO_LARGE, RS274NGC_OK, setup_struct::tool_max, and setup_struct::tool_table.

int rs274ngc_open const char *    filename
 

open a file of NC code.

string: the name of the input NC-program file

Parameters:
filename  ARGUMENTS

Definition at line 11495 of file rs274ngc_pre.cc.

References AND, CHK, ERM, setup_struct::file_pointer, setup_struct::filename, IS, ISNT, setup_struct::linetext, NCE_A_FILE_IS_ALREADY_OPEN, NCE_COMMAND_TOO_LONG, NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN, NCE_FILE_NAME_TOO_LONG, NCE_UNABLE_TO_OPEN_FILE, OFF, ON, setup_struct::percent_flag, RS274NGC_OK, rs274ngc_reset(), RS274NGC_TEXT_SIZE, setup_struct::sequence_number, and SET_TO.

Referenced by main().

int rs274ngc_read const char *    command = 0
 

read the mdi or the next line of the open NC code file.

may be NULL or a string to read

Parameters:
command  ARGUMENTS

Definition at line 11580 of file rs274ngc_pre.cc.

References setup_struct::block1, setup_struct::blocktext, CHK, CHP, ERP, setup_struct::file_pointer, GET_EXTERNAL_QUEUE_EMPTY(), ISNT, setup_struct::line_length, setup_struct::linetext, NCE_FILE_NOT_OPEN, NCE_QUEUE_IS_NOT_EMPTY_AFTER_PROBING, OFF, ON, parse_line(), setup_struct::probe_flag, read_text(), RS274NGC_ENDFILE, RS274NGC_EXECUTE_FINISH, RS274NGC_OK, and set_probe_data().

Referenced by interpret_from_file(), interpret_from_keyboard(), and rs274ngc_execute().

int rs274ngc_reset  
 

reset yourself.

rs274ngc_reset

Returned Value: int (RS274NGC_OK)

Side Effects: See below

Called By: external programs rs274ngc_close rs274ngc_exit rs274ngc_open

This function resets the parts of the _setup model having to do with reading and interpreting one line. It does not affect the parts of the model dealing with a file being open; rs274ngc_open and rs274ngc_close do that.

There is a hierarchy of resetting the interpreter. Each of the following calls does everything the ones above it do.

rs274ngc_reset() rs274ngc_close() rs274ngc_init()

In addition, rs274ngc_synch and rs274ngc_restore_parameters (both of which are called by rs274ngc_init) change the model.

Definition at line 11643 of file rs274ngc_pre.cc.

References setup_struct::blocktext, setup_struct::line_length, setup_struct::linetext, and RS274NGC_OK.

int rs274ngc_restore_parameters const char *    filename
 

restore interpreter variables from a file.

name of parameter file to read

Parameters:
filename  ARGUMENTS

Definition at line 11689 of file rs274ngc_pre.cc.

References _required_parameters, CHK, ERM, ISNT, NCE_PARAMETER_FILE_OUT_OF_ORDER, NCE_PARAMETER_NUMBER_OUT_OF_RANGE, NCE_REQUIRED_PARAMETER_MISSING, NCE_UNABLE_TO_OPEN_FILE, setup_struct::parameters, RS274NGC_MAX_PARAMETERS, and RS274NGC_OK.

Referenced by rs274ngc_init().

int rs274ngc_save_parameters const char *    filename,
const double    parameters[]
 

save interpreter variables to file.

parameters to save

Parameters:
filename  ARGUMENTS
parameters  name of file to write

Definition at line 11787 of file rs274ngc_pre.cc.

References _required_parameters, CHK, ERM, ISNT, NCE_CANNOT_CREATE_BACKUP_FILE, NCE_CANNOT_OPEN_BACKUP_FILE, NCE_CANNOT_OPEN_VARIABLE_FILE, NCE_PARAMETER_FILE_OUT_OF_ORDER, NCE_PARAMETER_NUMBER_OUT_OF_RANGE, RS274NGC_MAX_PARAMETERS, RS274NGC_OK, and RS274NGC_PARAMETER_FILE_BACKUP_SUFFIX.

int rs274ngc_synch  
 

synchronize your internal model with the external world.

NO ARGUMENTS

Definition at line 11884 of file rs274ngc_pre.cc.

References setup_struct::control_mode, setup_struct::current_slot, setup_struct::current_x, setup_struct::current_y, setup_struct::current_z, setup_struct::feed_rate, setup_struct::flood, GET_EXTERNAL_FEED_RATE(), GET_EXTERNAL_FLOOD(), GET_EXTERNAL_LENGTH_UNIT_TYPE(), GET_EXTERNAL_MIST(), GET_EXTERNAL_MOTION_CONTROL_MODE(), GET_EXTERNAL_PLANE(), GET_EXTERNAL_POSITION_X(), GET_EXTERNAL_POSITION_Y(), GET_EXTERNAL_POSITION_Z(), GET_EXTERNAL_SPEED(), GET_EXTERNAL_SPINDLE(), GET_EXTERNAL_TOOL_MAX(), GET_EXTERNAL_TOOL_SLOT(), GET_EXTERNAL_TRAVERSE_RATE(), ISNT, setup_struct::length_units, setup_struct::mist, OFF, ON, setup_struct::plane, rs274ngc_load_tool_table(), RS274NGC_OK, setup_struct::selected_tool_slot, SET_TO, setup_struct::speed, setup_struct::spindle_turning, setup_struct::tool_max, and setup_struct::traverse_rate.

void rs274ngc_active_g_codes int *    codes
 

copy active G codes into array [0]..[11].

array of codes to copy into

Parameters:
codes  ARGUMENTS

Definition at line 11940 of file rs274ngc_pre.cc.

References setup_struct::active_g_codes, and RS274NGC_ACTIVE_G_CODES.

Referenced by main().

void rs274ngc_active_m_codes int *    codes
 

copy active M codes into array [0]..[6].

array of codes to copy into

Parameters:
codes  ARGUMENTS

Definition at line 11965 of file rs274ngc_pre.cc.

References setup_struct::active_m_codes, and RS274NGC_ACTIVE_M_CODES.

Referenced by main().

void rs274ngc_active_settings double *    settings
 

copy active F, S settings into array [0]..[2].

array of settings to copy into

Parameters:
settings  ARGUMENTS

Definition at line 11990 of file rs274ngc_pre.cc.

References setup_struct::active_settings, and RS274NGC_ACTIVE_SETTINGS.

Referenced by main().

void rs274ngc_error_text int    error_code,
char *    error_text,
int    max_size
 

copy the text of the error message whose number is error_code into the error_text array, but stop at max_size if the text is longer.

maximum number of characters to copy

Parameters:
error_code  ARGUMENTS
error_text  code number of error
max_size  char array to copy error text into

Definition at line 12020 of file rs274ngc_pre.cc.

References _rs274ngc_errors, RS274NGC_MAX_ERROR, and RS274NGC_MIN_ERROR.

Referenced by report_error().

void rs274ngc_file_name char *    file_name,
int    max_size
 

copy the name of the currently open file into the file_name array, but stop at max_size if the name is longer.

maximum number of characters to copy

Parameters:
file_name  ARGUMENTS
max_size  string: to copy file name into

Definition at line 12052 of file rs274ngc_pre.cc.

References setup_struct::filename.

Referenced by main(), and rs274ngc_file().

int rs274ngc_line_length  
 

return the length of the most recently read line.

rs274ngc_line_length

Returned Value: the length of the most recently read line

Side Effects: none

Called By: external programs

Definition at line 12074 of file rs274ngc_pre.cc.

References setup_struct::line_length.

void rs274ngc_line_text char *    line_text,
int    max_size
 

copy the text of the most recently read line into the line_text array, but stop at max_size if the text is longer.

maximum number of characters to copy

Parameters:
line_text  ARGUMENTS
max_size  string: to copy line into

Definition at line 12095 of file rs274ngc_pre.cc.

References ISNT, and setup_struct::linetext.

Referenced by print_nc_line_number(), report_error(), and rs274ngc_command().

int rs274ngc_sequence_number  
 

return the current sequence number (how many lines read).

rs274ngc_sequence_number

Returned Value: the current interpreter sequence number (how many lines read since the last time the sequence number was reset to zero, which happens only when rs274ngc_init or rs274ngc_open is called).

Side Effects: none

Called By: external programs

Definition at line 12127 of file rs274ngc_pre.cc.

References setup_struct::sequence_number.

void rs274ngc_stack_name int    stack_index,
char *    function_name,
int    max_size
 

copy the function name from the stack_index'th position of the function call stack at the time of the most recent error into the function name string, but stop at max_size if the name is longer.

maximum number of characters to copy

Parameters:
stack_index  ARGUMENTS
function_name  index into stack of function names
max_size  string: to copy function name into

Definition at line 12156 of file rs274ngc_pre.cc.

References AND, ISNT, and setup_struct::stack.

Referenced by report_error().


Variable Documentation

const int _gees[] [static]
 

Interpreter global arrays for g_codes and m_codes. The nth entry in each array is the modal group number corresponding to the nth code. Entries which are -1 represent illegal codes. Remember g_codes in this interpreter are multiplied by 10.

The modal g groups and group numbers defined in [NCMS, pages 71 - 73] (see also [Fanuc, pages 43 - 45]) are used here, except the canned cycles (g80 - g89), which comprise modal g group 9 in [Fanuc], are treated here as being in the same modal group (group 1) with the straight moves and arcs (g0, g1, g2,g3). [Fanuc, page 45] says only one g_code from any one group may appear on a line, and we are following that rule. The straight_probe move, g38.2, is in group 1; it is not defined in [NCMS].

Some g_codes are non-modal (g4, g10, g28, g30, g53, g92, g92.1, g92.2, and g92.3 here - many more in [NCMS]). [Fanuc] and [NCMS] put all these in the same group 0, so we do also. Logically, there are two subgroups, those which require coordinate values (g10, g28, g30, and g92) and those which do not (g4, g53, g92.1, g92.2, and g92.3). The subgroups are identified by itemization when necessary.

Those in group 0 which require coordinate values may not be on the same line as those in group 1 (except g80) because they would be competing for the coordinate values. Others in group 0 may be used on the same line as those in group 1.

A total of 52 G-codes are implemented.

The groups are: group 0 = {g4,g10,g28,g30,g53,g92,g92.1,g92.2,g92.3} - NON-MODAL dwell, setup, return to ref1, return to ref2, motion in machine coordinates, set and unset axis offsets group 1 = {g0,g1,g2,g3,g38.2,g80,g81,g82,g83,g84,g85,g86,g87,g88,g89} - motion group 2 = {g17,g18,g19} - plane selection group 3 = {g90,g91} - distance mode group 5 = {g93,g94} - feed rate mode group 6 = {g20,g21} - units group 7 = {g40,g41,g42} - cutter diameter compensation group 8 = {g43,g49} - tool length offset group 10 = {g98,g99} - return mode in canned cycles group 12 = {g54,g55,g56,g57,g58,g59,g59.1,g59.2,g59.3} - coordinate system group 13 = {g61,g61.1,g64} - control mode

Definition at line 559 of file rs274ngc_pre.cc.

Referenced by read_g().

const int _ems[] [static]
 

Initial value:

  {
   4,  4,  4,  7,  7,  7,  6,  8,  8,  8,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
   4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1,  9,  9,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
   4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
Modal groups and modal group numbers for M codes are not described in [Fanuc]. We have used the groups from [NCMS] and added M60, as an extension of the language for pallet shuttle and stop. This version has no codes related to axis clamping.

The groups are: group 4 = {m0,m1,m2,m30,m60} - stopping group 6 = {m6} - tool change group 7 = {m3,m4,m5} - spindle turning group 8 = {m7,m8,m9} - coolant group 9 = {m48,m49} - feed and speed override switch bypass

Definition at line 627 of file rs274ngc_pre.cc.

Referenced by read_m().

const int _required_parameters[] [static]
 

This is an array of the index numbers of system parameters that must be included in a file used with the rs274ngc_restore_parameters function. The array is used by that function and by the rs274ngc_save_parameters function.

Definition at line 648 of file rs274ngc_pre.cc.

Referenced by rs274ngc_restore_parameters(), and rs274ngc_save_parameters().

const read_function_pointer _readers[] [static]
 

Initial value:

  {
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0, 0, 0, read_parameter_setting,0,      0,      0,      0,
read_comment, 0, 0,     0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
0,      0,      0,      0,      0,      0,      0,      read_a, read_b, read_c,
read_d, 0,      read_f, read_g, read_h, read_i, read_j, read_k, read_l, read_m,
0,      0,      read_p, read_q, read_r, read_s, read_t, 0     , 0,      0,
read_x, read_y, read_z}
_readers is an array of pointers to functions that read. It is used by read_one_item.

Definition at line 780 of file rs274ngc_pre.cc.

Referenced by read_one_item().

setup _setup [static]
 

There are four global variables. The first three are _gees, _ems, and _readers. The last one, declared here, is for interpreter settings

Definition at line 800 of file rs274ngc_pre.cc.


Generated on Mon Feb 11 21:31:17 2002 for rs274ngc by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001