Hi everyone
flipmatrix Python does not work? bug? Not defined in c # flipmatrix?
import ghpythonlib as gh
a=gh.components.FlipMatrix(x)
flip matrix.gh (10.2 KB)
Hi everyone
flipmatrix Python does not work? bug? Not defined in c # flipmatrix?
import ghpythonlib as gh
a=gh.components.FlipMatrix(x)
flip matrix.gh (10.2 KB)
Try to add trees before flipmatrix
How?
Can you do?
gh.components.trees it will appear when you type
hi not work! flip matrix.-tree.gh (10.3 KB)
import rhinoscriptsyntax as rs
import ghpythonlib.components as gh
b=gh.tree(x)
a=gh.FlipMatrix(b)
Hi @Rh-3d-p,
Instead of trying to get node-in-code going, you simply implement the matrix transposition yourself:
from ghpythonlib import treehelpers
matrix = treehelpers.tree_to_list(tree, lambda x: x[0]) # lambda here flattens the tree input (can be removed if manually simplifying the input)
print(matrix)
transposed = [[matrix[j][i] for j in xrange(len(matrix))] for i in xrange(len(matrix[0]))]
print(transposed)
a = treehelpers.list_to_tree(transposed)
I don’t know about Tree Sloth, but you might be able to replace that as well with Python code.
transpose_matrix.gh (8.8 KB)
thank you
Change x input to Trees Access
Just to add, an ultra terse method for transposing a Python list matrix is using zip(*matrix)
:
Another quick solution
Is it possible to control Undo and Redo via slider in Python? (In Gosphaper)
Thanks a lot, after considerable time, this is still quite useful.