Hi,
Here is the patch to make NURBS_FEED to take line_number from interpreter.
This fixes a total break of NURBS, so they somehow work again.
Regards,
Alex.
Make NURBS_FEED and friends take line_number
From: Alexey Starikovskiy <[email protected]>
This makes G5.2/G5.3 work (somehow) again.
Signed-off-by: Alexey Starikovskiy <[email protected]>
---
src/emc/nml_intf/canon.hh | 6 +++---
src/emc/rs274ngc/gcodemodule.cc | 15 +++++++--------
src/emc/rs274ngc/interp_convert.cc | 6 +++---
src/emc/sai/saicanon.cc | 6 +++---
src/emc/task/emccanon.cc | 26 +++++++++++++-------------
5 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh
index 29ce9cb..356155c 100644
--- a/src/emc/nml_intf/canon.hh
+++ b/src/emc/nml_intf/canon.hh
@@ -426,16 +426,16 @@ extern double alpha_finder(double dx, double dy);
/* Canon calls */
-extern void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k);
+extern void NURBS_FEED(int lineno, std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k);
/* Move at the feed rate along an approximation of a NURBS with a variable number
* of control points
*/
-extern void SPLINE_FEED(double x1, double y1, double x2, double y2, double x3, double y3);
+extern void SPLINE_FEED(int lineno, double x1, double y1, double x2, double y2, double x3, double y3);
/* Move at the feed rate along an approximation of the cubic
* bezier spline with control points x1y1 x2y2 and endpoint x3y3
*/
-extern void SPLINE_FEED(double x1, double y1, double x2, double y2);
+extern void SPLINE_FEED(int lineno, double x1, double y1, double x2, double y2);
/* Move at the feed rate along an approximation of the conic
* spline with control point x1y1 and endpoint x2y2
*/
diff --git a/src/emc/rs274ngc/gcodemodule.cc b/src/emc/rs274ngc/gcodemodule.cc
index 39c2e7b..9b4ac09 100644
--- a/src/emc/rs274ngc/gcodemodule.cc
+++ b/src/emc/rs274ngc/gcodemodule.cc
@@ -159,7 +159,7 @@ static double TO_PROG_LEN(double p) {
return p;
}
-void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k) {
+void NURBS_FEED(int line_number, std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k) {
double u = 0.0;
unsigned int n = nurbs_control_points.size() - 1;
double umax = n - k + 2;
@@ -169,17 +169,17 @@ void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k)
while (u+umax/div < umax) {
PLANE_POINT P1 = nurbs_point(u+umax/div,k,nurbs_control_points,knot_vector);
// EBo -- replace 12345 with *whatever* gives us the line_number
- STRAIGHT_FEED(12345, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
+ STRAIGHT_FEED(line_number, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
u = u + umax/div;
}
P1.X = nurbs_control_points[n].X;
P1.Y = nurbs_control_points[n].Y;
// EBo -- replace 12345 with *whatever* gives us the line_number
- STRAIGHT_FEED(12345, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
+ STRAIGHT_FEED(line_number, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
knot_vector.clear();
}
-void SPLINE_FEED(double x1, double y1, double x2, double y2) {
+void SPLINE_FEED(int line_number, double x1, double y1, double x2, double y2) {
double x0 = TO_PROG_LEN(_pos_x),
y0 = TO_PROG_LEN(_pos_y);
@@ -194,11 +194,11 @@ void SPLINE_FEED(double x1, double y1, double x2, double y2) {
double x = x0*t0 + x1*t1 + x2*t2;
double y = y0*t0 + y1*t1 + y2*t2;
// EBo -- replace 12345 with *whatever* gives us the line_number
- STRAIGHT_FEED(12345, x,y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
+ STRAIGHT_FEED(line_number, x,y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
}
}
-void SPLINE_FEED(double x1, double y1, double x2, double y2, double x3, double y3) {
+void SPLINE_FEED(int line_number, double x1, double y1, double x2, double y2, double x3, double y3) {
double x0 = TO_PROG_LEN(_pos_x),
y0 = TO_PROG_LEN(_pos_y);
@@ -209,8 +209,7 @@ void SPLINE_FEED(double x1, double y1, double x2, double y2, double x3, double y
double t0 = (1-t)*(1-t)*(1-t);
double x = x0*t0 + x1*t1 + x2*t2 + x3*t3;
double y = y0*t0 + y1*t1 + y2*t2 + y3*t3;
- // EBo -- replace 12345 with *whatever* gives us the line_number
- STRAIGHT_FEED(12345, x,y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
+ STRAIGHT_FEED(line_number, x,y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
}
}
diff --git a/src/emc/rs274ngc/interp_convert.cc b/src/emc/rs274ngc/interp_convert.cc
index 654f350..5a47f8a 100644
--- a/src/emc/rs274ngc/interp_convert.cc
+++ b/src/emc/rs274ngc/interp_convert.cc
@@ -183,7 +183,7 @@ int Interp::convert_nurbs(int mode,
CHKS((nurbs_control_points.size()<nurbs_order), _("You must specify a number of control points at least equal to the order L = %d"), nurbs_order);
settings->current_x = nurbs_control_points[nurbs_control_points.size()-1].X;
settings->current_y = nurbs_control_points[nurbs_control_points.size()-1].Y;
- NURBS_FEED(nurbs_control_points, nurbs_order);
+ NURBS_FEED(block->line_number, nurbs_control_points, nurbs_order);
//printf("hello\n");
nurbs_control_points.clear();
//printf("%d\n", nurbs_control_points.size());
@@ -233,7 +233,7 @@ int Interp::convert_spline(int mode,
y1 = settings->current_y + block->j_number;
CHP(find_ends(block, settings, &x2, &y2, &end_z, &AA_end, &BB_end, &CC_end,
&u_end, &v_end, &w_end));
- SPLINE_FEED(x1,y1,x2,y2);
+ SPLINE_FEED(block->line_number, x1,y1,x2,y2);
settings->current_x = x2;
settings->current_y = y2;
} else {
@@ -252,7 +252,7 @@ int Interp::convert_spline(int mode,
x2 = x3 + block->p_number;
y2 = y3 + block->q_number;
- SPLINE_FEED(x1, y1, x2, y2, x3, y3);
+ SPLINE_FEED(block->line_number, x1, y1, x2, y2, x3, y3);
settings->cycle_i = -block->p_number;
settings->cycle_j = -block->q_number;
diff --git a/src/emc/sai/saicanon.cc b/src/emc/sai/saicanon.cc
index eacdab3..602df16 100644
--- a/src/emc/sai/saicanon.cc
+++ b/src/emc/sai/saicanon.cc
@@ -385,7 +385,7 @@ void STOP_SPEED_FEED_SYNCH()
/* Machining Functions */
-void NURBS_FEED(
+void NURBS_FEED(int lineno,
std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k)
{
fprintf(_outfile, "%5d ", _line_number++);
@@ -396,7 +396,7 @@ std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k)
_program_position_y = nurbs_control_points[nurbs_control_points.size()].Y;
}
-void SPLINE_FEED(
+void SPLINE_FEED(int lineno,
double x1, double y1, double x2, double y2, double x3, double y3)
{
fprintf(_outfile, "%5d ", _line_number++);
@@ -408,7 +408,7 @@ double x1, double y1, double x2, double y2, double x3, double y3)
_program_position_y = y3;
}
-void SPLINE_FEED(
+void SPLINE_FEED(int lineno,
double x1, double y1, double x2, double y2)
{
fprintf(_outfile, "%5d ", _line_number++);
diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc
index db0312c..e59af62 100644
--- a/src/emc/task/emccanon.cc
+++ b/src/emc/task/emccanon.cc
@@ -1171,7 +1171,7 @@ static void unit(double *x, double *y) {
}
static void
-arc(double x0, double y0, double x1, double y1, double dx, double dy) {
+arc(int lineno, double x0, double y0, double x1, double y1, double dx, double dy) {
double small = 0.000001;
double x = x1-x0, y=y1-y0;
double den = 2 * (y*dx - x*dy);
@@ -1179,13 +1179,13 @@ arc(double x0, double y0, double x1, double y1, double dx, double dy) {
double i = dy*r, j = -dx*r;
double cx = x1+i, cy=y1+j;
if (fabs(den) > small) {
- ARC_FEED(interp_list.get_line_number(), x1, y1, cx, cy, r<0 ? 1 : -1,
+ ARC_FEED(lineno, x1, y1, cx, cy, r<0 ? 1 : -1,
TO_PROG_LEN(canonEndPoint.z - programOrigin.z), TO_PROG_ANG(canonEndPoint.a),
TO_PROG_ANG(canonEndPoint.b), TO_PROG_ANG(canonEndPoint.c),
TO_PROG_ANG(canonEndPoint.u),TO_PROG_ANG(canonEndPoint.v),
TO_PROG_ANG(canonEndPoint.w));
} else {
- STRAIGHT_FEED(interp_list.get_line_number(), x1,y1,
+ STRAIGHT_FEED(lineno, x1,y1,
TO_PROG_LEN(canonEndPoint.z), TO_PROG_ANG(canonEndPoint.a),
TO_PROG_ANG(canonEndPoint.b), TO_PROG_ANG(canonEndPoint.c),
TO_PROG_ANG(canonEndPoint.u),TO_PROG_ANG(canonEndPoint.v),
@@ -1194,7 +1194,7 @@ arc(double x0, double y0, double x1, double y1, double dx, double dy) {
}
static int
-biarc(double p0x, double p0y, double tsx, double tsy,
+biarc(int lineno, double p0x, double p0y, double tsx, double tsy,
double p4x, double p4y, double tex, double tey, double r=1.0) {
unit(&tsx, &tsy);
unit(&tex, &tey);
@@ -1223,15 +1223,15 @@ biarc(double p0x, double p0y, double tsx, double tsy,
double tmx = p3x-p2x, tmy = p3y-p2y;
unit(&tmx, &tmy);
- arc(p0x, p0y, p2x, p2y, tsx, tsy);
- arc(p2x, p2y, p4x, p4y, tmx, tmy);
+ arc(lineno, p0x, p0y, p2x, p2y, tsx, tsy);
+ arc(lineno, p2x, p2y, p4x, p4y, tmx, tmy);
return 1;
}
/* Canon calls */
-void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k) {
+void NURBS_FEED(int lineno, std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k) {
double u = 0.0;
unsigned int n = nurbs_control_points.size() - 1;
double umax = n - k + 2;
@@ -1263,7 +1263,7 @@ void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k)
dxe = cos(alphaM);
dye = sin(alphaM);
unit(&dxe,&dye);
- biarc(P0.X,P0.Y,dxs,dys,P1.X,P1.Y,dxe,dye);
+ biarc(lineno, P0.X,P0.Y,dxs,dys,P1.X,P1.Y,dxe,dye);
//printf("___________________________________________\n");
//printf("X %8.4f Y %8.4f\n", P0.X, P0.Y);
dxs = dxe;
@@ -1278,12 +1278,12 @@ void NURBS_FEED(std::vector<CONTROL_POINT> nurbs_control_points, unsigned int k)
dxe = nurbs_control_points[n].X - nurbs_control_points[n-1].X;
dye = nurbs_control_points[n].Y - nurbs_control_points[n-1].Y;
unit(&dxe,&dye);
- biarc(P0.X,P0.Y,dxs,dys,P1.X,P1.Y,dxe,dye);
+ biarc(lineno, P0.X,P0.Y,dxs,dys,P1.X,P1.Y,dxe,dye);
//printf("parameters: n = %d, umax = %f, div= %d, u = %f, k = %d\n",n,umax,div,u,k);
knot_vector.clear();
}
-void SPLINE_FEED(double x1, double y1, double x2, double y2) {
+void SPLINE_FEED(int lineno, double x1, double y1, double x2, double y2) {
flush_segments();
double x0 = TO_PROG_LEN(canonEndPoint.x);
@@ -1307,14 +1307,14 @@ perturb:
double y = y0*t0 + y1*t1 + y2*t2;
double dx = xx0*q0 + xx1*q1;
double dy = yy0*q0 + yy1*q1;
- if(!biarc(ox, oy, odx, ody, x, y, dx, dy)) {
+ if(!biarc(lineno, ox, oy, odx, ody, x, y, dx, dy)) {
t = t - u; u /= -2; goto perturb;
}
ox = x; oy = y; odx = dx; ody = dy;
}
}
-void SPLINE_FEED(double x1, double y1, double x2, double y2, double x3, double y3) {
+void SPLINE_FEED(int lineno, double x1, double y1, double x2, double y2, double x3, double y3) {
flush_segments();
double x0 = TO_PROG_LEN(canonEndPoint.x);
@@ -1340,7 +1340,7 @@ perturb:
double y = y0*t0 + y1*t1 + y2*t2 + y3*t3;
double dx = xx0*q0 + xx1*q1 + xx2*q2;
double dy = yy0*q0 + yy1*q1 + yy2*q2;
- if(!biarc(ox, oy, odx, ody, x, y, dx, dy)) {
+ if(!biarc(lineno, ox, oy, odx, ody, x, y, dx, dy)) {
t = t - u; u /= -2; goto perturb;
}
ox = x; oy = y; odx = dx; ody = dy;
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers