Advertisements

Archive for December 14th, 2017

MPCNC: GCMC Configuration

The default GCMC prolog(ue) spits out some G-Codes that GRBL doesn’t accept, requiring tweaks to the incantation.

A first pass at a useful prolog, minus the offending codes:

cat ~/.config/gcmc/prolog.gcmc 
(prolog begins)
G17 (XY plane)
G21 (mm)
G40 (no cutter comp)
G49 (no tool length comp)
G80 (no motion mode)
G90 (abs distance)
G94 (units per minute)
(prolog ends)

Including any of the usual “end of program” M-Codes in the epilog(ue) causes GRBL to pause before exiting the program, so leave only a placeholder:

cat ~/.config/gcmc/epilog.gcmc 
(epilog begins)
(M2) (allow program to continue)
(epilog ends)

Having done a git clone into /opt/gcmc before building the program, the GCMC library routines live in:
/opt/gcmc/library

Limiting numeric values to two decimal places makes sense:
-P 2

With all that in hand, unleashing the compiler on an unsuspecting source file requires this jawbreaker:

gcmc -P 2 -I /opt/gcmc/library \
-G ~/.config/gcmc/prolog.gcmc \
-g ~/.config/gcmc/epilog.gcmc \
-o cycloids.ngc \
cycloids.gcmc

One might, of course, tuck all that into a little script, rather than depend on extracting it from the bash history as needed.

The resulting G-Code file looks about right:

head cycloids.ngc
(prolog begins)
G17 (XY plane)
G21 (mm)
G40 (no cutter comp)
G49 (no tool length comp)
G80 (no motion mode)
G90 (abs distance)
G94 (units per minute)
(prolog ends)
F2500.00
[pi@MPCNC tmp]$ head -25 cycloids.ngc
(prolog begins)
G17 (XY plane)
G21 (mm)
G40 (no cutter comp)
G49 (no tool length comp)
G80 (no motion mode)
G90 (abs distance)
G94 (units per minute)
(prolog ends)
F2500.00
G0 Z1.00
(-- tracepath at Z=-1.00mm --)
G0 X-145.50 Y-30.00
G1 Z-1.00
G1 X-145.51 Y-29.93

... vast snippage ...

G1 X175.50 Y30.00
G1 Z1.00
G0 Z25.00
(epilog begins)
(M2)
(epilog ends)

Then it’s just a matter of tweaking cycloids.gcmc to make interesting things happen:

GGMC Cycloids test patterns

GGMC Cycloids test patterns

Advertisements

,

3 Comments