comparison pads2gpcb/decals.c @ 62:9d7e2937883d

pads2gpcb: select specific drawing levels for silk with -s
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 31 Jan 2016 05:30:33 +0000
parents ff1d565d233c
children 455a0051f9d2
comparison
equal deleted inserted replaced
61:ff1d565d233c 62:9d7e2937883d
10 10
11 static struct part_decal *current_decal; 11 static struct part_decal *current_decal;
12 static struct footprint_body fpbody; 12 static struct footprint_body fpbody;
13 static struct footprint_pad *pins_array; 13 static struct footprint_pad *pins_array;
14 14
15 #define MAX_SILK_LINES 16 15 #define MAX_SILK_LINES 64
16 static struct element_line silk_lines[MAX_SILK_LINES]; 16 static struct element_line silk_lines[MAX_SILK_LINES];
17 static struct element_arc silk_arcs[MAX_SILK_LINES]; 17 static struct element_arc silk_arcs[MAX_SILK_LINES];
18 static int num_silk_lines; 18 static int num_silk_lines;
19 static int num_silk_arcs; 19 static int num_silk_arcs;
20 20
56 exit(1); 56 exit(1);
57 } 57 }
58 } 58 }
59 59
60 static 60 static
61 drawpiece_silk_candidate()
62 {
63 int level;
64
65 if (input_line_nfields != 5)
66 return(0);
67 level = atoi(input_line_fields[4]);
68 return is_drawlevel_selected(level);
69 }
70
71 static
61 try_silk_open_closed() 72 try_silk_open_closed()
62 { 73 {
63 int ncoord, i, bad; 74 int ncoord, i, bad;
64 long x[MAX_SILK_LINES+1], y[MAX_SILK_LINES+1]; 75 long x[MAX_SILK_LINES+1], y[MAX_SILK_LINES+1];
65 long thickness; 76 long thickness;
66 77
67 if (strcmp(input_line_fields[0], "OPEN") && 78 if (strcmp(input_line_fields[0], "OPEN") &&
68 strcmp(input_line_fields[0], "CLOSED")) 79 strcmp(input_line_fields[0], "CLOSED"))
69 return(0);
70 if (input_line_nfields != 5)
71 return(0);
72 if (strcmp(input_line_fields[4], "0") &&
73 strcmp(input_line_fields[4], "1"))
74 return(0); 80 return(0);
75 ncoord = atoi(input_line_fields[1]); 81 ncoord = atoi(input_line_fields[1]);
76 if (ncoord < 2) { 82 if (ncoord < 2) {
77 printf("line %d: silk %s piece ncoord < 2\n", input_lineno, 83 printf("line %d: silk %s piece ncoord < 2\n", input_lineno,
78 input_line_fields[0]); 84 input_line_fields[0]);
122 int i, bad; 128 int i, bad;
123 long x[2], y[2]; 129 long x[2], y[2];
124 long centre_x, centre_y, diameter, thickness; 130 long centre_x, centre_y, diameter, thickness;
125 131
126 if (strcmp(input_line_fields[0], "CIRCLE")) 132 if (strcmp(input_line_fields[0], "CIRCLE"))
127 return(0);
128 if (input_line_nfields != 5)
129 return(0);
130 if (strcmp(input_line_fields[4], "0") &&
131 strcmp(input_line_fields[4], "1"))
132 return(0); 133 return(0);
133 if (strcmp(input_line_fields[1], "2")) { 134 if (strcmp(input_line_fields[1], "2")) {
134 printf("line %d: silk CIRCLE piece ncoord != 2\n", 135 printf("line %d: silk CIRCLE piece ncoord != 2\n",
135 input_lineno); 136 input_lineno);
136 return(0); 137 return(0);
211 fprintf(stderr, 212 fprintf(stderr,
212 "%s line %d: expected piece header line giving # of coords\n", 213 "%s line %d: expected piece header line giving # of coords\n",
213 input_filename, input_lineno); 214 input_filename, input_lineno);
214 exit(1); 215 exit(1);
215 } 216 }
216 if (do_footprint_silk) { 217 if (do_footprint_silk && drawpiece_silk_candidate()) {
217 if (try_silk_open_closed()) 218 if (try_silk_open_closed())
218 return; 219 return;
219 if (try_silk_circle()) 220 if (try_silk_circle())
220 return; 221 return;
221 } 222 }