API Reference

Overview

The GCode API is a library for streaming G-code commands to Galil DMC motion controllers. It provides both a C API for cross-language compatibility and a C++ wrapper for convenient RAII-based resource management.

📏 Units Support

The API works seamlessly with G-Code specified in inches or millimeters.

Simply ensure your project maintains consistent units throughout all commands and configurations.

Setup

To use the GCode API in your project:

  1. Add the appropriate header to your include path:
    • gcode_api.h for C projects
    • gcode_api.hpp for C++ projects (includes the C header automatically)
  2. Link against gcode_api.lib (Release) or gcode_apid.lib (Debug).

Both headers and libraries are located in the root of your installation directory. The path is available via the GALIL_GCODES environment variable set during installation.

API Documentation

Quick Example

Here's a minimal C++ example to get started:

#include "gcode_api.hpp"

int main() {
    GCode gcode("your-license-key-here");

    if (gcode.Connect("192.168.1.100") != GCODE_OK) {
        return 1;
    }

    gcode.ConfigureLinearAxis('X', 'A', 1000.0, 100.0);
    gcode.ConfigureLinearAxis('Y', 'B', 1000.0, 100.0);

    gcode.AddCommand("G1 X10 Y10 F100");
    gcode.Start();
    gcode.WaitForQueueEmpty();

    return 0;
}

See the C++ Wrapper documentation for complete examples.