Skip to content

thawkins/gcodekit3

Repository files navigation

GCodeKit - Rust Port of Universal G-Code Sender

A modern, cross-platform G-Code sender built with Rust and Tauri, inspired by Universal G-Code Sender.

Features

Core Functionality ✅

  • Cross-Platform: Works on Windows, macOS, and Linux
  • Modern Architecture: Built with Rust for performance and safety
  • Tauri GUI: Lightweight, fast UI using web technologies
  • GRBL Support: Full support for GRBL firmware
  • Serial Communication: Robust serial port handling with tokio-serial
  • Real-time Status: Live machine position and status updates (200ms polling)
  • Jogging: Incremental and continuous jogging support (X/Y/Z axes)
  • Homing: Support for homing cycles
  • Alarm Management: Handle and clear alarms
  • G-Code Streaming: Send G-code files with automatic flow control

3D Visualization ✨ (NEW!)

  • Interactive 3D Viewer: Real-time G-code toolpath visualization using Three.js
  • Toolpath Preview: Automatic rendering of G0/G1 movement commands
  • Gradient Coloring: Visual progression from blue (start) to cyan (end)
  • Machine Position: Real-time 3D indicator showing current position
  • Camera Controls: Orbit, zoom, and pan with mouse
  • View Modes: Quick access to Top, Front, Side, and Isometric views
  • Coordinate Axes: Color-coded XYZ axes (Red/Green/Blue)
  • Reference Grid: Ground plane for spatial reference
  • Bounds Display: Automatic workpiece dimension calculation
  • Hardware Accelerated: WebGL rendering at 60 FPS

Enhanced UI Features ✅ (Task 6)

  • Progress Bars: Real-time visual progress tracking with percentage display
  • File Validation: Pre-flight G-code file validation with error detection
  • Time Estimation: Estimated job duration based on command count
  • Elapsed Time: Live elapsed time tracking during job execution
  • Job History: Comprehensive history with status, duration, and timestamps
  • Streaming Controls: Start/Pause/Resume/Cancel functionality
  • Modern Design: Responsive UI with color-coded status indicators

Testing & Quality ✅

  • 115 Passing Tests: Comprehensive test suite with 100% success rate
  • Mock Testing: Mock serial ports for unit testing
  • Integration Tests: Full workflow testing scenarios
  • Edge Case Coverage: Extensive edge case testing

Architecture

The project is organized into the following modules:

Core Library (src/)

  • model/: Core data types (Position, Units, Axis, Alarm)
  • communication/: Serial and network communication layer
  • controller/: Controller implementations (GRBL, TinyG, etc.)
  • gcode/: G-code parsing and command generation
  • listeners/: Event system for controller state changes
  • firmware/: Firmware-specific settings and capabilities
  • utils/: Utility functions and helpers

Main Application (src/main.rs)

Tauri application with command handlers for:

  • Connection management
  • Status queries
  • Machine control (homing, jogging, etc.)
  • G-code sending

UI (ui/)

Modern HTML/CSS/JavaScript interface with:

  • 3D Toolpath Viewer with interactive controls (NEW!)
  • Connection panel with port selection
  • Machine status display with live updates
  • Jog controls with customizable distance/feed rate
  • File selection with validation (Task 6)
  • Progress tracking with visual bars (Task 6)
  • Job history panel (Task 6)
  • G-code command input
  • Console for messages and feedback

Building

Prerequisites

  • Rust 1.70 or higher
  • Node.js (for Tauri)
  • Platform-specific dependencies for Tauri

Development Build

cargo build

Release Build

cargo build --release

Running

cargo run

Testing

# Run all tests
cargo test

# Run tests with output
cargo test -- --nocapture

# Run specific test module
cargo test communication::

Tests are located in the tests/ directory, organized by module.

Usage

  1. Connect to Machine

    • Select serial port from dropdown
    • Choose baud rate (default: 115200)
    • Click "Connect"
  2. Home Machine

    • Click "Home" button to run homing cycle
  3. Jog Machine

    • Set feed rate and distance
    • Use directional buttons (X+/-, Y+/-, Z+/-)
  4. Send G-Code

    • Type command in input field
    • Press Enter or click "Send Command"
  5. Reset Zero

    • Click "Reset Zero" to set current position as origin

Comparison with Universal G-Code Sender

Feature UGS (Java) GCodeKit (Rust)
Language Java Rust
GUI Framework NetBeans Platform/Swing Tauri (HTML/CSS/JS)
Serial Library JSSC/JSerialComm tokio-serial
Memory Usage Higher Lower
Startup Time Slower Faster
Binary Size Larger (with JRE) Smaller

License

GPL-3.0 (same as Universal G-Code Sender)

Contributing

Contributions are welcome! Please ensure:

  • Code follows Rust best practices
  • Tests are included for new features
  • Documentation is updated
  • Commit messages are descriptive

Acknowledgments

This project is inspired by and based on Universal G-Code Sender by Will Winder and contributors.

Roadmap

  • Basic GRBL controller support
  • Serial communication
  • Jogging controls
  • Homing cycle
  • Status reporting
  • G-code file streaming
  • 3D visualization
  • TinyG/g2core support
  • Smoothieware support
  • Macro support
  • Probe operations
  • Advanced jogging (continuous, keyboard)
  • Work coordinate systems (G54-G59)
  • Tool length offset
  • Feed/spindle overrides

Known Limitations

  • Currently only supports GRBL firmware
  • Limited testing on all platforms

Support

For issues and questions:

  • Open an issue on GitHub
  • Check the documentation in docs/
  • Refer to Universal G-Code Sender documentation for G-code help

About

GCodeKit - Modern Rust port of Universal G-Code Sender with Tauri GUI and 3D visualization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors