summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Radek <chris@timeguy.com>2009-01-07 22:34:30 +0000
committerChris Radek <chris@timeguy.com>2009-01-07 22:34:30 +0000
commite0c96fbe3c1850adf090bc52c0a1756513e232d2 (patch)
treea8dded579bb7ffbd4edc7e7e61d82ada8f9d50e1
parent684c7b67fa63f95ea5e6a13169f53e83b2566b8e (diff)
downloadlinuxcnc-e0c96fbe3c1850adf090bc52c0a1756513e232d2.tar.gz
linuxcnc-e0c96fbe3c1850adf090bc52c0a1756513e232d2.zip
merge concave_comp2 branch: new cutter compensation algorithm that handles inside corners
-rw-r--r--src/emc/canterp/canterp.cc10
-rw-r--r--src/emc/nml_intf/canon.hh15
-rw-r--r--src/emc/nml_intf/interpl.cc5
-rw-r--r--src/emc/nml_intf/interpl.hh1
-rw-r--r--src/emc/rs274ngc/Submakefile1
-rw-r--r--src/emc/rs274ngc/gcodemodule.cc34
-rw-r--r--src/emc/rs274ngc/interp_convert.cc502
-rw-r--r--src/emc/rs274ngc/interp_cycles.cc376
-rw-r--r--src/emc/rs274ngc/interp_execute.cc2
-rw-r--r--src/emc/rs274ngc/interp_internal.cc1
-rw-r--r--src/emc/rs274ngc/interp_internal.hh5
-rw-r--r--src/emc/rs274ngc/interp_inverse.cc9
-rw-r--r--src/emc/rs274ngc/interp_queue.cc306
-rw-r--r--src/emc/rs274ngc/interp_queue.hh95
-rw-r--r--src/emc/rs274ngc/interp_read.cc20
-rw-r--r--src/emc/rs274ngc/rs274ngc.hh32
-rw-r--r--src/emc/rs274ngc/rs274ngc_errors.cc4
-rw-r--r--src/emc/sai/saicanon.cc11
-rw-r--r--src/emc/task/emccanon.cc47
19 files changed, 1086 insertions, 390 deletions
diff --git a/src/emc/canterp/canterp.cc b/src/emc/canterp/canterp.cc
index f48fbe54e..e16abb4a2 100644
--- a/src/emc/canterp/canterp.cc
+++ b/src/emc/canterp/canterp.cc
@@ -474,7 +474,7 @@ int emcTaskPlanExecute(const char *command)
{
int retval;
double d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
- int i1;
+ int i1, ln=-1;
char s1[256];
if (command) {
@@ -488,7 +488,7 @@ int emcTaskPlanExecute(const char *command)
&d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9)) {
return 1;
}
- STRAIGHT_FEED(d1, d2, d3, d4, d5, d6, d7, d8, d9);
+ STRAIGHT_FEED(ln, d1, d2, d3, d4, d5, d6, d7, d8, d9);
return 0;
}
@@ -498,7 +498,7 @@ int emcTaskPlanExecute(const char *command)
&d1, &d2, &d3, &d4, &i1, &d5, &d6, &d7, &d8, &d9, &d10, &d11)) {
return 1;
}
- ARC_FEED(d1, d2, d3, d4, i1, d5, d6, d7, d8, d9, d10, d11);
+ ARC_FEED(ln, d1, d2, d3, d4, i1, d5, d6, d7, d8, d9, d10, d11);
return 0;
}
@@ -507,7 +507,7 @@ int emcTaskPlanExecute(const char *command)
&d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9)) {
return 1;
}
- STRAIGHT_TRAVERSE(d1, d2, d3, d4, d5, d6, d7, d8, d9);
+ STRAIGHT_TRAVERSE(ln, d1, d2, d3, d4, d5, d6, d7, d8, d9);
return 0;
}
@@ -516,7 +516,7 @@ int emcTaskPlanExecute(const char *command)
&d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9)) {
return 1;
}
- STRAIGHT_PROBE(d1, d2, d3, d4, d5, d6, d7, d8, d9, 0);
+ STRAIGHT_PROBE(ln, d1, d2, d3, d4, d5, d6, d7, d8, d9, 0);
return 0;
}
diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh
index b768fa6f6..1e6a7f007 100644
--- a/src/emc/nml_intf/canon.hh
+++ b/src/emc/nml_intf/canon.hh
@@ -211,7 +211,8 @@ extern void SET_TRAVERSE_RATE(double rate);
is expected that no cutting will occur while a traverse move is being
made. */
-extern void STRAIGHT_TRAVERSE(double x, double y, double z,
+extern void STRAIGHT_TRAVERSE(int lineno,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w);
/*
@@ -359,7 +360,8 @@ extern void STOP_SPEED_FEED_SYNCH();
/* Machining Functions */
-extern void ARC_FEED(double first_end, double second_end,
+extern void ARC_FEED(int lineno,
+ double first_end, double second_end,
double first_axis, double second_axis, int rotation,
double axis_end_point,
double a, double b, double c,
@@ -416,7 +418,8 @@ a point moving along the arc has of its total motion.
*/
-extern void STRAIGHT_FEED(double x, double y, double z,
+extern void STRAIGHT_FEED(int lineno,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w);
@@ -424,13 +427,15 @@ extern void STRAIGHT_FEED(double x, double y, double z,
all axes have covered the same proportion of their required motion.
The meanings of the parameters is the same as for STRAIGHT_TRAVERSE.*/
-extern void RIGID_TAP(double x, double y, double z);
+extern void RIGID_TAP(int lineno,
+ double x, double y, double z);
/* Move linear and synced with the previously set pitch.
Only linear moves are allowed, axes A,B,C are not allowed to move.*/
-extern void STRAIGHT_PROBE(double x, double y, double z,
+extern void STRAIGHT_PROBE(int lineno,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w, unsigned char probe_type);
diff --git a/src/emc/nml_intf/interpl.cc b/src/emc/nml_intf/interpl.cc
index 6a2759ae3..dfe771a6b 100644
--- a/src/emc/nml_intf/interpl.cc
+++ b/src/emc/nml_intf/interpl.cc
@@ -236,8 +236,3 @@ int NML_INTERP_LIST::get_line_number()
{
return line_number;
}
-
-int NML_INTERP_LIST::get_next_line_number()
-{
- return next_line_number;
-}
diff --git a/src/emc/nml_intf/interpl.hh b/src/emc/nml_intf/interpl.hh
index 10f81ec0d..ef34d7cea 100644
--- a/src/emc/nml_intf/interpl.hh
+++ b/src/emc/nml_intf/interpl.hh
@@ -50,7 +50,6 @@ class NML_INTERP_LIST {
int set_line_number(int line);
int get_line_number();
- int get_next_line_number();
int append(NMLmsg &);
int append(NMLmsg *);
NMLmsg *get();
diff --git a/src/emc/rs274ngc/Submakefile b/src/emc/rs274ngc/Submakefile
index c64787a58..42753fb43 100644
--- a/src/emc/rs274ngc/Submakefile
+++ b/src/emc/rs274ngc/Submakefile
@@ -5,6 +5,7 @@ LIBRS274SRCS := $(addprefix emc/rs274ngc/, \
interp_array.cc \
interp_check.cc \
interp_convert.cc \
+ interp_queue.cc \
interp_cycles.cc \
interp_execute.cc \
interp_find.cc \
diff --git a/src/emc/rs274ngc/gcodemodule.cc b/src/emc/rs274ngc/gcodemodule.cc
index 345d2b95f..2974c85de 100644
--- a/src/emc/rs274ngc/gcodemodule.cc
+++ b/src/emc/rs274ngc/gcodemodule.cc
@@ -157,14 +157,14 @@ double tool_xoffset, tool_zoffset, tool_woffset;
Interp interp_new;
-void maybe_new_line() {
+void maybe_new_line(int line_number) {
if(interp_error) return;
LineCode *new_line_code =
(LineCode*)(PyObject_New(LineCode, &LineCodeType));
active_settings(new_line_code->settings);
active_g_codes(new_line_code->gcodes);
active_m_codes(new_line_code->mcodes);
- int sequence_number = interp_new.sequence_number();
+ int sequence_number = line_number == -1? interp_new.sequence_number(): line_number;
new_line_code->gcodes[0] = sequence_number;
if(sequence_number == last_sequence_number) {
Py_DECREF(new_line_code);
@@ -178,7 +178,13 @@ void maybe_new_line() {
Py_XDECREF(result);
}
-void ARC_FEED(double first_end, double second_end, double first_axis,
+void maybe_new_line(void) {
+ maybe_new_line(-1);
+}
+
+
+void ARC_FEED(int line_number,
+ double first_end, double second_end, double first_axis,
double second_axis, int rotation, double axis_end_point,
double a_position, double b_position, double c_position,
double u_position, double v_position, double w_position) {
@@ -193,7 +199,7 @@ void ARC_FEED(double first_end, double second_end, double first_axis,
v_position /= 25.4;
w_position /= 25.4;
}
- maybe_new_line();
+ maybe_new_line(line_number);
if(interp_error) return;
PyObject *result =
PyObject_CallMethod(callback, "arc_feed", "ffffifffffff",
@@ -205,14 +211,15 @@ void ARC_FEED(double first_end, double second_end, double first_axis,
Py_XDECREF(result);
}
-void STRAIGHT_FEED(double x, double y, double z,
+void STRAIGHT_FEED(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w) {
_pos_x=x; _pos_y=y; _pos_z=z;
_pos_a=a; _pos_b=b; _pos_c=c;
_pos_u=u; _pos_v=v; _pos_w=w;
if(metric) { x /= 25.4; y /= 25.4; z /= 25.4; u /= 25.4; v /= 25.4; w /= 25.4; }
- maybe_new_line();
+ maybe_new_line(line_number);
if(interp_error) return;
PyObject *result =
PyObject_CallMethod(callback, "straight_feed", "fffffffff",
@@ -221,14 +228,15 @@ void STRAIGHT_FEED(double x, double y, double z,
Py_XDECREF(result);
}
-void STRAIGHT_TRAVERSE(double x, double y, double z,
+void STRAIGHT_TRAVERSE(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w) {
_pos_x=x; _pos_y=y; _pos_z=z;
_pos_a=a; _pos_b=b; _pos_c=c;
_pos_u=u; _pos_v=v; _pos_w=w;
if(metric) { x /= 25.4; y /= 25.4; z /= 25.4; u /= 25.4; v /= 25.4; w /= 25.4; }
- maybe_new_line();
+ maybe_new_line(line_number);
if(interp_error) return;
PyObject *result =
PyObject_CallMethod(callback, "straight_traverse", "fffffffff",
@@ -416,14 +424,15 @@ void SET_MOTION_OUTPUT_BIT(int bit) {}
void SET_MOTION_OUTPUT_VALUE(int index, double value) {}
void TURN_PROBE_ON() {}
void TURN_PROBE_OFF() {}
-void STRAIGHT_PROBE(double x, double y, double z,
+void STRAIGHT_PROBE(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w, unsigned char probe_type) {
_pos_x=x; _pos_y=y; _pos_z=z;
_pos_a=a; _pos_b=b; _pos_c=c;
_pos_u=u; _pos_v=v; _pos_w=w;
if(metric) { x /= 25.4; y /= 25.4; z /= 25.4; u /= 25.4; v /= 25.4; w /= 25.4; }
- maybe_new_line();
+ maybe_new_line(line_number);
if(interp_error) return;
PyObject *result =
PyObject_CallMethod(callback, "straight_probe", "fffffffff",
@@ -432,9 +441,10 @@ void STRAIGHT_PROBE(double x, double y, double z,
Py_XDECREF(result);
}
-void RIGID_TAP(double x, double y, double z) {
+void RIGID_TAP(int line_number,
+ double x, double y, double z) {
if(metric) { x /= 25.4; y /= 25.4; z /= 25.4; }
- maybe_new_line();
+ maybe_new_line(line_number);
if(interp_error) return;
PyObject *result =
PyObject_CallMethod(callback, "rigid_tap", "fff",
diff --git a/src/emc/rs274ngc/interp_convert.cc b/src/emc/rs274ngc/interp_convert.cc
index dd6e18e21..4eb8a27dd 100644
--- a/src/emc/rs274ngc/interp_convert.cc
+++ b/src/emc/rs274ngc/interp_convert.cc
@@ -24,8 +24,17 @@
#include "rs274ngc.hh"
#include "rs274ngc_return.hh"
#include "interp_internal.hh"
+#include "interp_queue.hh"
#include "units.h"
+#ifndef R2D
+#define R2D(r) ((r)*180.0/M_PI)
+#endif
+#ifndef SQ
+#define SQ(a) ((a)*(a))
+#endif
+
+#define DEBUG_EMC
// lathe tools have strange origin points that are not at
// the center of the radius. This means that the point that
@@ -52,6 +61,7 @@ static double ztrans(setup_pointer settings, double z) {
return z;
}
+
/****************************************************************************/
/*! convert_arc
@@ -331,7 +341,7 @@ int Interp::convert_arc2(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_arc(*current1, *current2, *current3, center1, center2,
turn, end1, end2, end3, block, settings);
- ARC_FEED(end1, end2, center1, center2, turn, end3,
+ ARC_FEED(block->line_number, end1, end2, center1, center2, turn, end3,
AA_end, BB_end, CC_end, u, v, w);
*current1 = end1;
*current2 = end2;
@@ -482,14 +492,14 @@ int Interp::convert_arc_comp1(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_straight(xtrans(settings, current[0]), current[2], ztrans(settings, current[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end, block, settings);
- STRAIGHT_FEED(xtrans(settings, current[0]), current[2], ztrans(settings, current[1]),
+ STRAIGHT_FEED(block->line_number, xtrans(settings, current[0]), current[2], ztrans(settings, current[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_arc(current[0], current[1],
current[2], center[0], center[1], turn,
end[0], end[1], end[2], block, settings);
- ARC_FEED(ztrans(settings, end[1]), xtrans(settings, end[0]),
+ enqueue_ARC_FEED(block->line_number, ztrans(settings, end[1]), xtrans(settings, end[0]),
ztrans(settings, center[1]), xtrans(settings, center[0]),
-turn, end[2], AA_end, BB_end, CC_end, u_end, v_end, w_end);
settings->current_x = end[0];
@@ -506,8 +516,9 @@ int Interp::convert_arc_comp1(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
inverse_time_rate_arc(current[0], current[1],
current[2], center[0], center[1], turn,
end[0], end[1], end[2], block, settings);
- ARC_FEED(end[0], end[1], center[0], center[1], turn, end[2],
+ enqueue_ARC_FEED(block->line_number, end[0], end[1], center[0], center[1], turn, end[2],
AA_end, BB_end, CC_end, u_end, v_end, w_end);
+
settings->current_x = end[0];
settings->current_y = end[1];
settings->current_z = end[2];
@@ -638,10 +649,12 @@ int Interp::convert_arc_comp2(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
delta = atan2(center[1] - start[1], center[0] - start[0]);
alpha = (move == G_3) ? (delta - M_PI_2l) : (delta + M_PI_2l);
beta = (side == LEFT) ? (theta - alpha) : (alpha - theta);
- beta = (beta > (1.5 * M_PIl)) ? (beta - (2 * M_PIl)) :
- (beta < -M_PI_2l) ? (beta + (2 * M_PIl)) : beta;
+
+ // normalize beta -90 to +270?
+ beta = (beta > (1.5 * M_PIl)) ? (beta - (2 * M_PIl)) : (beta < -M_PI_2l) ? (beta + (2 * M_PIl)) : beta;
if (((side == LEFT) && (move == G_3)) || ((side == RIGHT) && (move == G_2))) {
+ // we are cutting inside the arc
gamma = atan2((center[1] - end[1]), (center[0] - end[0]));
CHK((arc_radius <= tool_radius),
NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP);
@@ -650,6 +663,7 @@ int Interp::convert_arc_comp2(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
delta = (delta + M_PIl);
}
+
if(settings->plane == CANON_PLANE_XZ) {
settings->program_x = end[0];
settings->program_z = end[1];
@@ -662,40 +676,117 @@ int Interp::convert_arc_comp2(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
end[0] = (end[0] + (tool_radius * cos(gamma))); /* end_x reset actual */
end[1] = (end[1] + (tool_radius * sin(gamma))); /* end_y reset actual */
-/* check if extra arc needed and insert if so */
- CHK(((beta < -small) || (beta > (M_PIl + small))),
- NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP);
- if (beta > small) { /* two arcs needed */
+ if (beta < -small ||
+ beta > M_PIl + small ||
+ // nasty detection for convex corner on tangent arcs
+ (fabs(beta - M_PIl) < small && !qc().empty() && qc().front().type == QARC_FEED &&
+ turn == qc().front().data.arc_feed.turn &&
+ ((side == RIGHT && turn == 1) || (side == LEFT && turn == -1)))) {
+ // concave
+ if (qc().front().type != QARC_FEED) {
+ // line->arc
+ double cy = arc_radius * sin(beta - M_PI_2l);
+ double toward_nominal;
+ double dist_from_center;
+ double angle_from_center;
+
+ if (((side == LEFT) && (move == G_3)) || ((side == RIGHT) && (move == G_2))) {
+ // tool is inside the arc
+ dist_from_center = arc_radius - tool_radius;
+ toward_nominal = cy + tool_radius;
+ if(move == G_3) {
+ angle_from_center = theta + asin(toward_nominal / dist_from_center);
+ } else {
+ angle_from_center = theta - asin(toward_nominal / dist_from_center);
+ }
+ } else {
+ dist_from_center = arc_radius + tool_radius;
+ toward_nominal = cy - tool_radius;
+ if(move == G_3) {
+ angle_from_center = theta + M_PIl - asin(toward_nominal / dist_from_center);
+ } else {
+ angle_from_center = theta + M_PIl + asin(toward_nominal / dist_from_center);
+ }
+
+ }
+
+ mid[0] = center[0] + dist_from_center * cos(angle_from_center);
+ mid[1] = center[1] + dist_from_center * sin(angle_from_center);
+ // XXX assuming XY
+ update_endpoint(mid[0], mid[1]);
+ } else {
+ // arc->arc
+ struct arc_feed &prev = qc().front().data.arc_feed;
+ double oldrad = hypot(prev.center2 - prev.end2, prev.center1 - prev.end1);
+ double newrad;
+ if (((side == LEFT) && (move == G_3)) || ((side == RIGHT) && (move == G_2))) {
+ // inside the arc
+ newrad = arc_radius - tool_radius;
+ } else {
+ newrad = arc_radius + tool_radius;
+ }
+
+ double arc_cc = hypot(prev.center2 - center[1], prev.center1 - center[0]);
+ double pullback = acos((SQ(oldrad) + SQ(arc_cc) - SQ(newrad)) / (2 * oldrad * arc_cc));
+ double cc_dir = atan2(center[1] - prev.center2, center[0] - prev.center1);
+ double dir;
+
+ if((side==LEFT && prev.turn==1) || (side==RIGHT && prev.turn==-1)) {
+ // inside the previous arc
+ if(turn == 1)
+ dir = cc_dir + pullback;
+ else
+ dir = cc_dir - pullback;
+ } else {
+ if(turn == 1)
+ dir = cc_dir - pullback;
+ else
+ dir = cc_dir + pullback;
+ }
+
+ if(0) printf("seqno %d old %g,%g new %g,%g oldrad %g arc_cc %g newrad %g pullback %g cc_dir %g dir %g\n", settings->sequence_number, prev.center1, prev.center2, center[0], center[1], oldrad, arc_cc, newrad, R2D(pullback), R2D(cc_dir), R2D(dir));
+
+ mid[0] = prev.center1 + oldrad * cos(dir);
+ mid[1] = prev.center2 + oldrad * sin(dir);
+
+ update_endpoint(mid[0], mid[1]);
+ }
+
+ enqueue_ARC_FEED(block->line_number, end[0], end[1], center[0], center[1], turn, end[2],
+ AA_end, BB_end, CC_end, u, v, w);
+ } else if (beta > small) { /* convex, two arcs needed */
mid[0] = (start[0] + (tool_radius * cos(delta)));
mid[1] = (start[1] + (tool_radius * sin(delta)));
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_arc2(start[0], start[1], (side == LEFT) ? -1 : 1,
mid[0], mid[1], center[0], center[1], turn,
end[0], end[1], end[2], block, settings);
+ dequeue_canons();
if(settings->plane == CANON_PLANE_XZ) {
- ARC_FEED(ztrans(settings, mid[1]), xtrans(settings, mid[0]), ztrans(settings, start[1]), xtrans(settings, start[0]),
+ ARC_FEED(block->line_number, ztrans(settings, mid[1]), xtrans(settings, mid[0]), ztrans(settings, start[1]), xtrans(settings, start[0]),
((side == LEFT) ? 1 : -1),
current[2], AA_end, BB_end, CC_end, u, v, w);
- ARC_FEED(ztrans(settings, end[1]), xtrans(settings, end[0]), ztrans(settings, center[1]), xtrans(settings, center[0]),
- -turn, end[2], AA_end, BB_end, CC_end, u, v, w);
+ enqueue_ARC_FEED(block->line_number, ztrans(settings, end[1]), xtrans(settings, end[0]), ztrans(settings, center[1]), xtrans(settings, center[0]),
+ -turn, end[2], AA_end, BB_end, CC_end, u, v, w);
} else if (settings->plane == CANON_PLANE_XY) {
- ARC_FEED(mid[0], mid[1], start[0], start[1], ((side == LEFT) ? -1 : 1),
+ ARC_FEED(block->line_number, mid[0], mid[1], start[0], start[1], ((side == LEFT) ? -1 : 1),
current[2],
AA_end, BB_end, CC_end, u, v, w);
- ARC_FEED(end[0], end[1], center[0], center[1], turn, end[2],
+ enqueue_ARC_FEED(block->line_number, end[0], end[1], center[0], center[1], turn, end[2],
AA_end, BB_end, CC_end, u, v, w);
}
- } else { /* one arc needed */
+ } else { /* convex, one arc needed */
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_arc(current[0], current[1],
current[2], center[0], center[1], turn,
end[0], end[1], end[2], block, settings);
+ dequeue_canons();
if(settings->plane == CANON_PLANE_XZ) {
- ARC_FEED(ztrans(settings, end[1]), xtrans(settings, end[0]), ztrans(settings, center[1]), xtrans(settings, center[0]),
- -turn, end[2], AA_end, BB_end, CC_end, u, v, w);
+ enqueue_ARC_FEED(block->line_number, ztrans(settings, end[1]), xtrans(settings, end[0]), ztrans(settings, center[1]), xtrans(settings, center[0]),
+ -turn, end[2], AA_end, BB_end, CC_end, u, v, w);
} else if (settings->plane == CANON_PLANE_XY) {
- ARC_FEED(end[0], end[1], center[0], center[1], turn, end[2],
+ enqueue_ARC_FEED(block->line_number, end[0], end[1], center[0], center[1], turn, end[2],
AA_end, BB_end, CC_end, u, v, w);
}
}
@@ -1174,7 +1265,7 @@ int Interp::convert_comment(char *comment) //!< string with comment
return INTERP_OK;
}
// else it's a real comment
- COMMENT(comment + start);
+ enqueue_COMMENT(comment + start);
return INTERP_OK;
}
@@ -1216,6 +1307,8 @@ int Interp::convert_control_mode(int g_code, //!< g_code being executed (G_6
setup_pointer settings) //!< pointer to machine settings
{
static char name[] = "convert_control_mode";
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot change control mode with cutter radius compensation on")));
if (g_code == G_61) {
SET_MOTION_CONTROL_MODE(CANON_EXACT_PATH, 0);
settings->control_mode = CANON_EXACT_PATH;
@@ -1319,6 +1412,8 @@ int Interp::convert_coordinate_system(int g_code, //!< g_code called (mus
double u, v, w;
double *parameters;
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot change coordinate systems with cutter radius compensation on")));
parameters = settings->parameters;
switch (g_code) {
case 540:
@@ -1354,7 +1449,7 @@ int Interp::convert_coordinate_system(int g_code, //!< g_code called (mus
if (origin == settings->origin_index) { /* already using this origin */
#ifdef DEBUG_EMC
- COMMENT("interpreter: continuing to use same coordinate system");
+ enqueue_COMMENT("interpreter: continuing to use same coordinate system");
#endif
return INTERP_OK;
}
@@ -1485,9 +1580,10 @@ Called by: convert_cutter_compensation
int Interp::convert_cutter_compensation_off(setup_pointer settings) //!< pointer to machine settings
{
#ifdef DEBUG_EMC
- COMMENT("interpreter: cutter radius compensation off");
+ enqueue_COMMENT("interpreter: cutter radius compensation off");
#endif
if(settings->cutter_comp_side != OFF && settings->cutter_comp_radius > 0.0) {
+ dequeue_canons();
settings->current_x = settings->program_x;
settings->current_y = settings->program_y;
settings->current_z = settings->program_z;
@@ -1602,9 +1698,9 @@ int Interp::convert_cutter_compensation_on(int side, //!< side of path cutte
}
#ifdef DEBUG_EMC
if (side == RIGHT)
- COMMENT("interpreter: cutter radius compensation on right");
+ enqueue_COMMENT("interpreter: cutter radius compensation on right");
else
- COMMENT("interpreter: cutter radius compensation on left");
+ enqueue_COMMENT("interpreter: cutter radius compensation on left");
#endif
settings->cutter_comp_radius = radius;
@@ -1635,6 +1731,9 @@ Called by: convert_g.
*/
+// OK to call this in a concave corner with a deferred move, since it
+// doesn't issue any CANONs
+
int Interp::convert_distance_mode(int g_code, //!< g_code being executed (must be G_90 or G_91)
setup_pointer settings) //!< pointer to machine settings
{
@@ -1642,14 +1741,14 @@ int Interp::convert_distance_mode(int g_code, //!< g_code being executed (mus
if (g_code == G_90) {
if (settings->distance_mode != MODE_ABSOLUTE) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: distance mode changed to absolute");
+ enqueue_COMMENT("interpreter: distance mode changed to absolute");
#endif
settings->distance_mode = MODE_ABSOLUTE;
}
} else if (g_code == G_91) {
if (settings->distance_mode != MODE_INCREMENTAL) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: distance mode changed to incremental");
+ enqueue_COMMENT("interpreter: distance mode changed to incremental");
#endif
settings->distance_mode = MODE_INCREMENTAL;
}
@@ -1680,6 +1779,9 @@ Called by: convert_g.
*/
+// OK to call this in a concave corner with a deferred move, since it
+// doesn't issue any CANONs except comments (and who cares where the comments are)
+
int Interp::convert_ijk_distance_mode(int g_code, //!< g_code being executed (must be G_90_1 or G_91_1)
setup_pointer settings) //!< pointer to machine settings
{
@@ -1687,14 +1789,14 @@ int Interp::convert_ijk_distance_mode(int g_code, //!< g_code being executed
if (g_code == G_90_1) {
if (settings->ijk_distance_mode != MODE_ABSOLUTE) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: IJK distance mode changed to absolute");
+ enqueue_COMMENT("interpreter: IJK distance mode changed to absolute");
#endif
settings->ijk_distance_mode = MODE_ABSOLUTE;
}
} else if (g_code == G_91_1) {
if (settings->ijk_distance_mode != MODE_INCREMENTAL) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: IJK distance mode changed to incremental");
+ enqueue_COMMENT("interpreter: IJK distance mode changed to incremental");
#endif
settings->ijk_distance_mode = MODE_INCREMENTAL;
}
@@ -1716,9 +1818,9 @@ Called by: convert_g.
*/
-int Interp::convert_dwell(double time) //!< time in seconds to dwell */
+int Interp::convert_dwell(setup_pointer settings, double time) //!< time in seconds to dwell */
{
- DWELL(time);
+ enqueue_DWELL(time);
return INTERP_OK;
}
@@ -1750,24 +1852,24 @@ int Interp::convert_feed_mode(int g_code, //!< g_code being executed (mus
static char name[] = "convert_feed_mode";
if (g_code == G_93) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: feed mode set to inverse time");
+ enqueue_COMMENT("interpreter: feed mode set to inverse time");
#endif
settings->feed_mode = INVERSE_TIME;
- SET_FEED_MODE(0);
+ enqueue_SET_FEED_MODE(0);
} else if (g_code == G_94) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: feed mode set to units per minute");
+ enqueue_COMMENT("interpreter: feed mode set to units per minute");
#endif
settings->feed_mode = UNITS_PER_MINUTE;
- SET_FEED_MODE(0);
- SET_FEED_RATE(0);
+ enqueue_SET_FEED_MODE(0);
+ enqueue_SET_FEED_RATE(0);
} else if(g_code == G_95) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: feed mode set to units per revolution");
+ enqueue_COMMENT("interpreter: feed mode set to units per revolution");
#endif
settings->feed_mode = UNITS_PER_REVOLUTION;
- SET_FEED_MODE(1);
- SET_FEED_RATE(0);
+ enqueue_SET_FEED_MODE(1);
+ enqueue_SET_FEED_RATE(0);
} else
ERS("BUG: Code not G93, G94, or G95");
return INTERP_OK;
@@ -1793,8 +1895,8 @@ This is called only if the feed mode is UNITS_PER_MINUTE or UNITS_PER_REVOLUTION
int Interp::convert_feed_rate(block_pointer block, //!< pointer to a block of RS274 instructions
setup_pointer settings) //!< pointer to machine settings
{
- SET_FEED_RATE(block->f_number);
settings->feed_rate = block->f_number;
+ enqueue_SET_FEED_RATE(block->f_number);
return INTERP_OK;
}
@@ -1862,7 +1964,7 @@ int Interp::convert_g(block_pointer block, //!< pointer to a block of RS27
int status;
if (block->g_modes[0] == G_4) {
- CHP(convert_dwell(block->p_number));
+ CHP(convert_dwell(settings, block->p_number));
}
if (block->g_modes[2] != -1) {
CHP(convert_set_plane(block->g_modes[2], settings));
@@ -1900,7 +2002,6 @@ int Interp::convert_g(block_pointer block, //!< pointer to a block of RS27
return INTERP_OK;
}
-
int Interp::convert_savehome(int code, block_pointer block, setup_pointer s) {
static char name[] = "convert_savehome";
double *p = s->parameters;
@@ -2002,7 +2103,7 @@ int Interp::convert_home(int move, //!< G code, must be G_28 or G_30
// waypoint is in currently active coordinate system
- STRAIGHT_TRAVERSE(end_x, end_y, end_z,
+ STRAIGHT_TRAVERSE(block->line_number, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end);
@@ -2065,7 +2166,7 @@ int Interp::convert_home(int move, //!< G code, must be G_28 or G_30
w_end = w_end_home;
}
- STRAIGHT_TRAVERSE(end_x, end_y, end_z,
+ STRAIGHT_TRAVERSE(block->line_number, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end);
settings->current_x = end_x;
@@ -2233,13 +2334,21 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
M68 reads an analog input*/
if (block->m_modes[5] == 62) {
- SET_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot set motion output with cutter radius compensation on"))); // XXX
+ SET_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
} else if (block->m_modes[5] == 63) {
- CLEAR_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot set motion output with cutter radius compensation on"))); // XXX
+ CLEAR_MOTION_OUTPUT_BIT(round_to_int(block->p_number));
} else if (block->m_modes[5] == 64) {
- SET_AUX_OUTPUT_BIT(round_to_int(block->p_number));
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot set auxiliary output with cutter radius compensation on"))); // XXX
+ SET_AUX_OUTPUT_BIT(round_to_int(block->p_number));
} else if (block->m_modes[5] == 65) {
- CLEAR_AUX_OUTPUT_BIT(round_to_int(block->p_number));
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot set auxiliary output with cutter radius compensation on"))); // XXX
+ CLEAR_AUX_OUTPUT_BIT(round_to_int(block->p_number));
} else if (block->m_modes[5] == 66) {
//P-word = digital channel
//E-word = analog channel
@@ -2281,6 +2390,9 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
timeout = 0;
}
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot wait for digital input with cutter radius compensation on"))); // XXX
+
ret = WAIT(round_to_int(block->p_number), DIGITAL_INPUT, type, timeout);
//WAIT returns 0 on success, -1 for out of bounds
CHK((ret == -1), NCE_DIGITAL_INPUT_INVALID_ON_M66);
@@ -2290,6 +2402,9 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
settings->input_digital = ON;
}
} else if (round_to_int(block->e_number) >= 0) { // got an analog input
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot wait for analog input with cutter radius compensation on"))); // XXX
+
ret = WAIT(round_to_int(block->e_number), ANALOG_INPUT, 0, 0); //WAIT returns 0 on success, -1 for out of bounds
CHK((ret == -1), NCE_ANALOG_INPUT_INVALID_ON_M66);
if (ret == 0) {
@@ -2329,27 +2444,27 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
}
if (block->m_modes[7] == 3) {
- START_SPINDLE_CLOCKWISE();
- settings->spindle_turning = CANON_CLOCKWISE;
+ enqueue_START_SPINDLE_CLOCKWISE();
+ settings->spindle_turning = CANON_CLOCKWISE;
} else if (block->m_modes[7] == 4) {
- START_SPINDLE_COUNTERCLOCKWISE();
- settings->spindle_turning = CANON_COUNTERCLOCKWISE;
+ enqueue_START_SPINDLE_COUNTERCLOCKWISE();
+ settings->spindle_turning = CANON_COUNTERCLOCKWISE;
} else if (block->m_modes[7] == 5) {
- STOP_SPINDLE_TURNING();
- settings->spindle_turning = CANON_STOPPED;
+ enqueue_STOP_SPINDLE_TURNING();
+ settings->spindle_turning = CANON_STOPPED;
}
if (block->m_modes[8] == 7) {
- MIST_ON();
- settings->mist = ON;
+ enqueue_MIST_ON();
+ settings->mist = ON;
} else if (block->m_modes[8] == 8) {
- FLOOD_ON();
- settings->flood = ON;
+ enqueue_FLOOD_ON();
+ settings->flood = ON;
} else if (block->m_modes[8] == 9) {
- MIST_OFF();
- settings->mist = OFF;
- FLOOD_OFF();
- settings->flood = OFF;
+ enqueue_MIST_OFF();
+ settings->mist = OFF;
+ enqueue_FLOOD_OFF();
+ settings->flood = OFF;
}
/* No axis clamps in this version
@@ -2370,11 +2485,15 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
*/
if (block->m_modes[9] == 48) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot enable overrides with cutter radius compensation on"))); // XXX
ENABLE_FEED_OVERRIDE();
ENABLE_SPEED_OVERRIDE();
settings->feed_override = ON;
settings->speed_override = ON;
} else if (block->m_modes[9] == 49) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot disable overrides with cutter radius compensation on"))); // XXX
DISABLE_FEED_OVERRIDE();
DISABLE_SPEED_OVERRIDE();
settings->feed_override = OFF;
@@ -2383,19 +2502,27 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
if (block->m_modes[9] == 50) {
if (block->p_number != 0) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot enable overrides with cutter radius compensation on"))); // XXX
ENABLE_FEED_OVERRIDE();
settings->feed_override = ON;
} else {
- DISABLE_FEED_OVERRIDE();
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot disable overrides with cutter radius compensation on"))); // XXX
+ DISABLE_FEED_OVERRIDE();
settings->feed_override = OFF;
}
}
if (block->m_modes[9] == 51) {
if (block->p_number != 0) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot enable overrides with cutter radius compensation on"))); // XXX
ENABLE_SPEED_OVERRIDE();
settings->speed_override = ON;
} else {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot disable overrides with cutter radius compensation on"))); // XXX
DISABLE_SPEED_OVERRIDE();
settings->speed_override = OFF;
}
@@ -2403,9 +2530,13 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
if (block->m_modes[9] == 52) {
if (block->p_number != 0) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot enable overrides with cutter radius compensation on"))); // XXX
ENABLE_ADAPTIVE_FEED();
settings->adaptive_feed = ON;
} else {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot disable overrides with cutter radius compensation on"))); // XXX
DISABLE_ADAPTIVE_FEED();
settings->adaptive_feed = OFF;
}
@@ -2413,9 +2544,13 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
if (block->m_modes[9] == 53) {
if (block->p_number != 0) {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot enable overrides with cutter radius compensation on"))); // XXX
ENABLE_FEED_HOLD();
settings->feed_hold = ON;
} else {
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot disable overrides with cutter radius compensation on"))); // XXX
DISABLE_FEED_HOLD();
settings->feed_hold = OFF;
}
@@ -2424,6 +2559,8 @@ int Interp::convert_m(block_pointer block, //!< pointer to a block of RS27
/* user-defined M codes */
if (block->m_modes[10] != -1) {
int index = block->m_modes[10];
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot call user-defined M code with cutter radius compensation on"))); // XXX
if (USER_DEFINED_FUNCTION[index - 100] != 0) {
(*(USER_DEFINED_FUNCTION[index - 100])) (index - 100,
block->p_number,
@@ -2524,7 +2661,7 @@ int Interp::convert_motion(int motion, //!< g_code for a line, arc, canned cyc
CHP(convert_probe(block, motion, settings));
} else if (motion == G_80) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: motion mode set to none");
+ enqueue_COMMENT("interpreter: motion mode set to none");
#endif
settings->motion_mode = G_80;
} else if (motion == G_73 || ((motion > G_80) && (motion < G_90))) {
@@ -2618,7 +2755,7 @@ int Interp::convert_probe(block_pointer block, //!< pointer to a block of RS27
NCE_START_POINT_TOO_CLOSE_TO_PROBE_POINT);
TURN_PROBE_ON();
- STRAIGHT_PROBE(end_x, end_y, end_z,
+ STRAIGHT_PROBE(block->line_number, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end, probe_type);
@@ -2653,14 +2790,16 @@ int Interp::convert_retract_mode(int g_code, //!< g_code being executed (mus
setup_pointer settings) //!< pointer to machine settings
{
static char name[] = "convert_retract_mode";
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot change retract mode with cutter radius compensation on")));
if (g_code == G_98) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: retract mode set to old_z");
+ enqueue_COMMENT("interpreter: retract mode set to old_z");
#endif
settings->retract_mode = OLD_Z;
} else if (g_code == G_99) {
#ifdef DEBUG_EMC
- COMMENT("interpreter: retract mode set to r_plane");
+ enqueue_COMMENT("interpreter: retract mode set to r_plane");
#endif
settings->retract_mode = R_PLANE;
} else
@@ -2867,7 +3006,7 @@ int Interp::convert_setup(block_pointer block, //!< pointer to a block of RS27
}
#ifdef DEBUG_EMC
else
- COMMENT("interpreter: setting coordinate system origin");
+ enqueue_COMMENT("interpreter: setting coordinate system origin");
#endif
return INTERP_OK;
}
@@ -2946,7 +3085,7 @@ Called by: execute_block.
int Interp::convert_speed(block_pointer block, //!< pointer to a block of RS274 instructions
setup_pointer settings) //!< pointer to machine settings
{
- SET_SPINDLE_SPEED(block->s_number);
+ enqueue_SET_SPINDLE_SPEED(block->s_number);
settings->speed = block->s_number;
return INTERP_OK;
}
@@ -2954,12 +3093,12 @@ int Interp::convert_speed(block_pointer block, //!< pointer to a block of RS27
int Interp::convert_spindle_mode(block_pointer block, setup_pointer settings)
{
if(block->g_modes[14] == G_97) {
- SET_SPINDLE_MODE(0);
+ enqueue_SET_SPINDLE_MODE(0);
} else { /* G_96 */
if(block->d_flag)
- SET_SPINDLE_MODE(block->d_number_float);
+ enqueue_SET_SPINDLE_MODE(block->d_number_float);
else
- SET_SPINDLE_MODE(1e30);
+ enqueue_SET_SPINDLE_MODE(1e30);
}
return INTERP_OK;
}
@@ -3034,6 +3173,8 @@ int Interp::convert_stop(block_pointer block, //!< pointer to a block of RS27
char *line;
int length;
+ dequeue_canons();
+
if (block->m_modes[4] == 0) {
PROGRAM_STOP();
} else if (block->m_modes[4] == 60) {
@@ -3152,7 +3293,7 @@ int Interp::convert_stop(block_pointer block, //!< pointer to a block of RS27
line = _setup.linetext;
for (;;) { /* check for ending percent sign and comment if missing */
if (fgets(line, LINELEN, _setup.file_pointer) == NULL) {
- COMMENT("interpreter: percent sign missing from end of file");
+ enqueue_COMMENT("interpreter: percent sign missing from end of file");
break;
}
length = strlen(line);
@@ -3266,7 +3407,7 @@ int Interp::convert_straight(int move, //!< either G_0 or G_1
CHP(status);
}
} else if (move == G_0) {
- STRAIGHT_TRAVERSE(end_x, end_y, end_z,
+ STRAIGHT_TRAVERSE(block->line_number, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end);
settings->current_x = end_x;
@@ -3278,7 +3419,7 @@ int Interp::convert_straight(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(end_x, end_y, end_z,
+ STRAIGHT_FEED(block->line_number, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end);
settings->current_x = end_x;
@@ -3289,7 +3430,7 @@ int Interp::convert_straight(int move, //!< either G_0 or G_1
(settings->spindle_turning != CANON_COUNTERCLOCKWISE)),
"Spindle not turning in G33");
START_SPEED_FEED_SYNCH(block->k_number, 0);
- STRAIGHT_FEED(end_x, end_y, end_z, AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ STRAIGHT_FEED(block->line_number, end_x, end_y, end_z, AA_end, BB_end, CC_end, u_end, v_end, w_end);
STOP_SPEED_FEED_SYNCH();
settings->current_x = end_x;
settings->current_y = end_y;
@@ -3299,7 +3440,7 @@ int Interp::convert_straight(int move, //!< either G_0 or G_1
(settings->spindle_turning != CANON_COUNTERCLOCKWISE)),
"Spindle not turning in G33.1");
START_SPEED_FEED_SYNCH(block->k_number, 0);
- RIGID_TAP(end_x, end_y, end_z);
+ RIGID_TAP(block->line_number, end_x, end_y, end_z);
STOP_SPEED_FEED_SYNCH();
// after the RIGID_TAP cycle we'll be in the same spot
} else if (move == G_76) {
@@ -3326,46 +3467,46 @@ int Interp::convert_straight(int move, //!< either G_0 or G_1
// make one threading pass. only called from convert_threading_cycle.
static void
-threading_pass(setup_pointer settings,
+threading_pass(setup_pointer settings, block_pointer block,
int boring, double safe_x, double depth, double end_depth,
double start_y, double start_z, double zoff, double taper_dist,
int entry_taper, int exit_taper, double taper_pitch,
double pitch, double full_threadheight, double target_z) {
- STRAIGHT_TRAVERSE(boring?
+ STRAIGHT_TRAVERSE(block->line_number, boring?
safe_x + depth - end_depth:
safe_x - depth + end_depth,
start_y, start_z - zoff, AABBCC); //back
if(taper_dist && entry_taper) {
DISABLE_FEED_OVERRIDE();
START_SPEED_FEED_SYNCH(taper_pitch, 0);
- STRAIGHT_FEED(boring?
+ STRAIGHT_FEED(block->line_number, boring?
safe_x + depth - full_threadheight:
safe_x - depth + full_threadheight,
start_y, start_z - zoff, AABBCC); //in
- STRAIGHT_FEED(boring? safe_x + depth: safe_x - depth, //angled in
+ STRAIGHT_FEED(block->line_number, boring? safe_x + depth: safe_x - depth, //angled in
start_y, start_z - zoff - taper_dist, AABBCC);
START_SPEED_FEED_SYNCH(pitch, 0);
} else {
- STRAIGHT_TRAVERSE(boring? safe_x + depth: safe_x - depth,
+ STRAIGHT_TRAVERSE(block->line_number, boring? safe_x + depth: safe_x - depth,
start_y, start_z - zoff, AABBCC); //in
DISABLE_FEED_OVERRIDE();
START_SPEED_FEED_SYNCH(pitch, 0);
}
if(taper_dist && exit_taper) {
- STRAIGHT_FEED(boring? safe_x + depth: safe_x - depth, //over
+ STRAIGHT_FEED(block->line_number, boring? safe_x + depth: safe_x - depth, //over
start_y, target_z - zoff + taper_dist, AABBCC);
START_SPEED_FEED_SYNCH(taper_pitch, 0);
- STRAIGHT_FEED(boring?
+ STRAIGHT_FEED(block->line_number, boring?
safe_x + depth - full_threadheight:
safe_x - depth + full_threadheight,
start_y, target_z - zoff, AABBCC); //angled out
} else {
- STRAIGHT_FEED(boring? safe_x + depth: safe_x - depth,
+ STRAIGHT_FEED(block->line_number, boring? safe_x + depth: safe_x - depth,
start_y, target_z - zoff, AABBCC); //over
}
STOP_SPEED_FEED_SYNCH();
- STRAIGHT_TRAVERSE(boring?
+ STRAIGHT_TRAVERSE(block->line_number, boring?
safe_x + depth - end_depth:
safe_x - depth + end_depth,
start_y, target_z - zoff, AABBCC); //out
@@ -3375,6 +3516,12 @@ threading_pass(setup_pointer settings,
int Interp::convert_threading_cycle(block_pointer block,
setup_pointer settings,
double end_x, double end_y, double end_z) {
+
+ static char name[] = "convert_threading_cycle";
+
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot use G76 threading cycle with cutter radius compensation on")));
+
double start_x = settings->current_x;
double start_y = settings->current_y;
double start_z = settings->current_z;
@@ -3423,7 +3570,7 @@ int Interp::convert_threading_cycle(block_pointer block,
depth = start_depth;
zoff = (depth - full_dia_depth) * tan(compound_angle);
while (depth < end_depth) {
- threading_pass(settings, boring, safe_x, depth, end_depth, start_y,
+ threading_pass(settings, block, boring, safe_x, depth, end_depth, start_y,
start_z, zoff, taper_dist, entry_taper, exit_taper,
taper_pitch, pitch, full_threadheight, target_z);
depth = full_dia_depth + cut_increment * pow(++pass, 1.0/degression);
@@ -3434,11 +3581,11 @@ int Interp::convert_threading_cycle(block_pointer block,
zoff = (depth - full_dia_depth) * tan(compound_angle);
// cut at least once -- more if spring cuts.
for(int i = 0; i<spring_cuts+1; i++) {
- threading_pass(settings, boring, safe_x, depth, end_depth, start_y,
+ threading_pass(settings, block, boring, safe_x, depth, end_depth, start_y,
start_z, zoff, taper_dist, entry_taper, exit_taper,
taper_pitch, pitch, full_threadheight, target_z);
}
- STRAIGHT_TRAVERSE(end_x, end_y, end_z, AABBCC);
+ STRAIGHT_TRAVERSE(block->line_number, end_x, end_y, end_z, AABBCC);
settings->current_x = end_x;
settings->current_y = end_y;
settings->current_z = end_z;
@@ -3534,11 +3681,11 @@ int Interp::convert_straight_comp1(int move, //!< either G_0 or G_1
if (move == G_0) {
if(settings->plane == CANON_PLANE_XZ) {
- STRAIGHT_TRAVERSE(xtrans(settings, c[0]), p[2], ztrans(settings, c[1]),
+ enqueue_STRAIGHT_TRAVERSE(block->line_number, xtrans(settings, c[0]), p[2], ztrans(settings, c[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
} else if(settings->plane == CANON_PLANE_XY) {
- STRAIGHT_TRAVERSE(c[0], c[1], p[2],
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ enqueue_STRAIGHT_TRAVERSE(block->line_number, c[0], c[1], p[2],
+ AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
}
else if (move == G_1) {
@@ -3548,16 +3695,16 @@ int Interp::convert_straight_comp1(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(xtrans(settings, c[0]), p[2], ztrans(settings, c[1]),
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ enqueue_STRAIGHT_FEED(block->line_number, xtrans(settings, c[0]), p[2], ztrans(settings, c[1]),
+ AA_end, BB_end, CC_end, u_end, v_end, w_end);
} else if(settings->plane == CANON_PLANE_XY) {
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_straight(c[0], c[1], p[2],
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(c[0], c[1], p[2],
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ enqueue_STRAIGHT_FEED(block->line_number, c[0], c[1], p[2],
+ AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
} else
ERM(NCE_BUG_CODE_NOT_G0_OR_G1);
@@ -3580,7 +3727,6 @@ int Interp::convert_straight_comp1(int move, //!< either G_0 or G_1
}
return INTERP_OK;
}
-
/****************************************************************************/
/*! convert_straight_comp2
@@ -3677,6 +3823,7 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
double theta;
double p[3]; /* programmed endpoint */
double c[2]; /* current */
+ int concave;
if(settings->plane == CANON_PLANE_XZ) {
p[0] = px;
@@ -3704,11 +3851,11 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
if ((p[1] == start[1]) && (p[0] == start[0])) { /* no XY motion */
if (move == G_0) {
if(settings->plane == CANON_PLANE_XZ) {
- STRAIGHT_TRAVERSE(xtrans(settings, end[0]), py, ztrans(settings, end[1]),
+ (qc().empty()? STRAIGHT_TRAVERSE: enqueue_STRAIGHT_TRAVERSE)(block->line_number, xtrans(settings, end[0]), py, ztrans(settings, end[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
} else if(settings->plane == CANON_PLANE_XY) {
- STRAIGHT_TRAVERSE(end[0], end[1], pz,
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ (qc().empty()? STRAIGHT_TRAVERSE: enqueue_STRAIGHT_TRAVERSE)(block->line_number, end[0], end[1], pz,
+ AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
} else if (move == G_1) {
if(settings->plane == CANON_PLANE_XZ) {
@@ -3717,16 +3864,16 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(xtrans(settings, end[0]), py, ztrans(settings, end[1]),
+ (qc().empty()? STRAIGHT_FEED: enqueue_STRAIGHT_FEED)(block->line_number, xtrans(settings, end[0]), py, ztrans(settings, end[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
} else if(settings->plane == CANON_PLANE_XY) {
- if (settings->feed_mode == INVERSE_TIME)
- inverse_time_rate_straight(end[0], end[1], pz,
- AA_end, BB_end, CC_end,
- u_end, v_end, w_end,
- block, settings);
- STRAIGHT_FEED(end[0], end[1], pz,
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ if (settings->feed_mode == INVERSE_TIME) // XXX
+ inverse_time_rate_straight(end[0], end[1], pz,
+ AA_end, BB_end, CC_end,
+ u_end, v_end, w_end,
+ block, settings);
+ (qc().empty()? STRAIGHT_FEED: enqueue_STRAIGHT_FEED)(block->line_number, end[0], end[1], pz,
+ AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
} else
ERM(NCE_BUG_CODE_NOT_G0_OR_G1);
@@ -3753,21 +3900,45 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
end[1] = (p[1] + (radius * sin(alpha + gamma)));
mid[0] = (start[0] + (radius * cos(alpha + gamma)));
mid[1] = (start[1] + (radius * sin(alpha + gamma)));
+
+ if(0) printf("alpha %g beta %g gamma %g ", R2D(alpha), R2D(beta), R2D(gamma));
+
+ if ((beta < -small) || (beta > (M_PIl + small))) {
+ if(0) printf("concave yes\n");
+ concave = 1;
+ } else if (beta > (M_PIl - small) &&
+ (!qc().empty() && qc().front().type == QARC_FEED &&
+ ((side == RIGHT && qc().front().data.arc_feed.turn == 1) ||
+ (side == LEFT && qc().front().data.arc_feed.turn == -1)))) {
+ // this is an "h" shape, tool on right, going right to left
+ // over the hemispherical round part, then up next to the
+ // vertical part (or, the mirror case). there are two ways
+ // to stay to the "right", either loop down and around, or
+ // stay above and right. we're forcing above and right.
+ if(0) printf("concave special case\n");
+ concave = 1;
+ } else {
+ if(0) printf("concave no\n");
+ concave = 0;
+ mid[0] = (start[0] + (radius * cos(alpha + gamma)));
+ mid[1] = (start[1] + (radius * sin(alpha + gamma)));
+ }
+
- CHK(((beta < -small) || (beta > (M_PIl + small))),
- NCE_CONCAVE_CORNER_WITH_CUTTER_RADIUS_COMP);
if (move == G_0) {
+ dequeue_canons();
if(settings->plane == CANON_PLANE_XZ) {
- STRAIGHT_TRAVERSE(xtrans(settings, end[0]), py, ztrans(settings, end[1]),
+ STRAIGHT_TRAVERSE(block->line_number, xtrans(settings, end[0]), py, ztrans(settings, end[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
- else if(settings->plane == CANON_PLANE_XY) {
- STRAIGHT_TRAVERSE(end[0], end[1], pz,
+ else if(settings->plane == CANON_PLANE_XY) { // XXX ?
+ STRAIGHT_TRAVERSE(block->line_number, end[0], end[1], pz,
AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
}
else if (move == G_1) {
- if (beta > small) { /* ARC NEEDED */
+ if (!concave && (beta > small)) { /* ARC NEEDED */
+ dequeue_canons();
if(settings->plane == CANON_PLANE_XZ) {
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_as(start[0], start[1],
@@ -3776,10 +3947,10 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- ARC_FEED(ztrans(settings, mid[1]), xtrans(settings, mid[0]), ztrans(settings, start[1]), xtrans(settings, start[0]),
+ ARC_FEED(block->line_number, ztrans(settings, mid[1]), xtrans(settings, mid[0]), ztrans(settings, start[1]), xtrans(settings, start[0]),
((side == LEFT) ? 1 : -1), settings->current_y,
AA_end, BB_end, CC_end, u_end, v_end, w_end);
- STRAIGHT_FEED(xtrans(settings, end[0]), p[2], ztrans(settings, end[1]),
+ enqueue_STRAIGHT_FEED(block->line_number, xtrans(settings, end[0]), p[2], ztrans(settings, end[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
}
else if(settings->plane == CANON_PLANE_XY) {
@@ -3790,20 +3961,95 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- ARC_FEED(mid[0], mid[1], start[0], start[1],
+ ARC_FEED(block->line_number, mid[0], mid[1], start[0], start[1],
((side == LEFT) ? -1 : 1), settings->current_z,
AA_end, BB_end, CC_end, u_end, v_end, w_end);
- STRAIGHT_FEED(end[0], end[1], p[2],
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+
+ enqueue_STRAIGHT_FEED(block->line_number, end[0], end[1], p[2],
+ AA_end, BB_end, CC_end,
+ u_end, v_end, w_end);
}
} else {
+ if (concave) {
+ if (qc().front().type != QARC_FEED) {
+ // line->line
+
+ double retreat;
+ // half the angle of the inside corner
+ double halfcorner = (beta + M_PIl) / 2.0;
+ CHKF((halfcorner == 0.0), (_("Zero degree inside corner is invalid for cutter compensation")));
+ retreat = radius / tan(halfcorner);
+ // move back along the compensated path
+ // this should replace the endpoint of the previous move
+ mid[0] = c[0] + retreat * cos(theta + gamma);
+ mid[1] = c[1] + retreat * sin(theta + gamma);
+ // we actually want to move the previous line's endpoint here. That's the same as
+ // discarding that line and doing this one instead.
+ update_endpoint(mid[0], mid[1]);
+ } else {
+ // arc->line
+ // beware: the arc we saved is the compensated one.
+ arc_feed prev = qc().front().data.arc_feed;
+ double oldrad = hypot(prev.center2 - prev.end2, prev.center1 - prev.end1);
+ double oldrad_uncomp;
+
+ // new line's direction
+ double base_dir = atan2(p[1] - start[1], p[0] - start[0]);
+ double theta = (prev.turn == 1) ? base_dir + M_PI_2l : base_dir - M_PI_2l;
+
+ double phi = atan2(prev.center2 - start[1], prev.center1 - start[0]);
+ double alpha = theta - phi;
+
+ if((prev.turn == 1 && side == LEFT) || (prev.turn == -1 && side == RIGHT)) {
+ // tool is inside the arc
+ oldrad_uncomp = oldrad + radius;
+ } else {
+ oldrad_uncomp = oldrad - radius;
+ }
+
+
+ // distance to old arc center perpendicular to the new line
+ double d = oldrad_uncomp * cos(alpha);
+ double d2;
+ if((prev.turn == 1 && side == LEFT) || (prev.turn == -1 && side == RIGHT)) {
+ d2 = d - radius;
+ } else {
+ d2 = d + radius;
+ }
+
+ double angle_from_center;
+
+ if((prev.turn == 1 && side == LEFT) || (prev.turn == -1 && side == RIGHT)) {
+ if(prev.turn == 1)
+ angle_from_center = - acos(d2/oldrad) + theta + M_PIl;
+ else
+ angle_from_center = acos(d2/oldrad) + theta + M_PIl;
+ } else {
+ if(prev.turn == 1)
+ angle_from_center = acos(d2/oldrad) + theta + M_PIl;
+ else
+ angle_from_center = - acos(d2/oldrad) + theta + M_PIl;
+ }
+
+ mid[0] = prev.center1 + oldrad * cos(angle_from_center);
+ mid[1] = prev.center2 + oldrad * sin(angle_from_center);
+
+ if(0) printf("c %g,%g d2 %g acos %g oldrad %g oldrad_uncomp %g base_dir %g theta %g phi %g alpha %g d %g d2 %g angle_from_center %g\n",
+ prev.center1, prev.center2, d2, R2D(acos(d2/oldrad)), oldrad,
+ oldrad_uncomp, R2D(base_dir), R2D(theta), R2D(phi), R2D(alpha),
+ d, d2, R2D(angle_from_center));
+
+ update_endpoint(mid[0], mid[1]);
+ }
+ }
+ dequeue_canons();
if(settings->plane == CANON_PLANE_XZ) {
if (settings->feed_mode == INVERSE_TIME)
inverse_time_rate_straight(end[0], p[2], end[1],
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(xtrans(settings, end[0]), p[2], ztrans(settings, end[1]),
+ enqueue_STRAIGHT_FEED(block->line_number, xtrans(settings, end[0]), p[2], ztrans(settings, end[1]),
AA_end, BB_end, CC_end, u_end, v_end, w_end);
} else if(settings->plane == CANON_PLANE_XY) {
if (settings->feed_mode == INVERSE_TIME)
@@ -3811,8 +4057,9 @@ int Interp::convert_straight_comp2(int move, //!< either G_0 or G_1
AA_end, BB_end, CC_end,
u_end, v_end, w_end,
block, settings);
- STRAIGHT_FEED(end[0], end[1], p[2],
- AA_end, BB_end, CC_end, u_end, v_end, w_end);
+ enqueue_STRAIGHT_FEED(block->line_number, end[0], end[1], p[2],
+ AA_end, BB_end, CC_end,
+ u_end, v_end, w_end);
}
}
} else
@@ -3886,6 +4133,9 @@ int Interp::convert_tool_change(setup_pointer settings) //!< pointer to machine
ERM(NCE_TXX_MISSING_FOR_M6);
}
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot change tools with cutter radius compensation on")));
+
if (!settings->tool_change_with_spindle_on) {
STOP_SPINDLE_TURNING();
settings->spindle_turning = CANON_STOPPED;
@@ -3899,9 +4149,11 @@ int Interp::convert_tool_change(setup_pointer settings) //!< pointer to machine
&discard, &discard, &discard,
&discard, &discard, &discard,
settings);
- STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, up_z,
+ COMMENT("AXIS,hide");
+ STRAIGHT_TRAVERSE(0, settings->current_x, settings->current_y, up_z,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, settings->w_current);
+ COMMENT("AXIS,show");
settings->current_z = up_z;
}
@@ -3929,7 +4181,7 @@ int Interp::convert_tool_change(setup_pointer settings) //!< pointer to machine
&AA_end, &BB_end, &CC_end,
&u_end, &v_end, &w_end, settings);
COMMENT("AXIS,hide");
- STRAIGHT_TRAVERSE(end_x, end_y, end_z,
+ STRAIGHT_TRAVERSE(0, end_x, end_y, end_z,
AA_end, BB_end, CC_end,
u_end, v_end, w_end);
COMMENT("AXIS,show");
@@ -3991,6 +4243,8 @@ int Interp::convert_tool_length_offset(int g_code, //!< g_code being execu
int index;
double xoffset, zoffset, woffset;
+ CHKS((settings->cutter_comp_side != OFF),
+ (_("Cannot change tool offset with cutter radius compensation on")));
if (g_code == G_49) {
xoffset = 0.;
zoffset = 0.;
@@ -4072,6 +4326,8 @@ A zero t_number is allowed and means no tool should be selected.
*/
+// OK to select tool in a concave corner, I think?
+
int Interp::convert_tool_select(block_pointer block, //!< pointer to a block of RS274 instructions
setup_pointer settings) //!< pointer to machine settings
{
diff --git a/src/emc/rs274ngc/interp_cycles.cc b/src/emc/rs274ngc/interp_cycles.cc
index 7b404c080..dd5b0b510 100644
--- a/src/emc/rs274ngc/interp_cycles.cc
+++ b/src/emc/rs274ngc/interp_cycles.cc
@@ -49,14 +49,15 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g81(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z) //!< value of z at bottom of cycle
+int Interp::convert_cycle_g81(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z) //!< value of z at bottom of cycle
{
- cycle_feed(plane, x, y, bottom_z);
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -86,16 +87,17 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g82(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- double dwell) //!< dwell time
+int Interp::convert_cycle_g82(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ double dwell) //!< dwell time
{
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
DWELL(dwell);
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -132,13 +134,14 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g83(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double r, //!< initial z-value
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- double delta) //!< size of z-axis feed increment
+int Interp::convert_cycle_g83(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double r, //!< initial z-value
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ double delta) //!< size of z-axis feed increment
{
static char name[] = "convert_cycle_g83";
double current_depth;
@@ -155,12 +158,12 @@ int Interp::convert_cycle_g83(CANON_PLANE plane, //!< selected plane
for (current_depth = (r - delta);
current_depth > bottom_z; current_depth = (current_depth - delta)) {
- cycle_feed(plane, x, y, current_depth);
- cycle_traverse(plane, x, y, clear_z);
- cycle_traverse(plane, x, y, current_depth + rapid_delta);
+ cycle_feed(block, plane, x, y, current_depth);
+ cycle_feed(block, plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, current_depth + rapid_delta);
}
- cycle_feed(plane, x, y, bottom_z);
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -196,13 +199,14 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g73(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double r, //!< initial z-value
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- double delta) //!< size of z-axis feed increment
+int Interp::convert_cycle_g73(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double r, //!< initial z-value
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ double delta) //!< size of z-axis feed increment
{
static char name[] = "convert_cycle_g73";
double current_depth;
@@ -219,11 +223,11 @@ int Interp::convert_cycle_g73(CANON_PLANE plane, //!< selected plane
for (current_depth = (r - delta);
current_depth > bottom_z; current_depth = (current_depth - delta)) {
- cycle_feed(plane, x, y, current_depth);
- cycle_traverse(plane, x, y, current_depth + rapid_delta);
+ cycle_feed(block, plane, x, y, current_depth);
+ cycle_feed(block, plane, x, y, current_depth + rapid_delta);
}
- cycle_feed(plane, x, y, bottom_z);
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -262,13 +266,14 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g84(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- CANON_DIRECTION direction, //!< direction spindle turning at outset
- CANON_SPEED_FEED_MODE mode) //!< the speed-feed mode at outset
+int Interp::convert_cycle_g84(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ CANON_DIRECTION direction, //!< direction spindle turning at outset
+ CANON_SPEED_FEED_MODE mode) //!< the speed-feed mode at outset
{
static char name[] = "convert_cycle_g84";
@@ -276,10 +281,10 @@ int Interp::convert_cycle_g84(CANON_PLANE plane, //!< selected plane
NCE_SPINDLE_NOT_TURNING_CLOCKWISE_IN_G84);
#if 0
START_SPEED_FEED_SYNCH();
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
STOP_SPINDLE_TURNING();
START_SPINDLE_COUNTERCLOCKWISE();
- cycle_feed(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, clear_z);
if (mode != CANON_SYNCHED)
STOP_SPEED_FEED_SYNCH();
STOP_SPINDLE_TURNING();
@@ -314,14 +319,15 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g85(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z) //!< value of z at bottom of cycle
+int Interp::convert_cycle_g85(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z) //!< value of z at bottom of cycle
{
- cycle_feed(plane, x, y, bottom_z);
- cycle_feed(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -357,13 +363,14 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g86(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- double dwell, //!< dwell time
- CANON_DIRECTION direction) //!< direction spindle turning at outset
+int Interp::convert_cycle_g86(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ double dwell, //!< dwell time
+ CANON_DIRECTION direction) //!< direction spindle turning at outset
{
static char name[] = "convert_cycle_g86";
@@ -371,10 +378,10 @@ int Interp::convert_cycle_g86(CANON_PLANE plane, //!< selected plane
(direction != CANON_COUNTERCLOCKWISE)),
NCE_SPINDLE_NOT_TURNING_IN_G86);
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
DWELL(dwell);
STOP_SPINDLE_TURNING();
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, clear_z);
if (direction == CANON_CLOCKWISE)
START_SPINDLE_CLOCKWISE();
else
@@ -442,16 +449,17 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g87(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double offset_x, //!< x-axis offset position
- double y, //!< y-value where cycle is executed
- double offset_y, //!< y-axis offset position
- double r, //!< z_value of r_plane
- double clear_z, //!< z-value of clearance plane
- double middle_z, //!< z-value of top of back bore
- double bottom_z, //!< value of z at bottom of cycle
- CANON_DIRECTION direction) //!< direction spindle turning at outset
+int Interp::convert_cycle_g87(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double offset_x, //!< x-axis offset position
+ double y, //!< y-value where cycle is executed
+ double offset_y, //!< y-axis offset position
+ double r, //!< z_value of r_plane
+ double clear_z, //!< z-value of clearance plane
+ double middle_z, //!< z-value of top of back bore
+ double bottom_z, //!< value of z at bottom of cycle
+ CANON_DIRECTION direction) //!< direction spindle turning at outset
{
static char name[] = "convert_cycle_g87";
@@ -459,22 +467,22 @@ int Interp::convert_cycle_g87(CANON_PLANE plane, //!< selected plane
(direction != CANON_COUNTERCLOCKWISE)),
NCE_SPINDLE_NOT_TURNING_IN_G87);
- cycle_traverse(plane, offset_x, offset_y, r);
+ cycle_feed(block, plane, offset_x, offset_y, r);
STOP_SPINDLE_TURNING();
ORIENT_SPINDLE(0.0, direction);
- cycle_traverse(plane, offset_x, offset_y, bottom_z);
- cycle_traverse(plane, x, y, bottom_z);
+ cycle_feed(block, plane, offset_x, offset_y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
if (direction == CANON_CLOCKWISE)
START_SPINDLE_CLOCKWISE();
else
START_SPINDLE_COUNTERCLOCKWISE();
- cycle_feed(plane, x, y, middle_z);
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, middle_z);
+ cycle_feed(block, plane, x, y, bottom_z);
STOP_SPINDLE_TURNING();
ORIENT_SPINDLE(0.0, direction);
- cycle_traverse(plane, offset_x, offset_y, bottom_z);
- cycle_traverse(plane, offset_x, offset_y, clear_z);
- cycle_traverse(plane, x, y, clear_z);
+ cycle_feed(block, plane, offset_x, offset_y, bottom_z);
+ cycle_feed(block, plane, offset_x, offset_y, clear_z);
+ cycle_feed(block, plane, x, y, clear_z);
if (direction == CANON_CLOCKWISE)
START_SPINDLE_CLOCKWISE();
else
@@ -513,12 +521,13 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g88(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double bottom_z, //!< value of z at bottom of cycle
- double dwell, //!< dwell time
- CANON_DIRECTION direction) //!< direction spindle turning at outset
+int Interp::convert_cycle_g88(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double bottom_z, //!< value of z at bottom of cycle
+ double dwell, //!< dwell time
+ CANON_DIRECTION direction) //!< direction spindle turning at outset
{
static char name[] = "convert_cycle_g88";
@@ -526,7 +535,7 @@ int Interp::convert_cycle_g88(CANON_PLANE plane, //!< selected plane
(direction != CANON_COUNTERCLOCKWISE)),
NCE_SPINDLE_NOT_TURNING_IN_G88);
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
DWELL(dwell);
STOP_SPINDLE_TURNING();
PROGRAM_STOP(); /* operator retracts the spindle here */
@@ -562,16 +571,17 @@ For the XZ and YZ planes, this makes analogous motions.
*/
-int Interp::convert_cycle_g89(CANON_PLANE plane, //!< selected plane
- double x, //!< x-value where cycle is executed
- double y, //!< y-value where cycle is executed
- double clear_z, //!< z-value of clearance plane
- double bottom_z, //!< value of z at bottom of cycle
- double dwell) //!< dwell time
+int Interp::convert_cycle_g89(block_pointer block,
+ CANON_PLANE plane, //!< selected plane
+ double x, //!< x-value where cycle is executed
+ double y, //!< y-value where cycle is executed
+ double clear_z, //!< z-value of clearance plane
+ double bottom_z, //!< value of z at bottom of cycle
+ double dwell) //!< dwell time
{
- cycle_feed(plane, x, y, bottom_z);
+ cycle_feed(block, plane, x, y, bottom_z);
DWELL(dwell);
- cycle_feed(plane, x, y, clear_z);
+ cycle_feed(block, plane, x, y, clear_z);
return INTERP_OK;
}
@@ -804,7 +814,7 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_Z_IN_CYCLE_IN_XY_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, r,
+ STRAIGHT_TRAVERSE(block->line_number, settings->current_x, settings->current_y, r,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, settings->w_current);
old_cc = r;
@@ -818,14 +828,14 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_XY, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_XY, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_XY, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_XY, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -834,7 +844,7 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_XY, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_XY, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -843,23 +853,23 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_XY, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_XY, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_XY, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_XY, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_XY, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_XY, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_XY, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_XY, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -879,7 +889,7 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
k = (cc + k); /* k always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_XY, aa, (aa + i), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_XY, aa, (aa + i), bb,
(bb + j), r, clear_cc, k, cc,
settings->spindle_turning)) break;
case G_88:
@@ -887,7 +897,7 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_XY, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_XY, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -897,7 +907,7 @@ int Interp::convert_cycle_xy(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_XY, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_XY, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -965,7 +975,7 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_W_IN_CYCLE_IN_UV_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, settings->current_z,
+ STRAIGHT_TRAVERSE(block->line_number, settings->current_x, settings->current_y, settings->current_z,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, r);
old_cc = r;
@@ -979,14 +989,14 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_UV, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_UV, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_UV, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_UV, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -995,7 +1005,7 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_UV, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_UV, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -1004,23 +1014,23 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_UV, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_UV, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_UV, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_UV, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_UV, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_UV, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_UV, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_UV, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1040,7 +1050,7 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
k = (cc + k); /* k always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_UV, aa, (aa + i), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_UV, aa, (aa + i), bb,
(bb + j), r, clear_cc, k, cc,
settings->spindle_turning)) break;
case G_88:
@@ -1048,7 +1058,7 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_UV, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_UV, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1058,7 +1068,7 @@ int Interp::convert_cycle_uv(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_UV, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_UV, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1175,7 +1185,7 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_X_IN_CYCLE_IN_YZ_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(r, settings->current_y, settings->current_z,
+ STRAIGHT_TRAVERSE(block->line_number, r, settings->current_y, settings->current_z,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, settings->w_current);
old_cc = r;
@@ -1189,14 +1199,14 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_YZ, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_YZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1205,7 +1215,7 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_YZ, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_YZ, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -1214,23 +1224,23 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_YZ, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_YZ, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_YZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_YZ, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_YZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1250,7 +1260,7 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
i = (cc + i); /* i always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_YZ, aa, (aa + j), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_YZ, aa, (aa + j), bb,
(bb + k), r, clear_cc, i, cc,
settings->spindle_turning)) break;
case G_88:
@@ -1258,7 +1268,7 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_YZ, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_YZ, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1268,7 +1278,7 @@ int Interp::convert_cycle_yz(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_YZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_YZ, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1337,7 +1347,7 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_U_IN_CYCLE_IN_VW_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, settings->current_z,
+ STRAIGHT_TRAVERSE(block->line_number, settings->current_x, settings->current_y, settings->current_z,
settings->AA_current, settings->BB_current, settings->CC_current,
r, settings->v_current, settings->w_current);
old_cc = r;
@@ -1351,14 +1361,14 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_VW, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_VW, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_VW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_VW, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1367,7 +1377,7 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_VW, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_VW, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -1376,23 +1386,23 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_VW, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_VW, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_VW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_VW, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_VW, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_VW, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_VW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_VW, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1412,7 +1422,7 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
i = (cc + i); /* i always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_VW, aa, (aa + j), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_VW, aa, (aa + j), bb,
(bb + k), r, clear_cc, i, cc,
settings->spindle_turning)) break;
case G_88:
@@ -1420,7 +1430,7 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_VW, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_VW, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1430,7 +1440,7 @@ int Interp::convert_cycle_vw(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_VW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_VW, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1556,7 +1566,7 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_Y_IN_CYCLE_IN_XZ_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(settings->current_x, r, settings->current_z,
+ STRAIGHT_TRAVERSE(block->line_number, settings->current_x, r, settings->current_z,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, settings->v_current, settings->w_current);
old_cc = r;
@@ -1570,14 +1580,14 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_XZ, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_XZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1586,7 +1596,7 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_XZ, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_XZ, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -1595,23 +1605,23 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_XZ, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_XZ, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_XZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_XZ, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_XZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1631,7 +1641,7 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
j = (cc + j); /* j always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_XZ, aa, (aa + k), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_XZ, aa, (aa + k), bb,
(bb + i), r, clear_cc, j, cc,
settings->spindle_turning)) break;
case G_88:
@@ -1639,7 +1649,7 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_XZ, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_XZ, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1649,7 +1659,7 @@ int Interp::convert_cycle_zx(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_XZ, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_XZ, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1717,7 +1727,7 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
CHK((r < cc), NCE_R_LESS_THAN_V_IN_CYCLE_IN_UW_PLANE);
if (old_cc < r) {
- STRAIGHT_TRAVERSE(settings->current_x, settings->current_y, settings->current_z,
+ STRAIGHT_TRAVERSE(block->line_number, settings->current_x, settings->current_y, settings->current_z,
settings->AA_current, settings->BB_current, settings->CC_current,
settings->u_current, r, settings->w_current);
old_cc = r;
@@ -1731,14 +1741,14 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
switch (motion) {
case G_81:
- CYCLE_MACRO(convert_cycle_g81(CANON_PLANE_UW, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g81(block, CANON_PLANE_UW, aa, bb, clear_cc, cc))
break;
case G_82:
CHK(((settings->motion_mode != G_82) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G82);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g82(CANON_PLANE_UW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g82(block, CANON_PLANE_UW, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1747,7 +1757,7 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G73);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g73(CANON_PLANE_UW, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g73(block, CANON_PLANE_UW, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
@@ -1756,23 +1766,23 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
NCE_Q_WORD_MISSING_WITH_G83);
block->q_number =
block->q_number == -1.0 ? settings->cycle_q : block->q_number;
- CYCLE_MACRO(convert_cycle_g83(CANON_PLANE_UW, aa, bb, r, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g83(block, CANON_PLANE_UW, aa, bb, r, clear_cc, cc,
block->q_number))
settings->cycle_q = block->q_number;
break;
case G_84:
- CYCLE_MACRO(convert_cycle_g84(CANON_PLANE_UW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g84(block, CANON_PLANE_UW, aa, bb, clear_cc, cc,
settings->spindle_turning,
settings->speed_feed_mode)) break;
case G_85:
- CYCLE_MACRO(convert_cycle_g85(CANON_PLANE_UW, aa, bb, clear_cc, cc))
+ CYCLE_MACRO(convert_cycle_g85(block, CANON_PLANE_UW, aa, bb, clear_cc, cc))
break;
case G_86:
CHK(((settings->motion_mode != G_86) && (block->p_number == -1.0)),
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G86);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g86(CANON_PLANE_UW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g86(block, CANON_PLANE_UW, aa, bb, clear_cc, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1792,7 +1802,7 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
if (settings->distance_mode == MODE_INCREMENTAL) {
j = (cc + j); /* j always absolute in function call below */
}
- CYCLE_MACRO(convert_cycle_g87(CANON_PLANE_UW, aa, (aa + k), bb,
+ CYCLE_MACRO(convert_cycle_g87(block, CANON_PLANE_UW, aa, (aa + k), bb,
(bb + i), r, clear_cc, j, cc,
settings->spindle_turning)) break;
case G_88:
@@ -1800,7 +1810,7 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G88);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g88(CANON_PLANE_UW, aa, bb, cc,
+ CYCLE_MACRO(convert_cycle_g88(block, CANON_PLANE_UW, aa, bb, cc,
block->p_number,
settings->spindle_turning)) settings->
cycle_p = block->p_number;
@@ -1810,7 +1820,7 @@ int Interp::convert_cycle_wu(int motion, //!< a g-code between G_81 and G_89, a
NCE_DWELL_TIME_P_WORD_MISSING_WITH_G89);
block->p_number =
block->p_number == -1.0 ? settings->cycle_p : block->p_number;
- CYCLE_MACRO(convert_cycle_g89(CANON_PLANE_UW, aa, bb, clear_cc, cc,
+ CYCLE_MACRO(convert_cycle_g89(block, CANON_PLANE_UW, aa, bb, clear_cc, cc,
block->p_number))
settings->cycle_p = block->p_number;
break;
@@ -1852,33 +1862,34 @@ respect to the given plane. No rotary axis motion takes place.
*/
-int Interp::cycle_feed(CANON_PLANE plane, //!< currently selected plane
- double end1, //!< first coordinate value
- double end2, //!< second coordinate value
- double end3) //!< third coordinate value
+int Interp::cycle_feed(block_pointer block,
+ CANON_PLANE plane, //!< currently selected plane
+ double end1, //!< first coordinate value
+ double end2, //!< second coordinate value
+ double end3) //!< third coordinate value
{
if (plane == CANON_PLANE_XY)
- STRAIGHT_FEED(end1, end2, end3,
+ STRAIGHT_FEED(block->line_number, end1, end2, end3,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_YZ)
- STRAIGHT_FEED(end3, end1, end2,
+ STRAIGHT_FEED(block->line_number, end3, end1, end2,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_XZ)
- STRAIGHT_FEED(end2, end3, end1,
+ STRAIGHT_FEED(block->line_number, end2, end3, end1,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_UV)
- STRAIGHT_FEED(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_FEED(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end1, end2, end3);
else if (plane == CANON_PLANE_VW)
- STRAIGHT_FEED(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_FEED(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end3, end1, end2);
else // (plane == CANON_PLANE_UW)
- STRAIGHT_FEED(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_FEED(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end2, end3, end1);
return INTERP_OK;
@@ -1909,34 +1920,35 @@ move with respect to the given plane. No rotary axis motion takes place.
*/
-int Interp::cycle_traverse(CANON_PLANE plane, //!< currently selected plane
- double end1, //!< first coordinate value
- double end2, //!< second coordinate value
- double end3) //!< third coordinate value
+int Interp::cycle_traverse(block_pointer block,
+ CANON_PLANE plane, //!< currently selected plane
+ double end1, //!< first coordinate value
+ double end2, //!< second coordinate value
+ double end3) //!< third coordinate value
{
if (plane == CANON_PLANE_XY)
- STRAIGHT_TRAVERSE(end1, end2, end3,
+ STRAIGHT_TRAVERSE(block->line_number, end1, end2, end3,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_YZ)
- STRAIGHT_TRAVERSE(end3, end1, end2,
+ STRAIGHT_TRAVERSE(block->line_number, end3, end1, end2,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_XZ)
- STRAIGHT_TRAVERSE(end2, end3, end1,
+ STRAIGHT_TRAVERSE(block->line_number, end2, end3, end1,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
_setup.u_current, _setup.v_current, _setup.w_current);
else if (plane == CANON_PLANE_UV)
- STRAIGHT_TRAVERSE(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_TRAVERSE(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end1, end2, end3);
else if (plane == CANON_PLANE_VW)
- STRAIGHT_TRAVERSE(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_TRAVERSE(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end3, end1, end2);
else // (plane == CANON_PLANE_UW)
- STRAIGHT_TRAVERSE(_setup.current_x, _setup.current_y, _setup.current_z,
+ STRAIGHT_TRAVERSE(block->line_number, _setup.current_x, _setup.current_y, _setup.current_z,
_setup.AA_current, _setup.BB_current, _setup.CC_current,
end2, end3, end1);
return INTERP_OK;
diff --git a/src/emc/rs274ngc/interp_execute.cc b/src/emc/rs274ngc/interp_execute.cc
index 348dba1d8..18d310147 100644
--- a/src/emc/rs274ngc/interp_execute.cc
+++ b/src/emc/rs274ngc/interp_execute.cc
@@ -239,6 +239,8 @@ int Interp::execute_block(block_pointer block, //!< pointer to a block of RS27
static char name[] = "execute_block";
int status;
+ block->line_number = settings->sequence_number;
+
if (block->comment[0] != 0) {
CHP(convert_comment(block->comment));
}
diff --git a/src/emc/rs274ngc/interp_internal.cc b/src/emc/rs274ngc/interp_internal.cc
index 7ea2f194d..55eb5a2bb 100644
--- a/src/emc/rs274ngc/interp_internal.cc
+++ b/src/emc/rs274ngc/interp_internal.cc
@@ -246,6 +246,7 @@ int Interp::init_block(block_pointer block) //!< pointer to a block to be i
block->l_number = -1;
block->l_flag = OFF;
block->line_number = -1;
+ block->n_number = -1;
block->motion_to_be = -1;
block->m_count = 0;
for (n = 0; n < 11; n++) {
diff --git a/src/emc/rs274ngc/interp_internal.hh b/src/emc/rs274ngc/interp_internal.hh
index fb2f4df15..32bd0c83c 100644
--- a/src/emc/rs274ngc/interp_internal.hh
+++ b/src/emc/rs274ngc/interp_internal.hh
@@ -252,6 +252,7 @@ typedef struct block_struct
int l_number;
ON_OFF l_flag;
int line_number;
+ int n_number;
int motion_to_be;
int m_count;
int m_modes[11];
@@ -563,9 +564,9 @@ macros totally crash-proof. If the function call stack is deeper than
{ \
aa = (aa + aa_increment); \
bb = (bb + bb_increment); \
- cycle_traverse(plane, aa, bb, old_cc); \
+ cycle_traverse(block, plane, aa, bb, old_cc); \
if (old_cc != r) \
- cycle_traverse(plane, aa, bb, r); \
+ cycle_traverse(block, plane, aa, bb, r); \
CHP(call); \
old_cc = clear_cc; \
}
diff --git a/src/emc/rs274ngc/interp_inverse.cc b/src/emc/rs274ngc/interp_inverse.cc
index aa9e3f3cb..ca73a63da 100644
--- a/src/emc/rs274ngc/interp_inverse.cc
+++ b/src/emc/rs274ngc/interp_inverse.cc
@@ -22,6 +22,7 @@
#include "rs274ngc.hh"
#include "interp_return.hh"
#include "interp_internal.hh"
+#include "interp_queue.hh"
/****************************************************************************/
@@ -59,7 +60,7 @@ int Interp::inverse_time_rate_arc(double x1, //!< x coord of start point of
length = find_arc_length(x1, y1, z1, cx, cy, turn, x2, y2, z2);
rate = MAX(0.1, (length * block->f_number));
- SET_FEED_RATE(rate);
+ enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;
return INTERP_OK;
@@ -114,7 +115,7 @@ int Interp::inverse_time_rate_arc2(double start_x, //!< x coord of last pr
cx, cy, turn2, end_x,
end_y, end_z));
rate = MAX(0.1, (length * block->f_number));
- SET_FEED_RATE(rate);
+ enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;
return INTERP_OK;
@@ -169,7 +170,7 @@ int Interp::inverse_time_rate_as(double start_x, //!< x coord of last program po
AA_end, BB_end, CC_end, u_end, v_end, w_end);
rate = MAX(0.1, (length * block->f_number));
- SET_FEED_RATE(rate);
+ enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;
return INTERP_OK;
@@ -214,7 +215,7 @@ int Interp::inverse_time_rate_straight(double end_x, //!< x coordinate of en
settings->u_current, settings->v_current, settings->w_current);
rate = MAX(0.1, (length * block->f_number));
- SET_FEED_RATE(rate);
+ enqueue_SET_FEED_RATE(rate);
settings->feed_rate = rate;
return INTERP_OK;
diff --git a/src/emc/rs274ngc/interp_queue.cc b/src/emc/rs274ngc/interp_queue.cc
new file mode 100644
index 000000000..3e4d492ce
--- /dev/null
+++ b/src/emc/rs274ngc/interp_queue.cc
@@ -0,0 +1,306 @@
+#include "rs274ngc.hh"
+#include "interp_queue.hh"
+
+std::vector<queued_canon>& qc(void) {
+ static std::vector<queued_canon> c;
+ if(0) printf("len %d\n", c.size());
+ return c;
+}
+
+void enqueue_SET_FEED_RATE(double feed) {
+ if(qc().empty()) {
+ SET_FEED_RATE(feed);
+ return;
+ }
+ queued_canon q;
+ q.type = QSET_FEED_RATE;
+ q.data.set_feed_rate.feed = feed;
+ qc().push_back(q);
+}
+
+void enqueue_DWELL(double time) {
+ if(qc().empty()) {
+ DWELL(time);
+ return;
+ }
+ queued_canon q;
+ q.type = QDWELL;
+ q.data.dwell.time = time;
+ qc().push_back(q);
+}
+
+void enqueue_SET_FEED_MODE(int mode) {
+ if(qc().empty()) {
+ SET_FEED_MODE(mode);
+ return;
+ }
+ queued_canon q;
+ q.type = QSET_FEED_MODE;
+ q.data.set_feed_mode.mode = mode;
+ qc().push_back(q);
+}
+
+void enqueue_MIST_ON(void) {
+ if(qc().empty()) {
+ MIST_ON();
+ return;
+ }
+ queued_canon q;
+ q.type = QMIST_ON;
+ qc().push_back(q);
+}
+
+void enqueue_MIST_OFF(void) {
+ if(qc().empty()) {
+ MIST_OFF();
+ return;
+ }
+ queued_canon q;
+ q.type = QMIST_OFF;
+ qc().push_back(q);
+}
+
+void enqueue_FLOOD_ON(void) {
+ if(qc().empty()) {
+ FLOOD_ON();
+ return;
+ }
+ queued_canon q;
+ q.type = QFLOOD_ON;
+ qc().push_back(q);
+}
+
+void enqueue_FLOOD_OFF(void) {
+ if(qc().empty()) {
+ FLOOD_OFF();
+ return;
+ }
+ queued_canon q;
+ q.type = QFLOOD_OFF;
+ qc().push_back(q);
+}
+
+void enqueue_START_SPINDLE_CLOCKWISE(void) {
+ if(qc().empty()) {
+ START_SPINDLE_CLOCKWISE();
+ return;
+ }
+ queued_canon q;
+ q.type = QSTART_SPINDLE_CLOCKWISE;
+ qc().push_back(q);
+}
+
+void enqueue_START_SPINDLE_COUNTERCLOCKWISE(void) {
+ if(qc().empty()) {
+ START_SPINDLE_COUNTERCLOCKWISE();
+ return;
+ }
+ queued_canon q;
+ q.type = QSTART_SPINDLE_COUNTERCLOCKWISE;
+ qc().push_back(q);
+}
+
+void enqueue_STOP_SPINDLE_TURNING(void) {
+ if(qc().empty()) {
+ STOP_SPINDLE_TURNING();
+ return;
+ }
+ queued_canon q;
+ q.type = QSTOP_SPINDLE_TURNING;
+ qc().push_back(q);
+}
+
+void enqueue_SET_SPINDLE_MODE(double mode) {
+ if(qc().empty()) {
+ SET_SPINDLE_MODE(mode);
+ return;
+ }
+ queued_canon q;
+ q.type = QSET_SPINDLE_MODE;
+ q.data.set_spindle_mode.mode = mode;
+ qc().push_back(q);
+}
+
+void enqueue_SET_SPINDLE_SPEED(double speed) {
+ if(qc().empty()) {
+ SET_SPINDLE_SPEED(speed);
+ return;
+ }
+ queued_canon q;
+ q.type = QSET_SPINDLE_SPEED;
+ q.data.set_spindle_speed.speed = speed;
+ qc().push_back(q);
+}
+
+void enqueue_COMMENT(char *c) {
+ if(qc().empty()) {
+ COMMENT(c);
+ return;
+ }
+ queued_canon q;
+ q.type = QCOMMENT;
+ q.data.comment.comment = strdup(c);
+ qc().push_back(q);
+}
+
+void enqueue_STRAIGHT_FEED(int l,
+ double x, double y, double z,
+ double a, double b, double c,
+ double u, double v, double w) {
+ queued_canon q;
+ q.type = QSTRAIGHT_FEED;
+ q.data.straight_feed.line_number = l;
+ q.data.straight_feed.x = x;
+ q.data.straight_feed.y = y;
+ q.data.straight_feed.z = z;
+ q.data.straight_feed.a = a;
+ q.data.straight_feed.b = b;
+ q.data.straight_feed.c = c;
+ q.data.straight_feed.u = u;
+ q.data.straight_feed.v = v;
+ q.data.straight_feed.w = w;
+ qc().push_back(q);
+}
+
+void enqueue_STRAIGHT_TRAVERSE(int l,
+ double x, double y, double z,
+ double a, double b, double c,
+ double u, double v, double w) {
+ queued_canon q;
+ q.type = QSTRAIGHT_TRAVERSE;
+ q.data.straight_traverse.line_number = l;
+ q.data.straight_traverse.x = x;
+ q.data.straight_traverse.y = y;
+ q.data.straight_traverse.z = z;
+ q.data.straight_traverse.a = a;
+ q.data.straight_traverse.b = b;
+ q.data.straight_traverse.c = c;
+ q.data.straight_traverse.u = u;
+ q.data.straight_traverse.v = v;
+ q.data.straight_traverse.w = w;
+ qc().push_back(q);
+}
+
+void enqueue_ARC_FEED(int l,
+ double end1, double end2, double center1, double center2,
+ int turn,
+ double end3,
+ double a, double b, double c,
+ double u, double v, double w) {
+ queued_canon q;
+
+ q.type = QARC_FEED;
+ q.data.arc_feed.line_number = l;
+ q.data.arc_feed.end1 = end1;
+ q.data.arc_feed.end2 = end2;
+ q.data.arc_feed.center1 = center1;
+ q.data.arc_feed.center2 = center2;
+ q.data.arc_feed.turn = turn;
+ q.data.arc_feed.end3 = end3;
+ q.data.arc_feed.a = a;
+ q.data.arc_feed.b = b;
+ q.data.arc_feed.c = c;
+ q.data.arc_feed.u = u;
+ q.data.arc_feed.v = v;
+ q.data.arc_feed.w = w;
+ qc().push_back(q);
+}
+
+void dequeue_canons(void) {
+
+ if(qc().empty()) return;
+
+ for(unsigned int i = 0; i<qc().size(); i++) {
+ queued_canon &q = qc()[i];
+
+ switch(q.type) {
+ case QARC_FEED:
+ ARC_FEED(q.data.arc_feed.line_number, q.data.arc_feed.end1, q.data.arc_feed.end2,
+ q.data.arc_feed.center1, q.data.arc_feed.center2,
+ q.data.arc_feed.turn,
+ q.data.arc_feed.end3,
+ q.data.arc_feed.a, q.data.arc_feed.b, q.data.arc_feed.c,
+ q.data.arc_feed.u, q.data.arc_feed.v, q.data.arc_feed.w);
+ break;
+ case QSTRAIGHT_FEED:
+ STRAIGHT_FEED(q.data.straight_feed.line_number,
+ q.data.straight_feed.x, q.data.straight_feed.y, q.data.straight_feed.z,
+ q.data.straight_feed.a, q.data.straight_feed.b, q.data.straight_feed.c,
+ q.data.straight_feed.u, q.data.straight_feed.v, q.data.straight_feed.w);
+ break;
+ case QSTRAIGHT_TRAVERSE:
+ STRAIGHT_TRAVERSE(q.data.straight_traverse.line_number,
+ q.data.straight_traverse.x, q.data.straight_traverse.y, q.data.straight_traverse.z,
+ q.data.straight_traverse.a, q.data.straight_traverse.b, q.data.straight_traverse.c,
+ q.data.straight_traverse.u, q.data.straight_traverse.v, q.data.straight_traverse.w);
+ break;
+ case QSET_FEED_RATE:
+ SET_FEED_RATE(q.data.set_feed_rate.feed);
+ break;
+ case QDWELL:
+ DWELL(q.data.dwell.time);
+ break;
+ case QSET_FEED_MODE:
+ SET_FEED_MODE(q.data.set_feed_mode.mode);
+ break;
+ case QMIST_ON:
+ MIST_ON();
+ break;
+ case QMIST_OFF:
+ MIST_OFF();
+ break;
+ case QFLOOD_ON:
+ FLOOD_ON();
+ break;
+ case QFLOOD_OFF:
+ FLOOD_OFF();
+ break;
+ case QSTART_SPINDLE_CLOCKWISE:
+ START_SPINDLE_CLOCKWISE();
+ break;
+ case QSTART_SPINDLE_COUNTERCLOCKWISE:
+ START_SPINDLE_COUNTERCLOCKWISE();
+ break;
+ case QSTOP_SPINDLE_TURNING:
+ STOP_SPINDLE_TURNING();
+ break;
+ case QSET_SPINDLE_MODE:
+ SET_SPINDLE_MODE(q.data.set_spindle_mode.mode);
+ break;
+ case QSET_SPINDLE_SPEED:
+ SET_SPINDLE_SPEED(q.data.set_spindle_speed.speed);
+ break;
+ case QCOMMENT:
+ COMMENT(q.data.comment.comment);
+ free(q.data.comment.comment);
+ break;
+ }
+ }
+ qc().clear();
+}
+
+void update_endpoint(double x, double y) {
+ if(qc().empty()) return;
+
+ for(unsigned int i = 0; i<qc().size(); i++) {
+ queued_canon &q = qc()[i];
+
+ switch(q.type) {
+ case QARC_FEED:
+ q.data.arc_feed.end1 = x;
+ q.data.arc_feed.end2 = y;
+ break;
+ case QSTRAIGHT_TRAVERSE:
+ q.data.straight_traverse.x = x;
+ q.data.straight_traverse.y = y;
+ break;
+ case QSTRAIGHT_FEED:
+ q.data.straight_feed.x = x;
+ q.data.straight_feed.y = y;
+ break;
+ default:
+ ;
+ }
+ }
+ dequeue_canons();
+}
diff --git a/src/emc/rs274ngc/interp_queue.hh b/src/emc/rs274ngc/interp_queue.hh
new file mode 100644
index 000000000..0f6b16d5d
--- /dev/null
+++ b/src/emc/rs274ngc/interp_queue.hh
@@ -0,0 +1,95 @@
+
+#include <vector>
+typedef enum queued_canon_type {QSTRAIGHT_TRAVERSE, QSTRAIGHT_FEED, QARC_FEED, QSET_FEED_RATE, QDWELL, QSET_FEED_MODE,
+ QMIST_ON, QMIST_OFF, QFLOOD_ON, QFLOOD_OFF,
+ QSTART_SPINDLE_CLOCKWISE, QSTART_SPINDLE_COUNTERCLOCKWISE, QSTOP_SPINDLE_TURNING,
+ QSET_SPINDLE_MODE, QSET_SPINDLE_SPEED,
+ QCOMMENT};
+
+struct straight_traverse {
+ int line_number;
+ double x,y,z, a,b,c, u,v,w;
+};
+
+struct straight_feed {
+ int line_number;
+ double x,y,z, a,b,c, u,v,w;
+};
+
+struct arc_feed {
+ int line_number;
+ double end1, end2, center1, center2;
+ int turn;
+ double end3, a,b,c, u,v,w;
+};
+
+struct set_feed_rate {
+ double feed;
+};
+
+struct set_feed_mode {
+ int mode;
+};
+
+struct dwell {
+ double time;
+};
+
+struct set_spindle_mode {
+ double mode;
+};
+
+struct set_spindle_speed {
+ double speed;
+};
+
+struct comment {
+ char *comment;
+};
+
+typedef struct queued_canon {
+ queued_canon_type type;
+ union {
+ struct straight_traverse straight_traverse;
+ struct straight_feed straight_feed;
+ struct arc_feed arc_feed;
+ struct set_feed_rate set_feed_rate;
+ struct dwell dwell;
+ struct set_feed_mode set_feed_mode;
+ struct set_spindle_mode set_spindle_mode;
+ struct set_spindle_speed set_spindle_speed;
+ struct comment comment;
+ } data;
+};
+
+std::vector<queued_canon>& qc(void);
+
+void enqueue_SET_FEED_RATE(double feed);
+void enqueue_DWELL(double time);
+void enqueue_SET_FEED_MODE(int mode);
+void enqueue_MIST_ON(void);
+void enqueue_MIST_OFF(void);
+void enqueue_FLOOD_ON(void);
+void enqueue_FLOOD_OFF(void);
+void enqueue_START_SPINDLE_CLOCKWISE(void);
+void enqueue_START_SPINDLE_COUNTERCLOCKWISE(void);
+void enqueue_STOP_SPINDLE_TURNING(void);
+void enqueue_SET_SPINDLE_MODE(double mode);
+void enqueue_SET_SPINDLE_SPEED(double speed);
+void enqueue_COMMENT(char *c);
+void enqueue_STRAIGHT_FEED(int l,
+ double x, double y, double z,
+ double a, double b, double c,
+ double u, double v, double w);
+void enqueue_STRAIGHT_TRAVERSE(int l,
+ double x, double y, double z,
+ double a, double b, double c,
+ double u, double v, double w);
+void enqueue_ARC_FEED(int l,
+ double end1, double end2, double center1, double center2,
+ int turn,
+ double end3,
+ double a, double b, double c,
+ double u, double v, double w);
+void dequeue_canons(void);
+void update_endpoint(double x, double y);
diff --git a/src/emc/rs274ngc/interp_read.cc b/src/emc/rs274ngc/interp_read.cc
index b53e079d1..d17272d22 100644
--- a/src/emc/rs274ngc/interp_read.cc
+++ b/src/emc/rs274ngc/interp_read.cc
@@ -672,7 +672,7 @@ Returned Value: int
Side effects:
The number read from the line is put into what integer_ptr points at.
-Called by: read_line_number
+Called by: read_n_number
This reads an explicit unsigned (positive) integer from a string,
starting from the position given by *counter. It expects to find one
@@ -759,7 +759,7 @@ int Interp::read_integer_value(char *line, //!< string: line of RS274/NGC
/*! read_items
Returned Value: int
- If read_line_number or read_one_item returns an error code,
+ If read_n_number or read_one_item returns an error code,
this returns that code.
Otherwise, it returns INTERP_OK.
@@ -804,7 +804,7 @@ int Interp::read_items(block_pointer block, //!< pointer to a block being f
else if (line[counter] == 'n')
{
- CHP(read_line_number(line, &counter, block));
+ CHP(read_n_number(line, &counter, block));
}
for (; counter < length;) {
CHP(read_one_item(line, &counter, block, parameters));
@@ -966,7 +966,7 @@ int Interp::read_l(char *line, //!< string: line of RS274/NGC code being proce
/****************************************************************************/
-/*! read_line_number
+/*! read_n_number
Returned Value: int
If read_integer_unsigned returns an error code, this returns that code.
@@ -993,11 +993,11 @@ line number to be too large.
*/
-int Interp::read_line_number(char *line, //!< string: line of RS274 code being processed
- int *counter, //!< pointer to a counter for position on the line
- block_pointer block) //!< pointer to a block being filled from the line
+int Interp::read_n_number(char *line, //!< string: line of RS274 code being processed
+ int *counter, //!< pointer to a counter for position on the line
+ block_pointer block) //!< pointer to a block being filled from the line
{
- static char name[] = "read_line_number";
+ static char name[] = "read_n_number";
int value;
int status;
@@ -1007,7 +1007,7 @@ int Interp::read_line_number(char *line, //!< string: line of RS274 code bein
CHP(read_integer_unsigned(line, counter, &value));
/* This next test is problematic as many CAM systems will exceed this !
CHK((value > 99999), NCE_LINE_NUMBER_GREATER_THAN_99999); */
- block->line_number = value;
+ block->n_number = value;
return INTERP_OK;
}
@@ -1094,7 +1094,7 @@ When this function is called, the counter is set so that the position
being considered is the first position of a word. The character at
that position must be one known to the system. In this version those
characters are: a,b,c,d,f,g,h,i,j,k,l,m,n,p,q,r,s,t,x,y,z,(,#,;.
-However, read_items calls read_line_number directly if the first word
+However, read_items calls read_n_number directly if the first word
begins with n, so no read function is included in the "_readers" array
for the letter n. Thus, if an n word is encountered in the middle of
a line, this function reports NCE_BAD_CHARACTER_USED.
diff --git a/src/emc/rs274ngc/rs274ngc.hh b/src/emc/rs274ngc/rs274ngc.hh
index d2d05916c..fc5d4ec19 100644
--- a/src/emc/rs274ngc/rs274ngc.hh
+++ b/src/emc/rs274ngc/rs274ngc.hh
@@ -40,7 +40,7 @@ typedef bool ON_OFF;
class Interp;
typedef int (Interp::*read_function_pointer) (char *, int *, block_pointer, double *);
-#define DEBUG_EMC
+#undef DEBUG_EMC
#define _logDebug(level, fmt, args...) \
do { \
@@ -219,33 +219,33 @@ private:
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,
+ int convert_cycle_g81(block_pointer block, CANON_PLANE plane, double x, double y,
double clear_z, double bottom_z);
- int convert_cycle_g82(CANON_PLANE plane, double x, double y,
+ int convert_cycle_g82(block_pointer block, CANON_PLANE plane, double x, double y,
double clear_z, double bottom_z, double dwell);
- int convert_cycle_g73(CANON_PLANE plane, double x, double y,
+ int convert_cycle_g73(block_pointer block, CANON_PLANE plane, double x, double y,
double r, double clear_z, double bottom_z,
double delta);
- int convert_cycle_g83(CANON_PLANE plane, double x, double y,
+ int convert_cycle_g83(block_pointer block, 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,
+ int convert_cycle_g84(block_pointer block, 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,
+ int convert_cycle_g85(block_pointer block, CANON_PLANE plane, double x, double y,
double clear_z, double bottom_z);
- int convert_cycle_g86(CANON_PLANE plane, double x, double y,
+ int convert_cycle_g86(block_pointer block, 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,
+ int convert_cycle_g87(block_pointer block, 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,
+ int convert_cycle_g88(block_pointer block, 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,
+ int convert_cycle_g89(block_pointer block, 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);
@@ -261,7 +261,7 @@ private:
setup_pointer settings);
int convert_distance_mode(int g_code, setup_pointer settings);
int convert_ijk_distance_mode(int g_code, setup_pointer settings);
- int convert_dwell(double time);
+ int convert_dwell(setup_pointer settings, 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);
@@ -301,9 +301,9 @@ private:
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,
+ int cycle_feed(block_pointer block, CANON_PLANE plane, double end1,
+ double end2, double end3);
+ int cycle_traverse(block_pointer block, 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);
@@ -392,7 +392,7 @@ private:
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_n_number(char *line, int *counter, block_pointer block);
int read_m(char *line, int *counter, block_pointer block,
double *parameters);
int read_o(char *line, int *counter, block_pointer block,
diff --git a/src/emc/rs274ngc/rs274ngc_errors.cc b/src/emc/rs274ngc/rs274ngc_errors.cc
index 0c3e9e18b..fd4143b41 100644
--- a/src/emc/rs274ngc/rs274ngc_errors.cc
+++ b/src/emc/rs274ngc/rs274ngc_errors.cc
@@ -53,7 +53,7 @@ const char * _rs274ngc_errors[] = {
/* 30 */ _("Bug code not in range g54 to g593"), // convert_coordinate_system
/* 31 */ _("Bug code not m0 m1 m2 m30 m60"), // convert_stop
/* 32 */ _("Bug distance mode not g90 or g91"), // convert_cycle_xy, convert_cycle_yz, convert_cycle_zx
-/* 33 */ _("Bug function should not have been called"), // convert_cycle_xy, convert_cycle_yz, convert_cycle_zx, read_a, read_b, read_c, read_comment, read_d, read_f, read_g, read_h, read_i, read_j, read_k, read_l, read_line_number, read_m, read_p, read_parameter, read_parameter_setting, read_q, read_r, read_real_expression, read_s, read_t, read_x, read_y, read_z
+/* 33 */ _("Bug function should not have been called"), // convert_cycle_xy, convert_cycle_yz, convert_cycle_zx, read_a, read_b, read_c, read_comment, read_d, read_f, read_g, read_h, read_i, read_j, read_k, read_l, read_n_number, read_m, read_p, read_parameter, read_parameter_setting, read_q, read_r, read_real_expression, read_s, read_t, read_x, read_y, read_z
/* 34 */ _("Bug in tool radius comp"), // arc_data_comp_r
/* 35 */ _("Bug plane not xy yz or xz"), // convert_arc, convert_cycle
/* 36 */ _("Bug side not right or left"), // convert_straight_comp1, convert_straight_comp2
@@ -118,7 +118,7 @@ const char * _rs274ngc_errors[] = {
/* 95 */ _("L word with no canned cycle, g10, or g76 to use it"), // check_other_codes
/* 96 */ _("Left bracket missing after slash with atan"), // read_atan
/* 97 */ _("Left bracket missing after unary operation name"), // read_unary
-/* 98 */ _("Line number greater than 99999"), // read_line_number
+/* 98 */ _("Line number greater than 99999"), // read_n_number
/* 99 */ _("Line with g10 does not have l2"), // check_g_codes
/* 100 */ _("M code greater than 199"), // read_m
/* 101 */ _("Mixed radius ijk format for arc"), // convert_arc
diff --git a/src/emc/sai/saicanon.cc b/src/emc/sai/saicanon.cc
index 5d234d669..e39ea72c4 100644
--- a/src/emc/sai/saicanon.cc
+++ b/src/emc/sai/saicanon.cc
@@ -29,7 +29,6 @@
* Copyright (c) 2007 All rights reserved.
*
* Last change:
-*
********************************************************************/
#include "canon.hh"
@@ -314,7 +313,7 @@ void SET_TRAVERSE_RATE(double rate)
_traverse_rate = rate;
}
-void STRAIGHT_TRAVERSE(
+void STRAIGHT_TRAVERSE( int line_number,
double x, double y, double z
#ifdef AA
, double a /*AA*/
@@ -433,7 +432,7 @@ void STOP_SPEED_FEED_SYNCH()
/* Machining Functions */
-void ARC_FEED(
+void ARC_FEED(int line_number,
double first_end, double second_end,
double first_axis, double second_axis, int rotation, double axis_end_point
#ifdef AA
@@ -501,7 +500,7 @@ void ARC_FEED(
#endif
}
-void STRAIGHT_FEED(
+void STRAIGHT_FEED(int line_number,
double x, double y, double z
#ifdef AA
, double a /*AA*/
@@ -557,7 +556,7 @@ void STRAIGHT_FEED(
point towards the previous location after the probing, if the probe
point is not the same as the previous point -- which it should not be. */
-void STRAIGHT_PROBE(
+void STRAIGHT_PROBE(int line_number,
double x, double y, double z
#ifdef AA
, double a /*AA*/
@@ -650,7 +649,7 @@ void PARAMETRIC_3D_CURVE_FEED(FunctionPtr xfcn, FunctionPtr yfcn,
*/
-void RIGID_TAP(double x, double y, double z)
+void RIGID_TAP(int line_number, double x, double y, double z)
{
diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc
index 1c785ac0b..263bf58c5 100644
--- a/src/emc/task/emccanon.cc
+++ b/src/emc/task/emccanon.cc
@@ -808,10 +808,8 @@ static void flush_segments(void) {
linearMoveMsg.type = EMC_MOTION_TYPE_FEED;
if ((vel && acc) || synched) {
- int save = interp_list.get_next_line_number();
interp_list.set_line_number(line_no);
interp_list.append(linearMoveMsg);
- interp_list.set_line_number(save);
}
canonUpdateEndPoint(x, y, z, a, b, c, u, v, w);
@@ -866,7 +864,8 @@ linkable(double x, double y, double z,
}
static void
-see_segment(double x, double y, double z,
+see_segment(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w) {
bool changed_abc = (a != canonEndPoint.a)
@@ -880,7 +879,7 @@ see_segment(double x, double y, double z,
if(!chained_points().empty() && !linkable(x, y, z, a, b, c, u, v, w)) {
flush_segments();
}
- pt pos = {x, y, z, a, b, c, u, v, w, interp_list.get_next_line_number()};
+ pt pos = {x, y, z, a, b, c, u, v, w, line_number};
chained_points().push_back(pos);
if(changed_abc || changed_uvw) {
flush_segments();
@@ -891,7 +890,8 @@ void FINISH() {
flush_segments();
}
-void STRAIGHT_TRAVERSE(double x, double y, double z,
+void STRAIGHT_TRAVERSE(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w)
{
@@ -918,8 +918,10 @@ void STRAIGHT_TRAVERSE(double x, double y, double z,
if(feed_mode)
STOP_SPEED_FEED_SYNCH();
- if(vel && acc)
+ if(vel && acc) {
+ interp_list.set_line_number(line_number);
interp_list.append(linearMoveMsg);
+ }
if(old_feed_mode)
START_SPEED_FEED_SYNCH(currentLinearFeedRate, 1);
@@ -927,7 +929,8 @@ void STRAIGHT_TRAVERSE(double x, double y, double z,
canonUpdateEndPoint(x, y, z, a, b, c, u, v, w);
}
-void STRAIGHT_FEED(double x, double y, double z,
+void STRAIGHT_FEED(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w)
{
@@ -936,11 +939,11 @@ void STRAIGHT_FEED(double x, double y, double z,
from_prog(x,y,z,a,b,c,u,v,w);
offset_pos(x,y,z,a,b,c,u,v,w);
- see_segment(x, y, z, a, b, c, u, v, w);
+ see_segment(line_number, x, y, z, a, b, c, u, v, w);
}
-void RIGID_TAP(double x, double y, double z)
+void RIGID_TAP(int line_number, double x, double y, double z)
{
double ini_maxvel, vel, acc;
EMC_TRAJ_RIGID_TAP rigidTapMsg;
@@ -968,8 +971,10 @@ void RIGID_TAP(double x, double y, double z)
flush_segments();
- if(vel && acc)
+ if(vel && acc) {
+ interp_list.set_line_number(line_number);
interp_list.append(rigidTapMsg);
+ }
// don't move the endpoint because after this move, we are back where we started
}
@@ -980,7 +985,8 @@ void RIGID_TAP(double x, double y, double z)
uses a probe message instead of a linear move message.
*/
-void STRAIGHT_PROBE(double x, double y, double z,
+void STRAIGHT_PROBE(int line_number,
+ double x, double y, double z,
double a, double b, double c,
double u, double v, double w,
unsigned char probe_type)
@@ -1020,8 +1026,10 @@ void STRAIGHT_PROBE(double x, double y, double z,
probeMsg.pos = to_ext_pose(x,y,z,a,b,c,u,v,w);
- if(vel && acc)
+ if(vel && acc) {
+ interp_list.set_line_number(line_number);
interp_list.append(probeMsg);
+ }
canonUpdateEndPoint(x, y, z, a, b, c, u, v, w);
}
@@ -1128,7 +1136,8 @@ static double chord_deviation(double sx, double sy, double ex, double ey, double
return dev;
}
-void ARC_FEED(double first_end, double second_end,
+void ARC_FEED(int line_number,
+ double first_end, double second_end,
double first_axis, double second_axis, int rotation,
double axis_end_point,
double a, double b, double c,
@@ -1156,7 +1165,7 @@ void ARC_FEED(double first_end, double second_end,
rotation, mx, my) < canonMotionTolerance) {
double x=FROM_PROG_LEN(first_end), y=FROM_PROG_LEN(second_end), z=FROM_PROG_LEN(axis_end_point);
offset_pos(x, y, z, a, b, c, u, v, w);
- see_segment(mx, my,
+ see_segment(line_number, mx, my,
(lz + z)/2,
(canonEndPoint.a + a)/2,
(canonEndPoint.b + b)/2,
@@ -1164,7 +1173,7 @@ void ARC_FEED(double first_end, double second_end,
(canonEndPoint.u + u)/2,
(canonEndPoint.v + v)/2,
(canonEndPoint.w + w)/2);
- see_segment(x, y, z, a, b, c, u, v, w);
+ see_segment(line_number, x, y, z, a, b, c, u, v, w);
return;
}
//ini_maxvel = max vel defined by various ini constraints
@@ -1403,8 +1412,10 @@ void ARC_FEED(double first_end, double second_end,
linearMoveMsg.vel = toExtVel(vel);
linearMoveMsg.ini_maxvel = toExtVel(ini_maxvel);
linearMoveMsg.acc = toExtAcc(acc);
- if(vel && acc)
+ if(vel && acc){
+ interp_list.set_line_number(line_number);
interp_list.append(linearMoveMsg);
+ }
} else {
circularMoveMsg.end.tran.x = TO_EXT_LEN(end.tran.x);
circularMoveMsg.end.tran.y = TO_EXT_LEN(end.tran.y);
@@ -1442,8 +1453,10 @@ void ARC_FEED(double first_end, double second_end,
circularMoveMsg.vel = toExtVel(vel);
circularMoveMsg.ini_maxvel = toExtVel(ini_maxvel);
circularMoveMsg.acc = toExtAcc(acc);
- if(vel && acc)
+ if(vel && acc) {
+ interp_list.set_line_number(line_number);
interp_list.append(circularMoveMsg);
+ }
}
// update the end point
canonUpdateEndPoint(end.tran.x, end.tran.y, end.tran.z, a, b, c, u, v, w);