Brep.Split returns Runtime Error: Multiple targets could match

Heya!

I’m quite new to scripting, trying to work with rhinocommon as exclusively as I can.
Now I’m creating a circle in the center of a Brep and then trying to extend lines to cut that Brep, the split command returns the Runtime Error:

Runtime error (ArgumentTypeException): Multiple targets could match: Split(IEnumerable[Curve], float), Split(IEnumerable[Brep], float)

Traceback:
  line 30, in script

This is the code:

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import scriptcontext as sc

#Find Centroid and Circle to Curve
centroidPlot = rg.AreaMassProperties.Compute(srfs).Centroid
centCirc = rg.Circle(centroidPlot, 2)
circNurb = rg.Circle.ToNurbsCurve(centCirc)
circNurb.Domain = rg.Interval(0, 1)
rep = rg.NurbsCurve.PointAt(circNurb, 0.5)

#Domain
domain = rg.Interval(0, 1)

circDiv = rg.Curve.DivideByCount(circNurb, 10, True)

divPts = []
divLines = []

for pt in circDiv:
    divPt = rg.Curve.PointAt(circNurb, pt)
    divPts.append(divPt)
    divLine = rg.Line(centroidPlot, divPt)
    divLines.append(divLine)

for srf in srfs:
    rg.Brep.Split(srf, divLines, 0.001)

Thanks a lot!

2 Likes

Thanks, took me a minute to figure out how to work with Overloads.
If anyone is struggling with is, you need to import this:

import System.Collections.Generic.IEnumerable as IEnumerable

and the brep.Split ended up looking like this (in my code):

    for srf in srfs:
        splitBrep = srf.Split.Overloads[IEnumerable[Rhino.Geometry.Curve], System.Double](divLines, 0.001)

Yep, overloads are a pain in a couple of cases, fortunately it’s not necessary to use the workaround too often in RhinoCommon/Python.