Trim and Boolean brep

trim.rar(725.9 KB) this attachment has a trim.3dm file and some codes.
in trim.3dm file,I have a curve named “Curve 1”,and two brep named “Brep 1” and “Brep 2”.
Brep 1 is bulit using the Curve 1 through the funciton ON_Brep CsdrNurbsAlgorithm::ExtrudeCurveStraight( const ON_Curve pCurve, ON_3dVector direction, double scale,AL_DIR aldir)*;this function writed by myself in code.txt file
I have some problems about them:
1:
I want to trim the Brep 2 using the curve 1 through the function
ON_Brep Trim(ON_Brepin_brep,ON_SimpleArray<ON_Curve> curve,double tol);
(this function wrtied myself,because rhino has’t a function can trim a ploysurface using curves,so I write it myself .first using these curves Extrude a brep, them using this brep to trim it )
but this failed at RhinoBrepTrim .why this failed?

2:
I want to use Brep1 and Brep 2 to do some boolean calculate,for examle,booleanunion.
but using command or c++ sdk function do these are failed.

trim2.3dm(1.6 MB) is new test 3dm file.
these file has three little breps,and a big brep.
I want using these little breps trim the big brep. or do RhinoBooleanUnion
two litttle breps can do succes.but one little brep can,t
please help me to see what the problem

The curve you used to create your extrusion is of very poor quality (a polycurve with 3 curves and 471 control points). When you extrude this curve, you end up with a Brep that contains 154 faces. It is this that is causing the problems with splitting and trimming.

Try rebuilding the curve with a reasonable number of curves and then extrude this curve. You will find that splitting and trimming work.

thanks very much,this is a good idea.

dale:
I have another problems about
The parts of B that lie to inside RhinoBrepTrim function:
question 1:trim.rar(1.2 MB) have three groups test data. the front two groups can the the inside parts of brep. but the third group get the outside parts of the group,why these happen?
qusttion 2:
RhinoBrepTrim function just can get the inside parts of brep,if I need add a param to these function,the RhinoBrepTrim function become like this:
//type==1:Get the inside parts of brep B,type==2,Get the outside parts of brep B
int RhinoBrepTrim( const ON_Brep& B, const ON_Brep& Cutter, double tol, ON_SimpleArray<ON_Brep>& Trim, int type=1,ON_ClassArray< ON_SimpleArray > fmap=NULL, ON_ClassArray< ON_SimpleArray >* emap=NULL);**
How can I do these?

sorry this is urgent, kindly help have a look ASAP, thanks for your help

You might be better off splitting the brep, using RhinoBrepSplit, and then throwing away the piece you don’t want.

but I don’t know How to find the piece I don’t want using c++ sdk function