# franpossetto/nina architecture

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

- Interactive diagram: https://gitdiagram.com/franpossetto/nina
- Repository: https://github.com/franpossetto/nina

## Overview

##### Main Components
- Revit Host Environment: At the top level, envision Revit (with its supported Revit API) as the host application into which your add-ins load.
- -in Modules: The solution contains multiple add-in projects targeting specific Revit versions (Nina.R2017, Nina.R2018, …, Nina.R2024). Each module is responsible for integration with a particular version of Revit.
- Common Utilities: The Nina.Common folder provides shared services such as configuration, logging, and GitHub integration that serve all add-in modules.
- Tool-Specific Modules: There are numerous specialized libraries addressing distinct functions:
- Nina.Language for language management (localization support for English, Russian, Spanish, etc.)
- Nina.Ribbon for creating and managing the custom Revit ribbon interface where commands are presented.
- Nina.PointCloud, Nina.Links, Nina.Selection, Nina.Visibility for their respective commands and operations (e.g., point cloud visualization, link management, element selection, visibility toggling).
- Installer: The Nina.Installer module provides the installation mechanism, packaging the add-ins into an MSI executable.
- Demo & Assets: These components serve as visual aids and sample configurations but are not core to the functionality.

##### Relationships and Interactions
- The add-ins (Nina.Rxxxx projects) directly interact with the Revit API. They orchestrate calls to the various tool-specific modules based on user actions in the Revit Ribbon.
- The Nina.Ribbon component acts as the UI layer that provides buttons, panels, and links to directly invoke functions in modules like PointCloud, Links, Selection, and Visibility.
- All add-ins and UI modules depend on Nina.Common for configuration management and logging – ensuring consistent behavior and easier maintenance.
- The Nina.Language module provides localization support across the UI and command implementations, allowing dynamic language changes based on user settings.
- The installer (Nina.Installer) packages these components correctly for deployment. It “glues” the different modules together during installation into the Revit environment.

##### Architectural Patterns and Design Principles
- Modular Design: The project’s structure clearly separates concerns by using directories for each distinct functionality. For example, version-specific add-ins allow tailored integrations while shared common code avoids duplication.
- Reusability: Common utilities, language management, and configuration files (e.g., in Nina.Common and Nina.Language) are used across many modules.
- UI Abstraction: The Ribbon module abstracts the creation and management of the user interface into its own component.
- Version Targeting: Maintaining separate projects for different Revit versions (R2017 through R2024) means that the architecture embraces version-specific customization, yet connects them via a common framework and shared libraries.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Top Level: Revit Host Environment
    Revit["Revit Host Environment<br/>(Revit API)"]:::external

    %% Version Specific Add-ins Subgraph
    subgraph "Version Specific Add-ins"
        R2017["Nina.R2017"]:::addIn
        R2018["Nina.R2018"]:::addIn
        R2019["Nina.R2019"]:::addIn
        R2020["Nina.R2020"]:::addIn
        R2021["Nina.R2021"]:::addIn
        R2022["Nina.R2022"]:::addIn
        R2023["Nina.R2023"]:::addIn
        R2024["Nina.R2024"]:::addIn
    end

    %% Shared Services Subgraph: Common Utilities & Language Management
    subgraph "Shared Services"
        Common["Nina.Common<br/>(Common Utilities)"]:::common
        Language["Nina.Language<br/>(Language Management)"]:::common
    end

    %% UI Layer: Ribbon Interface
    Ribbon["Nina.Ribbon<br/>(Ribbon UI)"]:::ribbon

    %% Tool Specific Modules Subgraph
    subgraph "Tool Modules"
        PointCloud["Nina.PointCloud<br/>(Point Cloud Tools)"]:::tool
        Links["Nina.Links<br/>(Links Management)"]:::tool
        Selection["Nina.Selection<br/>(Selection Tools)"]:::tool
        Visibility["Nina.Visibility<br/>(Visibility Tools)"]:::tool
    end

    %% Installer Component
    Installer["Nina.Installer<br/>(Installer)"]:::installer

    %% Supportive Visuals and Documents
    DemoAssets["Demo & Assets"]:::demo

    %% Connections from Revit to Version Specific Add-ins and Ribbon UI
    Revit -->|"loads"| R2017
    Revit -->|"loads"| R2018
    Revit -->|"loads"| R2019
    Revit -->|"loads"| R2020
    Revit -->|"loads"| R2021
    Revit -->|"loads"| R2022
    Revit -->|"loads"| R2023
    Revit -->|"loads"| R2024
    Revit -->|"displays"| Ribbon

    %% Connections from Add-ins to Shared Services
    R2017 -->|"uses"| Common
    R2018 -->|"uses"| Common
    R2019 -->|"uses"| Common
    R2020 -->|"uses"| Common
    R2021 -->|"uses"| Common
    R2022 -->|"uses"| Common
    R2023 -->|"uses"| Common
    R2024 -->|"uses"| Common

    %% Connections from Ribbon UI to Tool Modules and Language Management
    Ribbon -->|"invokes"| PointCloud
    Ribbon -->|"invokes"| Links
    Ribbon -->|"invokes"| Selection
    Ribbon -->|"invokes"| Visibility
    Ribbon -->|"localizes"| Language

    %% Connections from Tool Modules to Shared Services
    PointCloud -->|"uses"| Common
    Links -->|"uses"| Common
    Selection -->|"uses"| Common
    Visibility -->|"uses"| Common

    %% Installer packages components
    Installer -->|"packages"| R2017
    Installer -->|"packages"| Ribbon
    Installer -->|"packages"| Common
    Installer -->|"packages"| Language
    Installer -->|"packages"| PointCloud
    Installer -->|"packages"| Links
    Installer -->|"packages"| Selection
    Installer -->|"packages"| Visibility
    Installer -->|"includes"| DemoAssets

    %% Styles
    classDef external fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef addIn fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef common fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef ribbon fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef tool fill:#d9d2e9,stroke:#333,stroke-width:2px;
    classDef installer fill:#fcd5b4,stroke:#333,stroke-width:2px;
    classDef demo fill:#f0e68c,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mappings
    click R2017 "https://github.com/franpossetto/nina/blob/master/Nina.R2017"
    click R2018 "https://github.com/franpossetto/nina/blob/master/Nina.R2018"
    click R2019 "https://github.com/franpossetto/nina/blob/master/Nina.R2019"
    click R2020 "https://github.com/franpossetto/nina/blob/master/Nina.R2020"
    click R2021 "https://github.com/franpossetto/nina/blob/master/Nina.R2021"
    click R2022 "https://github.com/franpossetto/nina/blob/master/Nina.R2022"
    click R2023 "https://github.com/franpossetto/nina/blob/master/Nina.R2023"
    click R2024 "https://github.com/franpossetto/nina/blob/master/Nina.R2024"
    click Common "https://github.com/franpossetto/nina/blob/master/Nina.Common"
    click Language "https://github.com/franpossetto/nina/blob/master/Nina.Language"
    click Ribbon "https://github.com/franpossetto/nina/blob/master/Nina.Ribbon"
    click PointCloud "https://github.com/franpossetto/nina/blob/master/Nina.PointCloud"
    click Links "https://github.com/franpossetto/nina/blob/master/Nina.Links"
    click Selection "https://github.com/franpossetto/nina/blob/master/Nina.Selection"
    click Visibility "https://github.com/franpossetto/nina/blob/master/Nina.Visibility"
    click Installer "https://github.com/franpossetto/nina/blob/master/Nina.Installer"
    click DemoAssets "https://github.com/franpossetto/nina/tree/master/Nina/Demo and Nina/Assets"
```
