How miltonneal54/gerbervs works
Project type and purpose
• This is a Windows desktop application written in C# using WinForms.
• It consists of two main deliverables:
a. GerberView.exe – a graphical viewer/editor for Gerber (RS-274X) and NC drill files.
b. LibGerberVS.dll – a core parsing and rendering library based on Gerbv.
File structure
Top-level:
• GerberView/ – WinForms solution containing:
– Multiple Form*.cs files (Form1, DrillStatsFrm, LayerEditForm, etc.)
– Project.cs, ProjectFile.cs – orchestration of .gpf XML project files.
– Program.cs – application entry point.
– bin/, obj/ – build artifacts and debug/release outputs.
– gerberview.iss – Inno Setup installer script.
• LibGerberVS/ – core library solution:
– Gerber*.cs, Drill*.cs, Export*.cs, GerberProject.cs, etc.
– Implements parsing, data model, statistics, export (PNG, NC drill, RS-274X).
– bin/, obj/ – build artifacts.
• LibGerberVS.sln & GerberView.sln – Visual Studio solution files.
• README.*, LICENSE – supporting documentation.
Extract README insights
• Core library parses Gerber RS-274X & Ecelon drill, supports legacy commands.
• Projects (.gpf) are XML wrappers over multiple layers.
• Printing with preview, exporting to PNG.
• Acknowledges use of underlying Gerbv library.
Derive the architectural components
a. Presentation Layer (WinForms GUI – GerberView.exe)
• MainForms & Dialogs (Form1, LayerEditForm, DrillStatsFrm, SelectionPropertiesForm, etc.)
• Custom UI Controls (FileListBox, RulerControl, CustomColorDialog, MyListBox)
• Resource Manager (Bitmaps/, Resources/)
• Installer script (gerberview.iss)
b. Application Layer
• Project Manager (Project.cs, ProjectFile.cs) – loads/saves .gpf XML project files.
• Command Controllers – handle File→Open, Save, Print, Export commands.
c. Core Library Layer (LibGerberVS.dll)
• Parsers (GerberLineReader, GerberInstruction, Drill, DrillStats, etc.)
• Data Model (GerberProject, GerberNet, GerberSelection, DrillState)
• Exporters (ExportRS274X, ExportNCDrill, ExportProjectAsPNG)
• Utilities (BoundingBox, GerberStats, GerberImage)
d. External Interactions
• File System – reading .gbr/.drl files, writing .gpf, PNG, RS-274X, drill files
• Printing subsystem – .NET PrintDocument and PrintPreview
• Underlying Gerbv Library (at compile time integration)
Relationships and dataflows
• User launches GerberView.exe (Presentation) → Program.cs sets up main Form.
• User issues “Open Gerber/Drill file” → Presentation invokes Project Manager → Core Library parser loads file → Data Model is populated.
• Save Project → Application Layer serializes Data Model to XML via ProjectFile.cs.
• Export → Presentation calls Core Library Exporters → writes out to PNG/RS-274X/NC drill.
• Print → Presentation pipes Data Model to Print subsystem for preview and printer.
Architectural patterns
• Layered architecture (Presentation → Application → Core Library).
• Model-View pattern: Core Library holds the model, WinForms are the view/controllers.
• Single library module facilitates reuse (can be decoupled from GUI).
• XML-based project persistence.
Essential elements to capture
• Clear labels: e.g., “GerberView.exe (WinForms)”, “LibGerberVS.dll (Parser & Model)”.
• Data flows for Open, Render, Edit, Save, Export, Print.
• XML project serialization.
• Exporters vs. Parsing modules distinctions.