I’m writing a script which involves moving the vertices of a Brep and replacing the resulting Brep in the document.
However, it seems like it only works half-way, which appears in shaded mode, but the wireframe of the object stays in place. Also, this doesn’t appear immediately upon execution of the script, but only after navigating the view.
Simplified script and result are below. Does anyone have an idea why this happens or how to complete the replacement?
from scriptcontext import doc
import rhinoscriptsyntax as rs
from Rhino.Geometry import *
def moveVerts():
obj = rs.GetObject("Select object")
objBrep = rs.coercebrep(obj)
verts = objBrep.Vertices
moveDist = rs.GetReal("Enter the move distance of vertices",0)
for vert in verts:
x, y, z = [c + moveDist for c in vert.Location]
vert.Location = Point3f(x,y,z)
doc.Objects.Replace(obj, objBrep)
moveVerts()
8 posts - 3 participants
