Output more than just geometry
While the ShapeDiver Display components are ideal when an application only needs to render plain geometry in the online 3D viewer, there are use cases when one might want to output geometry enriched with metadata to the web application. In order to do so, one can use the ShapeDiver attribute system and the related plugin components which allow to define and store attributes in objects, as well as extract said attributes back from objects in which they are stored.
Some reserved attributes are compatible with the display components (used for online rendering). However, most generic attributes (which we refer to as custom attributes) are not stored in the glTF files generated by the display components. Instead, one should use the ShapeDiver Output component.
Instead of generating a plain glTF file, the ShapeDiver Output component generates another file format which we call sdTF: structured data transfer format. This file format allows to store attributes as metadata in the objects it includes. It also retains in a lossless fashion the data structure that is fed to it (items, lists and trees).
Check the Attributes Cheat Sheet in order to see how each reserved and custom attributes can be used in relation with various ShapeDiver features (define materials and layers, use the attribute visualization mode on the platform…).
Much like the native scripting components of Grasshopper, the ShapeDiver Output component lets users define a variable number of inputs, which result in structured data in the resulting files sent to the web application:
Each input of the component can only receive data of one nature (i.e. only meshes, only Breps or only numbers). For that reason, the component requires data to pass through a floating parameter component before being connected as input:
See it as a forced sanity check on the data sent to the component.
Each of the inputs of the component inherits the name of the floating parameter connected to it:
In the online platform and the API, such inputs can then be differentiated in the platform and APIs using these defined names.
The ShapeDiver Output component does not include a Material input, like the display components. Therefore, assigning a default material used by all objects sent to the component is not possible (see "Use the material input to define a default material for all input geometry").
However, the second method to assign materials using attributes (see “Use attributes to control the material of each input object”) is compatible with the Output component, and such stored materials will result in fully rendered geometry in the online viewer.
layer attribute in objects in order to enable the layers feature of the viewer in the model view page of the online platform. All objects with the same value for the layer attribute will be grouped in the same viewer layer, whose visibility can be turned on and off, or adjusted using an opacity slider:
At the moment, the layers feature of the viewer is only available while in attribute visualization mode.
Usage for attribute visualization
While some specific keys are related to reserved attributes, and linked to specific behavior when stored in geometry, any other key (which we refer to as custom attributes) can be used along with the attribute visualization mode of the platform. In this mode, each geometry element can be selected and its attributes displayed with their values.
Additionally, some types of attributes such as numbers, strings and colors can be used to color the individual elements contained in the model:
Numbers are used to define a gradient scheme spanning all values between the minimum and maximum value found in the model.
Strings are displayed with an individual different color for each string value.
Colors are displayed according to their own value.
Consider the following definition, which creates spheres with random positions and radii:
We store in each sphere two attributes, one for its radius, and one for its distance to the origin. We do not define materials, therefore after uploading the definition to the platform, all spheres get the default ShapeDiver material:
One can then switch to the attribute visualization mode (at the top of the right panel) and click on “Enable attribute visualization”. Once enabled, each of the spheres can be clicked on. The panel on the right displays both attributes that is stored in the selected sphere:
Clicking on the eye icon for a specific attribute (or manually through the visualization settings) one can then enable visualization of this specific attribute for all the objects in the scene that contain it. For example, for the radius attribute:
By default, a blue-red gradient is used, but this can be changed along with other settings in the “Visualization settings” section.
Find below the definition used in this example:
Read more about the attribute visualization mode on the platform.
Usage with desktop clients
Context menu options
Documentation in progress!
Save glTF 2.0: allows to export locally the glTF 2.0 asset that is generated by the component and used in the ShapeDiver online viewer. The resulting glTF asset can be used with the External Display component, loaded directly into the viewer using the glTF loader, or quickly previewed for debugging using the glTF monster.