Cloning via multisession

Hi there, I am a web developer. I need to be able to create an indefinite number of clones of a complete model that allows me to modify properties of the clone and that all cloned models behave as if they were a single model. At first I thought of using the clone method, however it is a static node. The second option I have left is to use multisessions, however I don’t know how complicated this can be. There is a project that managed to do it:
https://mysupergrid.com/build/configurator .

In the following screenshot you have the “original model”, clicking the ‘plus button’ “clones” the model and adds a copy right next to it.


They manage to get the model to continue to behave as one, however it puzzles me that the request types are not really requesting a new model, so the general question would be, how would it be possible to achieve this using just the API? of ShapeDiver? Thank you!

Hi @Gilberto_Rodriguez,

In the mentioned project all assets are static and stored in a 3dm file. The 3dm file has layers to separate product types and inside each layer, the objects have colors to define materials and names to define other objects inside the main product.

This 3dm file is imported in a first GH file through the Import Geometry component. This GH file selects one of the products based on the layer name and then assigns attributes to each of the pieces of geometry by using the color and name stored in the 3dm. The output is a single glTF with metadata which represents a single product positioned in the origin.

In a second GH file, a JSON stores the position of the products and the bouding box dimensions. This is enough information to calculate the transformation that needs to be applied to the glTF model created in the first GH file.

In ShapeDiver, when a user selects one product, the layer name is sent to the first GH file to output the geometry and the position is sent to the second GH file to output the transformation. After the outputs are ready, the resulting node is cloned and the transformation is applied to the glTF file. Therefore, the geometry is no longer directly connected to the GH file, it now lives just in the viewer.

If you have any other question, please let me know.

1 Like

How is it possible to make communication between these two GH files? Could you share some sample file? Thanks so much.

This is done via the API by opening multiple sessions. You can find several examples here.

1 Like

Hi, @edsahergom
Thank you for your answer, I have already reviewed the documentation that you have shared with me, I still have questions about this topic with the grasshopper definitions and I could not find these files to download them in the link that you sent me.

Could you share these grasshopper files with me so I can analyze them in detail?

What exactly you need to see in the Grasshopper files? The set up is not any different that any other regular Grasshopper file. Just make sure your inputs and outputs have clear names in Grasshopper if you want to identify them via the API.

I’d like to see this process to get a better idea of how to generate it.

@Gilberto_Rodriguez this file has no special set up but I will share with you the kitchen one you requested here as soon as I have it.