cleanup-all 701 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. function ngc_position {
  3. ifn="$1"
  4. offsetx=10
  5. offsety=10
  6. if [[ "$ifn" == "" ]] ; then
  7. echo "provide file"
  8. exit 1
  9. fi
  10. dos2unix $ifn
  11. sed -i 's/;.*//' $ifn
  12. #sed -i 's/G0 *F[0-9]*//' $ifn
  13. #sed -i 's/G1 F\(.*\)/G1 F\1\nG0 F8000/' $ifn
  14. mx=`ngc_bounds $ifn | grep min_x | cut -f2 -d' '`
  15. my=`ngc_bounds $ifn | grep min_y | cut -f2 -d' '`
  16. shiftx=` echo "-($mx) + $offsetx" | bc -l`
  17. shifty=` echo "-($my) + $offsety" | bc -l`
  18. tfn=`mktemp`
  19. grecode -shift "$shiftx" "$shifty" $ifn | \
  20. grep -v '^(' > $tfn
  21. mv $tfn $ifn
  22. rm -f $tfn
  23. }
  24. ./svg2ngc "back-plate.svg"
  25. ./svg2ngc "top-plate.svg"
  26. ngc_position "back-plate.ngc"
  27. ngc_position "top-plate.ngc"