37 #include <glib/gstdio.h>
43 #define DPRINTF(...) do { if (DEBUG) printf(__VA_ARGS__); } while (0)
44 #define round(x) floor(x+0.5)
50 GArray *apertureTable = g_array_new(FALSE,FALSE,
sizeof(
int));
54 setlocale(LC_NUMERIC,
"C");
56 if ((fd = g_fopen(filename,
"w")) == NULL) {
57 GERB_COMPILE_ERROR(_(
"Can't open file for writing: %s"),
70 "; Please change this parameters to your needs\r\n"
71 "; Don't forget to change the drill depth to\r\n"
72 "; your PCB thickness\r\n"
74 "; The normal movement velocity in 1/1000 mm/s\r\n"
77 "; The fast movement velocity in 1/1000 mm/s\r\n"
79 "; The safety height in mm over the PCB for movement\r\n"
83 "; Drill velocity of downwards movement in 1/1000 mm/s\r\n"
87 "; The drill depth in 1/1000 mm\r\n"
89 "DRILLDEF D1800 ; 1.5mm material + 0.3mm break through\r\n"
91 "; DO NOT CHANGE THESE PARAMETERS!!\r\n"
97 gerbv_aperture_t *currentAperture;
101 for (
int i=APERTURE_MIN; i<APERTURE_MAX; i++) {
102 currentAperture = image->
aperture[i];
104 if (!currentAperture)
107 switch (currentAperture->type) {
110 fprintf(fd,
"; TOOL %d - Diameter %1.3f mm\r\n",
112 COORD2MMS(currentAperture->parameter[0]));
113 g_array_append_val (apertureTable, i);
123 for (guint i=0; i<apertureTable->len; i++) {
124 int currentAperture=g_array_index (apertureTable,
int, i);
127 fprintf(fd,
"GETTOOL %d\r\n",currentAperture+1);
130 for (currentNet = image->
netlist; currentNet;
131 currentNet = currentNet->
next) {
133 if (currentNet->
aperture != currentAperture)
140 xVal = (long) round(COORD2MMS(currentNet->
stop_x)*1e3);
141 yVal = (long) round(COORD2MMS(currentNet->
stop_y)*1e3);
142 fprintf(fd,
"DRILL X%06ld Y%06ld\r\n",
147 GERB_COMPILE_WARNING(
148 _(
"Skipped to export of unsupported state %d "
149 "interpolation \"%s\""),
156 g_array_free (apertureTable, TRUE);
158 fprintf(fd,
"PROGEND\r\n");
163 setlocale(LC_NUMERIC,
"");
gboolean gerbv_export_isel_drill_file_from_image(const gchar *filename, gerbv_image_t *inputImage, gerbv_user_transformation_t *transform)
Export an image to a new file in ISEL NCP 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.
const char * gerbv_interpolation_name(gerbv_interpolation_t interp)
Return string name of gerbv_interpolation_t interpolation.
The main header file for the libgerbv library.
@ GERBV_APERTURE_STATE_FLASH
gerbv_aperture_t * aperture[APERTURE_MAX]
gerbv_aperture_state_t aperture_state
gerbv_interpolation_t interpolation