1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

Dogbone notches are now optional and can be set in the gnuplot file.

- cameo/cameo.c (main): use getopt
- cameo/cameo.c (main, usage, process_path): option -d to enable dog-bone
  notches (they're now disabled by default)
- cameo/path.h (struct path), cameo/path.c (path_new, path_from): added
  attribute "notch" to enable notches for a path
- cameo/gnuplot.c (gnuplot_read, gnuplot_do_write): read and write the
  #%notch hint
This commit is contained in:
Werner Almesberger
2010-11-01 19:15:35 -03:00
parent d77b4c8570
commit b47ef755ec
4 changed files with 35 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
char buf[1024];
double x, y, z, tmp;
double r_tool = r_tool_default;
int outside = 0;
int outside = 0, notch = 0;
int n;
struct path *paths = NULL, *path = NULL;
struct path **lnk = &paths;
@@ -43,6 +43,8 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
r_tool = tmp;
if (!strcmp(buf, "#%outside\n"))
outside = 1;
if (!strcmp(buf, "#%notch\n"))
notch = 1;
if (*buf == '#')
continue;
n = sscanf(buf, "%lf %lf %lf\n", &x, &y, &z);
@@ -50,7 +52,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
case -1:
path = NULL;
r_tool = r_tool_default;
outside = 0;
outside = notch = 0;
continue;
case 2:
z = 0;
@@ -66,6 +68,7 @@ struct path *gnuplot_read(const char *name, double r_tool_default)
if (!path) {
path = path_new(r_tool);
path->outside = outside;
path->notch = notch;
*lnk = path;
lnk = &path->next;
}
@@ -89,6 +92,8 @@ static int gnuplot_do_write(FILE *file, const struct path *paths)
return 0;
if (path->outside && fprintf(file, "#%%outside\n") < 0)
return 0;
if (path->notch && fprintf(file, "#%%notch\n") < 0)
return 0;
for (p = path->first; p; p = p->next)
if (fprintf(file, "%f %f %f\n", p->x, p->y, p->z) < 0)
return 0;