[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (4b37816d8a624fdac5dafa20aaf3d3188c555215)
The branch, master has been updated
via 4b37816d8a624fdac5dafa20aaf3d3188c555215 (commit)
via 23120603bd4385e8fedfc5ee84e76ebf8ffe5ccf (commit)
via 4ce9c6e97a67697b5738311c0c2e5ed81ea5f265 (commit)
via 1121e999a2d094d45a8fe11d0c21e0f4d1572bc5 (commit)
from 1ca5edbb19136e62131eee0192b48dc33cc73895 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/hid/gcode/gcode.c | 683 +++++++++++++++++++++++++++----------------------
src/hid/gcode/trace.c | 12 +-
src/hid/gcode/trace.h | 3 +-
3 files changed, 386 insertions(+), 312 deletions(-)
=================
Commit Messages
=================
commit 4b37816d8a624fdac5dafa20aaf3d3188c555215
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: Avoid more than one G or M code per line for advanced G-code.
Some primitive G-code interpreters can't deal with multiple
G or M codes in one line, so avoid them at no cost. Alberto Maccioni
asked on geda-user make this optional.
Affects-bug: lp-699497
:100644 100644 1bf0fd9... a5a6dcb... M src/hid/gcode/gcode.c
commit 23120603bd4385e8fedfc5ee84e76ebf8ffe5ccf
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: add a flag wether to produce advanced G-code.
Some primitive machine controllers don't understand what a variable
is, while those understanding variables can work without as well.
After all, using variables is just a convenience for later hand-editing
of the G-code programs. More changes for primitive controllers are
to come.
Affects-bug: lp-699497
:100644 100644 f2e37bd... 1bf0fd9... M src/hid/gcode/gcode.c
:100644 100644 7fb9012... 5d7c62e... M src/hid/gcode/trace.c
:100644 100644 2a07e61... d55fd3e... M src/hid/gcode/trace.h
commit 4ce9c6e97a67697b5738311c0c2e5ed81ea5f265
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: create better file names.
If the user adds a suffix to a file name in the dialog, he expects
the resulting files to have these suffixes as well.
This patch is a combination of the following two patches by Markus Hitter.
0001-HID-gcode-let-the-system-library-allocate-the-tempor.patch
0004-HID-gcode-create-better-file-names.patch
The original patches are avaiable at the bug-report on
launchpad lp-699497. The combination and modifications where done by Felix
Ruoff.
Affects-bug: lp-699497
:100644 100644 676ea94... f2e37bd... M src/hid/gcode/gcode.c
commit 1121e999a2d094d45a8fe11d0c21e0f4d1572bc5
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: get rid of tabulators in gcode.c. Pure whitespace change.
Developers should decide wether to use tabs or not, but not mix both.
Rebased to git head by Felix Ruoff
Affects-bug: lp-699497
:100644 100644 44a71fe... 676ea94... M src/hid/gcode/gcode.c
=========
Changes
=========
commit 4b37816d8a624fdac5dafa20aaf3d3188c555215
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: Avoid more than one G or M code per line for advanced G-code.
Some primitive G-code interpreters can't deal with multiple
G or M codes in one line, so avoid them at no cost. Alberto Maccioni
asked on geda-user make this optional.
Affects-bug: lp-699497
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 1bf0fd9..a5a6dcb 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -553,10 +553,16 @@ gcode_do_export (HID_Attr_Val * options)
variable_safeZ, gcode_safeZ);
fprintf (gcode_f2, "%s=%f (cutting depth)\n",
variable_cutdepth, gcode_cutdepth);
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
+ }
+ else
+ {
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17\nG%d\nG90\nG64 P0.003\nM3 S3000\nM7\nF%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
}
- fprintf (gcode_f2, "(---------------------------------)\n");
- fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
- metric ? 21 : 20, metric ? 25 : 1);
fprintf (gcode_f2, "G0 Z%s\n", variable_safeZ);
/* extract contour points from image */
r = bm_to_pathlist (bm, &plist, ¶m_default);
@@ -580,7 +586,10 @@ gcode_do_export (HID_Attr_Val * options)
else
fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
25.4 * d, d);
- fprintf (gcode_f2, "M5 M9 M2\n");
+ if (gcode_advanced)
+ fprintf (gcode_f2, "M5 M9 M2\n");
+ else
+ fprintf (gcode_f2, "M5\nM9\nM2\n");
pathlist_free (plist);
bm_free (bm);
fclose (gcode_f2);
@@ -611,10 +620,16 @@ gcode_do_export (HID_Attr_Val * options)
variable_safeZ, gcode_safeZ);
fprintf (gcode_f2, "%s=%f (drill depth)\n",
variable_drilldepth, gcode_drilldepth);
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
+ }
+ else
+ {
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17\nG%d\nG90\nG64 P0.003\nM3 S3000\nM7\nF%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
}
- fprintf (gcode_f2, "(---------------------------------)\n");
- fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
- metric ? 21 : 20, metric ? 25 : 1);
/* fprintf(gcode_f2,"G0 Z%s\n",variable_safeZ); */
for (r = 0; r < n_drill; r++)
{
@@ -637,7 +652,10 @@ gcode_do_export (HID_Attr_Val * options)
(drill[r].y - drill[r - 1].y) * (drill[r].y -
drill[r - 1].y));
}
- fprintf (gcode_f2, "M5 M9 M2\n");
+ if (gcode_advanced)
+ fprintf (gcode_f2, "M5 M9 M2\n");
+ else
+ fprintf (gcode_f2, "M5\nM9\nM2\n");
fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
25.4 * d, d);
fclose (gcode_f2);
commit 23120603bd4385e8fedfc5ee84e76ebf8ffe5ccf
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: add a flag wether to produce advanced G-code.
Some primitive machine controllers don't understand what a variable
is, while those understanding variables can work without as well.
After all, using variables is just a convenience for later hand-editing
of the G-code programs. More changes for primitive controllers are
to come.
Affects-bug: lp-699497
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index f2e37bd..1bf0fd9 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -123,6 +123,7 @@ static double gcode_cutdepth = 0; /* milling depth (inch) */
static double gcode_drilldepth = 0; /* drilling depth (inch) */
static double gcode_safeZ = 100; /* safe Z (inch) */
static double gcode_toolradius = 0; /* tool radius(inch) */
+static char gcode_advanced = 0;
static int save_drill = 0;
static int n_drill = 0;
static int nmax_drill = 0;
@@ -173,6 +174,12 @@ HID_Attribute gcode_attribute_list[] = {
HID_Unit, 0, 0, {-1, 0, 0}, units, 0},
#define HA_unit 6
+ {"advanced-gcode", "wether to produce G-code for advanced interpreters,\n"
+ "like using variables for often used values. Not all\n"
+ "machine controllers understand this, but it allows\n"
+ "better hand-editing of the resulting files",
+ HID_Boolean, 0, 0, {-1, 0, 0}, 0, 0},
+#define HA_advanced 7
};
#define NUM_OPTIONS (sizeof(gcode_attribute_list)/sizeof(gcode_attribute_list[0]))
@@ -419,6 +426,8 @@ gcode_do_export (HID_Attr_Val * options)
0.0, /* granularity */
},
};
+ char variable_safeZ[20], variable_cutdepth[20];
+ char variable_drilldepth[20];
if (!options)
{
@@ -451,13 +460,25 @@ gcode_do_export (HID_Attr_Val * options)
gcode_toolradius = metric
? MM_TO_COORD(options[HA_toolradius].real_value * scale)
: INCH_TO_COORD(options[HA_toolradius].real_value * scale);
+ gcode_advanced = options[HA_advanced].int_value;
gcode_choose_groups ();
+ if (gcode_advanced)
+ {
+ strcpy (variable_safeZ, "#100");
+ strcpy (variable_cutdepth, "#101");
+ strcpy (variable_drilldepth, "#102");
+ }
+ else
+ {
+ snprintf (variable_safeZ, 20, "%f", gcode_safeZ);
+ snprintf (variable_cutdepth, 20, "%f", gcode_cutdepth);
+ snprintf (variable_drilldepth, 20, "%f", gcode_drilldepth);
+ }
for (i = 0; i < MAX_LAYER; i++)
{
if (gcode_export_group[i])
{
-
gcode_cur_group = i;
/* magic */
@@ -526,12 +547,17 @@ gcode_do_export (HID_Attr_Val * options)
pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
else
pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
- fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
- fprintf (gcode_f2, "#101=%f (cutting depth)\n", gcode_cutdepth);
+ if (gcode_advanced)
+ {
+ fprintf (gcode_f2, "%s=%f (safe Z)\n",
+ variable_safeZ, gcode_safeZ);
+ fprintf (gcode_f2, "%s=%f (cutting depth)\n",
+ variable_cutdepth, gcode_cutdepth);
+ }
fprintf (gcode_f2, "(---------------------------------)\n");
fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
metric ? 21 : 20, metric ? 25 : 1);
- fprintf (gcode_f2, "G0 Z#100\n");
+ fprintf (gcode_f2, "G0 Z%s\n", variable_safeZ);
/* extract contour points from image */
r = bm_to_pathlist (bm, &plist, ¶m_default);
if (r)
@@ -540,9 +566,9 @@ gcode_do_export (HID_Attr_Val * options)
return;
}
/* generate best polygon and write vertices in g-code format */
- d =
- process_path (plist, ¶m_default, bm, gcode_f2,
- metric ? 25.4 / gcode_dpi : 1.0 / gcode_dpi);
+ d = process_path (plist, ¶m_default, bm, gcode_f2,
+ metric ? 25.4 / gcode_dpi : 1.0 / gcode_dpi,
+ variable_cutdepth, variable_safeZ);
if (d < 0)
{
fprintf (stderr, "ERROR: path process function failed\n");
@@ -579,25 +605,31 @@ gcode_do_export (HID_Attr_Val * options)
pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
else
pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
- fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
- fprintf (gcode_f2, "#101=%f (drill depth)\n",
- gcode_drilldepth);
+ if (gcode_advanced)
+ {
+ fprintf (gcode_f2, "%s=%f (safe Z)\n",
+ variable_safeZ, gcode_safeZ);
+ fprintf (gcode_f2, "%s=%f (drill depth)\n",
+ variable_drilldepth, gcode_drilldepth);
+ }
fprintf (gcode_f2, "(---------------------------------)\n");
fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
metric ? 21 : 20, metric ? 25 : 1);
-/* fprintf(gcode_f2,"G0 Z#100\n"); */
+/* fprintf(gcode_f2,"G0 Z%s\n",variable_safeZ); */
for (r = 0; r < n_drill; r++)
{
/* if(metric) fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x*25.4,drill[r].y*25.4); */
/* else fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x,drill[r].y); */
if (metric)
- fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
- drill[r].x * 25.4, drill[r].y * 25.4);
+ fprintf (gcode_f2, "G81 X%f Y%f Z%s R%s\n",
+ drill[r].x * 25.4, drill[r].y * 25.4,
+ variable_drilldepth, variable_safeZ);
else
- fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
- drill[r].x, drill[r].y);
-/* fprintf(gcode_f2,"G1 Z#101\n"); */
-/* fprintf(gcode_f2,"G0 Z#100\n"); */
+ fprintf (gcode_f2, "G81 X%f Y%f Z%s R%s\n",
+ drill[r].x, drill[r].y,
+ variable_drilldepth, variable_safeZ);
+/* fprintf(gcode_f2,"G1 Z%s\n",variable_depth); */
+/* fprintf(gcode_f2,"G0 Z%s\n",variable_safeZ); */
if (r > 0)
d +=
sqrt ((drill[r].x - drill[r - 1].x) * (drill[r].x -
diff --git a/src/hid/gcode/trace.c b/src/hid/gcode/trace.c
index 7fb9012..5d7c62e 100644
--- a/src/hid/gcode/trace.c
+++ b/src/hid/gcode/trace.c
@@ -1401,7 +1401,8 @@ malloc_error:
/* ---------------------------------------------------------------------- */
double
-plotpolygon (privpath_t * pp, FILE * f, double scale)
+plotpolygon (privpath_t * pp, FILE * f, double scale, const char *var_cutdepth,
+ const char *var_safeZ)
{
int i;
int m = pp->m;
@@ -1418,7 +1419,7 @@ plotpolygon (privpath_t * pp, FILE * f, double scale)
fprintf (f, "G0 X%f Y%f (start point)\n", pt[po[0]].x * scale,
pt[po[0]].y * scale);
- fprintf (f, "G1 Z#101\n");
+ fprintf (f, "G1 Z%s\n", var_cutdepth);
for (i = 1; i < m; i++)
{
fprintf (f, "G1 X%f Y%f\n", pt[po[i]].x * scale, pt[po[i]].y * scale);
@@ -1432,7 +1433,7 @@ plotpolygon (privpath_t * pp, FILE * f, double scale)
scale);
}
fprintf (f, "G1 X%f Y%f\n", pt[po[0]].x * scale, pt[po[0]].y * scale);
- fprintf (f, "G0 Z#100\n");
+ fprintf (f, "G0 Z%s\n", var_safeZ);
dm +=
sqrt ((pt[po[m - 1]].x - pt[po[0]].x) * scale * (pt[po[m - 1]].x -
pt[po[0]].x) * scale +
@@ -1447,7 +1448,8 @@ plotpolygon (privpath_t * pp, FILE * f, double scale)
/* return distance on success, -1 on error with errno set. */
double
process_path (path_t * plist, const potrace_param_t * param,
- const potrace_bitmap_t * bm, FILE * f, double scale)
+ const potrace_bitmap_t * bm, FILE * f, double scale,
+ const char *var_cutdepth, const char *var_safeZ)
{
path_t *p;
double dm = 0;
@@ -1460,7 +1462,7 @@ process_path (path_t * plist, const potrace_param_t * param,
TRY (bestpolygon (p->priv));
TRY (adjust_vertices (p->priv));
fprintf (f, "(polygon %d)\n", ++n);
- dm += plotpolygon (p->priv, f, scale);
+ dm += plotpolygon (p->priv, f, scale, var_cutdepth, var_safeZ);
/* No need to extract curves
TRY(smooth(&p->priv->curve, p->sign, param->alphamax));
if (param->opticurve) {
diff --git a/src/hid/gcode/trace.h b/src/hid/gcode/trace.h
index 2a07e61..d55fd3e 100644
--- a/src/hid/gcode/trace.h
+++ b/src/hid/gcode/trace.h
@@ -10,6 +10,7 @@
#include "potracelib.h"
double process_path (path_t * plist, const potrace_param_t * param,
- const potrace_bitmap_t * bm, FILE * f, double scale);
+ const potrace_bitmap_t * bm, FILE * f, double scale,
+ const char *var_cutdepth, const char *var_safeZ);
#endif /* TRACE_H */
commit 4ce9c6e97a67697b5738311c0c2e5ed81ea5f265
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: create better file names.
If the user adds a suffix to a file name in the dialog, he expects
the resulting files to have these suffixes as well.
This patch is a combination of the following two patches by Markus Hitter.
0001-HID-gcode-let-the-system-library-allocate-the-tempor.patch
0004-HID-gcode-create-better-file-names.patch
The original patches are avaiable at the bug-report on
launchpad lp-699497. The combination and modifications where done by Felix
Ruoff.
Affects-bug: lp-699497
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 676ea94..f2e37bd 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -113,7 +113,7 @@ static int gcode_export_group[MAX_LAYER];
/* Group that is currently exported. */
static int gcode_cur_group;
-/* Filename prefix that will be used when saving files. */
+/* Filename prefix and suffix that will be used when saving files. */
static const char *gcode_basename = NULL;
/* Horizontal DPI (grid points per inch) */
@@ -144,7 +144,8 @@ static const char *units[] = {
HID_Attribute gcode_attribute_list[] = {
/* other HIDs expect this to be first. */
- {"basename", "File name prefix",
+ {"basename", "File name prefix and suffix,\n"
+ "layer names will be inserted before the suffix",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_basename 0
@@ -187,10 +188,28 @@ static int pcb_to_gcode (int pcb)
return round(COORD_TO_INCH(pcb) * gcode_dpi);
}
-static char *
-gcode_get_png_name (const char *basename, const char *suffix)
+/* Fits the given layer name into basename, just before the suffix */
+static void
+gcode_get_filename (char *filename, const char *layername)
{
- return g_strdup_printf ("%s.%s.png", basename, suffix);
+ char *pt;
+ char suffix[MAXPATHLEN];
+
+ suffix[0] = '\0';
+ pt = strrchr (gcode_basename, '.');
+ if (pt && pt > strrchr (gcode_basename, '/'))
+ strcpy (suffix, pt);
+ else
+ pt = NULL;
+
+ strcpy (filename, gcode_basename);
+ if (pt)
+ *(filename + (pt - gcode_basename)) = '\0';
+ strcat (filename, "-");
+ strcat (filename, layername);
+ strcat (filename, suffix);
+
+ // result is in char *filename
}
/* Sorts drills in order of distance from the origin */
@@ -318,12 +337,15 @@ gcode_alloc_colors ()
}
static void
-gcode_start_png (const char *basename, const char *suffix)
+gcode_start_png (const char *layername)
{
int h, w;
- char *buf;
+ char *png_filename, *buf;
- buf = gcode_get_png_name (basename, suffix);
+ png_filename = (char *)malloc (MAXPATHLEN);
+ gcode_get_filename (png_filename, layername);
+ buf = g_strdup_printf ("%s.png", png_filename);
+ free(png_filename);
h = pcb_to_gcode (PCB->MaxHeight);
w = pcb_to_gcode (PCB->MaxWidth);
@@ -410,7 +432,7 @@ gcode_do_export (HID_Attr_Val * options)
gcode_basename = options[HA_basename].str_value;
if (!gcode_basename)
{
- gcode_basename = "pcb-out";
+ gcode_basename = "pcb-out.gcode";
}
gcode_dpi = options[HA_dpi].int_value;
if (gcode_dpi < 0)
@@ -446,7 +468,7 @@ gcode_do_export (HID_Attr_Val * options)
(GetLayerGroupNumberByNumber (idx) ==
GetLayerGroupNumberByNumber (solder_silk_layer)) ? 1 : 0;
save_drill = is_solder; /* save drills for one layer only */
- gcode_start_png (gcode_basename, layer_type_to_file_name (idx, FNS_fixed));
+ gcode_start_png (layer_type_to_file_name (idx, FNS_fixed));
hid_save_and_show_layer_ons (save_ons);
gcode_start_png_export ();
hid_restore_layer_ons (save_ons);
@@ -474,8 +496,7 @@ gcode_do_export (HID_Attr_Val * options)
}
gdImageDestroy (temp_im);
}
- sprintf (filename, "%s.%s.cnc", gcode_basename,
- layer_type_to_file_name (idx, FNS_fixed));
+ gcode_get_filename (filename, layer_type_to_file_name (idx, FNS_fixed));
for (r = 0; r < gdImageSX (gcode_im); r++)
{
for (c = 0; c < gdImageSY (gcode_im); c++)
@@ -541,7 +562,7 @@ gcode_do_export (HID_Attr_Val * options)
{
d = 0;
drill = sort_drill (drill, n_drill);
- sprintf (filename, "%s.drill.cnc", gcode_basename);
+ gcode_get_filename (filename, "drill");
gcode_f2 = fopen (filename, "wb");
if (!gcode_f2)
{
commit 1121e999a2d094d45a8fe11d0c21e0f4d1572bc5
Author: Markus Hitter <mah@xxxxxxxxxxx>
Commit: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
HID-gcode: get rid of tabulators in gcode.c. Pure whitespace change.
Developers should decide wether to use tabs or not, but not mix both.
Rebased to git head by Felix Ruoff
Affects-bug: lp-699497
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 44a71fe..676ea94 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -119,10 +119,10 @@ static const char *gcode_basename = NULL;
/* Horizontal DPI (grid points per inch) */
static int gcode_dpi = -1;
-static double gcode_cutdepth = 0; /* milling depth (inch) */
-static double gcode_drilldepth = 0; /* drilling depth (inch) */
-static double gcode_safeZ = 100; /* safe Z (inch) */
-static double gcode_toolradius = 0; /* tool radius(inch) */
+static double gcode_cutdepth = 0; /* milling depth (inch) */
+static double gcode_drilldepth = 0; /* drilling depth (inch) */
+static double gcode_safeZ = 100; /* safe Z (inch) */
+static double gcode_toolradius = 0; /* tool radius(inch) */
static int save_drill = 0;
static int n_drill = 0;
static int nmax_drill = 0;
@@ -206,17 +206,17 @@ sort_drill (struct drill_struct *drill, int n_drill)
dmin = 1e20;
imin = 0;
for (i = 0; i < n_drill - j; i++)
- {
- d =
- (drill[i].x - p.x) * (drill[i].x - p.x) + (drill[i].y -
- p.y) * (drill[i].y -
- p.y);
- if (d < dmin)
- {
- imin = i;
- dmin = d;
- }
- }
+ {
+ d =
+ (drill[i].x - p.x) * (drill[i].x - p.x) + (drill[i].y -
+ p.y) * (drill[i].y -
+ p.y);
+ if (d < dmin)
+ {
+ imin = i;
+ dmin = d;
+ }
+ }
/* printf("j=%d imin=%d dmin=%f p=(%f,%f)\n",j,imin,dmin,p.x,p.y); */
temp[j] = drill[imin];
drill[imin] = drill[n_drill - j - 1];
@@ -232,8 +232,8 @@ static void
gcode_parse_arguments (int *argc, char ***argv)
{
hid_register_attributes (gcode_attribute_list,
- sizeof (gcode_attribute_list) /
- sizeof (gcode_attribute_list[0]));
+ sizeof (gcode_attribute_list) /
+ sizeof (gcode_attribute_list[0]));
hid_parse_command_line (argc, argv);
}
@@ -255,8 +255,8 @@ gcode_get_export_options (int *n)
if (PCB)
{
derive_default_filename (PCB->Filename,
- &gcode_attribute_list[HA_basename],
- ".gcode", &last_made_filename);
+ &gcode_attribute_list[HA_basename],
+ ".gcode", &last_made_filename);
}
if (n)
{
@@ -280,23 +280,23 @@ gcode_choose_groups ()
layer = &PCB->Data->Layer[n];
if (layer->LineN || layer->TextN || layer->ArcN || layer->PolygonN)
- {
- /* layer isn't empty */
-
- /*
- * is this check necessary? It seems that special
- * layers have negative indexes?
- */
-
- if (SL_TYPE (n) == 0)
- {
- /* layer is a copper layer */
- m = GetLayerGroupNumberByNumber (n);
-
- /* the export layer */
- gcode_export_group[m] = 1;
- }
- }
+ {
+ /* layer isn't empty */
+
+ /*
+ * is this check necessary? It seems that special
+ * layers have negative indexes?
+ */
+
+ if (SL_TYPE (n) == 0)
+ {
+ /* layer is a copper layer */
+ m = GetLayerGroupNumberByNumber (n);
+
+ /* the export layer */
+ gcode_export_group[m] = 1;
+ }
+ }
}
}
@@ -385,16 +385,16 @@ gcode_do_export (HID_Attr_Val * options)
path_t *plist = NULL;
potrace_bitmap_t *bm = NULL;
potrace_param_t param_default = {
- 2, /* turnsize */
- POTRACE_TURNPOLICY_MINORITY, /* turnpolicy */
- 1.0, /* alphamax */
- 1, /* opticurve */
- 0.2, /* opttolerance */
+ 2, /* turnsize */
+ POTRACE_TURNPOLICY_MINORITY, /* turnpolicy */
+ 1.0, /* alphamax */
+ 1, /* opticurve */
+ 0.2, /* opttolerance */
{
- NULL, /* callback function */
- NULL, /* callback data */
- 0.0, 1.0, /* progress range */
- 0.0, /* granularity */
+ NULL, /* callback function */
+ NULL, /* callback data */
+ 0.0, 1.0, /* progress range */
+ 0.0, /* granularity */
},
};
@@ -402,9 +402,9 @@ gcode_do_export (HID_Attr_Val * options)
{
gcode_get_export_options (0);
for (i = 0; i < NUM_OPTIONS; i++)
- {
- gcode_values[i] = gcode_attribute_list[i].default_val;
- }
+ {
+ gcode_values[i] = gcode_attribute_list[i].default_val;
+ }
options = gcode_values;
}
gcode_basename = options[HA_basename].str_value;
@@ -434,169 +434,169 @@ gcode_do_export (HID_Attr_Val * options)
for (i = 0; i < MAX_LAYER; i++)
{
if (gcode_export_group[i])
- {
-
- gcode_cur_group = i;
-
- /* magic */
- idx = (i >= 0 && i < max_group) ?
- PCB->LayerGroups.Entries[i][0] : i;
- printf ("idx=%d %s\n", idx, layer_type_to_file_name (idx, FNS_fixed));
- is_solder =
- (GetLayerGroupNumberByNumber (idx) ==
- GetLayerGroupNumberByNumber (solder_silk_layer)) ? 1 : 0;
- save_drill = is_solder; /* save drills for one layer only */
- gcode_start_png (gcode_basename, layer_type_to_file_name (idx, FNS_fixed));
- hid_save_and_show_layer_ons (save_ons);
- gcode_start_png_export ();
- hid_restore_layer_ons (save_ons);
+ {
+
+ gcode_cur_group = i;
+
+ /* magic */
+ idx = (i >= 0 && i < max_group) ?
+ PCB->LayerGroups.Entries[i][0] : i;
+ printf ("idx=%d %s\n", idx, layer_type_to_file_name (idx, FNS_fixed));
+ is_solder =
+ (GetLayerGroupNumberByNumber (idx) ==
+ GetLayerGroupNumberByNumber (solder_silk_layer)) ? 1 : 0;
+ save_drill = is_solder; /* save drills for one layer only */
+ gcode_start_png (gcode_basename, layer_type_to_file_name (idx, FNS_fixed));
+ hid_save_and_show_layer_ons (save_ons);
+ gcode_start_png_export ();
+ hid_restore_layer_ons (save_ons);
/* ***************** gcode conversion *************************** */
/* potrace uses a different kind of bitmap; for simplicity gcode_im is copied to this format */
- bm = bm_new (gdImageSX (gcode_im), gdImageSY (gcode_im));
- filename = (char *)malloc (MAXPATHLEN);
- plist = NULL;
- if (is_solder)
- { /* only for back layer */
- gdImagePtr temp_im =
- gdImageCreate (gdImageSX (gcode_im), gdImageSY (gcode_im));
- gdImageCopy (temp_im, gcode_im, 0, 0, 0, 0,
- gdImageSX (gcode_im), gdImageSY (gcode_im));
- for (r = 0; r < gdImageSX (gcode_im); r++)
- {
- for (c = 0; c < gdImageSY (gcode_im); c++)
- {
- gdImageSetPixel (gcode_im, r, c,
- gdImageGetPixel (temp_im,
- gdImageSX (gcode_im) -
- 1 - r, c));
- }
- }
- gdImageDestroy (temp_im);
- }
- sprintf (filename, "%s.%s.cnc", gcode_basename,
- layer_type_to_file_name (idx, FNS_fixed));
- for (r = 0; r < gdImageSX (gcode_im); r++)
- {
- for (c = 0; c < gdImageSY (gcode_im); c++)
- {
- v =
- gdImageGetPixel (gcode_im, r,
- gdImageSY (gcode_im) - 1 - c);
- p = (gcode_im->red[v] || gcode_im->green[v]
- || gcode_im->blue[v]) ? 0 : 0xFFFFFF;
- BM_PUT (bm, r, c, p);
- }
- }
- gcode_f2 = fopen (filename, "wb");
- if (!gcode_f2)
- {
- perror (filename);
- return;
- }
- fprintf (gcode_f2, "(Created by G-code exporter)\n");
- t = time (NULL);
- sprintf (filename, "%s", ctime (&t));
- filename[strlen (filename) - 1] = 0;
- fprintf (gcode_f2, "( %s )\n", filename);
- fprintf (gcode_f2, "(%d dpi)\n", gcode_dpi);
- fprintf (gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch");
- if (metric)
- pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
- else
- pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
- fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
- fprintf (gcode_f2, "#101=%f (cutting depth)\n", gcode_cutdepth);
- fprintf (gcode_f2, "(---------------------------------)\n");
- fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
- metric ? 21 : 20, metric ? 25 : 1);
- fprintf (gcode_f2, "G0 Z#100\n");
- /* extract contour points from image */
- r = bm_to_pathlist (bm, &plist, ¶m_default);
- if (r)
- {
- fprintf (stderr, "ERROR: pathlist function failed\n");
- return;
- }
- /* generate best polygon and write vertices in g-code format */
- d =
- process_path (plist, ¶m_default, bm, gcode_f2,
- metric ? 25.4 / gcode_dpi : 1.0 / gcode_dpi);
- if (d < 0)
- {
- fprintf (stderr, "ERROR: path process function failed\n");
- return;
- }
- if (metric)
- fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n", d,
- d * 1 / 25.4);
- else
- fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
- 25.4 * d, d);
- fprintf (gcode_f2, "M5 M9 M2\n");
- pathlist_free (plist);
- bm_free (bm);
- fclose (gcode_f2);
- if (save_drill)
- {
- d = 0;
- drill = sort_drill (drill, n_drill);
- sprintf (filename, "%s.drill.cnc", gcode_basename);
- gcode_f2 = fopen (filename, "wb");
- if (!gcode_f2)
- {
- perror (filename);
- return;
- }
- fprintf (gcode_f2, "(Created by G-code exporter)\n");
- fprintf (gcode_f2, "(drill file: %d drills)\n", n_drill);
- sprintf (filename, "%s", ctime (&t));
- filename[strlen (filename) - 1] = 0;
- fprintf (gcode_f2, "( %s )\n", filename);
- fprintf (gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch");
- if (metric)
- pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
- else
- pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
- fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
- fprintf (gcode_f2, "#101=%f (drill depth)\n",
- gcode_drilldepth);
- fprintf (gcode_f2, "(---------------------------------)\n");
- fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
- metric ? 21 : 20, metric ? 25 : 1);
+ bm = bm_new (gdImageSX (gcode_im), gdImageSY (gcode_im));
+ filename = (char *)malloc (MAXPATHLEN);
+ plist = NULL;
+ if (is_solder)
+ { /* only for back layer */
+ gdImagePtr temp_im =
+ gdImageCreate (gdImageSX (gcode_im), gdImageSY (gcode_im));
+ gdImageCopy (temp_im, gcode_im, 0, 0, 0, 0,
+ gdImageSX (gcode_im), gdImageSY (gcode_im));
+ for (r = 0; r < gdImageSX (gcode_im); r++)
+ {
+ for (c = 0; c < gdImageSY (gcode_im); c++)
+ {
+ gdImageSetPixel (gcode_im, r, c,
+ gdImageGetPixel (temp_im,
+ gdImageSX (gcode_im) -
+ 1 - r, c));
+ }
+ }
+ gdImageDestroy (temp_im);
+ }
+ sprintf (filename, "%s.%s.cnc", gcode_basename,
+ layer_type_to_file_name (idx, FNS_fixed));
+ for (r = 0; r < gdImageSX (gcode_im); r++)
+ {
+ for (c = 0; c < gdImageSY (gcode_im); c++)
+ {
+ v =
+ gdImageGetPixel (gcode_im, r,
+ gdImageSY (gcode_im) - 1 - c);
+ p = (gcode_im->red[v] || gcode_im->green[v]
+ || gcode_im->blue[v]) ? 0 : 0xFFFFFF;
+ BM_PUT (bm, r, c, p);
+ }
+ }
+ gcode_f2 = fopen (filename, "wb");
+ if (!gcode_f2)
+ {
+ perror (filename);
+ return;
+ }
+ fprintf (gcode_f2, "(Created by G-code exporter)\n");
+ t = time (NULL);
+ sprintf (filename, "%s", ctime (&t));
+ filename[strlen (filename) - 1] = 0;
+ fprintf (gcode_f2, "( %s )\n", filename);
+ fprintf (gcode_f2, "(%d dpi)\n", gcode_dpi);
+ fprintf (gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch");
+ if (metric)
+ pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
+ else
+ pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
+ fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
+ fprintf (gcode_f2, "#101=%f (cutting depth)\n", gcode_cutdepth);
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
+ fprintf (gcode_f2, "G0 Z#100\n");
+ /* extract contour points from image */
+ r = bm_to_pathlist (bm, &plist, ¶m_default);
+ if (r)
+ {
+ fprintf (stderr, "ERROR: pathlist function failed\n");
+ return;
+ }
+ /* generate best polygon and write vertices in g-code format */
+ d =
+ process_path (plist, ¶m_default, bm, gcode_f2,
+ metric ? 25.4 / gcode_dpi : 1.0 / gcode_dpi);
+ if (d < 0)
+ {
+ fprintf (stderr, "ERROR: path process function failed\n");
+ return;
+ }
+ if (metric)
+ fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n", d,
+ d * 1 / 25.4);
+ else
+ fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
+ 25.4 * d, d);
+ fprintf (gcode_f2, "M5 M9 M2\n");
+ pathlist_free (plist);
+ bm_free (bm);
+ fclose (gcode_f2);
+ if (save_drill)
+ {
+ d = 0;
+ drill = sort_drill (drill, n_drill);
+ sprintf (filename, "%s.drill.cnc", gcode_basename);
+ gcode_f2 = fopen (filename, "wb");
+ if (!gcode_f2)
+ {
+ perror (filename);
+ return;
+ }
+ fprintf (gcode_f2, "(Created by G-code exporter)\n");
+ fprintf (gcode_f2, "(drill file: %d drills)\n", n_drill);
+ sprintf (filename, "%s", ctime (&t));
+ filename[strlen (filename) - 1] = 0;
+ fprintf (gcode_f2, "( %s )\n", filename);
+ fprintf (gcode_f2, "(Unit: %s)\n", metric ? "mm" : "inch");
+ if (metric)
+ pcb_fprintf (gcode_f2, "(Board size: %.2mmx%.2mm mm)", PCB->MaxWidth, PCB->MaxHeight);
+ else
+ pcb_fprintf (gcode_f2, "(Board size: %.2mix%.2mi inches)", PCB->MaxWidth, PCB->MaxHeight);
+ fprintf (gcode_f2, "#100=%f (safe Z)\n", gcode_safeZ);
+ fprintf (gcode_f2, "#101=%f (drill depth)\n",
+ gcode_drilldepth);
+ fprintf (gcode_f2, "(---------------------------------)\n");
+ fprintf (gcode_f2, "G17 G%d G90 G64 P0.003 M3 S3000 M7 F%d\n",
+ metric ? 21 : 20, metric ? 25 : 1);
/* fprintf(gcode_f2,"G0 Z#100\n"); */
- for (r = 0; r < n_drill; r++)
- {
+ for (r = 0; r < n_drill; r++)
+ {
/* if(metric) fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x*25.4,drill[r].y*25.4); */
/* else fprintf(gcode_f2,"G0 X%f Y%f\n",drill[r].x,drill[r].y); */
- if (metric)
- fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
- drill[r].x * 25.4, drill[r].y * 25.4);
- else
- fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
- drill[r].x, drill[r].y);
+ if (metric)
+ fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
+ drill[r].x * 25.4, drill[r].y * 25.4);
+ else
+ fprintf (gcode_f2, "G81 X%f Y%f Z#101 R#100\n",
+ drill[r].x, drill[r].y);
/* fprintf(gcode_f2,"G1 Z#101\n"); */
/* fprintf(gcode_f2,"G0 Z#100\n"); */
- if (r > 0)
- d +=
- sqrt ((drill[r].x - drill[r - 1].x) * (drill[r].x -
- drill[r - 1].x) +
- (drill[r].y - drill[r - 1].y) * (drill[r].y -
- drill[r - 1].y));
- }
- fprintf (gcode_f2, "M5 M9 M2\n");
- fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
- 25.4 * d, d);
- fclose (gcode_f2);
- free (drill);
- drill = NULL;
- n_drill = nmax_drill = 0;
- }
- free (filename);
+ if (r > 0)
+ d +=
+ sqrt ((drill[r].x - drill[r - 1].x) * (drill[r].x -
+ drill[r - 1].x) +
+ (drill[r].y - drill[r - 1].y) * (drill[r].y -
+ drill[r - 1].y));
+ }
+ fprintf (gcode_f2, "M5 M9 M2\n");
+ fprintf (gcode_f2, "(end, total distance %.2fmm = %.2fin)\n",
+ 25.4 * d, d);
+ fclose (gcode_f2);
+ free (drill);
+ drill = NULL;
+ n_drill = nmax_drill = 0;
+ }
+ free (filename);
/* ******************* end gcode conversion **************************** */
- gcode_finish_png ();
- }
+ gcode_finish_png ();
+ }
}
}
@@ -736,7 +736,7 @@ use_gc (hidGC gc)
else
*/
gdImageSetThickness (gcode_im,
- pcb_to_gcode (gc->width + 2 * gcode_toolradius));
+ pcb_to_gcode (gc->width + 2 * gcode_toolradius));
linewidth = gc->width;
need_brush = 1;
}
@@ -749,54 +749,54 @@ use_gc (hidGC gc)
int r;
switch (gc->cap)
- {
- case Round_Cap:
- case Trace_Cap:
- type = 'C';
- r = pcb_to_gcode (gc->width / 2 + gcode_toolradius);
- break;
- default:
- case Square_Cap:
- r = pcb_to_gcode (gc->width + gcode_toolradius * 2);
- type = 'S';
- break;
- }
+ {
+ case Round_Cap:
+ case Trace_Cap:
+ type = 'C';
+ r = pcb_to_gcode (gc->width / 2 + gcode_toolradius);
+ break;
+ default:
+ case Square_Cap:
+ r = pcb_to_gcode (gc->width + gcode_toolradius * 2);
+ type = 'S';
+ break;
+ }
sprintf (name, "#%.2x%.2x%.2x_%c_%d", gc->color->r, gc->color->g,
- gc->color->b, type, r);
+ gc->color->b, type, r);
if (hid_cache_color (0, name, &bval, &bcache))
- {
- gc->brush = (gdImagePtr)bval.ptr;
- }
+ {
+ gc->brush = (gdImagePtr)bval.ptr;
+ }
else
- {
- int bg, fg;
- if (type == 'C')
- gc->brush = gdImageCreate (2 * r + 1, 2 * r + 1);
- else
- gc->brush = gdImageCreate (r + 1, r + 1);
- bg = gdImageColorAllocate (gc->brush, 255, 255, 255);
- fg =
- gdImageColorAllocate (gc->brush, gc->color->r, gc->color->g,
- gc->color->b);
- gdImageColorTransparent (gc->brush, bg);
-
- /*
- * if we shrunk to a radius/box width of zero, then just use
- * a single pixel to draw with.
- */
- if (r == 0)
- gdImageFilledRectangle (gc->brush, 0, 0, 0, 0, fg);
- else
- {
- if (type == 'C')
- gdImageFilledEllipse (gc->brush, r, r, 2 * r, 2 * r, fg);
- else
- gdImageFilledRectangle (gc->brush, 0, 0, r, r, fg);
- }
- bval.ptr = gc->brush;
- hid_cache_color (1, name, &bval, &bcache);
- }
+ {
+ int bg, fg;
+ if (type == 'C')
+ gc->brush = gdImageCreate (2 * r + 1, 2 * r + 1);
+ else
+ gc->brush = gdImageCreate (r + 1, r + 1);
+ bg = gdImageColorAllocate (gc->brush, 255, 255, 255);
+ fg =
+ gdImageColorAllocate (gc->brush, gc->color->r, gc->color->g,
+ gc->color->b);
+ gdImageColorTransparent (gc->brush, bg);
+
+ /*
+ * if we shrunk to a radius/box width of zero, then just use
+ * a single pixel to draw with.
+ */
+ if (r == 0)
+ gdImageFilledRectangle (gc->brush, 0, 0, 0, 0, fg);
+ else
+ {
+ if (type == 'C')
+ gdImageFilledEllipse (gc->brush, r, r, 2 * r, 2 * r, fg);
+ else
+ gdImageFilledRectangle (gc->brush, 0, 0, r, r, fg);
+ }
+ bval.ptr = gc->brush;
+ hid_cache_color (1, name, &bval, &bcache);
+ }
gdImageSetBrush (gcode_im, gc->brush);
lastbrush = gc->brush;
@@ -806,32 +806,32 @@ use_gc (hidGC gc)
if (lastcolor != CBLEND (gc))
{
if (is_drill || is_mask)
- {
+ {
#ifdef FIXME
- fprintf (f, "%d gray\n", gc->erase ? 0 : 1);
+ fprintf (f, "%d gray\n", gc->erase ? 0 : 1);
#endif
- lastcolor = 0;
- }
+ lastcolor = 0;
+ }
else
- {
- double r, g, b;
- r = gc->r;
- g = gc->g;
- b = gc->b;
- if (gc->faded)
- {
- r = 0.8 * 255 + 0.2 * r;
- g = 0.8 * 255 + 0.2 * g;
- b = 0.8 * 255 + 0.2 * b;
- }
+ {
+ double r, g, b;
+ r = gc->r;
+ g = gc->g;
+ b = gc->b;
+ if (gc->faded)
+ {
+ r = 0.8 * 255 + 0.2 * r;
+ g = 0.8 * 255 + 0.2 * g;
+ b = 0.8 * 255 + 0.2 * b;
+ }
#ifdef FIXME
- if (gc->r == gc->g && gc->g == gc->b)
- fprintf (f, "%g gray\n", r / 255.0);
- else
- fprintf (f, "%g %g %g rgb\n", r / 255.0, g / 255.0, b / 255.0);
+ if (gc->r == gc->g && gc->g == gc->b)
+ fprintf (f, "%g gray\n", r / 255.0);
+ else
+ fprintf (f, "%g %g %g rgb\n", r / 255.0, g / 255.0, b / 255.0);
#endif
- lastcolor = CBLEND (gc);
- }
+ lastcolor = CBLEND (gc);
+ }
}
}
@@ -840,10 +840,10 @@ gcode_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
{
use_gc (gc);
gdImageRectangle (gcode_im,
- pcb_to_gcode (x1 - gcode_toolradius),
- pcb_to_gcode (y1 - gcode_toolradius),
- pcb_to_gcode (x2 + gcode_toolradius),
- pcb_to_gcode (y2 + gcode_toolradius), gc->color->c);
+ pcb_to_gcode (x1 - gcode_toolradius),
+ pcb_to_gcode (y1 - gcode_toolradius),
+ pcb_to_gcode (x2 + gcode_toolradius),
+ pcb_to_gcode (y2 + gcode_toolradius), gc->color->c);
/* printf("Rect %d %d %d %d\n",x1,y1,x2,y2); */
}
@@ -854,10 +854,10 @@ gcode_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
gdImageSetThickness (gcode_im, 0);
linewidth = 0;
gdImageFilledRectangle (gcode_im,
- pcb_to_gcode (x1 - gcode_toolradius),
- pcb_to_gcode (y1 - gcode_toolradius),
- pcb_to_gcode (x2 + gcode_toolradius),
- pcb_to_gcode (y2 + gcode_toolradius), gc->color->c);
+ pcb_to_gcode (x1 - gcode_toolradius),
+ pcb_to_gcode (y1 - gcode_toolradius),
+ pcb_to_gcode (x2 + gcode_toolradius),
+ pcb_to_gcode (y2 + gcode_toolradius), gc->color->c);
/* printf("FillRect %d %d %d %d\n",x1,y1,x2,y2); */
}
@@ -875,12 +875,12 @@ gcode_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
gdImageSetThickness (gcode_im, 0);
linewidth = 0;
gdImageLine (gcode_im, pcb_to_gcode (x1), pcb_to_gcode (y1),
- pcb_to_gcode (x2), pcb_to_gcode (y2), gdBrushed);
+ pcb_to_gcode (x2), pcb_to_gcode (y2), gdBrushed);
}
static void
gcode_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height,
- Angle start_angle, Angle delta_angle)
+ Angle start_angle, Angle delta_angle)
{
Angle sa, ea;
@@ -910,18 +910,18 @@ gcode_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height,
#if 0
printf ("draw_arc %d,%d %dx%d %d..%d %d..%d\n",
- cx, cy, width, height, start_angle, delta_angle, sa, ea);
+ cx, cy, width, height, start_angle, delta_angle, sa, ea);
printf ("gdImageArc (%p, %d, %d, %d, %d, %d, %d, %d)\n",
- im, SCALE_X (cx), SCALE_Y (cy),
- SCALE (width), SCALE (height), sa, ea, gc->color->c);
+ im, SCALE_X (cx), SCALE_Y (cy),
+ SCALE (width), SCALE (height), sa, ea, gc->color->c);
#endif
use_gc (gc);
gdImageSetThickness (gcode_im, 0);
linewidth = 0;
gdImageArc (gcode_im, pcb_to_gcode (cx), pcb_to_gcode (cy),
- pcb_to_gcode (2 * width + gcode_toolradius * 2),
- pcb_to_gcode (2 * height + gcode_toolradius * 2), sa, ea,
- gdBrushed);
+ pcb_to_gcode (2 * width + gcode_toolradius * 2),
+ pcb_to_gcode (2 * height + gcode_toolradius * 2), sa, ea,
+ gdBrushed);
}
static void
@@ -932,20 +932,20 @@ gcode_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
gdImageSetThickness (gcode_im, 0);
linewidth = 0;
gdImageFilledEllipse (gcode_im, pcb_to_gcode (cx), pcb_to_gcode (cy),
- pcb_to_gcode (2 * radius + gcode_toolradius * 2),
- pcb_to_gcode (2 * radius + gcode_toolradius * 2),
- gc->color->c);
+ pcb_to_gcode (2 * radius + gcode_toolradius * 2),
+ pcb_to_gcode (2 * radius + gcode_toolradius * 2),
+ gc->color->c);
if (save_drill && is_drill)
{
if (n_drill == nmax_drill)
- {
- drill =
- (struct drill_struct *) realloc (drill,
- (nmax_drill +
- 100) *
- sizeof (struct drill_struct));
- nmax_drill += 100;
- }
+ {
+ drill =
+ (struct drill_struct *) realloc (drill,
+ (nmax_drill +
+ 100) *
+ sizeof (struct drill_struct));
+ nmax_drill += 100;
+ }
drill[n_drill].x = COORD_TO_INCH(PCB->MaxWidth - cx); /* convert to inch, flip: will drill from bottom side */
drill[n_drill].y = COORD_TO_INCH(PCB->MaxHeight - cy); /* PCB reverses y axis */
n_drill++;
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs