mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 09:55:32 +02:00
gp2rml/gp2rml.c: allow unit of Z clearance (mm) to be specified explictly
This commit is contained in:
parent
50918a26fd
commit
00166f3751
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* gp2rml.c - Convert from gnuplot to RML
|
* gp2rml.c - Convert from gnuplot to RML
|
||||||
*
|
*
|
||||||
* Written 2010 by Werner Almesberger
|
* Written 2010-2011 by Werner Almesberger
|
||||||
* Copyright 2010 Werner Almesberger
|
* Copyright 2010-2011 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
|
||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
@ -178,8 +179,9 @@ static void output_paths(double z_clear, double xy_speed, double z_speed)
|
|||||||
static void usage(const char *name)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s z_clear xy_speed z_speed [file]\n\n"
|
"usage: %s z_clear[mm] xy_speed z_speed [file]\n\n"
|
||||||
" z_clear clearance above the highest peak, in mm (must be > 0)\n"
|
" z_clear clearance above the highest peak, in mm (must be > 0)\n"
|
||||||
|
" Unit (\"mm\") can optionally be specified\n"
|
||||||
" xy_speed cutting speed, in mm/s\n"
|
" xy_speed cutting speed, in mm/s\n"
|
||||||
" z_speed vertical speed when lowering the pen, in mm/s\n"
|
" z_speed vertical speed when lowering the pen, in mm/s\n"
|
||||||
, name);
|
, name);
|
||||||
@ -210,6 +212,12 @@ int main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
for (i = 0; i != 3; i++) {
|
for (i = 0; i != 3; i++) {
|
||||||
p[i] = strtod(argv[i+1], &end);
|
p[i] = strtod(argv[i+1], &end);
|
||||||
|
/*
|
||||||
|
* Allow the clearance to have a unit, for consistency in
|
||||||
|
* mkmk-simple
|
||||||
|
*/
|
||||||
|
if (!i && *end && !strcmp(end, "mm"))
|
||||||
|
continue;
|
||||||
if (*end || p[i] <= 0)
|
if (*end || p[i] <= 0)
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user