minimum drill diameter script: add feature to increase copper diamater of pins/vias as well
Stefan Schuermans

Stefan Schuermans commited on 2015-03-15 11:40:56
Showing 1 changed files, with 22 additions and 7 deletions.

... ...
@@ -4,23 +4,38 @@ use strict;
4 4
 use warnings;
5 5
 
6 6
 if (@ARGV < 1) {
7
-  print ("usage: pcb_move.pl <new minium drill diameter>\n");
7
+  print ("usage: pcb_move.pl <new min drill> [<new min copper>]\n");
8 8
   exit (1);
9 9
 }
10 10
 
11
-my $mindia = int($ARGV[0]);
11
+my $mindrill = int($ARGV[0]);
12
+my $mincopper = 0;
13
+if (@ARGV >= 2) {
14
+  $mincopper = int($ARGV[1]);
15
+}
12 16
 
13 17
 my $line;
14 18
 while ($line = <STDIN>) {
15 19
   chomp ($line);
16 20
   chomp ($line);
17 21
 
18
-  if ($line =~ /^([ \t]*(?:Via|Pin)[ \t]*\[)((?:-?[0-9]+[ \t]+){5})([0-9]+)(.*)$/) {
19
-    my $dia = int ($3);
20
-    if ($dia < $mindia) {
21
-      $dia = $mindia;
22
+  if ($line =~ /^([ \t]*(?:Via|Pin)[ \t]*\[(?:-?[0-9]+[ \t]+){2})([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)(.*)$/) {
23
+    my $begin = $1;
24
+    my $copper = int ($2);
25
+    my $clearance = int ($3);
26
+    my $solderstop = int ($4);
27
+    my $drill = int ($5);
28
+    my $end = $6;
29
+    if ($copper < $mincopper) {
30
+      if ($solderstop > $copper) {
31
+        $solderstop += $mincopper - $copper;
32
+      }
33
+      $copper = $mincopper;
34
+    }
35
+    if ($drill < $mindrill) {
36
+      $drill = $mindrill;
22 37
     }
23
-    $line = $1 . $2 . $dia . $4;
38
+    $line = "$begin$copper $clearance $solderstop $drill$end";
24 39
   }
25 40
 
26 41
   print ($line . "\n");
27 42