Skip to content

Examples Gallery

Explore real-world GScript programs and learn common patterns.

Quick Start Examples

Hello World: Simple Drill

The simplest GScript program - drill a single hole:

gscript
tool drill_3mm {
    diameter: 3.0,
    flutes: 2,
    max_rpm: 15000,
}

drill {
    tool: drill_3mm,
    locations: [(50, 50)],
    depth: 5.0,
    feed: 300.0,
}

Face Milling

Surface a rectangular area:

gscript
tool endmill_6mm {
    diameter: 6.0,
    flutes: 4,
    max_rpm: 18000,
}

face {
    area: rect(0, 0, 100, 100),
    tool: endmill_6mm,
    depth: 2.0,
    stepover: 0.75,
    feed: 1200.0,
}

Pocket Milling

Mill a rectangular pocket:

gscript
tool endmill_6mm {
    diameter: 6.0,
    flutes: 4,
    max_rpm: 18000,
}

pocket {
    area: rect(10, 10, 80, 80),
    tool: endmill_6mm,
    depth: 10.0,
    stepdown: 2.0,
    stepover: 0.5,
    feed: 1000.0,
}

Example Categories

Basic Examples

Simple programs demonstrating core features:

Advanced Examples

Complex programs using multiple operations:

Real-World Projects

Complete projects from production use:

Learning Path

  1. Start with Basic Examples to learn GScript syntax
  2. Progress to Advanced Examples for complex operations
  3. Study Real-World Projects to see complete workflows

Try It Yourself

Download the example files from the GitHub repository and compile them:

bash
gscript compile examples/basic/drill-pattern.gs --backend grbl

Contributing Examples

Have a great GScript example to share? Submit a pull request to add it to the gallery! See the Contributing Guide for details.

Released under the Apache License 2.0