The Materials Manager provides a comprehensive CRUD (Create, Read, Update, Delete) interface for managing the materials database in GCodeKit4.
The Materials Manager allows you to manage the following material properties:
- ID: Unique material identifier (e.g.,
wood_oak_red,metal_al_6061) - Name: Display name of the material
- Category: Material category (Wood, Engineered Wood, Plastic, Non-Ferrous Metal, Ferrous Metal, Composite, Stone & Ceramic)
- Subcategory: More specific classification (e.g., "Hardwood", "Alloy")
- Description: Brief description of the material
- Density: Material density in kg/m³
- Machinability Rating: Ease of machining on a scale of 1-10
- Tensile Strength: Optional tensile strength in MPa
- Melting Point: Optional melting or glass transition temperature in °C
- Chip Type: Type of chips formed during cutting (Continuous, Segmented, Granular, Small)
- Heat Sensitivity: Sensitivity to heat during machining (Low, Moderate, High)
- Abrasiveness: Tool wear factor (Low, Moderate, High)
- Surface Finish: Achievable surface finish quality (Excellent, Good, Fair, Rough)
- Dust Hazard: Level of dust hazard (None, Minimal, Moderate, High)
- Fume Hazard: Level of fume hazard (None, Minimal, Moderate, High)
- Coolant Required: Whether coolant is required for machining
- Required PPE: Personal protective equipment needed
- Notes: Custom notes, tips, and recommendations for working with the material
The Materials Manager is accessible from:
- Tab Bar: Click the "📦 Materials" tab in the main tab bar
- Menu Bar: View → Materials
- Keyboard: Use the menu shortcut to switch to Materials view
The left panel displays all materials in the library with:
- Material name and category
- Machinability rating with color coding:
- Green (7-10): Easy to machine
- Orange (5-6): Moderate difficulty
- Red (1-4): Difficult to machine
- "Custom" badge for user-defined materials
- Search Box: Search materials by name or subcategory
- Category Filter: Filter materials by category
- Refresh Button: Reload materials from the database
The right panel provides a tabbed interface for editing material properties:
- Basic Info: Name, category, subcategory, and description
- Properties: Physical properties (density, machinability, tensile strength, melting point)
- Machining: Machining characteristics (chip type, heat sensitivity, abrasiveness, surface finish)
- Safety: Safety information (dust/fume hazards, coolant requirements, PPE)
- Notes: Additional notes and machining tips
- Click the "➕ New Material" button
- Fill in the material ID (required for new materials)
- Enter material properties across the tabs
- Click "💾 Save" to add the material to the library
- Click on any material in the list
- Properties are displayed in the tabbed interface
- Navigate between tabs to view different property groups
- Select a material from the list
- Modify any properties in the editor
- Click "💾 Save" to update the material
- Select a custom material from the list
- Click "🗑️ Delete" to remove it
- Note: Standard library materials cannot be deleted
Custom materials are automatically saved to disk and restored when the application starts:
- Storage Location:
~/.config/gcodekit4/custom_materials.json(Linux/macOS) or%APPDATA%\gcodekit4\custom_materials.json(Windows) - Auto-Save: Materials are saved automatically when created, updated, or deleted
- Format: JSON format for easy backup and manual editing if needed
- Standard Library: Built-in materials (Red Oak, Aluminum 6061, Acrylic) are always available and cannot be deleted
Note: Only custom materials (those created by users) are saved to disk. Standard library materials are loaded from code on each startup.
The backend provides helper functions for managing the materials database with automatic persistence:
use gcodekit4::ui::MaterialsManagerBackend;
use gcodekit4::data::materials::{Material, MaterialId, MaterialCategory};
// Create a backend instance
let mut backend = MaterialsManagerBackend::new();
// Get all materials
let materials = backend.get_all_materials();
// Search materials
let results = backend.search_materials("aluminum");
// Filter by category
let metals = backend.filter_by_category(MaterialCategory::NonFerrousMetal);
// Add a material
let material = Material::new(
MaterialId("custom_material".to_string()),
"Custom Material".to_string(),
MaterialCategory::Wood,
"Custom".to_string(),
);
backend.add_material(material);
// Remove a material
backend.remove_material(&MaterialId("custom_material".to_string()));The backend provides conversion functions for UI values:
string_to_category(): Convert category name toMaterialCategoryenumstring_to_chip_type(): Convert chip type name toChipTypeenumstring_to_heat_sensitivity(): Convert sensitivity level toHeatSensitivityenumstring_to_abrasiveness(): Convert abrasiveness level toAbrasivenessenumstring_to_surface_finish(): Convert finish quality toSurfaceFinishabilityenumstring_to_hazard_level(): Convert hazard level toHazardLevelenum
The system comes with a standard library of common materials:
- Red Oak (Hardwood): Dense American hardwood, good for general CNC work
- Aluminum 6061 (Alloy): Common aluminum alloy, excellent machinability
- Acrylic (PMMA): Clear plastic, good for engraving and cutting
- UI Component:
src/ui_panels/materials_manager.slint - Backend Logic:
src/ui/materials_manager_backend.rs - Data Models:
src/data/materials.rs
Planned improvements include:
- PPE Management: Detailed PPE requirement tracking and display
- Cutting Parameters: Per-tool cutting parameter recommendations
- Material Database Import/Export: JSON/CSV import and export
- Material Templates: Quick creation from templates
- Supplier Information: Track material suppliers and pricing
- Usage Statistics: Track which materials are used most frequently
The Materials Manager integrates with the Designer tool to:
- Provide material selection for design projects
- Supply recommended cutting parameters based on material properties
- Display safety warnings for selected materials
- Calculate estimated machining time based on material machinability