- Easy G-Code Plotter
Easy G-Code Plot is a comprehensive desktop application for viewing, editing, and analyzing G-code files. It provides a rich set of features including 3D visualization, code editing with syntax highlighting, export functionality with multiple output formats, and various code manipulation tools.
- New/Open/Save: Create, open, and save G-code files
- Drag & Drop: Open files by dragging them onto the application
- Recent Files: Track recently opened files
- Auto-save Prompt: Warns about unsaved changes before closing
- Syntax Highlighting: Color-coded G-code commands (rapid moves, linear moves, circular moves)
- Customizable Editor:
- Adjustable font family, size, and style
- Configurable margins and line numbers
- Caret line highlighting
- Whitespace visibility control
- Advanced Editing:
- Find and Replace with options (case-sensitive, whole word, wrap-around)
- Undo/Redo operations
- Copy/Cut/Paste functionality
- Line numbering with customizable spacing
- 3D Plotting: Real-time visualization of toolpaths
- Multiple Views: 3D, Top, Front, and Left view modes
- Zoom Controls: In/out zoom functionality
- Grid Display: Configurable grid with adjustable size and spacing
- Lathe Mode: Specialized view for lathe operations
- Toolpath Animation: Step-by-step simulation with playback controls
- Renumber Blocks: Add, remove, or renumber N-line sequences
- Cleanup Tools:
- Remove unnecessary spaces
- Delete empty lines
- Eliminate comments
- Block Skipping: Skip commented lines with leading "/"
- Multiple Output Languages: Support for different G-code dialects
- Export Modes:
- Absolute or incremental positioning
- Force address output
- Leading zero suppression
- Program Headers/Footers: Customizable start and end program blocks
- Safety Lines: Option to add standard safety commands
- Delimiter Control: Space or no-space between commands
- Statistics: Calculate toolpath length and machining time
- Coordinate Limits: Determine min/max X, Y, Z values
- Feed Rate Analysis: Identify rapid vs. feed moves
- Python 3.7+
- PyQt5
- PyQtGraph
- QScintilla2
- NumPy
-
Clone the repository:
git clone https://github.com/MaestroFusion360/easy_gcode_plot.git cd easy-gcode-plotter -
Install required packages:
pip install -r scripts/requirements.txt
-
Run the application:
python main.py
- Open a G-code file using File → Open or by dragging and dropping it.
- Select ISO G-code for syntax highlighting, then press Refresh to apply.
- View the toolpath in the 3D plot window.
- Edit the code in the syntax-highlighted editor.
- Simulate the program using the playback controls.
- Export the modified G-code with the desired settings.
- Left side of the application
- Syntax-highlighted G-code display
- Line numbers and margin area
- Context menu for editing operations
- Right side of the application
- Interactive 3D visualization
- View control buttons (3D, Top, Front, Left)
- Grid toggle option
- Slider: Navigate through toolpath steps
- Coordinate Display: Current X, Y, Z, I, J, K, Feed values
- Playback Controls: Play, stop, forward, backward buttons
- Character count
- Cursor position
- Progress bar for long operations
Access via File → Export Options:
- Language Selection: Choose G-code dialect
- Output Mode: Absolute/Incremental
- Address Forcing: Always output G/M codes
- Program Start/End: Custom program headers/footers
- Sequence Numbers: Configure N-line numbering
- Formatting: Delimiters and zero suppression
G00: Rapid positioningG01: Linear interpolationG02: Circular interpolation (clockwise)G03: Circular interpolation (counter-clockwise)
G17: XY planeG18: ZX planeG19: YZ plane
G54-G59: Work coordinate systemsG90: Absolute positioningG91: Incremental positioning
G80: Cancel canned cycleG81: Drilling cycleG82: Spot drillingG83: Peck drilling
G40: Cancel cutter compensationG41: Cutter compensation leftG42: Cutter compensation rightG43: Tool length compensation positiveG49: Cancel tool length compensation
M00: Program stopM01: Optional stopM02: Program endM03: Spindle clockwiseM04: Spindle counter-clockwiseM05: Spindle stopM06: Tool changeM08: Coolant onM09: Coolant offM30: Program end and reset
The application saves configuration to config.ini in the following sections:
- Timer speed
- Arc calculation type
- Machine coordinates
- Lathe mode
- Line/background/grid colors
- Grid size and spacing
- Font family, size, weight, italic
- Caret line color and visibility
- Whitespace and EOL visibility
- Margin settings
- Language selection
- Address forcing
- Incremental mode
- Program start/end strings
- Sequence number configuration
- Window position and size
- Maximized state
-
Plot Not Displaying
- Ensure the G-code contains valid motion commands
- Check for syntax errors in the code
- Verify machine coordinates are set correctly
-
Export Errors
- Confirm output language compatibility
- Check for invalid characters in custom headers/footers
- Ensure sufficient disk space
-
Performance Issues
- Reduce plot complexity for very large files
- Close unnecessary applications
- Update graphics drivers
The application creates a main.log file for debugging:
- Log level: DEBUG
- Location: Application directory
- Contains: Conversion errors, export issues, general exceptions
- Frontend: PyQt5 with custom OpenGL visualization
- Editor: QScintilla with custom G-code lexer
- Plotting: PyQtGraph OpenGL implementation
- Configuration: QSettings with INI file storage
- Optimized for files up to 10,000 lines
- Incremental plotting for large toolpaths
- Background processing for export operations
- Input: Standard G-code (.nc, .cnc, .txt)
- Output: Customizable G-code formats
- Encoding: UTF-8
# Install development dependencies
pip install -r scripts/requirements.txt
# Create executable (optional)
pip install pyinstaller
pyinstaller main.py --name easy_gcode_plot --onefilemain.py: Main application windowmain_ui.py: Qt Designer generated UIfind_replace.py: Find/replace dialogexport.py: Export options dialogblock_num.py: Block numbering dialogfiles_res.py: Resource file (icons, etc.)
- New G-code commands: Update
convert()method - Visualization enhancements: Modify
addMotion()method - Export formats: Extend
exportPgm()method
MIT License - See LICENSE for details
