How to get Point3d from System.Collections.Generic.List in GHPython3

Greetings,
I have some lists of Rhino.Geometry.Point3d . How do I output the actual points instead of Generic List ?

Thank you!

can you share the gh file?

hi @Gijs
Please find it attached:
241008 Loop divide.gh (73.4 KB)

you are creating a nested array:

yes, so each nested array should become a list of points.
How is this done?

Thanks!

See if this helps:
241008 Loop divide.gh (93.3 KB)

based on this sample:

import Rhino
import Grasshopper as gh

# Create an empty data tree
tree = gh.DataTree[object]()

# Assume 'nestedArray' is your nested array (a list of lists)
nestedArray = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]

# Iterate through the nested array and add the sublists to the tree
for i, sublist in enumerate(nestedArray):
    # Create a path for each sublist
    path = gh.Kernel.Data.GH_Path(i)
    
    # Add the sublist to the tree under the created path
    tree.AddRange(sublist, path)

# Output the tree
a = tree  # 'a' is the output parameter in the Python component
2 Likes

Yes, thank you!
Good example!
These kinds of situations happen all the time.