Reverse mesh vertex normals


#1

I am trying to reverse a mesh vertex normals via python, but I can find no method for that. I wonder if there is a way to do it using Rhino Common. I think I can get the mesh geometry and revert the vertex normals, but then I don’t know how to save those changes to the document:
mesh = rhutil.coercemesh(mesh_id)
mesh.Flip(True, False, False)
…and now?


#2

I found it, maybe someone finds it useful:

import Rhino
import rhinoscript.utility as rhutil
mesh_obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(rhutil.coerceguid(id_to_search))
mesh = mesh_obj.MeshGeometry
mesh.Flip(True, False, False)
mesh_obj.CommitChanges()