That’s understandable. As far as I can tell the support here for Hops related stuff is not really great. In the advent of better Python 3 support in Rhino 8, my guess is that the project is less of a priority than it previously was and might be rendered superfluous in the future. This is speculative though!
Ah, this is a Rhino 8 thing at the moment. We are passing meshes from Hops to the CPython server in a Rhino 8 format and the CPython server only currently knows how to deal with Rhino7 and below formats. We’re actively getting the libraries that the CPython server updated so the server will work with Rhino 8 format.
OK, I revisited this and figured out how to convert the incoming mesh from rhino3dm to Rhino.Geometry and back again in hops, this works and is relatively fast, but I’m interested to know if there’s a better way / I’m doing it wrong:
import rhinoinside
rhinoinside.load(8)
import System
import Rhino.Geometry as rg
import Rhino.FileIO as rf
import rhino3dm
# ... hops component that passes the mesh from grasshopper to python (JSON data states it is Rhino Geometry Mesh type, but in python it is rhino3dm.mesh)...
mesh_JSON = mesh.Encode()
rg_mesh = rg.Mesh.FromBase64String(
mesh_JSON['archive3dm'],
mesh_JSON['opennurbs'],
mesh_JSON['data']
)
# modify your mesh ...
modified_mesh = do_something_in_python(rg_mesh)
# pass the modified mesh back for hops
s_options = rf.SerializationOptions()
mesh_out = modified_mesh.ToJSON(s_options)
return rhino3dm.CommonObject.Decode(json.loads(mesh_out))