Python Grasshopper list error

I am trying to generate a rectangular within a grid created by GH. one way I was trying is use python to identify the index of the list then connect them.


but I was not quite understand the gh python,
Q1: input x is list of point, why it become a guiID in python?
Q2:I trying to add text dot to the python, but it does not show up

GH file here
Q_python in GH.gh (9.4 KB)

Here is one way with python, plus a native gh option.
Q_python in GH_v2.gh (13.9 KB)

thanks so much adam, I learn a lot just see your python.

it’s so weird, when I just run the first part of your python, there is an error, “GUID” object has no atribute ‘branchcount’, do you know what’s wrong?

Right-click on the x input and select Tree Access

-Kevin

2 Likes

I also tried to identify the list with your python, not get it right, it does not read the branch? and it clappse all at end row.


Q_ how to identify the list pythonGh.gh (7.5 KB)

Changed code at lines 11 and 13.

Flattened Location input to Text Tag 3D component.

Q_ how to identify the list pythonGh_re.gh (10.2 KB)

-Kevin

1 Like

Thanks , I should read the imput data structure.
Also curious, why the th.tree_to_list return , give this “ironpython.runtime.list”, but in python the line 8 give GUID of the points

After using the method plist = th.tree_to_list(pt) the the plist variable references a list of lists (nested list). This isn’t a native type for grasshopper so if you want to use it for further processing in grasshopper you’ll need to convert it back to a DataTree with the method plist = th.list_to_tree(plist) at the end of your code.

-Kevin

just to dig a little further. " A Data Tree is a hierarchical structure for storing data in nested lists." but seems as you explained, data tree in grasshopper is different than the nested list in python. could you help me understand the data tree in grasshopper more?

Have a look here:

And here: