Create CPython components using Hops in Grasshopper

Was this post meant for a new thread? I don’t understand what this has to do with Hops

Sounds very similar to this request

1 Like

Could you call the hops component through node in code scripting with Rhino.python: http://developer.rhino3d.com/guides/rhinopython/ghpython-call-components/

Thanks, we’ve seen this form of spam a bit lately.

hey @scottd! how do you pass the URL to hops with node-in-code? could you please provide an example?

This is not currently available in node-in-code. See a discussion on the topic at

1 Like

I disagree : this is clearly a huge groundswell of popular support for my request :wink:

1 Like

Hi @stevebaer
I try a python code with the new update , when the output is a tree i got an error.

I don’t believe this is new with the latest release. The ghhops-server does not have support for outputting trees yet. If you need this functionality today, you might want to consider outputting json from python that represents your tree and using a tool like jswan to work with the json in grasshopper.

2 Likes

Thanks, i see this problem in another topic and i though it solved.
Actually i convert tree to one list avoid this error than i split it in grasshopper.
We can also create output list for length of lists in the tree than use it to split the flattened tree.

Input trees were implemented, but not output trees

@seghierkhaled if its any help, I’ve been dealing with oupting trees in two ways:

  1. serialiazing the python nested list into a string with the json module, namemly json.dumps(), and after hops converting it back into a nested list with a ghpyhon component that deserializes it with json.loads()
  2. flattening the list in python, then passing also a length of each list in another hops output to regenerate the structure with the partition list GH component.

Either way has worked well so far, until those tree outpus in hops come around

1 Like

Thanks, i used the second method

I’m not sure how hard would it be to implement or what are your plans with CPython + Hops, but I believe that it would be really cool if there would be some way to make it more portable.

I mean it would be great to make it possible to create some sort of plugin with these Hops components, the plugin that could be released on food4rhino, and the user could easily install it and use it. Right now it’s already amazing, but for your own usage, cause you still need to run the code manually in VSC / Pycharm, and set addresses for Hops components manually.

Looking forward to see more :wink:

Packaging as gha is something I would love to implement, but it is still a ways off.

3 Likes

Hello guys,

First of all, congratulations for this amazing feature! I’m loving testing it.
During those tests, I came up with something I couldn’t figure:
What is the correct version to define in a pyproject.toml file?
I thought it was “1.4.0” but it didn’t work.

1 Like

@thomas.takeuchi Are you using poetry to manage the environment? Seems like you originally had ghhops-server @ 1.3.0 and then manually edited the pyproject file to 1.4.0
poetry throws the error that you see.

Run poetry update to update the poetry.lock file

1 Like

Oh That’s true!
I changed the version manually and forgot about it.
Thank you! Now it worked!

Here it is! Thank you for the callout @eirannejad!

Thanks for these development, inside compute and then hops, only beneficial impacts on my work :smiley: