Automating the "Trim" command via python or the c++ SDK?

I’m trying to automate execution of the “trim” command to trim a surface using a few isocurves. The context is Howto form spout for glass cup/pitcher?

Anyone know how to do this in python, or failing that, via the c++ SDK? Rhino python has a TrimSurface() method, but it looks like it only trims in one of the U and V directions, not both at the same time, like the “trim” command does. The TrimBrep method looks promising if I could construct a polysurface from the isocurves somehow…
Thanks for any ideas!
Josh

You might consider using Rhino.Geometry.BrepFace.Split and then throw away the piece(s) you don’t need.

Yeah, it took a fair bit of code to explicitly create the right polysurface that I think Trim creates internally, but it worked, thanks.