# shaise/freecad_sheetmetal architecture

> Architecture diagram of the GitHub repository shaise/freecad_sheetmetal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaise/freecad_sheetmetal
- Repository: https://github.com/shaise/freecad_sheetmetal

## Overview

##### Project Type and Purpose
This is a specialized CAD workbench (plugin/extension) for FreeCAD that provides sheet metal design and manipulation tools. It's primarily focused on providing functionality for creating, folding, and unfolding sheet metal designs.

##### Main System Components

a. Core Components:
- Base Command System (SheetMetalBaseCmd.py, SheetMetalCmd.py)
- Sheet Metal Operations (Fold, Bend, Extend, Relief, etc.)
- Unfolder System (SheetMetalUnfolder.py)
- Material Management System (K-factor handling)

b. UI Components:
- Task Panels (Resources/panels/*.ui files)
- Command Interface (InitGui.py)
- Translation System (Resources/translations)

c. Testing Framework:
- Test Suite (SMTests directory)

**┌─ User Interface Layer ─────────────────────┐**
- Command Toolbar                          │
- Task Panels                              │
- Property Editors                         │
- Command Layer ──────────────────────────┐ │
- Sheet Metal Operations                 │ │
- Modification Tools                     │ │
- Core Processing Layer ─────────────────┐│ │
- Geometry Calculations                ││ │
- K-factor Processing                  ││ │
- Unfolding Engine                     ││ │
- Integration Layer ───────────────────┐ ││ │
- FreeCAD API Interface              │ ││ │
- Material Definition Interface       │ ││ │
- ┴─┴┴─┘

##### Key Relationships to Highlight

- Data flow between UI components and command processing
- Relationship between base commands and specialized operations
- Demonstrate how the unfolding system interacts with other components
- Material definition system's integration points

##### Implementation Details

- The modular nature of the different sheet metal operations
- The separation between UI and processing logic
- The integration with FreeCAD's core system
- The material definition and K-factor handling system
- The translation system's integration

##### Technical Notes

Annotations for:
- Python version compatibility
- FreeCAD version requirements
- Key dependencies
- File format handling (DXF/SVG export)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef ui fill:#a8d1f0,stroke:#333
    classDef process fill:#90EE90,stroke:#333
    classDef core fill:#FFE5B4,stroke:#333
    classDef integration fill:#D3D3D3,stroke:#333
    classDef test fill:#FFB6C1,stroke:#333

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Processing Components]:::process
        L3[Core Components]:::core
        L4[Integration Components]:::integration
        L5[Testing Components]:::test
    end

    %% User Interface Layer
    subgraph UI
        InitGui[Command Interface]:::ui
        TaskPanels[Task Panels]:::ui
        Translations[Translation System]:::ui
    end

    %% Command Layer
    subgraph Commands
        BaseCmd[Base Command System]:::process
        SheetOps[Sheet Metal Operations]:::process
        UnfoldCmd[Unfold Commands]:::process
    end

    %% Core Processing Layer
    subgraph Core
        UnfoldEngine[Unfolding Engine]:::core
        KFactorProc[K-factor Processing]:::core
        GeomCalc[Geometry Calculations]:::core
    end

    %% Integration Layer
    subgraph Integration
        FreeCADAPI[FreeCAD API Interface]:::integration
        MaterialDef[Material Definition Interface]:::integration
    end

    %% Testing Framework
    subgraph Testing
        TestSuite[Test Suite]:::test
        KFactorTests[K-factor Tests]:::test
        FoldTests[Folding Tests]:::test
    end

    %% Utility Components
    subgraph Utils
        Logger[Logger]:::process
        Tools[Sheet Metal Tools]:::process
        Lookup[Lookup Tables]:::process
    end

    %% Relationships
    InitGui --> BaseCmd
    InitGui --> TaskPanels
    TaskPanels --> SheetOps
    BaseCmd --> SheetOps
    SheetOps --> GeomCalc
    SheetOps --> KFactorProc
    UnfoldCmd --> UnfoldEngine
    UnfoldEngine --> GeomCalc
    KFactorProc --> MaterialDef
    GeomCalc --> FreeCADAPI
    MaterialDef --> FreeCADAPI
    TestSuite --> KFactorTests
    TestSuite --> FoldTests
    Logger --> Tools
    Tools --> Lookup

    %% Click Events
    click InitGui "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/InitGui.py"
    click TaskPanels "https://github.com/shaise/FreeCAD_SheetMetal/tree/master/Resources/panels/"
    click Translations "https://github.com/shaise/FreeCAD_SheetMetal/tree/master/Resources/translations/"
    click BaseCmd "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalBaseCmd.py"
    click SheetOps "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalFoldCmd.py"
    click UnfoldCmd "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalUnfoldCmd.py"
    click UnfoldEngine "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalUnfolder.py"
    click KFactorProc "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalKfactor.py"
    click TestSuite "https://github.com/shaise/FreeCAD_SheetMetal/tree/master/SMTests/"
    click KFactorTests "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SMTests/testKfactor.py"
    click FoldTests "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SMTests/testFolder.py"
    click Logger "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalLogger.py"
    click Tools "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalTools.py"
    click Lookup "https://github.com/shaise/FreeCAD_SheetMetal/blob/master/lookup.py"
```
