forked from fritzing/eagle2fritzing
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbus.pl
30 lines (23 loc) · 813 Bytes
/
bus.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl
# This is a simple script to automatically create the busses for internal connections when using vias for prototyping areas!
# run with "perl bus.pl < part.fpz > foo.txt" check foo.txt to make sure its what you want and place between the <buses></buses> xml
while (<>) {
if (/connector id=[\"\']([^\"]+)[\"\'] .* name=[\"\']([^\"]+)[\"\']/) {
#print "$1 $2\n";
$conn = $1;
$name = $2;
push(@{$connectors{$name}}, $conn);
}
}
$i = 1;
foreach my $group (keys %connectors) {
#print " <!-- $group --!>\n";
#if (! ($group =~ /N\$/)) { next; }
if ( scalar @{$connectors{$group}} <= 1) { next; }
print " <bus id=\"internal", $i, "\">\n";
foreach (@{$connectors{$group}}) {
print " <nodeMember connectorId=\"",$_,"\"/>\n";
}
print " </bus>\n";
$i++;
}