Root/hacks/brdclw

Source at commit a27d1958fb3a238dcdc9fe15e0d0649448409129 created 10 years 2 months ago.
By Werner Almesberger, ircstat/ML: update for 12/2013
1#!/usr/bin/perl
2#
3# brdclw - Change line width in a specific module in a KiCAD .brd file
4#
5
6sub 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
18while (<>) {
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

Archive Download this file

Branches:
master



interactive