#!/bin/bash if [ "$6" == "" ]; then echo 'use: getmosaic.sh ' exit 1 fi xmin=$1 xstep=$2 xcount=$3 ymin=$4 ystep=$5 ycount=$6 snapname=`date +%Y%m%d-%H%M` if [ "$7" ]; then snapname="$7-$snapname"; fi snapext=".jpg" SERVER=3Dprinter PORT=8080 SLEEPSHORT=0.5 SLEEPLONG=1 FSPEED=3000 function gotoxyraw { echo "GOTO $1 $2 [$3:$4]" 8g1 X$1 Y$2 F$FSPEED } function gotoxy { gx=`echo "$xmin + ($1 - 1) * $xstep" | bc` gy=`echo "$ymin + ($2 - 1) * $ystep" | bc` gotoxyraw $gx $gy $1 $2 } function snapshot { name=$snapname-$1-$2$snapext echo SNAP:$name curl -s "http://$SERVER:$PORT/?action=snapshot" > $name ls -l $name } gotoxyraw $xmin $ymin sleep $SLEEPLONG sleep $SLEEPLONG for y in `seq 1 $ycount`; do echo Y:$y for x in `seq 1 $xcount`; do echo X:$x # gotoxy `echo "$xmin + ($x - 1) * $xstep" | bc` `echo "$ymin + ($y - 1) * $ystep" | bc` gotoxy $x $y sleep $SLEEPSHORT if [ "$x" == "1" ]; then sleep $SLEEPLONG; fi snapshot $x $y done;done gotoxyraw $xmin $ymin 8beep