RhinoSplitBrepFace Get a Wrong brep

I use next codes to get a split brep, when I use AddBrepObject to scene,the return rb is equal 0.
the attachment has the whole test codes and a test file,please help me to see why this happen?
ON_Brep sbrep=RhinoSplitBrepFace(brep,i,cs,1.0,true);
if(sbrep)
{
*CRhinoBrepObject*rb=context.m_doc.AddBrepObject(sbrep);
if(rb==0)
{
MessageBox(GetForegroundWindow(),L"Add Brep fail",L"hint",MB_OK);
}
}

sorry forget uplode the attachement files
RhinoSplitBrepFace.rar (11.6 MB)

See if this example is helpful.

https://gist.github.com/dalefugier/880b6c82f12a21acb37c

– Dale

dale:
I can’t open the link you provided,can you upload the test project ,thanks

See attached…

cmdSampleRhinoSplitBrepFace.txt (3 KB)

dale:
your test code is work fine
but I still don’t what problem of my test codes

the diffrent between my codes and your test codes are:
My codes AddObject with params ON_brep,and Your codes AddObject with params CRhinoBrepObject

My sample uses the document’s absolute tolerance for splitting. My example also don’t leak memory. :wink:

dale, these are realy the diffrent of of your example,but I think these are not the reason led to rb is 0
*CRhinoBrepObject*rb=context.m_doc.AddBrepObject(sbrep);

I do not understand your response. But my example seems to work on your sample file, right?

yes,dale,but if just chang your chodes

AddObject with params CRhinoBrepObject,to AddObject with params ON_brep

will also get zero object