Cutting an object with multiple objects - rhinoscriptsyntax

Hello - something like this I’d say - you need to make it a list of the cutters.

import scriptcontext as sc #<<<< at the top of your script if it is no there
tol = .001
SRF = rs.coercebrep(srf)
breps= [rs.coercebrep(id) for id in cuttingObjects]
splitList = SRF.Split(breps, tol)

newIds = [ sc.doc.Objects.AddBrep(brep) for brep in splitList]

The above not tested…

OK. yeahhh… that ‘Multiple targets’ thing is back… let me think…

I am shifting this over to the Scripting forum though… let’s continue there.

@revink - it gets a little weird in this particular case (Multiple targets could match) That refers to the function being able to take breps OR curves as input for the cutters and in Python it cannot tell what you’re handing it so you need to be more explicit. Admittedly this is not an ideal example to get started with RhinoCommon - the relevant info is here in a post from @dale -

and here is an example for your case:

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
import System.Collections.Generic.IEnumerable as IEnumerable
import System.Double as sd
   
       
tol = .001
srf = rs.GetObject(filter=8)
SRF = rs.coercebrep(srf)
cuttingObjects = rs.GetObjects(filter= 8 + 16)
breps= [rs.coercebrep(id) for id in cuttingObjects]

splitList = SRF.Split.Overloads[IEnumerable[Rhino.Geometry.Brep], sd]( breps, tol) #<<<Here

newIds = [ sc.doc.Objects.AddBrep(brep) for brep in splitList]

As you can see, I am first telling brep.Split exactly what it is I am about to give it (breps and a double, not curves and a double ) and then I give the inputs. This is not usually needed… but you hit a tricky one.

-Pascal