# saito40/gh_usefull architecture

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

- Interactive diagram: https://gitdiagram.com/saito40/gh_usefull
- Repository: https://github.com/saito40/gh_usefull

## Overview

##### Project Overview
- The project is designed to provide a collection of Python-based scripts intended to enhance or automate tasks in Grasshopper (a visual programming language for Rhino). The README states that the repository contains "便利？なもの" ("useful things") for Grasshopper.
- The code is organized into several modules (each in its own directory) that serve different purposes when integrated with Grasshopper; these include utilities for dynamic gene pooling, on/off & hide/show functionalities, and handling Nurbs via Rhino’s Python interface.

##### Main Components
- GH_usefull/gene_pool module:
- Directory: “GH_usefull/genepool_dynamic_py”
- Core file: GenePool_Dynamic.py
- Additional assets: a corresponding python.xml and readme file
- Purpose: Likely aimed at dynamically managing “gene pool” logic within Grasshopper.
- GH_usefull/metahopper-like module:
- Directory: “GH_usefull/like_metahopper_OnOff&HideShow”
- Core files: HideShow.py, OnOff.py, SelObj.py
- Additional assets: python.xml and a readme
- Purpose: Intended to toggle object states in Grasshopper (e.g., visibility or activation).
- GH_usefull/rhino_inside_python_Nurbs module:
- Directory: “GH_usefull/rhino_inside_python_Nurbs”
- Core files: Nurbs.py, graph.py along with CSV data and 3dm files
- Purpose: Likely supports operations for creating or manipulating NURBS geometry in Rhino, possibly leveraging Rhino.inside principles.
- GH_useless/hatarakitakunai module:
- Directory: “GH_useless/hatarakitakunai”
- Core file: hatarakatakunai.py with its associated python.xml and readme
- Purpose: While labeled under “GH_useless”, it still represents another module. It may serve experimental or less central functionality.

##### Architectural Patterns and Design Principles
- Modularity: Each directory represents a distinct functionality, with its own Python and XML components.
- Loose Coupling: The modules appear to be self-contained, designed to be optionally integrated within Grasshopper, suggesting that they do not tightly depend on one another.
- Configuration-driven: The presence of XML files for each module indicates that parts of the integration with Grasshopper are configured externally.
- Extendability: The file structure (with additional modules under “GH_useless”) shows that new utilities can be added without extensive rework of existing components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Environment
    GHEnv("Grasshopper Environment"):::ghenv

    %% GenePool Dynamic Module
    subgraph "GenePool Dynamic Module"
        GP_XML["python.xml"]:::config
        GP_Py["GenePool_Dynamic.py"]:::script
        GP_Readme["readme.md"]:::doc
        GP_XML -->|"loads"| GP_Py
    end

    %% Metahopper OnOff/HideShow Module
    subgraph "Metahopper OnOff/HideShow Module"
        MH_XML["python.xml"]:::config
        MH_HS["HideShow.py"]:::script
        MH_OO["OnOff.py"]:::script
        MH_SO["SelObj.py"]:::script
        MH_Readme["readme.md"]:::doc
        MH_XML -->|"loads"| MH_HS
        MH_XML -->|"loads"| MH_OO
        MH_XML -->|"loads"| MH_SO
    end

    %% Rhino_inside_python_Nurbs Module
    subgraph "Rhino_inside_python_Nurbs Module"
        Rhino_Nurbs["Nurbs.py"]:::script
        Rhino_Graph["graph.py"]:::script
        Rhino_PWK["PWK.csv"]:::config
        Rhino_XY["xy.csv"]:::config
        Rhino_3dm["origin.3dm"]:::config
        Rhino_3dmbak["origin.3dmbak"]:::config
        Rhino_Readme["readme.md"]:::doc
        Rhino_Graph -->|"assists"| Rhino_Nurbs
        Rhino_PWK -->|"input"| Rhino_Nurbs
        Rhino_XY -->|"input"| Rhino_Nurbs
        Rhino_3dm -->|"input"| Rhino_Nurbs
        Rhino_3dmbak -->|"backup"| Rhino_Nurbs
    end

    %% Hatarakitakunai Module
    subgraph "Hatarakitakunai Module"
        Hatara_XML["python.xml"]:::config
        Hatara["hatarakitakunai.py"]:::script
        Hatara_Readme["readme.md"]:::doc
        Hatara_XML -->|"loads"| Hatara
    end

    %% Connections from Grasshopper Environment to modules (via configuration files or main scripts)
    GHEnv -->|"reads"| GP_XML
    GHEnv -->|"reads"| MH_XML
    GHEnv -->|"reads"| Hatara_XML
    GHEnv -->|"invokes"| Rhino_Nurbs

    %% Click Events for GenePool Dynamic Module
    click GP_Py "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/genepool_dynamic_py/GenePool_Dynamic.py"
    click GP_XML "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/genepool_dynamic_py/python.xml"
    click GP_Readme "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/genepool_dynamic_py/readme.md"

    %% Click Events for Metahopper OnOff/HideShow Module
    click MH_HS "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/like_metahopper_OnOff&HideShow/HideShow.py"
    click MH_OO "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/like_metahopper_OnOff&HideShow/OnOff.py"
    click MH_SO "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/like_metahopper_OnOff&HideShow/SelObj.py"
    click MH_XML "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/like_metahopper_OnOff&HideShow/python.xml"
    click MH_Readme "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/like_metahopper_OnOff&HideShow/readme.md"

    %% Click Events for Rhino_inside_python_Nurbs Module
    click Rhino_Nurbs "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/Nurbs.py"
    click Rhino_Graph "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/graph.py"
    click Rhino_PWK "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/PWK.csv"
    click Rhino_XY "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/xy.csv"
    click Rhino_3dm "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/origin.3dm"
    click Rhino_3dmbak "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/origin.3dmbak"
    click Rhino_Readme "https://github.com/saito40/gh_usefull/blob/master/GH_usefull/rhino_inside_python_Nurbs/readme.md"

    %% Click Events for Hatarakitakunai Module
    click Hatara "https://github.com/saito40/gh_usefull/blob/master/GH_useless/hatarakitakunai/hatarakitakunai.py"
    click Hatara_XML "https://github.com/saito40/gh_usefull/blob/master/GH_useless/hatarakitakunai/python.xml"
    click Hatara_Readme "https://github.com/saito40/gh_usefull/blob/master/GH_useless/hatarakitakunai/readme.md"

    %% Class Definitions for Colors and Styles
    classDef ghenv fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef script fill:#d6eaf8,stroke:#1b4f72,stroke-width:1px;
    classDef config fill:#d5f5e3,stroke:#145a32,stroke-width:1px;
    classDef doc fill:#fcf3cf,stroke:#7d6608,stroke-width:1px;
```
