Portal is a Grasshopper3D plugin designed to facilitate Inter-Process Communication (IPC), enabling seamless data exchange between Grasshopper and external applications or processes. By extending workflow capabilities beyond Grasshopper3D and Rhino3D, Portal opens up new possibilities for integrated, multi-platform design processes.
- Portal.blender
- Portal.unity (Coming Soon)
- Portal.revit (Coming Soon)
blender-grasshopper-link.mp4
- Multiple Communication Methods:
- UDP Sockets
- WebSockets
- Named Pipes
- Memory Mapped File
- Local File
- Data Serialization / Deserialization for various geometry types:
- Point
- Mesh
- Curve (PolylineCurve, ArcCurve, LineCurve, NurbsCurve)
- Data Compression / Decompression using GZip
- Rhino3D 7.13+
- Windows OS
- Download the
Portal.Gh.zip
from the Releases page. - Unzip and copy the
Portal.GH
folder into...\AppData\Roaming\Grasshopper\Libraries
- Unblock all library files:
- Right-click on each
.gha
and.dll
file - If there's an "Unblock" option, make sure to select it
- Right-click on each
Portal supports various communication methods, each with its own strengths:
Method | Speed | Reliability | Remote | Streamable | Description |
---|---|---|---|---|---|
WebSockets | 5/10 | 9/10 | ✅ | ✅ | Real-time, bidirectional communication. Ideal for interactive applications requiring constant updates. |
UDP Sockets | 6/10 | 7/10 | ✅ | ❌ | Fast data transmission, prioritizing speed over reliability. Best for scenarios where occasional data loss is acceptable. |
Named Pipes | 8/10 | 10/10 | ❌ | ✅ | Reliable inter-process communication within the same machine. Suitable for complex data exchanges locally. |
Memory Mapped File | 10/10 | 6/10 | ❌ | ❌ | Fastest data exchange possible on the same machine. Unmatched in speed for local settings but less reliable and may cause crash or memory leak if one side doesn't handel data correctly. |
Local File | 1/10 | 2/10 | ❌ | ❌ | Basic method for simple data exchange. Slowest but useful for non-real-time communication. |
Portal uses a flexible data structure to facilitate communication between Grasshopper and external applications. Understanding this structure is crucial for effectively handling data transfer.
- All data is sent and received as bytes.
- Data can be compressed using GZip before sending to save bandwidth and increase transfer speed. Proper decompression handling is required on the receiving end.
-
Direct Text Messages: Simple text can be sent and received directly.
-
Structured Data (JSON): Complex data structures can be sent as JSON, allowing for flexible data exchange. The receiving end must know how to handle and parse the JSON data.
-
Geometry Data: Geometric data (like meshes, curves) can be serialized into JSON, encoded into bytes, compressed, and then sent. The receiving end must reverse this process to reconstruct the geometry.
Portal provides JSON data models for various geometric entities. These models define the structure for serializing and deserializing geometric data:
- Point Data Model
- Mesh Data Model
- Polyline Curve Model
- Arc Curve Model
- Line Curve Model
- Nurbs Curve Model
For Memory Mapped File and Named Pipe communication methods, the data structure is as follows:
[4B: int32 size] [payload]
- The first 4 bytes contain an
int32
value indicating the payload size. - This prefix allows the receiver to allocate the correct memory buffer size for the incoming data.
- The payload contains the actual data bytes.
Here's an example of how you might send a mesh from Grasshopper to another application (e.g., Blender):
-
In Grasshopper:
- Serialize the mesh into JSON
- Encode the JSON text into bytes
- Compress the bytes using GZip
- Send the compressed data via Named Pipe
-
In the receiving application (e.g., Blender):
- Receive the compressed bytes
- Decompress the data
- Decode the bytes into a string
- Parse the JSON
- Deserialize and construct the mesh
Portal is licensed under the Apache License 2.0. See the LICENSE for more details.
If you encounter any issues or have questions, please file an issue on the GitHub repository.
Made with ❤️ by Zeke Zhang