Yes, this is where Python really shows its (in my view) weakness: it has no type information.
The problem is that there are two Split functions that both take 2 arguments. One takes an array of curves, the other an array of surfaces. In strongly typed programming languages, this is sorted out at compile time, but in Python this is not done.
Looks like the following might work (I havenât tried it)
crvtype = type(crv_objs[0]) #that is a LineCurve
breps = srf.Split[System.Collections.Generic.IEnumerable[Rhino.Geometry.Curve]]([crv for crv in crv_objs], tol)
breps = srf.Split[List[Rhino.Geometry.Curve]]([crv for crv in crv_objs], tol)
breps = srf.Split[Array[Rhino.Geometry.Curve]]([crv for crv in crv_objs], tol)
breps = srf.Split[System.Collections.Generic.IEnumerable[crvtype]]([crv for crv in crv_objs], tol)
import Rhino
import scriptcontext as sc
from System import Array
def splitBrepWithMultipleCurves():
# get brep
result, objRef = Rhino.Input.RhinoGet.GetOneObject("Pick brep to split", False, Rhino.DocObjects.ObjectType.Brep)
if result != Rhino.Commands.Result.Success: return result
brep = objRef.Geometry()
# get curves
result, arrObjRefs = Rhino.Input.RhinoGet.GetMultipleObjects("Pick curves to split with", False, Rhino.DocObjects.ObjectType.Curve)
if result != Rhino.Commands.Result.Success: return result
listCurves = [obj.Geometry() for obj in arrObjRefs]
# construct nice distinct strictly typed Curve array for brep.split overload
arrCurves = Array[Rhino.Geometry.Curve](listCurves)
# split the brep
arrBrepSplitResult = brep.Split(arrCurves, sc.doc.ModelAbsoluteTolerance)
# Add to doc
if arrBrepSplitResult:
for brep in arrBrepSplitResult:
sc.doc.Objects.AddBrep(brep)
# redraw viewport so we see what we did
sc.doc.Views.Redraw()
if __name__ == "__main__":
splitBrepWithMultipleCurves()