Python3 object created using rhino3dm: how to convert it to RhinoCommon Object?

I have created a Mesh object using Rhino3dm. When created, it gives a message as below:
{0}
0. <rhino3dm._rhino3dm.Mesh object at 0x00000153122CB8B0>

What is this code? How can I convert this object to a Rhino.Geometry Object (using RhinoCommon.dll)?

ps. doing all this in Python3

The short answer is that it is a RhinoCommon object!

RhinoCommon is a .NET wrapper library around the Rhino C++ SDK. RhinoCommon only runs inside Rhino. Rhino3dm is a set of wrapper libraries (.NET, Python and JavaScript) around the public parts of the SDK, a.k.a. openNURBS. Rhino3dm can run outside of Rhino.

Under the hood, your mesh object is an openNURBS mesh. You can use the rhino3dm python library to write this mesh to .3dm file, and then open it in Rhino, or serialise it to JSON and send it to a web server.

# sample: create model, add mesh and write to .3dm file
model = rhino3dm.File3dm()
model.AddMesh(mesh)
model.Write('example.3dm')

What is it that you want to do with this mesh object? Knowing a bit more about how you want to use rhino3dm will help us to provide some more relevant information. :slight_smile:

thanks for your response! I am rewriting some code that I had before in C# in Python3 within the CPython components in GH. I can easily import Rhino3dm in Python 3 and write 3dm files to open externally but cannot convert them into mesh objects digestible by grasshopper. Importing grasshoper in the CPython does not seem to be possible; so I was hoping I could use RhinoCommon to convert this Rhino3dm memory object into a Rhino object, i.e. without writing it into a separate 3dm file. Would that be possible?

Is there a reason you can’t use the built-in GhPython script components?