CLI Documentation
The GScript Command Line Interface (CLI) provides tools for compiling, validating, simulating, and optimizing GScript programs.
Installation
Install via cargo:
bash
cargo install gscriptOr download pre-built binaries from the releases page.
Basic Usage
bash
gscript [COMMAND] [OPTIONS]Available Commands
compile
Compile GScript to G-code:
bash
gscript compile input.gs --backend grbl -o output.gcodeOptions:
--backend <BACKEND>: Target backend (grbl, marlin, fanuc, linuxcnc, tinyg)-o, --output <FILE>: Output file path-O <LEVEL>: Optimization level (0-3)--profile <PROFILE>: Machine profile to use
validate
Validate GScript syntax and semantics:
bash
gscript validate input.gsChecks for:
- Syntax errors
- Type errors
- Tool definition issues
- Workspace boundary violations
- Feed rate validation
simulate
Simulate toolpaths and visualize operations:
bash
gscript simulate input.gsShows:
- Toolpath preview
- Collision detection results
- Material removal simulation
- Cycle time estimate
estimate
Calculate machining costs:
bash
gscript estimate input.gs --profile my-machineProvides:
- Estimated cycle time
- Material usage
- Tool wear estimation
- Total cost breakdown
optimize
Optimize G-code output:
bash
gscript optimize input.gcode -O3 -o optimized.gcodeApplies optimizations:
- Redundancy elimination
- Feed rate optimization
- Travel path optimization
- Arc fitting
Global Options
Available for all commands:
--verbose, -v: Enable verbose output--quiet, -q: Suppress non-error output--version: Show version information--help, -h: Show help information
Examples
Compile with optimization:
bash
gscript compile program.gs --backend grbl -O2 -o output.gcodeValidate before compiling:
bash
gscript validate program.gs && gscript compile program.gs --backend marlinEstimate costs before running:
bash
gscript estimate program.gs --profile haas-vf2Next Steps
- Commands Reference - Detailed command documentation
- Machine Profiles - Configure machine settings
- Hooks System - Automate workflows with hooks