BlinkenArea - GitList
Repositories
Blog
Wiki
partlib
Code
Commits
Branches
Tags
Search
Tree:
cd92b87
Branches
Tags
master
stefan.experimental
partlib
pcb_stuff
pcb_move.pl
move scripts into own subdir
Stefan Schuermans
commited
cd92b87
at 2014-01-11 13:44:27
pcb_move.pl
Blame
History
Raw
#! /usr/bin/perl use strict; if( @ARGV < 2 ) { print( "usage: pcb_move.pl <delta-x> <delta-y> \n" ); exit( 1 ); } my $dx = int( @ARGV[0] ); my $dy = int( @ARGV[1] ); my $line; while( $line = <STDIN> ) { chomp( $line ); chomp( $line ); if( $line =~ /^([ \t]*Element[ \t]*\[[^ \t]+[ \t]+"[^"]*"[ \t]+"[^"]*"[ \t]+"[^"]*"[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+)(-?[0-9]+)([ \t]+)(-?[0-9]+)(.*)$/ ) { $line = $1 . (int( $2 ) + $dx) . $3 . (int( $4 ) + $dy) . $5; } elsif( $line =~ /^([ \t]*(?:Via|Pin|ElementArc)[ \t]*\[)(-?[0-9]+)([ \t]+)(-?[0-9]+)(.*)$/ ) { $line = $1 . (int( $2 ) + $dx) . $3 . (int( $4 ) + $dy) . $5; } elsif( $line =~ /^([ \t]*(?:Line|Pad|ElementLine)[ \t]*\[)(-?[0-9]+)([ \t]+)(-?[0-9]+)([ \t]+)(-?[0-9]+)([ \t]+)(-?[0-9]+)(.*)$/ ) { $line = $1 . (int( $2 ) + $dx) . $3 . (int( $4 ) + $dy) . $5 . (int( $6 ) + $dx) . $7 . (int( $8 ) + $dy) . $9; } print( $line . "\n" ); }