Unable to load points from hops component

drawing.py (3.6 KB)

Hi everyone! I’ve been quite stumped, I am creating a list of points dirived from a 2d ‘drawing’ using tkinter. This works fine and I’m able to get a list of points from it. (like this [(x,y,z), (x,y,z), etc.]) However if I want to load it into grashopper through a hops component, the connection is made and there don’t seem to be any errors given however it doesn’t get any of the points send over. Anyone know how to fix this?

Hi Elisa. Thanks for sharing your code.

Under Vector → Point there’s a Numbers to Points native component (“Num2Pt”).

Alternatively, as you know how to write Python already, connect your hops component to a GhPython component’s input (that’s set to list mode) called x, import rhinoscriptsyntax as rs and do a = rs.AddPoints(x). That should both create the points and add them to the GH canvas (and you could then connect a to a Points Param).

https://developer.rhino3d.com/api/RhinoScriptSyntax/#geometry-AddPoints

Hi! Thank you for your reply! I have tried the solutions you gave, however the problem I think lies somewhere else. I just realised that the hops component in grashopper doesn’t recieve any points or other data, it connects to the script but seems to send an empty list. If it’s a problem in the python code should I take the question somewhere else? (stackoverflow for example?)

You’re welcome. I’d make the simplest possible example of a Hops component, that only outputs a constant hardcoded list of 3-tuples first of all.

The official Python discourse is friendly, I’d go there first.

StackOverflow’s invaluable, being full of helpful world experts. But it probably has the highest barrier to new posters of any site on the internet. That doesn’t stop a lot of users from trying their luck, but their rules require you before posting, to be sure you’ve taken lots of steps to researched a problem thoroughly yourself, and that you’re asking a unique question.

Hi, I found the solution! It was due to the fact I had a list of points listed in the correct way but not ‘rhino points’ so it couldn’t read it. I changed the while loop in my python code to read this:


Turning ithem into rhino points if that makes sence. (you can see in the terminal that a rhino point has a lot of different data in it’s list.)


drawinghops.py (3.7 KB)

Well done!

1 Like