[C# rhino7] How to drill holes in surfaces

hi guys .As shown in the figure, I want to use curve to drill holes in the surface. What function should I use to achieve this goal .Can you provide some useful solutions?

Trim will work from an orthographic view. Or use MakeHole. There are a variety of other alternatives…

Edit - I see RhinoCommon in your tag - are you looking for a scripting solution?

Yes, I am looking for how to implement using C # code

OK, I don’t know C# but - again several general methods

First you need to determine the trim direction. If it’s a planar curve, it might be the curve plane, or maybe you want the active viewport’s CPlane normal - either one pof these can be gotten via RhinoCommon.

Then you can get the bounding box of the surface you are trimming (in the given plane) and extrude the curve through the box, then use it to split the surface. Or, you could project the curve to the surface in the desired direction and split the surface with that. Then you just need to determine which part to keep.

It might be possible to use Brep.CreateBooleanDifference (or Intersection), I haven’t tried to see if it will work with open objects.

I have tried some methods, but they have not been effective. I feel a bit sad, so I want to know the exact method that works because I have already wasted a lot of time

Well, maybe post what you’ve got and someone who knows C# can help.

Okay, I’ll organize the code

Hello- presumably you are using RhinoCommon functions? If you want to do this all yourself in code, you’ll need to use things like Curve.ProjectToBrep(), Brep.Trim() etc - see

https://developer.rhino3d.com/api/rhinocommon/

If you have more specific questions and code to share, please ask on the scripting forum

Scripting

-Pascal