Naming parameter-generated objects to make them clickable

Hi,

From what I understand from this Tutorial, to interact with a 3d object with a mouse I have to name it with the SDDisplayGeometry component. But’s it’s one component to name one object.
The thing is that in my gh definition, the objects I want to make clickable are panels for which the quantity depends on my input parameters, so I can’t really think of having a component for each of my panels.

Any tips on how I could name a list of breps or mesh (for example panel_1, panel_2 […] panel_n), making them accessible throught the SD API ?

Cheers,

sego

There is a way to make several objects selectable indidually using a single Display Geometry component: you need to send them in separate tree branches to the component. Each tree branch will remain a separate single object form the API’s point of view. You can then connect a list of materials to the component and each element of the material list will be assigned to each branch of the tree.

This is explained in more detail here: https://support.shapediver.com/hc/en-us/articles/360022020852-Component-Display-Geometry

In the API, you will still see the Display component as a single asset, but it then contains an array of objects in the content property:

For example, see what you get below using a single Display component called “Line1” where a tree with 10 branches is connected:

The API lets you select the whole asset or its individual elements from the content array by switching between global mode and sub mode in the interactionMode property of the asset (ShapeDiver 3D Viewer Interface: ApiSceneInterface).

I had the same issue and came with the same solution as Mathieu. Unfortunately, I was struggling to assign multiple materials in a single branch, because the Display component does not support material branches.

See, expected result is drowen above.

So I end up with much many display components and feeding data to them separetly. Or do I miss something?

Hi Mathieu,

Thanks for the reply, seems logical to me.
The issue I might encounter though is that I have (3/4 of the time) more than 64 panels…

ShapeDiver only allows 64 file parts per output component ( ShapeDiverDisplayGeometry or ShapeDiverDisplayExternalGeometry ). Always make sure you need to keep your objects separate in a tree. Otherwise, think about flattening your data structure to reduce the number of file parts in the model.

You probably have to use a Merge component rather than Entwine when creating the list of colors for your SDMaterial component.

The reason why we don’t use data trees in both inputs is because you can apply one material to various geometries but you can not apply various materials to one geometry.

Thanks for explaining it to me.

My case was to create the multi-material objects into separate braches in order to make the “groups” clickable in a scene. I did not find a way to proceed with it. Maybe there is some workround via frontend but IDK. As I said, the solution is to create many display outputs and keep the structure of items synchronized with definition inputs to know what is what.

You are right that this is not possible via the legacy plugin. Since you have joined the private beta, note that you can now manipulate materials more flexibly using the new attribute system. Objects do not need to all be in separate branches anymore to get different materials. If you want to experiment with that, please ask questions directly on the beta testing discord server, as per the instructions I sent you.

1 Like