BlinkenArea - GitList
Repositories
Blog
Wiki
partlib
Code
Commits
Branches
Tags
Search
Tree:
8c1680e
Branches
Tags
master
stefan.experimental
partlib
pcb_move.pl
initial commit
Stefan Schuermans
commited
8c1680e
at 2012-10-03 10:15:25
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" ); }