Partition List in Py

Hi All,
I have a list of 9 points to divide 3 points into 3 lists


in Gh i used Partition List, while in Py i used this code:

import rhinoscriptsyntax as rs

a = []
for i in range(3):
    print "ID", i
    b = []
    for j in range(3):
    print a

import ghpythonlib.treehelpers as gh
a = gh.list_to_tree(a)

the question is this:
it would be possible to have the same result in Py, using only rhinoscriptsyntax without using ghpythonlib?

You need to use DataTree Class.

Not really. rhinoscriptsyntax is meant for scripting in Rhino. In Grasshopper, you should use Node in Code or even better the API (RhinoCommon), which rhinoscriptsyntax is a wrapper of with some sugar on top. ghpyhtonlib on the other hand is also a wrapper for API functionality, but for GHPython explicitly.

You can take a peek at the code by finding where it’s located. :wink:

1 Like

thanks @603419608, @diff-arch for the reply :+1: