mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 04:23:20 +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:
parent
c422be5543
commit
c59e39356b
@ -174,6 +174,13 @@ If the current paths have different Z coordinates, each level is
|
||||
processed separately.
|
||||
|
||||
|
||||
Path reversal:
|
||||
|
||||
reverse
|
||||
|
||||
Reverses all paths. This can be used to reverse tool direction.
|
||||
|
||||
|
||||
Drill/mill conversion:
|
||||
|
||||
drill <min-diameter> <max-diameter>
|
||||
|
@ -50,6 +50,7 @@ NUM -?[0-9]+\.?[0-9]*
|
||||
<INITIAL>optimize return TOK_OPTIMIZE;
|
||||
<INITIAL>remainder return TOK_REMAINDER;
|
||||
<INITIAL>reset return TOK_RESET;
|
||||
<INITIAL>reverse return TOK_REVERSE;
|
||||
<INITIAL>rotate return TOK_ROTATE;
|
||||
<INITIAL>stats return TOK_STATS;
|
||||
<INITIAL>translate return TOK_TRANSLATE;
|
||||
|
10
cameo/lang.y
10
cameo/lang.y
@ -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_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_DOG TOK_INSIDE TOK_ANY
|
||||
|
||||
@ -255,6 +255,14 @@ command:
|
||||
{
|
||||
paths = optimize_paths(paths);
|
||||
}
|
||||
| TOK_REVERSE
|
||||
{
|
||||
struct path *tmp;
|
||||
|
||||
tmp = reverse_paths(paths);
|
||||
clear_paths();
|
||||
paths = tmp;
|
||||
}
|
||||
| TOK_ROTATE number
|
||||
{
|
||||
rotate(paths, $2);
|
||||
|
17
cameo/ops.c
17
cameo/ops.c
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* ops.c - Higher-level toolpath operations
|
||||
*
|
||||
* Written 2010-2011 by Werner Almesberger
|
||||
* Copyright 2010-2011 Werner Almesberger
|
||||
* Written 2010-2012 by Werner Almesberger
|
||||
* Copyright 2010-2012 Werner Almesberger
|
||||
*
|
||||
* 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
|
||||
@ -140,3 +140,16 @@ struct path *optimize_paths(struct path *paths)
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* ops.h - Higher-level toolpath operations
|
||||
*
|
||||
* Written 2010-2011 by Werner Almesberger
|
||||
* Copyright 2010-2011 Werner Almesberger
|
||||
* Written 2010-2012 by Werner Almesberger
|
||||
* Copyright 2010-2012 Werner Almesberger
|
||||
*
|
||||
* 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
|
||||
@ -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_mill(struct path *path, double diam, double step, int any);
|
||||
struct path *optimize_paths(struct path *paths);
|
||||
struct path *reverse_paths(const struct path *paths);
|
||||
|
||||
#endif /* !OPS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user