How to update geometry after making a change to it? (SwapEdge)

Hello,

I am trying to
SwapEdge
of a mesh box that I triangulated.

 #I get the box with:
 Mesh = rs.coercemesh(meshID)
 # The ID of an edge which can be swapped
 EdgeID = 10

 #And then try to pass this:
 Mesh.TopologyEdges.SwapEdge(EdgeID)

But nothing happens, there is no error as well.

Any idea why, am I approaching this correctly?

Hi @qtov,

After modifying the mesh, make sure to replace the original mesh with the modified one.

import rhinoscriptsyntax as rs
import scriptcontext as sc

mesh_id = rs.GetObject("Select mesh")
mesh = rs.coercemesh(mesh_id)
edge_index = 10
mesh.TopologyEdges.SwapEdge(edge_index)
sc.doc.Objects.Replace(mesh_id, mesh)
sc.doc.Views.Redraw()

– Dale

1 Like

Hello Dale,

Thank you. Appreciate the solution. Works perfect!