Vagrearg Logo  
 

gcmc

Section: Misc. Reference Manual Pages (1)
Updated: 1.8.2
Index Return to Main Contents
 

NAME

gcmc - G-Code Meta Compiler

 

SYNOPSIS

gcmc [ options ] [ -o outfile | --output=outfile] [ infile ]  

DESCRIPTION

gcmc Gcmc is a front-end language for generating G-code, SVG and DXF for CNC mills, lathes, laser cutters and other numerical controlled machines employing G-code, SVG or DXF. The language is a context-free grammar created to overcome the archaic format of G-code programming and aims to be more readable and understandable. Gcmc makes extensive use of vector mathematics to support the 3D nature of CNC machining.
The input script is read from infile specified on the command-line or stdin if none is specified. Output is sent to outfile or stdout if not specified.

 

OPTIONS

-a, --offset-a=OFFSET
Set global A-axis offset. OFFSET defaults to degrees. The offset value may have angular units 'deg' or 'rad' associated. Radians will be converted to degrees internally.

-b, --offset-b=OFFSET
Set global B-axis offset. OFFSET defaults to degrees. The offset value may have angular units 'deg' or 'rad' associated. Radians will be converted to degrees internally.

-c, --offset-c=OFFSET
Set global C-axis offset. OFFSET defaults to degrees. The offset value may have angular units 'deg' or 'rad' associated. Radians will be converted to degrees internally.

-D, --define=STMT
Define a variable or statement on the command-line. The argument STMT is executed as a script prior to the handling of any input file. Multiple -D options may be used and are executed in command-line order. Each STMT is automatically appended a semi-colon (';') to ensure a complete statement.

-d, --debug
Enable debug. Only used for debugging gcmc.

--dxf
Set output format to DXF. Only feed moves (G1, G2, G3, etc.) are output in a single layer. DXF files include X, Y and Z coordinates, but no attempt is made to construct 3D geometries and the output is considered a 2D projection of the XY plane.

--gcode
Set output format to G-code. This is the default.

--gcode-function=NAME
Generate a G-code function (file-based sub-routine) with name NAME. The prologue and epilogue code are changed such that a valid file-based and named G-code function is stored in the output file using o-codes, which can be called from within LinuxCNC. Manual prologue and epilogue overrides are not allowed when generating G-code functions. The output filename should be in the format "NAME.ngc" and stored in the LinuxCNC search path.

--gcode-nom2
Use % starting and ending the file instead of an ending M2 when generating a subroutine using the --gcode-function option.

-G, --prologue=FILE
Use FILE as prologue code. The file data is verbatim copied before any generated code. FILE is copied regardless the prologue/epilogue suppression is enabled or not using the -q or --bare option. Changing the prologue is only supported when generating G-code output.

-g, --epilogue=FILE
Use FILE as prologue code. The file data is verbatim copied after any generated code. FILE is copied regardless the prologue/epilogue suppression is enabled or not using the -q or --bare option. Changing the epilogue is only supported when generating G-code output.

-h, --help
Brief description of all command-line options.

-I, --include=PATH
Add PATH to the include search path. This option may be used multiple times and any include file is searched in the order of these option(s). The gcmc library at /usr/local/share/gcmc and the current directory is always implicitly added after processing command-line options. The current directory is always the last entry in the search path.

i, --imperial
Use imperial output units for all values in the script that do not explicitly associate units. Command-line values such as axis offsets and SVG tool-width also take the units from this option. The default is to use metric units (millimeters).

-o, --output=FILE
Write output to FILE. Output is written to stdout if no output file is given.

--pedantic
Enable pedantic warnings.

-P, --precision=DEC
Use DEC decimals in output coordinates. A warning is emitted if DEC is less than 3. Valid range is 1 through 15. Default is 8.

-p, --plane=PLANE
Set initial cutting plane to PLANE where PLANE is one of 0 or XY, 1 or XZ, 2 or YZ.

-q, --bare
Suppress output of default prologue and epilogue code. Specifying -G and -g still outputs the user prologue and epilogue code. The prologue and epilogue code can only be suppressed when generating G-code.

-r, --relative
Output all coordinates using relative positioning. Each new position is referenced as a distance/angle from the previous location. The script still uses absolute coordinates, which will be translated to relative coordinates upon output (unless relative functions are used exclusively). Offsets must be unspecified or zero if relative mode is selected.

--svg
Set output format to SVG. The SVG backend creates two layers, one with the feed moves (G1, G2, G3, etc.) called the cut-path and one with the rapid (G0) movements, unless the --svg-no-movelayer option is specified. Only X and Y coordinates are used and the entire output is a XY-plane projection.

--svg-opacity=VAL
Set the opacity of the cut-path output lines to VAL, where VAL must be a value between 0.001 and 1.0.

--svg-no-flip
Do not flip (mirror) the Y axis and relocate the origin to the left-top corner in the SVG file.

--svg-no-movelayer
Disable output of rapids (G0/goto() moves) and suppress the move layer in the SVG file entirely.

--svg-toolwidth=WIDTH
Set the linewidth in the cut-path output to WIDTH. WIDTH is in units determined by the --imperial or -i option.

-U, --uvw
Enable 9-axis base XYZABCUVW output on move() and goto() calls. Default is only to output 6-axis coordinates (XYZABC).

-V, --version
Print version and exit.

-W, --error
Exit the gcmc executable with a non-zero return value if warnings are encountered. Default is to output warnings, but exit with a zero value.

-u, --offset-u=OFFSET
Set global U-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option. Only used when option --uvw or -U is set too.

-v, --offset-v=OFFSET
Set global V-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option. Only used when option --uvw or -U is set too.

-w, --offset-w=OFFSET
Set global W-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option. Only used when option --uvw or -U is set too.

-x, --offset-x=OFFSET
Set global X-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option.

-y, --offset-y=OFFSET
Set global Y-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option.

-z, --offset-z=OFFSET
Set global Z-axis offset. OFFSET may have distance units 'mm', 'in' or 'mil' associated and defaults to units determined by the --imperial or -i option.

 

EXAMPLE

Consider following file (saved as infile.gcmc) describing a 30 degree rotated star:
starpath = {
        [ 1,  1], [ 0,  3],
        [-1,  1], [-3,  0],
        [-1, -1], [ 0, -3],
        [ 1, -1], [ 3,  0]
};
starpath = rotate_xy(starpath * 100mm, 30deg);
goto(starpath[-1]);
foreach(starpath; v) {
  move(v);
}
Compiling above script with:
gcmc -o outfile.ngc infile.gcmc
results in an output file containing (excluding prologue and epilogue):
 ...
G0 X259.80762114 Y150.00000000
G1 X36.60254038 Y136.60254038
G1 X-150.00000000 Y259.80762114
G1 X-136.60254038 Y36.60254038
G1 X-259.80762114 Y-150.00000000
G1 X-36.60254038 Y-136.60254038
G1 X150.00000000 Y-259.80762114
G1 X136.60254038 Y-36.60254038
G1 X259.80762114 Y150.00000000
 ...
The same script may be converted to SVG and DXF format using the --svg and --dxf options respectively and viewed with the appropriate programs. More examples are available in the distribution and on the project's homepage.

 

DOCUMENTATION

Gcmc syntax and built-in function documentation may be found at the project homepage:
http://www.vagrearg.org/content/gcmc

 

BUGS

Probably... Please report any abnormalities to gcmc_at_vagrearg.org with an example of the problem.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLE
DOCUMENTATION
BUGS

This document was created by man2html, using the manual pages.
Time: 21:05:22 GMT, February 19, 2017
 
 
Overengineering @ request