This project is a very simple G-code loader and simulator designed to interpret, simulate, and send machining commands to CNC machines, ensuring accurate execution of tasks. It provides a streamlined solution for working with G-code, the language used to control CNC (Computer Numerical Control) machines. The project parses G-code files, simulates the machining process, and sends commands directly to CNC machines for execution. It is an essential tool for machinists, hobbyists, and professionals aiming to optimize their CNC workflows.
Key Features
1. G-code File Loading:
- Supports the loading of standard G-code files (*.nc, *.gcode) with syntax highlighting for ease of use.
- Parses file content to extract commands and parameters.
2. Simulation Mode:
- Visualize tool paths and machine movements in a 2D/3D graphical environment.
- Helps detect errors or inefficiencies in the machining process before actual execution.
3. Command Interpretation:
- Interprets G-code commands and parameters, ensuring they conform to CNC machine capabilities.
4. Real-Time Command Transmission:
- Sends commands directly to the CNC machine via a serial or network connection.
- Provides feedback on command execution status.
- Detects and logs errors in the G-code or during transmission for troubleshooting.
Technical Implementation
Core Functionalities
1. G-code Parsing:
- Reads and processes G-code commands such as G0 (rapid movement), G1 (linear interpolation), G2/G3 (circular interpolation), and more.
- Extracts key parameters like coordinates, feed rates, and spindle speeds.
2. Simulation Engine:
- Renders tool paths based on G-code commands using graphical libraries.
- Simulates machine behavior for both visual feedback and error checking.
3. Communication with CNC Machines:
- Implements serial communication (e.g., via USB/RS232) or network protocols for command transmission.
- Ensures real-time synchronization between the software and the CNC controller.
4. User Interface:
- Features an intuitive interface for loading files, visualizing simulations, and managing command transmission.
- Includes start/stop controls and progress monitoring.
Technology Stack
1. Programming Language:- Written in C# for a robust and efficient desktop application.
- Built using Windows Forms for a user-friendly interface.
- Incorporates libraries for rendering tool paths and simulations.
- Leverages serial libraries (e.g., System.IO.Ports) for direct communication with CNC controllers.
The Tarsier G-Code project bridges the gap between G-code programming and CNC machine operation, making it easier for users to interpret, simulate, and execute machining commands. By combining powerful parsing, visualization, and communication features, this tool empowers users to minimize errors, optimize workflows, and achieve precision in their CNC tasks.