It could look like this in a panel
{0}
0 - A
1 - B
{1}
0 - C
1 - D
{2}
0 - E
1 - F
question: can you operate on elements between branches?
By default, when you apply polyline, it will connect the elements inside their branch. But how do we connect '{0} 0 - A' with '{1} 0 - B' and '{2} 0 - C'?
2)If we have 6 elements (A,B,C,D,E,F) at the same level or issued from a flatten operation, how do we create a tree like this one:
{0}
0 - A
1 - B
{1}
0 - C
1 - D
{2}
0 - E
1 - F
?
3) a work around would be to reverse the branch:
as the following transformation:
from this list:
{0}
0 - A
1 - B
{1}
0 - C
1 - D
{2}
0 - E
1 - F
that would transform in this one
{0}
0 - A
1 - C
2 - E
{1}
0 - B
1 - D
2 - F
?
4) Can we do such operation:
from this list:
{0;0}
0 - A
{0;1}
0 - B
{1;0}
0 - C
{1;1}
0 - D
{2;0}
0 - E
{2;1}
0 - F
to
{0}
0 - A
1 - B
{1}
0 - C
1 - D
{2}
0 - E
1 - F
5) I saw in a previous discussion in the VB# corner (about grid) that David was suggesting using some methods but I don't know how to use the "GH_Path" and the "Grasshopper.DataTree" object? is there other methods which are not mention either in SDK doc and Primer Grasshopper hand book?
Many thanks…
p them in two different group of points, but mantaining their structure, because first I need to move them in different ways and later group them again to create lines between them:
0. null 0. a
1. b 1. null
2. c 2. null
3. null 3. d
4. null 4. e
5. f 5. null
Thank you
…
lections import defaultdict
example_list = [[1,2,4], [1,2,3], [3,4,3], [1,2,3], [5,7,1], [3,4,3], [5,7,1], [1,2,4], [9,4,9], [9,3,9], [9,4,9]]
d = defaultdict(list)
for item in example_list: d[tuple(item)].append(item)
groupedlist = sorted(d[x] for x in d)
print groupedlist
# Returns [[[1, 2, 3], [1, 2, 3]], [[1, 2, 4], [1, 2, 4]], [[3, 4, 3], [3, 4, 3]], [[5, 7, 1], [5, 7, 1]], [[9, 3, 9]], [[9, 4, 9], [9, 4, 9]]]
____________________________________________________
However working with python inside GH the code fails as (I'm assuming the id is included in the list ie.
[<Rhino.Geometry.Point3d object at 0x0000000000000BD0 [1611664.12669822,2952929.94466619,5788.70761766478]>]
If I print my object[0] i get just the vector, i.e [1611664.12669822,2952929.94466619,5788.70761766478]
However if i append my object, (for i in xrange (len(X)... list.append(my object[x])
The id included!?
[<Rhino.Geometry.Point3d object at 0x0000000000000BD0 [1611664.12669822,2952929.94466619,5788.70761766478]>]
Perhaps I'm over complicating this and should just use GH to group objects with the same position...
Also sometimes when getting vectors I receive long numbers such as.. 9.0122222900391e(10), and another times I don't.... Same file, script, geometry etc..
I'm quite a noobie in python for GH so any help or pointers are welcome...
Thank you in advance!
…