list_to_ghtree

compas_ghpython.utilities.list_to_ghtree(items, none_and_holes=False, base_path=[0])[source]

Transforms nestings of lists or tuples to a Grasshopper DataTree.

Parameters
  • items (list) – Nesting of lists and/or tuples.

  • none_and_holes (bool, optional)

  • base_path (list, optional)

Examples

>>> items = [[1, 2], 3, [], [4, [5]]]
>>> a = list_to_tree(items)
>>> b = list_to_tree(items, none_and_holes=True, base_path=[7, 1])