ACADIA 2015 Hackathon - Sending Snippets via Flux

As part of the ACADIA 2015 Hackathon, Ramon van der Heijden at Front Inc and I developed a way to send arbitrary Grasshopper snippets to another instance of Grasshopper (on a local or remote machine). This can be used to push the computation to another machine, allowing you to continue editing the definition, then the output of your snippet will be pushed back when the computation has completed on the remote machine. Alternatively, you can store snippets in data keys and instantiate them as needed or simply have a live way of sharing portions of a script with others.

This is a modification of Andrew Heumann's Create Snippets script that looks at all the nodes that are grouped with the CreateSnippet node and generates the XML of those objects. Then using Flux, the XML data is transmitted to the other instance, and is essentially "pasted" onto the remote instances' canvas. If you include nodes to transmit the data back to the local instance, the result will appear once the solver has completed on the remote machine. The script automatically enables all nodes that have been disabled on the local side. This allows you to prevent the solver from calculating the snippet on your machine, but allows it to be run remotely.

When setting up a Flux, you can simply create a data key to send the data up to the other machine and one to send it back. You can see these in the example images as the blue Item Selector nodes with the names "LocalToVirtual" and "VirtualToLocal."  

We were able to use this to push computation to an Amazon EC2 instance. This would be especially handy for nodes that already have multi-threading/parallel computing options available (ie Honeybee / Ladybug), but we're looking in to ways of splitting large data sets up and running them on multiple instances of Rhino/GH on the same machine. 

The files area attached below, feel free to give it a try and see how you can improve it!

LocalMachine_RetrieveResults.gh

RemoteMachine.gh