1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 08:39:33 +02:00

cameo: new command "reverse" to reverse all paths

Experimentally used to reverse tool direction in the smoothing pass.
This commit is contained in:
Werner Almesberger 2012-03-21 20:31:29 -03:00
parent c422be5543
commit c59e39356b
5 changed files with 36 additions and 6 deletions

View File

@ -174,6 +174,13 @@ If the current paths have different Z coordinates, each level is
processed separately. processed separately.
Path reversal:
reverse
Reverses all paths. This can be used to reverse tool direction.
Drill/mill conversion: Drill/mill conversion:
drill <min-diameter> <max-diameter> drill <min-diameter> <max-diameter>

View File

@ -50,6 +50,7 @@ NUM -?[0-9]+\.?[0-9]*
<INITIAL>optimize return TOK_OPTIMIZE; <INITIAL>optimize return TOK_OPTIMIZE;
<INITIAL>remainder return TOK_REMAINDER; <INITIAL>remainder return TOK_REMAINDER;
<INITIAL>reset return TOK_RESET; <INITIAL>reset return TOK_RESET;
<INITIAL>reverse return TOK_REVERSE;
<INITIAL>rotate return TOK_ROTATE; <INITIAL>rotate return TOK_ROTATE;
<INITIAL>stats return TOK_STATS; <INITIAL>stats return TOK_STATS;
<INITIAL>translate return TOK_TRANSLATE; <INITIAL>translate return TOK_TRANSLATE;

View File

@ -189,7 +189,7 @@ static struct path **classify(struct path **anchor, struct path *path)
%token TOK_ALIGN TOK_ARRAY TOK_CLEAR TOK_DRILL TOK_EMPTY TOK_AREA %token TOK_ALIGN TOK_ARRAY TOK_CLEAR TOK_DRILL TOK_EMPTY TOK_AREA
%token TOK_MILL TOK_OFFSET TOK_OPTIMIZE TOK_REMAINDER TOK_RESET %token TOK_MILL TOK_OFFSET TOK_OPTIMIZE TOK_REMAINDER TOK_RESET
%token TOK_ROTATE TOK_STATS TOK_TRANSLATE TOK_Z %token TOK_REVERSE TOK_ROTATE TOK_STATS TOK_TRANSLATE TOK_Z
%token TOK_APPEND TOK_GERBER TOK_GNUPLOT TOK_EXCELLON TOK_WRITE %token TOK_APPEND TOK_GERBER TOK_GNUPLOT TOK_EXCELLON TOK_WRITE
%token TOK_DOG TOK_INSIDE TOK_ANY %token TOK_DOG TOK_INSIDE TOK_ANY
@ -255,6 +255,14 @@ command:
{ {
paths = optimize_paths(paths); paths = optimize_paths(paths);
} }
| TOK_REVERSE
{
struct path *tmp;
tmp = reverse_paths(paths);
clear_paths();
paths = tmp;
}
| TOK_ROTATE number | TOK_ROTATE number
{ {
rotate(paths, $2); rotate(paths, $2);

View File

@ -1,8 +1,8 @@
/* /*
* ops.c - Higher-level toolpath operations * ops.c - Higher-level toolpath operations
* *
* Written 2010-2011 by Werner Almesberger * Written 2010-2012 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger * Copyright 2010-2012 Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -140,3 +140,16 @@ struct path *optimize_paths(struct path *paths)
} }
return res; return res;
} }
struct path *reverse_paths(const struct path *paths)
{
const struct path *path;
struct path *res = NULL, **last = &res;
for (path = paths; path; path = path->next) {
*last = path_reverse(path);
last = &(*last)->next;
}
return res;
}

View File

@ -1,8 +1,8 @@
/* /*
* ops.h - Higher-level toolpath operations * ops.h - Higher-level toolpath operations
* *
* Written 2010-2011 by Werner Almesberger * Written 2010-2012 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger * Copyright 2010-2012 Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,5 +22,6 @@ struct path *tool_comp_paths(const struct path *paths, int dog_bone,
struct path *try_drill(struct path *path, double d_min, double d_max); struct path *try_drill(struct path *path, double d_min, double d_max);
struct path *try_mill(struct path *path, double diam, double step, int any); struct path *try_mill(struct path *path, double diam, double step, int any);
struct path *optimize_paths(struct path *paths); struct path *optimize_paths(struct path *paths);
struct path *reverse_paths(const struct path *paths);
#endif /* !OPS_H */ #endif /* !OPS_H */