How thekaushikls/catsule works
Project Type and Purpose
• Catsule is a desktop plugin (written in C#/.NET) for the Rhino 3D modeling environment with Grasshopper integration. It also ships with a static website (in “Web”) and documentation (in “docs”). Its core functionality lives in the “Source” folder as a Rhino/Grasshopper command library.
High-Level File Structure Analysis
• Source/Catsule.sln & .csproj: the Visual Studio solution and project defining the plugin assembly.
• Source/Commands: C# classes implementing Rhino commands (GhReloadCommand, GhSettingsCommand, GhReloadCommand).
• Source/DocumentHandler.cs: central logic that hooks into Rhino document events (.3dm open).
• Source/EmbeddedResources & Properties: resources and assembly metadata.
• Web/*: static site assets (Mobirise-generated) for the public homepage/demos.
• docs/*: standalone documentation site with its own assets.
• Scripts/update_version.py & .github/workflows/release_ci.yml: automation for version bumping and CI/CD.
Core Components
• Rhino Host (RhinoCommon API)
• Grasshopper Host (Grasshopper API)
• Catsule Plugin Assembly
• DocumentHandler (hooks Rhino events)
• GhAutoload module (auto-opens matching .gh)
• GhSettings module (toggles autoload feature, persists settings)
• GhReload module (re-initializes open Grasshopper files)
• File System (.3dm and .gh files)
• Configuration store (local file or registry, manipulated by GhSettings)
• CI/CD Pipeline (GitHub Actions → build → package → publish to Rhino PackageManager / Food4Rhino)
• Web/UI & Documentation sites (static assets served separately)
Component Relationships and Data Flows
• On Rhino “New/Open .3dm” event → DocumentHandler intercepts → if GhAutoload enabled → GhAutoload reads .3dm path → instructs Grasshopper Host to open corresponding .gh.
• User invokes “GhSettings” in Rhino → GhSettings module toggles flag → writes to configuration store → DocumentHandler picks up new setting on next document event.
• User invokes “GhReload” in Rhino → GhReload module signals Grasshopper Host to reload current Grasshopper definition(s).
• CI Pipeline monitors source repo → on push or release tag → invokes build script → outputs plugin package → pushes to GitHub Releases and Rhino PackageManager.
Architectural Patterns and Design Principles
• Plugin/Extension pattern: Catsule assembly loaded at Rhino startup.
• Command pattern: each feature exposed as a distinct Rhino command class.
• Event-driven: DocumentHandler subscribes to Rhino document events.
• Separation of concerns: core logic (Source) is distinct from static web assets (Web/docs) and from CI scripts.