How svenhb/grbl-plotter works
Project Type and Purpose
• GRBL-Plotter is a Windows desktop “full-stack” application written in C# and .NET 4.0.
• Its purpose is to import, create, manipulate and send G-Code to GRBL-based CNC/plotting hardware via serial ports (and optionally control a 2nd GRBL device or 4th axis).
File-Structure Analysis
• Top level:
• GRBL-Plotter.sln – Visual Studio solution
• Firmware/hex_files – static firmware builds for GRBL hardware (supporting multiple versions/configurations)
• GRBL-Plotter/ – main application folder
• data/ – configuration, sample scripts, fonts, automations, buttons, usecases, etc.
• doc/ – markdown docs and screenshots
• Under GRBL-Plotter/:
• GUI/ – WinForms presentation layer
• ImportFromFile/ – domain services to parse incoming file formats (SVG, DXF, Gerber, HPGL, CSV, images) into G-Code or intermediate representations
• Vectorize/ – wrapper around Potrace functionality for vectorizing bitmaps
• MachineControl/ – modules to manage serial communication, GRBL commands, jogging, streaming, 4th-axis control, camera integration, probing
• Properties, Resources – application metadata, localization, settings, logs (NLog.config), and resources
• Program.cs – application entry point
Key Architectural Patterns
• Layered architecture:
• Presentation Layer (GUI)
• Application/Domain Layer (GCodeCreation, ImportFromFile, Vectorize, MachineControl, common utilities)
• Infrastructure Layer (serial port abstraction, file I/O, configuration via IniFile.cs, logging via NLog, external notifications via email/pushbullet)
• Plugin/extension style: file-import and G-code creation paths are pluggable by dropping new modules under GCodeCreation or ImportFromFile.
• MVC-style separation: UI forms call into controller classes in Application/Domain; UI contains no business logic.
Main Components and Interactions
• GUI (WinForms)
• MainForm, various dialogs (AboutForm, MessageForm, SetupForms…)
• Displays project settings, file dialogs, visual G-Code paths, camera overlay
• Routes user actions to Application services
• G-Code Processing
• ImportFromFile modules parse external files → produce intermediate vector or G-Code model
• Vectorize modules convert bitmaps → vector paths → feed into GCodeCreation
• MachineControl
• SerialPort manager streams G-Code lines to GRBL, interprets status responses
• Supports reconnect, feed/spindle override, jog, probe, height mapping, 4th axis, dual-GRBL control
• Data/Configuration
• data/automations, buttons, usecases – XML/INI presets loaded at runtime for automation scripts and UIBUTTON definitions
• data/fonts, data/tools – resource files used by GCodeCreation
• Infrastructure & External
• IniFile, Settings – persistence of user preferences
• Logging (NLog) – file and console logging
• External notifications – email/pushbullet for progress updates
• Firmware folder – shipped hex images for users to flash GRBL