Just some notes and references for myself.
- In bash, you can access your
C:\
drive via/mnt/c/
~
=C:\Users\MLM\AppData\Local\lxss\home\mlm
and is different from your Windows user directoryC:\Users\MLM
def list_to_tree(input, none_and_holes=True, source=[0]): | |
"""Transforms nestings of lists or tuples to a Grasshopper DataTree""" | |
from Grasshopper import DataTree as Tree | |
from Grasshopper.Kernel.Data import GH_Path as Path | |
from System import Array | |
def proc(input,tree,track): | |
path = Path(Array[int](track)) | |
if len(input) == 0 and none_and_holes: tree.EnsurePath(path); return | |
for i,item in enumerate(input): | |
if hasattr(item, '__iter__'): #if list or tuple |
A warning occurred (42 apples) | |
An error occurred |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!