I’m quite new to the Rhino API but have lot of python experience. I’m trying to figure out how to input and output lists and trees with the GH Hops component. My research from this thread about accessing trees in Hops suggests it should be working if the access is set correctly. Looking at other Hops tagged posts on the forums shows people are passing in lists of any sort this with ease but since it doesn’t show all the steps there are still gaps in my knowledge.
I’m not sure why my highly simplified python script isn’t working as expected. I’m expecting it to take a list/tree of 12 integers and output it. I want to be able to do more sophisticated calculations and sorting in python with more numbers. Instead I’m getting the error 1. Solution exception:Input string was not in a correct format.
I can see in the python terminal the script is receiving the input as expected: {'{0}': [6190, 6170, 6150, 6340, 6260, 6500, 6090, 6510, 6330, 6080, 6530, 6210]}
but I’m not sure how to manipulate it. What do I need to change about my code to make it output a list of integers?
@hops.component(
"/worker",
name="Worker",
nickname="Worker",
description="Basic Template For Python Function",
inputs=[
hs.HopsBoolean("Toggle", "T", "Evaluate Function"),
hs.HopsInteger("Column Length", "L", "List of Column Lengths",access=HopsParamAccess.TREE),
],
outputs=[hs.HopsInteger("Data", "D", "Test output")]
)
def main(t, l):
if t is True:
print(l)
return l
elif t is False:
return -1
I’m using: Hops 0.9, ghhops_server 1.4.0, and python 3.8 on mac oxs.