2026-01-27 17:14:59 -08:00
|
|
|
# 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](01-core-architecture.md) | Application entry point, initialization, module organization |
|
|
|
|
|
| 2 | [Application Controller](02-application-controller.md) | Central singleton, workspaces, events, plugin registration |
|
|
|
|
|
| 3 | [UI & Rendering](03-ui-rendering.md) | Widget system, theming, tabs, popovers |
|
|
|
|
|
| 4 | [3D View & Part Preview](04-part-preview.md) | 3D viewport, scene context, camera, selection |
|
|
|
|
|
| 5 | [Printer Communication](05-printer-communication.md) | Serial communication, G-code streams, state machine |
|
|
|
|
|
| 6 | [Slicing System](06-slicing-system.md) | MatterSlice integration, settings mapping |
|
|
|
|
|
| 7 | [Library System](07-library-system.md) | Content management, containers, providers |
|
|
|
|
|
| 8 | [Data Storage](08-data-storage.md) | SQLite database, entities, application data |
|
|
|
|
|
| 9 | [Settings Management](09-settings-management.md) | Profiles, layers, presets, validation |
|
|
|
|
|
| 10 | [Design Tools](10-design-tools.md) | Primitives, operations, boolean, transforms |
|
|
|
|
|
| 11 | [Print Queue & History](11-print-queue-history.md) | Queue, history, recovery, tracking |
|
|
|
|
|
| 12 | [Plugin System](12-plugin-system.md) | Extension points, OEM customization |
|
|
|
|
|
| 13 | [Mesh Operations](13-mesh-operations.md) | Import/export, processing, CSG |
|
|
|
|
|
| 14 | [Utilities & Helpers](14-utilities.md) | Caching, localization, threading, math |
|
|
|
|
|
|
|
|
|
|
## Key Entry Points
|
|
|
|
|
|
|
|
|
|
| File | Purpose |
|
|
|
|
|
|------|---------|
|
|
|
|
|
| [Program.cs](../Program.cs) | Application entry point |
|
|
|
|
|
| [MatterControlApplication.cs](../MatterControlLib/MatterControlApplication.cs) | Static configuration |
|
|
|
|
|
| [RootSystemWindow.cs](../MatterControlLib/RootSystemWindow.cs) | Main window |
|
|
|
|
|
| [ApplicationController.cs](../MatterControlLib/ApplicationView/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 controller
|
|
|
|
|
- `Datastore.Instance` - Database access
|
|
|
|
|
- `ProfileManager.Instance` - Profile management
|
|
|
|
|
|
|
|
|
|
**Observer Pattern:**
|
|
|
|
|
- Events throughout for loose coupling
|
|
|
|
|
- `*Changed` events 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
|