SpeckleCoreGeometry Converts Rhino.LineCurve to SpeckleBoolean


I’m trying to convert Rhino geometries into Speckle objects using Python. Since the input object is a Rhino.LineCurve, I’m expecting SpeckleCoreGeometryRhino.Conversions.ToSpeckle() method to convert them as SpecklePolyline or SpeckleCurve; yet, the output of the method returns me a SpeckleBoolean. (I also tried converting the same curve on Grasshopper using Speckle Grasshopper Plug-in, and it converted the curve without any problem.)

I’m attaching the code and the output below for reference. I would be glad if anyone could help me with this issue.


import SpeckleCore
import SpeckleCoreGeometryClasses
import SpeckleCoreGeometryRhino
speckle_object = SpeckleCoreGeometryRhino.Conversions.ToSpeckle(geo)


<rhino3dm._rhino3dm.PolylineCurve object at 0x000001D81B99C030>
<class ‘rhino3dm._rhino3dm.PolylineCurve’>

Thank you in advance.

Hi @ozanyetkin,

In C# you can just convert a line with SpeckleCore, I guess this should be almost the same in IronPython.

Hi @pauldotnet

Thank you for your response, it works just fine in IronPython. But the thing I need is actually to convert the objects within the CPython environment (using Rhino Compute API to produce Rhino geometry and converting them into Speckle objects by calling Speckle .NET frameworks from CPython).

When I try Serialise method directly with Rhino LineCurve as below, it returns an error that says:

speckle_object = SpeckleCore.Converter.Serialise(geo)

<rhino3dm._rhino3dm.LineCurve object at 0x000001BA66D6C930>
TypeError: No method matches given arguments for Serialise

Yet, when I pass a string into the Serialise method, it converts into a SpeckleString without an error.

speckle_object = SpeckleCore.Converter.Serialise(“a string”)


What could be the problem when converting a LineCurve geometry instead of a string?
Thank you in advance

Hi @ozanyetkin and welcome to the forum!

I can’t help much on the python side of thing, but can help you debug SpeckleCore:

There quite some .NET reflection going on in SpeckleCore, so it might not be easy to understand what’s going on…
Hope it helps & let us know if you find a solution!


Hi @ozanyetkin, I am trying something similar :star_struck: but also get stuck at replicating SpeckleRhino using Python.NET:

import clr
import SpeckleCore
speckle_object = SpeckleCore.Converter.Serialise(rhino_geo)

Did you make any progress on this by any chance?

1 Like

Hi @Guus, I resolved the issue by migrating the project from Python.NET to .NET itself :slight_smile: