32 #include <glib/gstdio.h>
40 #define round(x) floor(x + 0.5)
47 GArray* apertureTable = g_array_new(FALSE, FALSE,
sizeof(
int));
51 setlocale(LC_NUMERIC,
"C");
53 if ((fd = g_fopen(filename,
"w")) == NULL) {
54 GERB_COMPILE_ERROR(_(
"Can't open file for writing: %s"), filename);
63 fprintf(fd,
"INCH,TZ\n");
66 gerbv_aperture_t* aperture;
70 for (
int i = APERTURE_MIN; i < APERTURE_MAX; i++) {
76 switch (aperture->type) {
78 fprintf(fd,
"T%dC%1.3f\n", i, aperture->parameter[0]);
80 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);
103 fd,
"X%06ldY%06ld\n", (
long)round(net->
stop_x * 10000.0), (
long)round(net->
stop_y * 10000.0)
108 fd,
"X%06ldY%06ldG85X%06ldY%06ld\n", (
long)round(net->
start_x * 10000.0),
109 (
long)round(net->
start_y * 10000.0), (
long)round(net->
stop_x * 10000.0),
110 (
long)round(net->
stop_y * 10000.0)
117 g_array_free(apertureTable, TRUE);
120 fprintf(fd,
"M30\n\n");
125 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