# autodesk-forge/design.automation-asp.net-cabinet-sample architecture

> Architecture diagram of the GitHub repository autodesk-forge/design.automation-asp.net-cabinet-sample, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/autodesk-forge/design.automation-asp.net-cabinet-sample
- Repository: https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample

## Overview

##### Project Type and Purpose
- It’s a full-stack web application (ASP.NET MVC) that:
- Serves an HTML/JS UI (jQuery, jQuery UI, Razor views) and Autodesk Viewer on the browser
- Invokes Autodesk Forge Design Automation v2 (“AutoCAD I/O”) to run custom AutoCAD commands in the cloud
- Stores input/output DWG files on AWS S3
- Uses an email service (SMTP) to send generated drawings

##### Main Components
a. Browser / Client Layer
– UI: Razor Views (Index.cshtml, _Layout.cshtml, etc.)
– JS: jQuery, jQuery UI, Autodesk Viewer v5.0
b. Web Server / Backend (ASP.NET MVC)
– Presentation: Controllers (HomeController)
– Domain: Models (ClosetModel)
– Data: App_Data MDF (aspnet-MvcApplication2.mdf) for settings/user data
– Configuration: Web.config, AWS & Forge credentials, SMTP settings
c. Forge Design Automation Services
– AppPackage Registration: CustomPlugin (bundled in CreateCloset.bundle/CustomPlugin)
– WorkItem Submission: via design.automation-.net-library (Client.cs in CreateCloset.bundle/Custom-AppPackage)
d. Storage Services
– AWS S3 Bucket: input DWG templates (Blank.dwg, BlankIso.dwg), result.dwg
– Local App_Data database (membership, settings)
e. Email Service
– SMTP server (configured in Web.config) to send the DWG as attachment
f. Development/Test Console (optional)
– CreateCloset.bundle/Custom-Apppackage console app to test AppPackage+WorkItem workflow locally

##### Relationships and Data Flows
1. User adjusts closet parameters in browser → clicks “Preview” or “Send Email.”
2. Browser posts form to ASP.NET MVC controller.
3. Controller uploads DWG template and parameter JSON to AWS S3.
4. Controller calls Forge Design Automation API:
- Registers / references the CustomPlugin AppPackage
- Submits WorkItem with S3 input, custom script (CreateCloset command), S3 output target
5. Forge executes AutoCAD in the cloud with CustomPlugin → writes result.dwg to S3.
6a. For Preview: Controller calls Forge Model Derivative API (SVF translation) → returns Viewer URN → Browser displays model in Autodesk Viewer.
6b. For Email: Controller downloads result.dwg from S3 → attaches to SMTP email → sends to user.

##### Architectural Patterns & Key Technologies
– MVC pattern for web tier
– Orchestration layer: .NET client library calling external REST APIs (Forge + AWS)
– Plugin pattern: AutoCAD .NET plugin (CustomPlugin built with ObjectARX SDK)
– Cloud file storage: AWS S3
– API integration: Design Automation v2, Model Derivative, Data Management

##### Essential Elements
– Clear, concise labels (e.g., “HomeController → ForgeDesignAutomationClient”)
– Note configuration sources (Web.config for credentials)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Browser (Client Layer)"
        direction TB
        Index["Index.cshtml"]:::frontend
        Layout["_Layout.cshtml"]:::frontend
        Scripts["Scripts (*.js)"]:::frontend
        CSS["Site.css & jQuery UI CSS"]:::frontend
    end

    %% Web Server / Backend
    subgraph "ASP.NET MVC Web Server" 
        direction TB
        Controllers["HomeController.cs"]:::backend
        Models["ClosetModel.cs"]:::backend
        Config["Web.config"]:::backend
        DB["aspnet-MvcApplication2.mdf"]:::storage
    end

    %% Forge Design Automation
    subgraph "Forge Design Automation v2" 
        direction TB
        AppPackage["CustomPlugin AppPackage"]:::forge
        ClientLib["DesignAutomation .NET Client\n(Client.cs, AIO.cs)"]:::forge
    end

    %% AWS S3 Storage
    subgraph "AWS S3 Bucket" 
        direction TB
        InputDWG["Blank.dwg\nBlankIso.dwg"]:::storage
        OutputDWG["result.dwg"]:::storage
    end

    %% Email Service
    subgraph "Email Service"
        SMTP["SMTP Server"]:::email
    end

    %% Development/Test Console
    subgraph "Dev/Test Console"
        Console["Program.cs (Console App)"]:::forge
    end

    %% Connections
    Index -->|"loads view"| Controllers
    Layout --> Controllers
    Scripts --> Controllers
    CSS --> Controllers

    Controllers -->|"uses Model"| Models
    Models --> DB

    Controllers -->|"calls Design Automation"| ClientLib
    ClientLib -->|"references AppPackage"| AppPackage
    AppPackage -->|"executes in cloud\nwrites output"| OutputDWG
    Controllers -->|"uploads inputs"| InputDWG
    Controllers -->|"downloads result & sends"| SMTP

    Console -->|"tests AppPackage locally"| AppPackage

    %% Click Events
    click Index "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Views/Home/Index.cshtml"
    click Layout "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Views/Shared/_Layout.cshtml"
    click Scripts "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Scripts/*.js"
    click CSS "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Content/Site.css"
    click Controllers "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Controllers/HomeController.cs"
    click Models "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Models/ClosetModel.cs"
    click Config "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Web.config"
    click DB "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/App_Data/aspnet-MvcApplication2-20140904123607.mdf"
    click AppPackage "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/tree/master/CreateCloset.bundle/CustomPlugin/CustomPlugin/"
    click ClientLib "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/CreateCloset.bundle/Custom-Apppackage/Client/Client.cs"
    click Console "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/CreateCloset.bundle/Custom-Apppackage/Client/Program.cs"
    click InputDWG "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/Blank.dwg"
    click OutputDWG "https://github.com/autodesk-forge/design.automation-asp.net-cabinet-sample/blob/master/AutoCADIODemoWebApp/result.dwg"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0366D6,color:#0366D6
    classDef backend fill:#DFF5D0,stroke:#258026,color:#258026
    classDef forge fill:#FFE4B3,stroke:#E68A00,color:#E68A00
    classDef storage fill:#E0E0E0,stroke:#7A7A7A,color:#7A7A7A
    classDef email fill:#F0E0FF,stroke:#8A2BE2,color:#8A2BE2
```
