diff 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
line wrap: on
line diff
--- a/pads2gpcb/decals.c	Sun Jan 31 05:02:49 2016 +0000
+++ b/pads2gpcb/decals.c	Sun Jan 31 05:30:33 2016 +0000
@@ -12,7 +12,7 @@
 static struct footprint_body fpbody;
 static struct footprint_pad *pins_array;
 
-#define	MAX_SILK_LINES	16
+#define	MAX_SILK_LINES	64
 static struct element_line silk_lines[MAX_SILK_LINES];
 static struct element_arc silk_arcs[MAX_SILK_LINES];
 static int num_silk_lines;
@@ -58,6 +58,17 @@
 }
 
 static
+drawpiece_silk_candidate()
+{
+	int level;
+
+	if (input_line_nfields != 5)
+		return(0);
+	level = atoi(input_line_fields[4]);
+	return is_drawlevel_selected(level);
+}
+
+static
 try_silk_open_closed()
 {
 	int ncoord, i, bad;
@@ -67,11 +78,6 @@
 	if (strcmp(input_line_fields[0], "OPEN") &&
 	    strcmp(input_line_fields[0], "CLOSED"))
 		return(0);
-	if (input_line_nfields != 5)
-		return(0);
-	if (strcmp(input_line_fields[4], "0") &&
-	    strcmp(input_line_fields[4], "1"))
-		return(0);
 	ncoord = atoi(input_line_fields[1]);
 	if (ncoord < 2) {
 		printf("line %d: silk %s piece ncoord < 2\n", input_lineno,
@@ -125,11 +131,6 @@
 
 	if (strcmp(input_line_fields[0], "CIRCLE"))
 		return(0);
-	if (input_line_nfields != 5)
-		return(0);
-	if (strcmp(input_line_fields[4], "0") &&
-	    strcmp(input_line_fields[4], "1"))
-		return(0);
 	if (strcmp(input_line_fields[1], "2")) {
 		printf("line %d: silk CIRCLE piece ncoord != 2\n",
 			input_lineno);
@@ -213,7 +214,7 @@
 			input_filename, input_lineno);
 		exit(1);
 	}
-	if (do_footprint_silk) {
+	if (do_footprint_silk && drawpiece_silk_candidate()) {
 		if (try_silk_open_closed())
 			return;
 		if (try_silk_circle())