How sonderwoods/mantaray works
Project Type and Purpose
• This is an open-source Grasshopper plugin (C#/.NET) that connects Rhino/Grasshopper to a Linux Radiance environment over SSH.
• It bundles a suite of GH components (SSH Connect, Execute Async, MeshToObj, RadViewer, etc.) that build Radiance commands or files, send them to WSL, run them, and return parsed results into the GH canvas.
File Structure
• Top level:
• MantaRay.sln (Visual Studio solution)
• MantaRay/ (C# plugin project)
• UnitTests/ (test project)
• Examples/ (sample Grasshopper/Rhino files and Radiance files)
• Setup/ (installation helpers and scripts)
• Within MantaRay/:
• Components/ (each GH component class)
• Components/Templates/ (base classes and async templates)
• HeadsUpDisplay/ (UI overlay classes)
• Helpers/ (utility classes: SSH_Helper, PathHelper, LogHelper, etc.)
• Interfaces/ (ISetConnection, IFolderConversion, etc.)
• Radiance/ (domain model for Radiance geometry & materials)
• Types/ (value types: Grid, GradientParser, etc.)
Extract Key Architectural Insights from README
• Core workflow: GH component → builds Radiance files/commands → SSH to WSL → execute Radiance CLI or GUI tools → return geometry, images, logs → display in GH.
• Supports asynchronous execution, caching of results, streaming man pages over HTTP, integration with ImageMagick and optional denoiser.
• Single “Setup Globals” component provides shared configuration (project folder, SSH settings).
Main System Components
a. Grasshopper UI Layer (Client)
• Rhino viewport & GH canvas hosting components
• User-placed GH Components (SSH Connect, Execute Async, CreateView, etc.)
b. Plugin Core Layer
• Component Classes (in Components/)
• Async & Template Base Classes (in Components/Templates/)
• HeadsUpDisplay UI overlays
• Domain Model (Radiance geometry & Material classes)
• Helpers & Interfaces (SSH helper, file IO, logging, parsing)
c. Infrastructure Layer
• SSH Service (WSL SSH Daemon)
• File synchronization (SFTP, temp folders)
• Radiance CLI & GUI Tools (rad, rpict, rvu)
• External Utilities (ImageMagick, Intel OIDenoiser)
• ManPage HTTP service (fetched on demand)
d. Sample & Test Artifacts
• Example GH definitions (.gh), Rhino files (.3dm), .rad files
• UnitTests project
Relationships & Data Flows
• “Setup Globals” sits at the top of the plugin core and feeds configuration into all components.
• Async components spawn parallel SSH sessions; use RAN output to synchronize downstream GH components.
• RadViewer parses .rad files returned over SSH and feeds geometry into GH preview.
Architectural Patterns & Design Principles
• Layered architecture: UI → Component layer → Domain model → Infrastructure.
• Plugin pattern: Components/Templates allow easy addition of new GH components.
• Async execution: non-blocking GH UI, parallel SSH commands.
• Single source of configuration via “Setup Globals”.
• Clear separation: Radiance domain objects are defined in Radiance/ folder, SSH logic in Helpers, UI logic in HeadsUpDisplay.
Final Checklist
• Optional: annotate key classes (SSH_Helper, RadianceObjectCollection, GH_ExecuteAsync) to highlight extension points.