CreateBooleanIntersection Surface and Solid

Hello,

I got a Solid and want to trim a part of a surface thats not withini the Solid. How to do this?

I’ve tried:
Geometry.Brep.CreateBooleanIntersection(Brep1, Brep2, doc.ModelAbsoluteTolerance)
but doesnt work with a srf. Missing something here or wrong command?

Could you convert your srf to a Brep using srf.ToBrep() maybe, and then try CreateBooleanIntersection?

yes I’ve tried that but its only working with solids somehow.

Deleted it accidentaly. I’ve had something like":

Dim object1 As DocObjects.ObjRef = Nothing
Dim rc = Rhino.Input.RhinoGet.GetOneObject("Object1", False, DocObjects.ObjectType.AnyObject, object1)
If rc <> Result.Success Then
Return Nothing
End If

Dim object2 As DocObjects.ObjRef = Nothing
Dim rc = Rhino.Input.RhinoGet.GetOneObject("Object2", False, DocObjects.ObjectType.AnyObject, object2)
If rc <> Result.Success Then
Return Nothing
End If

Dim NewBrep as geometry.brep = Geometry.Brep.CreateBooleanIntersection(Object1.Brep, Object2.Brep, doc.ModelAbsoluteTolerance)

doc.objects.addbrep(NewBrep)

Ah, ok. You could maybe use Brep.Split on the Brep created from the srf?

Brep solid; // defined elsewhere
Brep b = srf.ToBrep();
Brep[] splitted = b.Split(solid, doc.ModelAbsoluteTolerance);

the splitted array contains the “inside” and “outside” parts. You need to write code to find out which is which.

Also possible yes.
I can check if the surface that i want to keep is withing the solid. Ifso. Add it to the doc. else delete :smile:

I’ll try and figure out if I can get that too work. Thanks :slight_smile:

Can trim like this

Dim Splitted As Geometry.Brep() = b.Trim(object1.Brep, doc.ModelAbsoluteTolerance)

Was searching in rhino.geometry for a solution. Was indeed easier to just use the brep itself with Trim/Split.
Thanks :slight_smile: