Date:2012-03-22 00:31:29 (12 years 6 days ago)
Author:Werner Almesberger
Commit:c59e39356b1fc9d46ec2f95858c3217c5551dc65
Message:cameo: new command "reverse" to reverse all paths

Experimentally used to reverse tool direction in the smoothing pass.
Files: cameo/README (2 diffs)
cameo/lang.l (1 diff)
cameo/lang.y (2 diffs)
cameo/ops.c (2 diffs)
cameo/ops.h (2 diffs)

Change Details

cameo/README
137137Vertical adjustment:
138138
139139  z [<z0>] <z0-pos>
140
140
141141
142142Tool compensation:
143143
...... 
174174processed separately.
175175
176176
177Path reversal:
178
179  reverse
180
181Reverses all paths. This can be used to reverse tool direction.
182
183
177184Drill/mill conversion:
178185
179186  drill <min-diameter> <max-diameter>
cameo/lang.l
5050<INITIAL>optimize return TOK_OPTIMIZE;
5151<INITIAL>remainder return TOK_REMAINDER;
5252<INITIAL>reset return TOK_RESET;
53<INITIAL>reverse return TOK_REVERSE;
5354<INITIAL>rotate return TOK_ROTATE;
5455<INITIAL>stats return TOK_STATS;
5556<INITIAL>translate return TOK_TRANSLATE;
cameo/lang.y
189189
190190%token TOK_ALIGN TOK_ARRAY TOK_CLEAR TOK_DRILL TOK_EMPTY TOK_AREA
191191%token TOK_MILL TOK_OFFSET TOK_OPTIMIZE TOK_REMAINDER TOK_RESET
192%token TOK_ROTATE TOK_STATS TOK_TRANSLATE TOK_Z
192%token TOK_REVERSE TOK_ROTATE TOK_STATS TOK_TRANSLATE TOK_Z
193193%token TOK_APPEND TOK_GERBER TOK_GNUPLOT TOK_EXCELLON TOK_WRITE
194194%token TOK_DOG TOK_INSIDE TOK_ANY
195195
...... 
255255        {
256256            paths = optimize_paths(paths);
257257        }
258    | TOK_REVERSE
259        {
260            struct path *tmp;
261
262            tmp = reverse_paths(paths);
263            clear_paths();
264            paths = tmp;
265        }
258266    | TOK_ROTATE number
259267        {
260268            rotate(paths, $2);
cameo/ops.c
11/*
22 * ops.c - Higher-level toolpath operations
33 *
4 * Written 2010-2011 by Werner Almesberger
5 * Copyright 2010-2011 Werner Almesberger
4 * Written 2010-2012 by Werner Almesberger
5 * Copyright 2010-2012 Werner Almesberger
66 *
77 * This program is free software; you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
...... 
140140    }
141141    return res;
142142}
143
144
145struct path *reverse_paths(const struct path *paths)
146{
147    const struct path *path;
148    struct path *res = NULL, **last = &res;
149
150    for (path = paths; path; path = path->next) {
151        *last = path_reverse(path);
152        last = &(*last)->next;
153    }
154    return res;
155}
cameo/ops.h
11/*
22 * ops.h - Higher-level toolpath operations
33 *
4 * Written 2010-2011 by Werner Almesberger
5 * Copyright 2010-2011 Werner Almesberger
4 * Written 2010-2012 by Werner Almesberger
5 * Copyright 2010-2012 Werner Almesberger
66 *
77 * This program is free software; you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
...... 
2222struct path *try_drill(struct path *path, double d_min, double d_max);
2323struct path *try_mill(struct path *path, double diam, double step, int any);
2424struct path *optimize_paths(struct path *paths);
25struct path *reverse_paths(const struct path *paths);
2526
2627#endif /* !OPS_H */

Archive Download the corresponding diff file

Branches:
master



interactive