Seeking Advice: Plugin for Live Material Data Integration with ShapeDiver

Hi everyone,

We have launched a beta version of our platform connecting GH models on ShapeDiver with manufacturers. Our goal was to build a tool that enables parametric designers to sell customizable, made-to-fit furniture through local manufacturers. With support from keen CNC shop owners, we now have our first recurring sales of customizable MDF Shaker doors which have been modest in size but exciting milestones to cross.

However, we’ve encountered a challenge and need your help. Currently, we must update and upload new models each time materials (i.e. plywood, MDF, etc.) or prices change. We started building a database of materials available to all models.

What should we take into account before we start developing a script or plugin that integrates with Grasshopper models on ShapeDiver to provide live data from our materials and hardware database? Is anyone here experienced with GHPython?

Well done on what you’ve achieved so far.

I’m experienced with GHPython and don’t anticipate insurmountable problems there, but I’m new to ShapeDiver.

So the consideration that springs to my mind are about their platform. Namely, does ShapeDiver enforce a sand box? I.e. is it going to stop your GH file and anything else, calling out from its server to whereever your database or API lives, or from receiving a response? Does that require configuration, opening ports and whitelisting IPs? Otherwise can ShapeDiver host a simple Excel file too, and let the GH file refer to that, which could be manually updated periodically, just the same as your DB would get updated?

Hi James,

Thank you!

ShapeDiver does enforce a sandbox environment for the Grasshopper files but only when the file is "running. We can call the models and “run” the computation via the backend API. The data, as far as I know, has to be processed and passed on as a JSON object or CSV file.

If you want to use a file like Excel, you would need to convert it to a compatible format (e.g., CSV) and then upload it with your Grasshopper model. This file would need to be updated manually and re-uploaded to ShapeDiver whenever changes are made. That’s not the desirable method.

The most promising, though still somewhat unclear, option in my opinion is a dynamic integration using an external service (written in GHPython??) to fetch the preprocess data given by the service sitting between Shapediver and the database. Ideally, this would involve a component or plugin that any ShapeDiver users can easily access and use.

What do you think? Is this realistic?

Cpnverting a DB or Excel file to .csv or .json is easily scriptable, within GH, or outside in a normal Python.

As I said, I’ve not used Shapediver before. But I don’t forsee the problem being the GHPython code. It’s setting up and securing services. I’d just do some simple experiments first from a Shapediver example file, and make sure I could actually call out to some server, and receive a response, even just:

    import subprocess
    a = subprocess.check_output(['curl','example.com'])
    print(a)

Without ShapeDiver, e.g. using RhinoCompute self hosted, it requires someone who knows IIS and the Microsoft approach to networking.

There are multiple solutions to this issue, depending on your implementation and the type of data you want to synchronise with your definitions uploaded to ShapeDiver.
Did you have a look at this topic for example, which explains how to pull data from a Google Sheet?

You could also use any other service available through HTTP requests along with the Switflet plugin to pull data every time a computation is run.

Note that in all these cases, you will either need to empty the cache of your models when the database is updated, or force new computations using a model input with a timestamp for example.

Those are just a few examples on how to connect to your dynamic database. If you would like to discuss more closely with our team how to best move forward, feel free to join the next onboarding call, which is available with your Business account.

We are doing something similar and have a database with all materials, first we had it in a Google Sheet, by now it comes from Airtable. In there we have URLs to different textures and all relevant material properties for Shapediver. Then you just make all of them inputs in Shapediver and send the relevant options when requesting a model from Shapediver. Just put them all in a group and make them hidden in Shapediver.

Make sure the textures are publicly available at least to shapediver.com. We just have them in an Amazon S3 bucket with the restrictions for certain domains.

If you are working with textures I can recommend the texture mapping components that come with the Human plugin.

You might also want to build 1 model where you have all the material properties as slider inputs and some file upload components for the textures. That way you have 1 model to tweak the values and textures. Otherwise it will take forever and you have to test it in the browser to see it with the lighting from the web renderer.

It’s a bit of a task, but once you have a working setup its super easy to update and add new materials.