Skip to content

Commit 97dccdc

Browse files
committed
rs274: change canon_plane to class enum
1 parent 64d27a3 commit 97dccdc

19 files changed

Lines changed: 381 additions & 381 deletions

src/emc/canterp/canterp.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,15 @@ int Canterp::execute(const char *line) {
347347

348348
if (!strcmp(the_command_name, "SELECT_PLANE")) {
349349
if (!strcmp(the_command_args, "CANON_PLANE_XY")) {
350-
SELECT_PLANE(CANON_PLANE_XY);
350+
SELECT_PLANE(CANON_PLANE::XY);
351351
return 0;
352352
}
353353
if (!strcmp(the_command_args, "CANON_PLANE_YZ")) {
354-
SELECT_PLANE(CANON_PLANE_YZ);
354+
SELECT_PLANE(CANON_PLANE::YZ);
355355
return 0;
356356
}
357357
if (!strcmp(the_command_args, "CANON_PLANE_XZ")) {
358-
SELECT_PLANE(CANON_PLANE_XZ);
358+
SELECT_PLANE(CANON_PLANE::XZ);
359359
return 0;
360360
}
361361
return INTERP_ERROR;

src/emc/nml_intf/canon.hh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ struct NURBS_G6_DPLANE_POINT {
7171
}; //è impiegata per salvare le derivate x'(u) y'(u).
7272

7373

74-
enum CANON_PLANE {
75-
CANON_PLANE_XY = 1,
76-
CANON_PLANE_YZ,
77-
CANON_PLANE_XZ,
78-
CANON_PLANE_UV,
79-
CANON_PLANE_VW,
80-
CANON_PLANE_UW,
74+
enum class CANON_PLANE {
75+
XY = 1,
76+
YZ,
77+
XZ,
78+
UV,
79+
VW,
80+
UW,
8181
};
8282

8383
enum CANON_UNITS
@@ -552,12 +552,12 @@ extern std::vector<double> nurbs_G6_knot_vector_new_creator_sgment(unsigned int
552552

553553
/* Canon calls */
554554

555-
extern void NURBS_G5_FEED(int lineno, std::vector<NURBS_CONTROL_POINT> nurbs_control_points, unsigned int nurbs_order, int plane);
555+
extern void NURBS_G5_FEED(int lineno, std::vector<NURBS_CONTROL_POINT> nurbs_control_points, unsigned int nurbs_order, CANON_PLANE plane);
556556
/* Move at the feed rate along an approximation of a NURBS with a variable number
557557
* of control points
558558
*/
559559

560-
extern void NURBS_G6_FEED(int lineno, std::vector<NURBS_G6_CONTROL_POINT> nurbs_control_points, unsigned int k, double feedrate, int l, int plane);
560+
extern void NURBS_G6_FEED(int lineno, std::vector<NURBS_G6_CONTROL_POINT> nurbs_control_points, unsigned int k, double feedrate, int l, CANON_PLANE plane);
561561
// this is for G6xx
562562

563563
extern double alpha_finder(double dx, double dy);

src/emc/rs274ngc/canonmodule.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ BOOST_PYTHON_MODULE(emccanon) {
4242
"Canon access & introspection\n"
4343
;
4444
enum_<CANON_PLANE>("CANON_PLANE")
45-
.value("CANON_PLANE_XY", CANON_PLANE_XY)
46-
.value("CANON_PLANE_YZ", CANON_PLANE_YZ)
47-
.value("CANON_PLANE_XZ", CANON_PLANE_XZ)
48-
.value("CANON_PLANE_UV", CANON_PLANE_UV)
49-
.value("CANON_PLANE_VW", CANON_PLANE_VW)
50-
.value("CANON_PLANE_UW", CANON_PLANE_UW)
45+
.value("CANON_PLANE_XY", CANON_PLANE::XY)
46+
.value("CANON_PLANE_YZ", CANON_PLANE::YZ)
47+
.value("CANON_PLANE_XZ", CANON_PLANE::XZ)
48+
.value("CANON_PLANE_UV", CANON_PLANE::UV)
49+
.value("CANON_PLANE_VW", CANON_PLANE::VW)
50+
.value("CANON_PLANE_UW", CANON_PLANE::UW)
5151
.export_values();
5252

5353
enum_<CANON_UNITS>("CANON_UNITS")

src/emc/rs274ngc/gcodemodule.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static void maybe_new_line(int sequence_number) {
197197

198198
//das ist für die Vorschau
199199
/* G_5_2/G_5_3*/
200-
void NURBS_G5_FEED(int line_number, std::vector<NURBS_CONTROL_POINT> nurbs_control_points, unsigned int nurbs_order, int plane)
200+
void NURBS_G5_FEED(int line_number, std::vector<NURBS_CONTROL_POINT> nurbs_control_points, unsigned int nurbs_order, CANON_PLANE plane)
201201
{
202202
double u = 0.0;
203203
unsigned int n = nurbs_control_points.size() - 1;
@@ -210,15 +210,15 @@ void NURBS_G5_FEED(int line_number, std::vector<NURBS_CONTROL_POINT> nurbs_contr
210210
//printf("P1 X: %8.4f Y: %8.4f pos_x: %8.4f pos_y: %8.4f pos_z: %8.4f (F: %s L: %d)\n",P1.NURBS_X,P1.NURBS_Y,_pos_x,_pos_y,_pos_z,__FILE__,__LINE__);
211211

212212
//STRAIGHT_FEED(line_number, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
213-
if(plane==CANON_PLANE_XY) {
213+
if(plane==CANON_PLANE::XY) {
214214
//printf("XY (F: %s L: %d)\n",__FILE__,__LINE__);
215215
STRAIGHT_FEED(line_number, P1.NURBS_X, P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
216216
}
217-
if(plane==CANON_PLANE_YZ) {
217+
if(plane==CANON_PLANE::YZ) {
218218
//printf("YZ (F: %s L: %d)\n",__FILE__,__LINE__);
219219
STRAIGHT_FEED(line_number, _pos_x, P1.NURBS_X, P1.NURBS_Y, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
220220
}
221-
if(plane==CANON_PLANE_XZ) {
221+
if(plane==CANON_PLANE::XZ) {
222222
//printf("XZ (F: %s L: %d)\n",__FILE__,__LINE__);
223223
STRAIGHT_FEED(line_number, P1.NURBS_Y, _pos_y, P1.NURBS_X, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
224224
}
@@ -228,21 +228,21 @@ void NURBS_G5_FEED(int line_number, std::vector<NURBS_CONTROL_POINT> nurbs_contr
228228
P1.NURBS_Y = nurbs_control_points[n].NURBS_Y;
229229
//printf("Pn X: %8.4f Y: %8.4f pos_x: %8.4f pos_y: %8.4f pos_z: %8.4f (F: %s L: %d)\n",P1.X,P1.Y,_pos_x,_pos_y,_pos_z,__FILE__,__LINE__);
230230
//STRAIGHT_FEED(line_number, P1.X,P1.Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
231-
if(plane==CANON_PLANE_XY) {
231+
if(plane==CANON_PLANE::XY) {
232232
STRAIGHT_FEED(line_number, P1.NURBS_X, P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
233233
}
234-
if(plane==CANON_PLANE_YZ) {
234+
if(plane==CANON_PLANE::YZ) {
235235
STRAIGHT_FEED(line_number, _pos_x, P1.NURBS_X, P1.NURBS_Y, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
236236
}
237-
if(plane==CANON_PLANE_XZ) {
237+
if(plane==CANON_PLANE::XZ) {
238238
STRAIGHT_FEED(line_number, P1.NURBS_Y, _pos_y, P1.NURBS_X, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w); //
239239
}
240240
knot_vector.clear();
241241
}
242242

243243
/* G_6_2 L_option is unused */
244244
//-----------------------------------------------------------------------------------------------------------------------------------------
245-
void NURBS_G6_FEED(int line_number, std::vector<NURBS_G6_CONTROL_POINT> nurbs_control_points, unsigned int k, double feedrate, int L_option, int plane) { // (L_option: NICU, NICL, NICC see publication from Lo Valvo and Drago)
245+
void NURBS_G6_FEED(int line_number, std::vector<NURBS_G6_CONTROL_POINT> nurbs_control_points, unsigned int k, double feedrate, int L_option, CANON_PLANE plane) { // (L_option: NICU, NICL, NICC see publication from Lo Valvo and Drago)
246246
double u = 0.0;
247247
unsigned int n = nurbs_control_points.size() - 1-k;
248248
double umax = nurbs_control_points[n+k].NURBS_K;
@@ -256,27 +256,27 @@ void NURBS_G6_FEED(int line_number, std::vector<NURBS_G6_CONTROL_POINT> nurbs_co
256256
P1 = nurbs_G6_pointx(knot_vector[0],k,nurbs_control_points,knot_vector,A6);
257257
//printf("%.3d P1 X: %8.4f Y: %8.4f pos_x: %8.4f pos_y: %8.4f pos_z: %8.4f (F: %s L: %d)\n",line_number,P1.NURBS_X,P1.NURBS_Y,_pos_x,_pos_y,_pos_z,__FILE__,__LINE__);
258258
//STRAIGHT_FEED(line_number, P1.NURBS_X,P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
259-
if(plane==CANON_PLANE_XY) {
259+
if(plane==CANON_PLANE::XY) {
260260
STRAIGHT_FEED(line_number, P1.NURBS_X, P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
261261
}
262-
if(plane==CANON_PLANE_YZ) {
262+
if(plane==CANON_PLANE::YZ) {
263263
STRAIGHT_FEED(line_number, _pos_x, P1.NURBS_X, P1.NURBS_Y, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
264264
}
265-
if(plane==CANON_PLANE_XZ) {
265+
if(plane==CANON_PLANE::XZ) {
266266
STRAIGHT_FEED(line_number, P1.NURBS_Y, _pos_y, P1.NURBS_X, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
267267
}
268268
u=0.1;
269269
while (u+umax/div < umax) {
270270
P1x = nurbs_G6_point_x(u+umax/div,k,nurbs_control_points,knot_vector);
271271
//printf("%.3d P1x X: %8.4f Y: %8.4f pos_x: %8.4f pos_y: %8.4f pos_z: %8.4f (F: %s L: %d)\n",line_number,P1x.NURBS_X,P1x.NURBS_Y,_pos_x,_pos_y,_pos_z,__FILE__,__LINE__);
272272
//STRAIGHT_FEED(line_number, P1x.NURBS_X,P1x.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
273-
if(plane==CANON_PLANE_XY) {
273+
if(plane==CANON_PLANE::XY) {
274274
STRAIGHT_FEED(line_number, P1x.NURBS_X, P1x.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
275275
}
276-
if(plane==CANON_PLANE_YZ) {
276+
if(plane==CANON_PLANE::YZ) {
277277
STRAIGHT_FEED(line_number, _pos_x, P1x.NURBS_X, P1x.NURBS_Y, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
278278
}
279-
if(plane==CANON_PLANE_XZ) {
279+
if(plane==CANON_PLANE::XZ) {
280280
STRAIGHT_FEED(line_number, P1x.NURBS_Y, _pos_y, P1x.NURBS_X, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
281281
}
282282
u = u + umax/div;
@@ -285,13 +285,13 @@ void NURBS_G6_FEED(int line_number, std::vector<NURBS_G6_CONTROL_POINT> nurbs_co
285285
P1 = nurbs_G6_pointx(umax,k,nurbs_control_points,knot_vector,A6);
286286
//printf("%.3d P1 X: %8.4f Y: %8.4f pos_x: %8.4f pos_y: %8.4f pos_z: %8.4f (F: %s L: %d)\n",line_number,P1.NURBS_X,P1.NURBS_Y,_pos_x,_pos_y,_pos_z,__FILE__,__LINE__);
287287
//STRAIGHT_FEED(line_number, P1.NURBS_X,P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
288-
if(plane==CANON_PLANE_XY) {
288+
if(plane==CANON_PLANE::XY) {
289289
STRAIGHT_FEED(line_number, P1.NURBS_X, P1.NURBS_Y, _pos_z, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
290290
}
291-
if(plane==CANON_PLANE_YZ) {
291+
if(plane==CANON_PLANE::YZ) {
292292
STRAIGHT_FEED(line_number, _pos_x, P1.NURBS_X, P1.NURBS_Y, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
293293
}
294-
if(plane==CANON_PLANE_XZ) {
294+
if(plane==CANON_PLANE::XZ) {
295295
STRAIGHT_FEED(line_number, P1.NURBS_Y, _pos_y, P1.NURBS_X, _pos_a, _pos_b, _pos_c, _pos_u, _pos_v, _pos_w);
296296
}
297297
knot_vector.clear();
@@ -692,7 +692,7 @@ double GET_EXTERNAL_FEED_RATE() { return 1; }
692692
double GET_EXTERNAL_TRAVERSE_RATE() { return 0; }
693693
int GET_EXTERNAL_FLOOD() { return 0; }
694694
int GET_EXTERNAL_MIST() { return 0; }
695-
CANON_PLANE GET_EXTERNAL_PLANE() { return CANON_PLANE_XY; }
695+
CANON_PLANE GET_EXTERNAL_PLANE() { return CANON_PLANE::XY; }
696696
double GET_EXTERNAL_SPEED(int spindle) { return 0; }
697697
void DISABLE_ADAPTIVE_FEED() {}
698698
void ENABLE_ADAPTIVE_FEED() {}

src/emc/rs274ngc/interp_arc.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@
3131

3232
#define _(s) gettext(s)
3333

34-
char Interp::arc_axis1(int plane) {
34+
char Interp::arc_axis1(CANON_PLANE plane) {
3535
switch(plane) {
36-
case CANON_PLANE_XY: return 'X';
37-
case CANON_PLANE_XZ: return 'Z';
38-
case CANON_PLANE_YZ: return 'Y';
36+
case CANON_PLANE::XY: return 'X';
37+
case CANON_PLANE::XZ: return 'Z';
38+
case CANON_PLANE::YZ: return 'Y';
3939
default: return '!';
4040
}
4141
}
4242

43-
char Interp::arc_axis2(int plane) {
43+
char Interp::arc_axis2(CANON_PLANE plane) {
4444
switch(plane) {
45-
case CANON_PLANE_XY: return 'Y';
46-
case CANON_PLANE_XZ: return 'X';
47-
case CANON_PLANE_YZ: return 'Z';
45+
case CANON_PLANE::XY: return 'Y';
46+
case CANON_PLANE::XZ: return 'X';
47+
case CANON_PLANE::YZ: return 'Z';
4848
default: return '!';
4949
}
5050
}
@@ -76,7 +76,7 @@ tool radius from the arc.
7676
*/
7777

7878
int Interp::arc_data_comp_ijk(int move, //!<either G_2 (cw arc) or G_3 (ccw arc)
79-
int plane, //!<active plane
79+
CANON_PLANE plane, //!<active plane
8080
CUTTER_COMP side, //!<either RIGHT or LEFT
8181
double tool_radius, //!<radius of the tool
8282
double current_x, //!<first coordinate of current point
@@ -199,7 +199,7 @@ the pin is inside or outside the hoop.
199199
*/
200200

201201
int Interp::arc_data_comp_r(int move, //!< either G_2 (cw arc) or G_3 (ccw arc)
202-
int plane,
202+
CANON_PLANE plane,
203203
CUTTER_COMP side, //!< either RIGHT or LEFT
204204
double tool_radius, //!< radius of the tool
205205
double current_x, //!< first coordinate of current point
@@ -255,7 +255,7 @@ are handled similarly.
255255
*/
256256

257257
int Interp::arc_data_ijk(int move, //!< either G_2 (cw arc) or G_3 (ccw arc)
258-
int plane,
258+
CANON_PLANE plane,
259259
double current_x, //!< first coordinate of current point
260260
double current_y, //!< second coordinate of current point
261261
double end_x, //!< first coordinate of arc end point
@@ -347,7 +347,7 @@ of the arc lies on a line through M perpendicular to L.
347347
*/
348348

349349
int Interp::arc_data_r(int move, //!< either G_2 (cw arc) or G_3 (ccw arc)
350-
int plane,
350+
CANON_PLANE plane,
351351
double current_x, //!< first coordinate of current point
352352
double current_y, //!< second coordinate of current point
353353
double end_x, //!< first coordinate of arc end point

0 commit comments

Comments
 (0)