Rhino GH Python output seems wrong

Hi,

I wrote this primitive script in GH Python component to make a set of curves:

import Rhino.Geometry as rg

# Create a plane in the horizontal direction
plane = rg.Plane.WorldXY
curves = []

for i in range(1, irange):
    # Offset the curve in the horizontal plane
    offset_curve = curve.Offset(plane, -i*0.1, 0.01, rg.CurveOffsetCornerStyle.Round)
    
    curves.append(offset_curve)
a = curves
print(curves)

Problem is that it outputs this instead of geometry:

When I set the output to “a = offset_curve” it does output a curve. I have found an example where a list of curves is handled the same and it works fine so I don´t know what is wrong.

Thank you for your time :slight_smile:

Hi,

the methode you use return the expected result.

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.curve/offset

Description:

Offsets this curve. If you have a nice offset, then there will be one entry in the array. If the original curve had kinks or the offset curve had self intersections, you will get multiple segments in the output array.

Just append the first list entry of your curve result to your curve list and you will see if you get what you expect.

Tested it…answer before was only a guess.

1 Like

To improve on @flokart’s solution, don’t append just the first curve, but all returned curves to the list. Python list has a handy built-in method for it.

curves.extend(offset_curve)
2 Likes