32 #include <glib/gstdio.h>
37 #define DPRINTF(...) do { if (DEBUG) printf(__VA_ARGS__); } while (0)
39 #define round(x) floor(x+0.5)
45 GArray *apertureTable = g_array_new(FALSE, FALSE,
sizeof(
int));
49 setlocale(LC_NUMERIC,
"C");
51 if ((fd = g_fopen(filename,
"w")) == NULL) {
52 GERB_COMPILE_ERROR( _(
"Can't open file for writing: %s"),
62 fprintf(fd,
"INCH,TZ\n");
65 gerbv_aperture_t *aperture;
69 for (
int i = APERTURE_MIN; i < APERTURE_MAX; i++) {
75 switch (aperture->type) {
77 fprintf(fd,
"T%dC%1.3f\n", i, aperture->parameter[0]);
79 g_array_append_val(apertureTable, i);
89 for (guint i = 0; i < apertureTable->len; i++) {
90 int aperture_idx = g_array_index(apertureTable,
int, i);
93 fprintf(fd,
"T%d\n", aperture_idx);
102 fprintf(fd,
"X%06ldY%06ld\n",
103 (
long)round(net->
stop_x * 10000.0),
104 (
long)round(net->
stop_y * 10000.0));
107 fprintf(fd,
"X%06ldY%06ldG85X%06ldY%06ld\n",
108 (
long)round(net->
start_x * 10000.0),
109 (
long)round(net->
start_y * 10000.0),
110 (
long)round(net->
stop_x * 10000.0),
111 (
long)round(net->
stop_y * 10000.0));
118 g_array_free (apertureTable, TRUE);
121 fprintf(fd,
"M30\n\n");
126 setlocale(LC_NUMERIC,
"");
gboolean gerbv_export_drill_file_from_image(const gchar *filename, gerbv_image_t *inputImage, gerbv_user_transformation_t *transform)
Export an image to a new file in Excellon drill format.
void gerbv_destroy_image(gerbv_image_t *image)
Free an image structure.
gerbv_image_t * gerbv_image_duplicate_image(gerbv_image_t *sourceImage, gerbv_user_transformation_t *transform)
Duplicate an existing image and return the new copy.
The main header file for the libgerbv library.
@ GERBV_APERTURE_STATE_ON
@ GERBV_APERTURE_STATE_FLASH
gerbv_aperture_t * aperture[APERTURE_MAX]
gerbv_aperture_state_t aperture_state