InkObject
General
InkObjects are the main datatype of the Inkbeagle plugin. This type is fully serializable and bakable in Grasshopper. This means for instance that this data type can be internalized in an input parameter of a component.
Construct inkObject
The main logic of an inkObject follows the idea of a named dictionary where data can be identified by a named key. A generic InkObject can be create by linking any Grasshopper data type to the named keys as an input to the Construct InkObject component. Any data type that inherits from an IGH_Goo
type can be used as data for the InkObject assembly.
You can assemble as much as keys as needed by creating more or less input parameters by clicking on the +
or -
button when zooming in on the component on the Grasshopper canvas.
By right-clicking on the input parameter's name, you can change they name of the key to which the input value corresponds. Additionally, you can set the Visibility
and Bakability
property by checking the corresponding item in the right-click menu of the named key. When an input's visibility property is checked, the preview geometry linked to this key will be drew in the Rhino viewport. Only when an input's bakability property is checked, the geometry corresponding to this key will be baked whenever you are baking the inkObject to Rhino.
Finally, an inkObject is created with data attached to each named key. By adding lists of data to the Construct InkObject component, you create a list of inkObjects with all individual data items from the input lists attached to the corresponding named keys.
Handling null values
When no input or null values are set as input value for a key, the value corresponding to this key will be set consequently to a null value.
Naming of the keys
- Key names must be unique and cannot be repeated.
- Key names can only contain alphanumeric characters and cannot start with a number or underscore. Allowed key name regex:
^[a-z0-9_]+[a-z0-9_-]*
.
Handling of list input
InkObjects only allow one item as an input. List input for a single key is not supported (yet?). This means that list or tree inputs will be processed as item
input. When the input lists/trees for different keys have not the same structure, Grasshopper will solve the component according to its default behaviour.
Deconstruct inkObject
This component allows to decompose one or more inkObjects while the output parameters of the component are dynamically created based on the key names of the inkObject. When a list of inkObjects with different keys (structure) is provided, all possible keys (envelope) will be generated as output parameters and null values will be returned for those objects that do not contain the particular key. In order to sort out your inkObjects by their structure (its key), the Group by Structure component can be used.
Working with inkObjects
Add Key
Once an inkObject is created, it is fairly simple to attach more data items to existing inkObjects. By choosing a custom key name, any Grasshopper data type can be set as value. The user interface to set the key names is identical to the Construct inkObject component.
Naming of the keys
- Key names must be unique and cannot be repeated.
- Key names can only contain alphanumeric characters and cannot start with a number or underscore. Allowed key name regex:
^[a-z0-9_]+[a-z0-9_-]*
.
Remove Key
One or more keys and their corresponding values can be removed from an existing inkObject. By right-clicking the key name below the inkObject input, you can choose the named key from the context menu. When zooming in on the Remove Key component, +
and/or -
buttons will appear to select more keys that are to be removed.
Modify Value
The values corresponding to a key in an existing inkObject can be modified with the help of this component. By right-clicking the key name below the inkObject input, you can choose the named key from the context menu. When zooming in on the Modify Value component, +
and/or -
buttons will appear to select more keys of which the value needs to be modified. Any data type that inherits from an IGH_Goo
type can be used as input.
Handling null values
When a specific inkObject from the input list does not contain the requested key, the requested key values will not be changed, nor added, as they do not exist.
Get Value
The values corresponding to a key in an existing inkObject can be retrieved with the help of this component. By right-clicking the key name below the inkObject input, you can choose from the context menu the named key from which you want to get the value. By zooming in on the Get Value component, +
and/or -
buttons will appear to select more keys from which the value needs to be retrieved. When more than one key is requested, the output is of these key's values will be returned as a list.
inkObjects of different structure
When inkObjects of a different structure (different key names) are used as an input, you are able to select one or more keys from the unified set of keys they have in common. When a specific inkObject from the input list does not contain the requested key, a null value will be returned.
To group a list of inkObjects by their structure, you can use the Group by Structure component.
inkLists
Pack inkList
This component takes a list as input and consolidates it into a single entity, simplifying data organization and reducing computational complexity.
Unpack inkList
This component performs the reverse operation of the Pack inkList
. It takes a packed entity as input and unpacks it into individual elements, restoring the original list structure for further data manipulation.