Hops from CPython and Lists

Hey I am trying Hops from CPython. Example works fine I was just trying to figure out Lists with CPython.

I have this with no compile errors:


@hops.component(
    "/pointat",
    name="PointAt",
    description="Get point along curve",
    icon="examples/pointat.png",
    inputs=[
        hs.HopsCurve("Curve", "C", "Curve to evaluate", access=hs.HopsParamAccess.LIST),
        hs.HopsNumber("t", "t", "Parameter on Curve to evaluate", access=hs.HopsParamAccess.LIST),
    ],
    outputs=[
        hs.HopsNumber("P", "P", "Point on curve at t")
    ]
)
def pointat(curves, ts):
    return len(curves)

But I am getting Requires at most 0 items in GH. Where do we set this?

image

Also in order to get autocomplete for list how should we hint that to python? I saw in the examples that you were doing something like that for a single input. Any thought for a list and even a tree?

def pointat(curve: rhino3dm.Curve, t=0.0):
    return curve.PointAt(t)

This was reported yesterday at LIST parameter not supported · Issue #316 · mcneel/compute.rhino3d · GitHub

It is probably an easy fix. We’ll try to take a look at it in the next few days.

1 Like