GHPython, triangulate mesh

I wrote a GHPython script that takes a mesh as input and creates a mesh shell from it. It only makes sense with triangulated meshes, so, at first, I want to check if the input mesh has quad faces and triangulate it if so.

There’s a code example in the RhinoScriptSyntax docs:

import rhinoscriptsyntax as rs
obj = rs.GetObject(“Select mesh”, rs.filter.mesh )
if rs.MeshQuadCount(obj)>0:

This works when the Python component’s mesh input type hint is set to “ghdoc”.

However, I need the type hint set to “mesh”, because later in the code I use RhinoCommon access to mesh.TopologyVertices and mesh.TopologyEdges.

There does not seem to be a “triangulate” function in Rhino.Geometry.Mesh.

So, is there a way to get the mesh data from a Guid object?

Best regards

mesh = rs.coercemesh(mesh_guid)

The rhinoscriptsyntax code is open source on Github, so you can see how everything is done under the hood:

Thank you, sir! So, both ways are possible.
Best regards