Advertisements

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

,

  1. #1 by madbodger on 2017-12-14 - 08:48

    I know it’s pass√© these days, but I still build all sorts of things with “make”. The ability to build up definitions chunk by chunk programaticallly lets me avoid typing things twice, makes it clearer (to me, at least) why the commands look like they do, and I can set up arbitrarily complex dependencies. I do prefer “gmake” these days, it has an assortment of useful improvements.

    • #2 by Jason Doege on 2017-12-14 - 09:21

      For larger builds, TUP is worth a look as an alternative to make. It will automatically execute unrelated parts of the build in parallel.

    • #3 by Ed on 2017-12-14 - 11:10

      I’m agnostic: whatever the author / maintainer wants for a build system, it’s all good.

      Feeding a handful of configs into a command-line program, that I can do! [grin]