5.8 KiB
5.8 KiB
MatterControl Codebase Documentation
This directory contains comprehensive documentation of the MatterControl 3D printing software codebase.
Overview
MatterControl is a comprehensive 3D printing workflow application built by MatterHackers. It provides:
- 3D model viewing and manipulation
- Parametric design tools
- Integrated slicing (MatterSlice)
- Printer communication and control
- Library management
- Print history and recovery
Technology Stack:
- .NET 6.0 (C#)
- Custom UI framework (agg-sharp)
- OpenGL rendering
- SQLite database
- MatterSlice slicer engine
Documentation Index
| # | Document | Description |
|---|---|---|
| 1 | Core Architecture | Application entry point, initialization, module organization |
| 2 | Application Controller | Central singleton, workspaces, events, plugin registration |
| 3 | UI & Rendering | Widget system, theming, tabs, popovers |
| 4 | 3D View & Part Preview | 3D viewport, scene context, camera, selection |
| 5 | Printer Communication | Serial communication, G-code streams, state machine |
| 6 | Slicing System | MatterSlice integration, settings mapping |
| 7 | Library System | Content management, containers, providers |
| 8 | Data Storage | SQLite database, entities, application data |
| 9 | Settings Management | Profiles, layers, presets, validation |
| 10 | Design Tools | Primitives, operations, boolean, transforms |
| 11 | Print Queue & History | Queue, history, recovery, tracking |
| 12 | Plugin System | Extension points, OEM customization |
| 13 | Mesh Operations | Import/export, processing, CSG |
| 14 | Utilities & Helpers | Caching, localization, threading, math |
Submodule Documentation
| Submodule | Document | Description |
|---|---|---|
| agg-sharp | agg-sharp.md | Graphics library: 2D rendering, GUI widgets, 3D mesh, VectorMath, OpenGL, Typography |
Planning
| Document | Description |
|---|---|
| Design-Only Fork | Plan to strip MatterControl down to a pure 3D design/modeling application, removing all printing, slicing, and cloud features. |
| Web Port Feasibility | Analysis of porting design features to a web app (JavaScript, WASM, WebGL). Includes technology mapping and timeline estimates. |
| Linux Migration | Feasibility of migrating the project from its many Windows-only dependencies to cross platform alternatives to fully support Linux. |
Key Entry Points
| File | Purpose |
|---|---|
| Program.cs | Application entry point |
| MatterControlApplication.cs | Static configuration |
| RootSystemWindow.cs | Main window |
| ApplicationController.cs | Central controller |
Project Structure
MatterControl/
├── MatterControl/ # Main executable
├── MatterControlLib/ # Core library
│ ├── ApplicationView/ # Application state, workspaces
│ ├── CustomWidgets/ # UI components
│ ├── DataStorage/ # Persistence layer
│ ├── DesignTools/ # Parametric design
│ ├── Library/ # Content management
│ ├── PartPreviewWindow/ # 3D view, tabs
│ ├── PrinterCommunication/# Printer connectivity
│ ├── PrintQueue/ # Queue management
│ ├── SettingsManagement/ # Application settings
│ └── SlicerConfiguration/ # Slicer settings
├── MatterControl.Printing/ # G-code, serial
├── MatterControl.OpenGL/ # OpenGL utilities
├── MatterControl.MeshOperations/ # Mesh editing
├── Plugins/ # Optional features
├── StaticData/ # Resources
└── Submodules/
├── agg-sharp/ # Rendering, UI, math
└── MatterSlice/ # Slicer engine
Key Namespaces
| Namespace | Purpose |
|---|---|
MatterHackers.MatterControl |
Main application |
MatterHackers.MatterControl.ApplicationView |
App controller, workspaces |
MatterHackers.MatterControl.PrinterCommunication |
Printer drivers |
MatterHackers.MatterControl.SlicerConfiguration |
Slicing settings |
MatterHackers.MatterControl.PartPreviewWindow |
3D visualization |
MatterHackers.MatterControl.Library |
Content management |
MatterHackers.MatterControl.DataStorage |
Database layer |
MatterHackers.MatterControl.DesignTools |
3D editing tools |
Key Patterns
Singleton Pattern:
ApplicationController.Instance- Central controllerDatastore.Instance- Database accessProfileManager.Instance- Profile management
Observer Pattern:
- Events throughout for loose coupling
*Changedevents for state notifications
Stream Pipeline:
- G-code processing via chained streams
- Each stream transforms/filters commands
Container Pattern:
- Library uses hierarchical containers
- Uniform navigation across storage backends
Dependencies
Internal (Submodules):
- agg-sharp - Graphics, UI, math
- MatterSlice - Slicing engine
- clipper_library - Polygon operations
- geometry3Sharp - Geometry algorithms
External (NuGet):
- Newtonsoft.Json - JSON serialization
- Markdig - Markdown parsing
- Lucene.Net - Full-text search
- AngleSharp - HTML parsing
- PDFsharp - PDF generation
- Zeroconf - Network discovery