How do I simplify/rebuild this NURB edge into plain 3 segment polyline?

Is dup’ing the edges, simplifying curves and making a new brep the only way?

Before trimming, make sure the trim curve is split at kinks. Afterwards, you can use BrepEdgeList.SplitKinkyEdge.

def test_split_kinky_edges():
    filter = Rhino.DocObjects.ObjectType.Surface | Rhino.DocObjects.ObjectType.PolysrfFilter
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select surface or polysurface", False, filter)
    if not objref or rc != Rhino.Commands.Result.Success: 
        return
        
    brep = objref.Brep()
    if not brep:
        return
        
    tol = Rhino.RhinoMath.DefaultAngleTolerance
    
    bcopy = brep.DuplicateBrep()
    for i in range(0, bcopy.Edges.Count):
        bcopy.Edges.SplitKinkyEdge(i, tol)
    bcopy.Compact()
    
    sc.doc.Objects.Replace(objref, bcopy)
    sc.doc.Views.Redraw()

– Dale

I’m trimming with a pipe “poly” brep, so no curves involved. But Edges.SplitKinkyEdge did the trick! Thanks Dale!