chiark / gitweb /
doveclip ExtenderPillars optional baseweb
[reprap-play.git] / manual-gcode-generator
index c9e452ee4c08959d52806f95436497ca65cbacd6..ba9a0cdc070b639bd95e49c99841dc5dd88b2345 100755 (executable)
@@ -11,7 +11,7 @@ sub readdata () {
     while (<>) {
        chomp or die;
        s/\s+$//;
-       s/^\!\s*/!/;
+       s/^\s*\!\s*/!/;
        $l .= $_;
        next if $l =~ s/\\$//;
 
@@ -49,6 +49,8 @@ defvar('retractfeedrate',1800);
 defvar('movefeedrate',7800);
 defvar('zlift',0.1);
 defvar('zprint');
+defvar('orgx',0);
+defvar('orgy',0);
 
 sub float_g ($) {
     my ($f) = @_;
@@ -78,7 +80,7 @@ sub proc ($) {
            die "$pname ?" unless $procs{$pname};
            proc($procs{$pname});
        } elsif (m/^\!draw\s+/) {
-           my @coords = split /\s+/, $';
+           my @coords = split /\s+/, $'; #';
            my @undefs = grep { !defined $c{$_} } qw(zprint);
            die "@undefs ?" if @undefs;
            @coords = map {
@@ -86,6 +88,14 @@ sub proc ($) {
                m/\,/ or die $!;
                [ $`, $', !!$jerk ]; # '];
            } @coords;
+           foreach my $co (@coords) {
+               foreach my $xy (qw(0 1)) {
+                   my $xyv = $co->[$xy];
+                   next unless $xyv =~ s/^\@//;
+                   my $orgxy = ($c{orgx},$c{orgy})[$xy];
+                   $co->[$xy] = float_g($xyv + $orgxy);
+               }
+           }
            my $extrudepos=$c{restart};
            pl("G92 E0");
            my $zmove=$c{zprint}+$c{zlift};