Hops Tree Parameter Access

Hi @stevebaer I’m trying to input a tree into a Hops component with hs.HopsParamAccess.TREE
and getting an error that doesn’t provide much info:

Here’s a sample of my code:

    description="Test Tree Input",
        hs.HopsInteger("Integers", "I", "Integers in a tree", hs.HopsParamAccess.TREE),
        hs.HopsInteger("Output Integers", "O", "Output integers")
def treetest(int_tree):
    return int_tree

Do you see anything wrong there?

I would stay away from tree input and output if you don’t need it. We haven’t done a whole lot of work in this area and it is pretty infrequent when you actually need to work with a tree in your function.

Do you really need a tree for input to your function? It’s pretty rare even in core grasshopper components for this.

I wouldn’t say it’s too rare, at least not for my daily workflow. For instance, if I’m trying to bring many many vectors of n-dimensions, I would put each of them into a list an pass it as such.

How would you pass a nested list from GH to CPython through Hops instead? Is there any other object that can handle this transaction?


I knew I was going to get flack for writing that. I should just resolve to writing nothing but bug reports here. I asked a question and provided a fact about core grasshopper, nothing more.

I understand that there is a need for tree input, but the majority of core components in grasshopper are item or list input and allow grasshopper to perform the iteration when trees are provided as input.

I added this to our buglist at

and will see what is going on.

Considering that data trees have always been at the core of Grasshopper, yeah, the statement was a surprise (to put it mildly).

Tree inputs and outputs are properly handled for components that have item and list access

@dadandroid the Hops component doesn’t actually support tree parameter access on the inputs. The component should be defaulting to list access and may well be throwing an error because the first list is empty (assuming you’re using the default inputs for the Series components). Strangely on my Mac I get a warning instead of an error.

The error because you have an empty branch (the first one) and you don’t need use tree access

        hs.HopsNumber("input", "i", "test")
        hs.HopsNumber("output", "o", "test")
def tree(input):
    return input

That form calls the python server with one item at a time and then relies on GH to construct the output tree. David is looking to get at the whole tree at once.


FWIW I got around this by serializing the nested list into a json formated string and back, which seems to work since it’s a nested lists of integers. Probably won’t be so easy for other types, though

1 Like

@dadandroid I just updated both Hops (0.5.0) and ghhops-server (1.3.0). This version supports passing trees from grasshopper to the python server.

1 Like