Skip to content

Instantly share code, notes, and snippets.

@jenrik
Last active June 6, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenrik/359c2f10ca09fa27de59e321360e4f61 to your computer and use it in GitHub Desktop.
Save jenrik/359c2f10ca09fa27de59e321360e4f61 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Generate front+back mill + cut gcode
#
# zwork is set at 0.0. Adjust z-coordinate after touch off (e.g. to 0.1/0.2 mm) to cut below surface.
# (0.0 is usually a bit shallow if touched of on contact)
#
# zcut is set at just -1.4 mm to avoid cutting into and damaging material below
#
# cutter-diameter is 3.0 mm for 3.0 mm fishtail tool. Can be changed to 1.6 mm for 30 degree V-bit.
#
# offset 0.125 (for isolation) can be tuned if pcb has room
pcb2gcode \
--back *-B.Cu.gbr \
--front *-F.Cu.gbr \
--outline *-Edge.Cuts.gbr \
--drill *-PTH.drl \
--cut-feed=128 \
--cut-infeed=200 \
--cut-speed=2 \
--cut-vertfeed=128 \
--cutter-diameter=1.6 \
--milldrill-diameter=1.0 \
--dpi=1000 \
--drill-feed=256 \
--drill-speed=0 \
--metric \
--metricoutput \
--mill-feed=500 \
--mill-speed=2 \
--mill-vertfeed=254 \
--offset=0.125 \
--zchange=10 \
--zcut=-1.4 \
--zdrill=-1.6 \
--zero-start \
--zsafe=3 \
--zwork=0.0 \
--extra-passes=1 \
--drill-side back
# Strip tool changes from drill file
#
# notooldrill.ngc is the drill file without tool changes
grep -v "^T" drill.ngc > notooldrill.ngc
# Remove unsupported irrelevant g-code
grep -v "^G64" front.ngc > fix-front.ngc
grep -v "^G64" back.ngc > fix-back.ngc
grep -v "^G64" outline.ngc > fix-outline.ngc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment