We are happy to release the ShapeDiver Model View API. This new feature will allow our users to use the full potential of the ShapeDiver cloud computing infrastructure. Read everything you need to know below!
A New Cloud-Based REST API For ShapeDiver Models
Most designers and end users experience ShapeDiver through our online viewer. However, this is only the tip of the iceberg.
In reality, our servers are the ones who bring the muscle to process Grasshopper definitions in the cloud. They compute results in the most efficient way for our over 2,700 users (and counting) and deliver geometry, data and CAD files back to them in a fast and scalable way.
Many of our users are building tools that use a different viewer, or don’t need to use a viewer at all! They just have one thing in common: all of them need to run parametric computations at scale. And now this is possible, thanks to the release of the ShapeDiver model view API.
The ShapeDiver model view API is a RESTful API which allows to communicate with ShapeDiver models, without using the ShapeDiver viewer. From now on, Grasshopper models can be used to run remote computations using the Rhino geometry kernel, accessed remotely and integrated in any cloud application.
ShapeDiver PRO users might already have noticed an additional option in their model settings. By checking the “Allow Backend Access” option in any model's Edit Page, the platform will create a new ticket to use with the model view API. You can find the ticket in the “Sharing And Embedding” section of the model page. Afterwards, you can point your developer to the full documentation of the model view API here.
We know that a big part of the Grasshopper community already has many applications in mind for remote Grasshopper computations. Still, we describe below a couple of examples where the model view API is solving major pain points for some of our users.
1. Asynchronous Exports For eCommerce Carts
In Unruh's configurators, the Grasshopper models are accessed from the cart, after the configuration process is already over.
Generating files and data for production can involve heavy computations. Yet, those operations are not needed when users interact with a model online.In that phase, it is often enough to generate simple geometry for visualization.
A typical example are boolean operations, since a boolean difference does not influence visualization. It is more efficient to show both full pieces of geometry during the configuration phase, and only execute the costly boolean difference for production.
Asynchronous exports solve a common issue with the eCommerce workflow. Up until now, it was necessary to export requests directly from the configurator. Using the new REST API for exports, eCommerce stores can now wait until the actual purchase is validated before generating production files and data. In terms of the ShapeDiver dashboard, this also means that the export count closely reflects the conversion rate, when compared to the total number of user sessions.
An example: Unruh Furniture configurators are able to export detailed data sheets from Grasshopper. The level of complexity of those exports involves computations of up to 20 seconds! With the model view API, Unruh now offers their customers a flawless user experience in the configurator. The website requests silent exports while customers fill their information in the cart.
2. Batch Processing
Need to export and store thousands of solutions from a Grasshopper definition? Running a batch script on a local machine can be unreliable and inefficient. Make use of the ShapeDiver cloud infrastructure to easily iterate through selected parameters of your definitions and export all solutions.
An example: Google sheets integration
Google sheet populated by export results (example 2)
We have developed a simple Add-On to Google Sheets. It contains functions to communicate with ShapeDiver models, send parameters and get back computation results and export files. See the Add-On in action in the following three examples below.
In each case, the first sheet lets you enter the backend ticket for your model. You will automatically see the list of parameters and outputs filled in the next two sheets. Finally, the last sheet contains a small application of the API:
In this first example, a mini image processing app lets users enter an image URL and creates a voronoi-based stylized bitmap from it.
In this second example, we batch export 2D drawings from a range of parameter sets of a furniture piece with various sizes and options.
In this third example, we show a simple example of a complex geometry operation run headless using the REST API. It lets users import an open mesh a fill the holes to close it.
NOTE: Just open any of the spreadsheets links above and make a copy with your own Google Account to start playing with them. Developers can also check the scripts included with the Google Sheets example for additional API examples.
A Secure, Reliable, Scalable, And Fast Infrastructure For Rhino And Grasshopper In The Cloud
Diagram describing ShapeDiver's architecture.
The ShapeDiver backend system serves all of the requests made to the ShapeDiver model view API. It uses a smart caching system based on parametric model graph decomposition. You can read more about this here, and how it relates to Rhino Compute and Rhino InsideTM.
As an example, if your application requests an export for a specific configuration multiple times, starting from your second request the export results will be served directly from the cache.
We have developed a fine grained load balancing algorithm, which adapts to application-specific needs. As a result, the algorithm is able to serve a wide range of requirements, for eCommerce applications (very fast response times) as well as batch and background processing (long computation times). These features of the ShapeDiver backend system allow us to guarantee very high availability and maintainability under fluctuating loads.
As a major bonus, the ShapeDiver backend is compatible with Rhino 5 and Rhino 6. In fact, Rhino 5 is still widely used in the community, including many of our users. We will of course support Rhino 7 from day 1 of its release.
As of today, we are operating both shared and private ShapeDiver backend systems for our clients in five different geographic regions.
Interested? Contact us if you want to use the model view API or if you have any questions about the feature!