mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-01-05 20:30:16 +02:00
cameo: cleaned up and documented the tool compensation
- README, lang.l, lang.y: renamed the "tool" command to "offset" - README: documented "offset" - ops.h, ops.c (tool_comp_paths), cameo.c (main), lang.y: added parameter to tool_comp_paths to treat all paths as internal - lang.l, lang.y: added option "inside" to the "offset" command - lang.y: "offset" can now take multiple options in any order
This commit is contained in:
parent
68d5eff7cd
commit
3ae3d6cdd3
13
cameo/README
13
cameo/README
@ -110,4 +110,15 @@ Vertical adjustment:
|
|||||||
|
|
||||||
Tool compensation:
|
Tool compensation:
|
||||||
|
|
||||||
tool [dog]
|
offset [dog] [inside]
|
||||||
|
|
||||||
|
"offset" offsets the toolpaths by the tool radius. By default, it offsets
|
||||||
|
the outermost toolpath to the outside and all other toolpaths to the
|
||||||
|
inside. This can be overridden with the #%outside directive in a gnuplot
|
||||||
|
file or the "inside" option to "offset". "inside" has precedence over
|
||||||
|
"#%outside".
|
||||||
|
|
||||||
|
Concave corners on an outside path are normally cut such that the corner
|
||||||
|
is round, leaving material at and near the corner point. The option "dog"
|
||||||
|
changes this to cutting a "dogbone" hole such that material is also
|
||||||
|
removed up to the corner point.
|
||||||
|
@ -100,7 +100,7 @@ int main(int argc, char **argv)
|
|||||||
paths = gerber_read(in, r);
|
paths = gerber_read(in, r);
|
||||||
else
|
else
|
||||||
paths = gnuplot_read(in, r);
|
paths = gnuplot_read(in, r);
|
||||||
tool_comp_paths(paths, dog_bone);
|
tool_comp_paths(paths, dog_bone, 0);
|
||||||
gnuplot_write(out, paths);
|
gnuplot_write(out, paths);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -43,7 +43,7 @@ NUM -?[0-9]+\.?[0-9]*
|
|||||||
<INITIAL>array return TOK_ARRAY;
|
<INITIAL>array return TOK_ARRAY;
|
||||||
<INITIAL>clear return TOK_CLEAR;
|
<INITIAL>clear return TOK_CLEAR;
|
||||||
<INITIAL>reset return TOK_RESET;
|
<INITIAL>reset return TOK_RESET;
|
||||||
<INITIAL>tool return TOK_TOOL;
|
<INITIAL>offset return TOK_OFFSET;
|
||||||
<INITIAL>translate return TOK_TRANSLATE;
|
<INITIAL>translate return TOK_TRANSLATE;
|
||||||
<INITIAL>z return TOK_Z;
|
<INITIAL>z return TOK_Z;
|
||||||
|
|
||||||
@ -55,6 +55,7 @@ NUM -?[0-9]+\.?[0-9]*
|
|||||||
return TOK_WRITE; }
|
return TOK_WRITE; }
|
||||||
|
|
||||||
<INITIAL>dog return TOK_DOG;
|
<INITIAL>dog return TOK_DOG;
|
||||||
|
<INITIAL>inside return TOK_INSIDE;
|
||||||
|
|
||||||
<INITIAL>mm metric = 1;
|
<INITIAL>mm metric = 1;
|
||||||
<INITIAL>mil metric = 0;
|
<INITIAL>mil metric = 0;
|
||||||
|
40
cameo/lang.y
40
cameo/lang.y
@ -113,19 +113,24 @@ static void align(int ref, double x, double y)
|
|||||||
%union {
|
%union {
|
||||||
double num;
|
double num;
|
||||||
char *str;
|
char *str;
|
||||||
|
enum {
|
||||||
|
OO_DOG = 1 << 0,
|
||||||
|
OO_INSIDE = 1 << 1,
|
||||||
|
} oopt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
%token TOK_ALIGN TOK_ARRAY TOK_CLEAR TOK_RESET TOK_TOOL
|
%token TOK_ALIGN TOK_ARRAY TOK_CLEAR TOK_RESET TOK_OFFSET
|
||||||
%token TOK_TRANSLATE TOK_Z
|
%token TOK_TRANSLATE TOK_Z
|
||||||
%token TOK_GERBER TOK_GNUPLOT TOK_WRITE
|
%token TOK_GERBER TOK_GNUPLOT TOK_WRITE
|
||||||
%token TOK_DOG
|
%token TOK_DOG TOK_INSIDE
|
||||||
|
|
||||||
%token <num> NUM_EXP_MIL NUM_EXP_MM NUM_IMP_MIL NUM_IMP_MM REF
|
%token <num> NUM_EXP_MIL NUM_EXP_MM NUM_IMP_MIL NUM_IMP_MM REF
|
||||||
%token <str> STRING
|
%token <str> STRING
|
||||||
|
|
||||||
%type <str> opt_filename
|
%type <str> opt_filename
|
||||||
%type <num> dimen number
|
%type <num> dimen number
|
||||||
|
%type <oopt> offset_options offset_option
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@ -172,13 +177,10 @@ command:
|
|||||||
{
|
{
|
||||||
xo = yo = 0;
|
xo = yo = 0;
|
||||||
}
|
}
|
||||||
| TOK_TOOL
|
| TOK_OFFSET offset_options
|
||||||
{
|
{
|
||||||
tool_comp_paths(paths, 0);
|
tool_comp_paths(paths,
|
||||||
}
|
!!($2 & OO_DOG), !!($2 & OO_INSIDE));
|
||||||
| TOK_TOOL TOK_DOG
|
|
||||||
{
|
|
||||||
tool_comp_paths(paths, 1);
|
|
||||||
}
|
}
|
||||||
| TOK_TRANSLATE dimen dimen
|
| TOK_TRANSLATE dimen dimen
|
||||||
{
|
{
|
||||||
@ -251,3 +253,25 @@ number:
|
|||||||
$$ = $1;
|
$$ = $1;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
offset_options:
|
||||||
|
{
|
||||||
|
$$ = 0;
|
||||||
|
}
|
||||||
|
| offset_option offset_options
|
||||||
|
{
|
||||||
|
$$ = $1 | $2;
|
||||||
|
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
offset_option:
|
||||||
|
TOK_DOG
|
||||||
|
{
|
||||||
|
$$ = OO_DOG;
|
||||||
|
}
|
||||||
|
| TOK_INSIDE
|
||||||
|
{
|
||||||
|
$$ = OO_INSIDE;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
@ -29,7 +29,7 @@ static void tool_comp_1(struct path *path, int inside, int dog_bone)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void tool_comp_paths(struct path *paths, int dog_bone)
|
void tool_comp_paths(struct path *paths, int dog_bone, int all_inside)
|
||||||
{
|
{
|
||||||
struct path *leftmost, *path;
|
struct path *leftmost, *path;
|
||||||
|
|
||||||
@ -46,10 +46,11 @@ void tool_comp_paths(struct path *paths, int dog_bone)
|
|||||||
|
|
||||||
leftmost = path_find_leftmost(paths);
|
leftmost = path_find_leftmost(paths);
|
||||||
for (path = paths; path; path = path->next)
|
for (path = paths; path; path = path->next)
|
||||||
if (path != leftmost && !path->outside)
|
if (path != leftmost && (all_inside || !path->outside))
|
||||||
tool_comp_1(path, 1, dog_bone);
|
tool_comp_1(path, 1, dog_bone);
|
||||||
|
if (!all_inside)
|
||||||
for (path = paths; path; path = path->next)
|
for (path = paths; path; path = path->next)
|
||||||
if (path != leftmost && path->outside)
|
if (path != leftmost && path->outside)
|
||||||
tool_comp_1(path, 0, dog_bone);
|
tool_comp_1(path, 0, dog_bone);
|
||||||
tool_comp_1(leftmost, 0, dog_bone);
|
tool_comp_1(leftmost, !all_inside, dog_bone);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,6 @@
|
|||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
|
|
||||||
void tool_comp_paths(struct path *paths, int dog_bone);
|
void tool_comp_paths(struct path *paths, int dog_bone, int all_inside);
|
||||||
|
|
||||||
#endif /* !OPS_H */
|
#endif /* !OPS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user