rhino3dm.Extrusion.Create() throws Error for PolylineCurve

Hello together,

i am pretty new with Rhino and rhino3dm, so i also might be missing a small thing only. But i want to use rhino3dm in python to create an Extrusion from an Curve i made in Rhino and exported as 3dm.file.

The problem is i get an Error thrown in the “rhino3dm.Extrusion.Create()” function, that i use an incompatible function argument, because the function accepts only rhino3dm.Curve but i have a PolyLineCurve. But shouldn’t it still be possible, as the PolylineCurve is a child of the Curve class. Also when i print the ObjectType from the PolylineCurve i get “ObjectType.Curve”.

Traceback (most recent call last):
  File "/home/yannick/master/test_rhino.py", line 9, in <module>
    extrusion = rhino.Extrusion.Create(polyCurve, 10.0)
TypeError: Create(): incompatible function arguments. The following argument types are supported:
    1. (planarCurve: rhino3dm._rhino3dm.Curve, height: float, cap: bool) -> rhino3dm._rhino3dm.Extrusion
Invoked with: <rhino3dm._rhino3dm.PolylineCurve object at 0x7fdaae8deaf0>, 10.0

My code looks like the following, where i load the 3dm file and try to create the extrusion.

import rhino3dm as rhino

model = rhino.File3dm.Read('test.3dm')

for object in model.Objects:
    if isinstance(object.Geometry, rhino.Curve):
        print(object.Geometry.ObjectType)
        polyCurve = object.Geometry
        extrusion = rhino.Extrusion.Create(polyCurve, 10.0)

I also tested with the IsPlanar function that my curve is planar and got True as result.

I appreciate any help.

Greetings,
Yannick

test.3dm (806.0 KB)

Okay it actually was a small mistake. As i thought the Error came from using the PolylineCurve, it was actually because i did not hand over a Boolean for the cap argument in the rhino.Extrusion.Create() function

With that i solved the Error.

1 Like