Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
| 1 | #!/usr/bin/perl |
| 2 | # |
| 3 | # brdclw - Change line width in a specific module in a KiCAD .brd file |
| 4 | # |
| 5 | |
| 6 | sub usage |
| 7 | { |
| 8 | print STDERR "usage: $0 module from to in-file\n"; |
| 9 | exit(1); |
| 10 | } |
| 11 | |
| 12 | &usage unless @ARGV == 4; |
| 13 | |
| 14 | $mod = shift(@ARGV); |
| 15 | $from = shift(@ARGV); |
| 16 | $to = shift(@ARGV); |
| 17 | |
| 18 | while (<>) { |
| 19 | $this = $1 eq $mod if /^\$MODULE\s+(\S+)/; |
| 20 | $this = 0 if /^\$EndMODULE/; |
| 21 | if ($this && /^DS\s/) { |
| 22 | @ds = split(/\s+/); |
| 23 | if ($ds[5] == $from) { |
| 24 | $ds[5] = $to; |
| 25 | $_ = join(" ", @ds)."\n"; |
| 26 | } |
| 27 | } |
| 28 | print || die; |
| 29 | } |
| 30 |
Branches:
master
