Creating Custom Objects
Generate custom objects with user data • Last modified on 9/17/2019 • edit

You can create your own custom object using the "Create a Custom Speckle Object" component. This component allows you to create a Speckle object of type object with custom properties which you set as the input, providing a good way to organize and send your custom data over Speckle.

To start, add the component to your canvas. The component has two outputs: the Speckle object itself and a dictionary representation of your object. Once placed, you can modify the inputs of the component. By zooming in to the inputs, you can add or remove new properties by clicking the + and - buttons. Right-clicking the input and renaming it also renames the property. The object can now be sent to Speckle just like any other objects.

send

To unpack the data of the object, use the "Expand Dictionary or SpeckleObject" component. This will expose all the properties that were set and their values.

example

Nesting objects and properties

Using the "Create a Custom Speckle Object" component, you can also nest objects within the properties. To do so, attach the dictionary output as the input to another Speckle object.

nesting

Lists

In order to attach a list to an object, you will need to use the "Encapsulate a List" component. This will collapse the list as a single object, allowing you to assign it to a single property. Without this component, the "Create a Custom Speckle Object" component will create a Speckle object for each item in a list.

encapsulate list