R8 Python and RhinoCommon API Calls - Polyline outputs as Points?

I feel stupid for even asking this here, but i am really stumped with this:

import Rhino.Geometry as rg

pline = rg.Polyline()

for i in range(0, 10):
    pline.Add(rg.Point3d(i, 0, 0))

print(type(pline)) #Outputs: <class 'Rhino.Geometry.Polyline'>
a = pline # This outputs a list of 10 points???

Update: even simpler - passing a polyline it becomes a point list, that cant be meant like this?
I know that Polylines are a bit of a strage object internally - just some kind of list structure, but this should not be…

Ok, search helped: looks like Grashopper / Python try to iterate it no matter what, so the way to go is:

a = pline.ToNurbsCurve()

I would use Poylinecurve. The key is to set List Access input hint on the component:

"""Grasshopper Script"""
import Rhino
# Put the 3 points in a list

# Create an instance of an PolylineCurve
a = Rhino.Geometry.PolylineCurve(x)

Always has been like this. This is normal expected behaviour. Polyline inherits from Point3dList, see: https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.polyline?version=8.x

1 Like

To add to Roger’s comment. A polyline structure is really a common list of ordered points, as it derives from Point3D.

Where PolylineCurve derives from Rhino.Geometry.Curve